Split third_party/BUILD.gn in per-project files.

Bug: chromium:1064305

Change-Id: I6fc2da97e20865b62ff34a9d1c3f42120ac90348
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19202
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Corentin Wallez 2020-04-10 08:24:00 +00:00 committed by Commit Bot service account
parent b31015b836
commit d11cc3961a
10 changed files with 235 additions and 217 deletions

View File

@ -29,6 +29,7 @@ dawn_has_build = true
# The paths to Dawn's dependencies # The paths to Dawn's dependencies
dawn_jinja2_dir = "//third_party/jinja2" dawn_jinja2_dir = "//third_party/jinja2"
dawn_glfw_dir = "//third_party/glfw" dawn_glfw_dir = "//third_party/glfw"
dawn_glm_dir = "//third_party/glm"
dawn_googletest_dir = "//third_party/googletest" dawn_googletest_dir = "//third_party/googletest"
dawn_shaderc_dir = "//third_party/shaderc" dawn_shaderc_dir = "//third_party/shaderc"
dawn_spirv_tools_dir = "//third_party/SPIRV-Tools" dawn_spirv_tools_dir = "//third_party/SPIRV-Tools"

View File

@ -77,7 +77,7 @@ dawn_sample("ComputeBoids") {
"ComputeBoids.cpp", "ComputeBoids.cpp",
] ]
deps = [ deps = [
"${dawn_root}/third_party:glm", "${dawn_root}/third_party/gn/glm",
] ]
} }
@ -92,7 +92,7 @@ dawn_sample("CubeReflection") {
"CubeReflection.cpp", "CubeReflection.cpp",
] ]
deps = [ deps = [
"${dawn_root}/third_party:glm", "${dawn_root}/third_party/gn/glm",
] ]
} }

View File

@ -148,7 +148,7 @@ if (is_win || is_linux || is_mac || is_fuchsia || is_android) {
] ]
if (dawn_enable_vulkan) { if (dawn_enable_vulkan) {
public_deps = [ public_deps = [
"../../third_party:vulkan_headers", "${dawn_root}/third_party/khronos:vulkan_headers",
] ]
} }
if (is_android) { if (is_android) {

View File

@ -397,7 +397,7 @@ source_set("dawn_native_sources") {
if (dawn_enable_opengl) { if (dawn_enable_opengl) {
public_deps += [ public_deps += [
":dawn_native_opengl_loader_gen", ":dawn_native_opengl_loader_gen",
"${dawn_root}/third_party:khronos_platform", "${dawn_root}/third_party/khronos:khronos_platform",
] ]
sources += get_target_outputs(":dawn_native_opengl_loader_gen") sources += get_target_outputs(":dawn_native_opengl_loader_gen")
sources += [ sources += [
@ -447,7 +447,7 @@ source_set("dawn_native_sources") {
} }
if (dawn_enable_vulkan) { if (dawn_enable_vulkan) {
public_deps += [ "${dawn_root}/third_party:vulkan_headers" ] public_deps += [ "${dawn_root}/third_party/khronos:vulkan_headers" ]
sources += [ sources += [
"vulkan/AdapterVk.cpp", "vulkan/AdapterVk.cpp",
"vulkan/AdapterVk.h", "vulkan/AdapterVk.h",

View File

@ -328,7 +328,7 @@ source_set("dawn_white_box_tests_sources") {
] ]
if (dawn_enable_vulkan) { if (dawn_enable_vulkan) {
deps += [ "${dawn_root}/third_party:vulkan_headers" ] deps += [ "${dawn_root}/third_party/khronos:vulkan_headers" ]
if (is_chromeos) { if (is_chromeos) {
sources += [ "white_box/VulkanImageWrappingTestsDmaBuf.cpp" ] sources += [ "white_box/VulkanImageWrappingTestsDmaBuf.cpp" ]

View File

@ -26,7 +26,7 @@ import("${dawn_root}/scripts/dawn_features.gni")
if (dawn_supports_glfw_for_windowing) { if (dawn_supports_glfw_for_windowing) {
group("dawn_glfw") { group("dawn_glfw") {
public_deps = [ public_deps = [
"${dawn_root}/third_party:glfw", "${dawn_root}/third_party/gn/glfw",
] ]
} }
} else if (is_fuchsia) { } else if (is_fuchsia) {

210
third_party/BUILD.gn vendored
View File

@ -1,210 +0,0 @@
# Copyright 2018 The Dawn Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build_overrides/build.gni")
import("../scripts/dawn_features.gni")
import("../scripts/dawn_overrides_with_defaults.gni")
###############################################################################
# Third-party dependencies needed by dawn_native
###############################################################################
# Empty targets to add the include dirs and list the sources of Khronos headers for header inclusion check.
config("khronos_headers_public") {
include_dirs = [ "khronos" ]
}
config("vulkan_headers_config") {
include_dirs = [ "khronos" ]
}
source_set("vulkan_headers") {
sources = [
"khronos/vulkan/vk_icd.h",
"khronos/vulkan/vk_layer.h",
"khronos/vulkan/vk_platform.h",
"khronos/vulkan/vk_sdk_platform.h",
"khronos/vulkan/vulkan.h",
"khronos/vulkan/vulkan_core.h",
]
if (is_fuchsia) {
sources += [ "khronos/vulkan/vulkan_fuchsia_extras.h" ]
}
public_configs = [ ":vulkan_headers_config" ]
}
source_set("khronos_platform") {
sources = [
"khronos/KHR/khrplatform.h",
]
public_configs = [ ":khronos_headers_public" ]
}
###############################################################################
# GLFW - good enough build targets
###############################################################################
# Only expose GLFW targets on platforms where GLFW is supported: otherwise they
# might get discovered by GN when another target in this file is referenced,
# and GLFW will be built as part of "all" builds, causing compilation failures.
if (is_win || (is_linux && !is_chromeos) || is_mac) {
glfw_dir = dawn_glfw_dir
config("glfw_public") {
include_dirs = [ "${glfw_dir}/include" ]
if (is_win) {
defines = [ "_GLFW_WIN32" ]
}
if (is_mac) {
defines = [ "_GLFW_COCOA" ]
}
if (is_linux) {
defines = [ "_GLFW_X11" ]
}
}
static_library("glfw") {
public_configs = [ ":glfw_public" ]
if (dawn_has_build) {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
if (is_win && !is_clang) {
# nonstandard extension, function/data pointer conversion in expression
cflags_c = [ "/wd4152" ]
} else {
cflags_c = [
"-Wno-sign-compare",
"-Wno-missing-field-initializers",
]
}
sources = [
"${glfw_dir}/include/GLFW/glfw3.h",
"${glfw_dir}/include/GLFW/glfw3native.h",
"${glfw_dir}/src/context.c",
"${glfw_dir}/src/egl_context.c",
"${glfw_dir}/src/egl_context.h",
"${glfw_dir}/src/init.c",
"${glfw_dir}/src/input.c",
"${glfw_dir}/src/internal.h",
"${glfw_dir}/src/monitor.c",
"${glfw_dir}/src/osmesa_context.c",
"${glfw_dir}/src/osmesa_context.h",
"${glfw_dir}/src/vulkan.c",
"${glfw_dir}/src/window.c",
]
libs = []
if (is_win) {
sources += [
"${glfw_dir}/src/wgl_context.c",
"${glfw_dir}/src/wgl_context.h",
"${glfw_dir}/src/win32_init.c",
"${glfw_dir}/src/win32_joystick.c",
"${glfw_dir}/src/win32_joystick.h",
"${glfw_dir}/src/win32_monitor.c",
"${glfw_dir}/src/win32_platform.h",
"${glfw_dir}/src/win32_thread.c",
"${glfw_dir}/src/win32_time.c",
"${glfw_dir}/src/win32_window.c",
]
}
if (is_linux || is_mac) {
sources += [
"${glfw_dir}/src/posix_thread.c",
"${glfw_dir}/src/posix_thread.h",
]
}
if (is_linux) {
sources += [
"${glfw_dir}/src/glx_context.c",
"${glfw_dir}/src/glx_context.h",
"${glfw_dir}/src/linux_joystick.c",
"${glfw_dir}/src/linux_joystick.h",
"${glfw_dir}/src/posix_time.c",
"${glfw_dir}/src/posix_time.h",
"${glfw_dir}/src/x11_init.c",
"${glfw_dir}/src/x11_monitor.c",
"${glfw_dir}/src/x11_platform.h",
"${glfw_dir}/src/x11_window.c",
"${glfw_dir}/src/xkb_unicode.c",
"${glfw_dir}/src/xkb_unicode.h",
]
libs += [
"rt",
"dl",
"X11",
"Xcursor",
"Xinerama",
"Xrandr",
]
}
if (is_mac) {
sources += [
"${glfw_dir}/src/cocoa_init.m",
"${glfw_dir}/src/cocoa_joystick.h",
"${glfw_dir}/src/cocoa_joystick.m",
"${glfw_dir}/src/cocoa_monitor.m",
"${glfw_dir}/src/cocoa_platform.h",
"${glfw_dir}/src/cocoa_time.c",
"${glfw_dir}/src/cocoa_window.m",
"${glfw_dir}/src/nsgl_context.h",
"${glfw_dir}/src/nsgl_context.m",
]
libs += [
"Cocoa.framework",
"IOKit.framework",
"CoreFoundation.framework",
"CoreVideo.framework",
]
cflags_objc = [
"-Wno-sign-compare",
"-Wno-unguarded-availability",
"-Wno-objc-multiple-method-names",
]
}
}
}
###############################################################################
# Header-only dependencies for samples
###############################################################################
if (dawn_standalone) {
# GLM
config("glm_public_config") {
include_dirs = [ "glm" ]
}
source_set("glm") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
public_configs = [ ":glm_public_config" ]
# GLM is header only but has too many files to list them.
}
}

149
third_party/gn/glfw/BUILD.gn vendored Normal file
View File

@ -0,0 +1,149 @@
# Copyright 2020 The Dawn Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("../../../scripts/dawn_overrides_with_defaults.gni")
import("${dawn_root}/scripts/dawn_features.gni")
# Only expose GLFW targets on platforms where GLFW is supported: otherwise they
# might get discovered by GN when another target in this file is referenced,
# and GLFW will be built as part of "all" builds, causing compilation failures.
assert(dawn_supports_glfw_for_windowing)
glfw_dir = dawn_glfw_dir
config("glfw_public") {
include_dirs = [ "${glfw_dir}/include" ]
if (is_win) {
defines = [ "_GLFW_WIN32" ]
}
if (is_mac) {
defines = [ "_GLFW_COCOA" ]
}
if (is_linux) {
defines = [ "_GLFW_X11" ]
}
}
static_library("glfw") {
public_configs = [ ":glfw_public" ]
if (dawn_has_build) {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
}
if (is_win && !is_clang) {
# nonstandard extension, function/data pointer conversion in expression
cflags_c = [ "/wd4152" ]
} else {
cflags_c = [
"-Wno-sign-compare",
"-Wno-missing-field-initializers",
]
}
sources = [
"${glfw_dir}/include/GLFW/glfw3.h",
"${glfw_dir}/include/GLFW/glfw3native.h",
"${glfw_dir}/src/context.c",
"${glfw_dir}/src/egl_context.c",
"${glfw_dir}/src/egl_context.h",
"${glfw_dir}/src/init.c",
"${glfw_dir}/src/input.c",
"${glfw_dir}/src/internal.h",
"${glfw_dir}/src/monitor.c",
"${glfw_dir}/src/osmesa_context.c",
"${glfw_dir}/src/osmesa_context.h",
"${glfw_dir}/src/vulkan.c",
"${glfw_dir}/src/window.c",
]
libs = []
if (is_win) {
sources += [
"${glfw_dir}/src/wgl_context.c",
"${glfw_dir}/src/wgl_context.h",
"${glfw_dir}/src/win32_init.c",
"${glfw_dir}/src/win32_joystick.c",
"${glfw_dir}/src/win32_joystick.h",
"${glfw_dir}/src/win32_monitor.c",
"${glfw_dir}/src/win32_platform.h",
"${glfw_dir}/src/win32_thread.c",
"${glfw_dir}/src/win32_time.c",
"${glfw_dir}/src/win32_window.c",
]
}
if (is_linux || is_mac) {
sources += [
"${glfw_dir}/src/posix_thread.c",
"${glfw_dir}/src/posix_thread.h",
]
}
if (is_linux) {
sources += [
"${glfw_dir}/src/glx_context.c",
"${glfw_dir}/src/glx_context.h",
"${glfw_dir}/src/linux_joystick.c",
"${glfw_dir}/src/linux_joystick.h",
"${glfw_dir}/src/posix_time.c",
"${glfw_dir}/src/posix_time.h",
"${glfw_dir}/src/x11_init.c",
"${glfw_dir}/src/x11_monitor.c",
"${glfw_dir}/src/x11_platform.h",
"${glfw_dir}/src/x11_window.c",
"${glfw_dir}/src/xkb_unicode.c",
"${glfw_dir}/src/xkb_unicode.h",
]
libs += [
"rt",
"dl",
"X11",
"Xcursor",
"Xinerama",
"Xrandr",
]
}
if (is_mac) {
sources += [
"${glfw_dir}/src/cocoa_init.m",
"${glfw_dir}/src/cocoa_joystick.h",
"${glfw_dir}/src/cocoa_joystick.m",
"${glfw_dir}/src/cocoa_monitor.m",
"${glfw_dir}/src/cocoa_platform.h",
"${glfw_dir}/src/cocoa_time.c",
"${glfw_dir}/src/cocoa_window.m",
"${glfw_dir}/src/nsgl_context.h",
"${glfw_dir}/src/nsgl_context.m",
]
libs += [
"Cocoa.framework",
"IOKit.framework",
"CoreFoundation.framework",
"CoreVideo.framework",
]
cflags_objc = [
"-Wno-sign-compare",
"-Wno-unguarded-availability",
"-Wno-objc-multiple-method-names",
]
}
}

29
third_party/gn/glm/BUILD.gn vendored Normal file
View File

@ -0,0 +1,29 @@
# Copyright 2020 The Dawn Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("../../../scripts/dawn_overrides_with_defaults.gni")
assert(dawn_standalone)
config("glm_public_config") {
include_dirs = [ "${dawn_glm_dir}" ]
}
source_set("glm") {
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
public_configs = [ ":glm_public_config" ]
# GLM is header only but has too many files to list them for "gn check"
}

49
third_party/khronos/BUILD.gn vendored Normal file
View File

@ -0,0 +1,49 @@
# Copyright 2020 The Dawn Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Empty targets to add the include dirs and list the sources of Khronos
# headers for header inclusion check.
config("vulkan_headers_config") {
include_dirs = [ "." ]
}
source_set("vulkan_headers") {
sources = [
"vulkan/vk_icd.h",
"vulkan/vk_layer.h",
"vulkan/vk_platform.h",
"vulkan/vk_sdk_platform.h",
"vulkan/vulkan.h",
"vulkan/vulkan_core.h",
]
if (is_fuchsia) {
sources += [ "vulkan/vulkan_fuchsia_extras.h" ]
}
public_configs = [ ":vulkan_headers_config" ]
}
config("khronos_headers_public") {
include_dirs = [ "." ]
}
source_set("khronos_platform") {
sources = [
"KHR/khrplatform.h",
]
public_configs = [ ":khronos_headers_public" ]
}