From 2d10e954cec2a605345e0971c4cf7fc046a27ca8 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Tue, 7 Apr 2020 07:44:00 +0000 Subject: [PATCH] BUILD.gn: rename libdawn_native/wire to dawn_native/wire This helps take advantage of the GN feature where when a directory is used as a target name, like //foo/bar/baz, the //foo/bar/baz:baz target is used automatically. Bug: chromium:1064305 Change-Id: I2e2d9f308fda1b811482026962ab0770ac45e988 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18862 Commit-Queue: Corentin Wallez Reviewed-by: Kai Ninomiya --- BUILD.gn | 49 +++++++++--------- docs/debug_markers.md | 2 +- src/dawn_native/BUILD.gn | 55 ++++++++++++--------- src/dawn_wire/BUILD.gn | 23 ++++++--- src/fuzzers/BUILD.gn | 4 +- src/tests/unittests/GetProcAddressTests.cpp | 2 +- third_party/BUILD.gn | 2 +- 7 files changed, 75 insertions(+), 62 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 1ea676cf8e..8c270406b2 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -91,8 +91,8 @@ static_library("dawn_utils") { ] deps = [ "${dawn_root}/src/common", - "${dawn_root}/src/dawn_native:libdawn_native", - "${dawn_root}/src/dawn_wire:libdawn_wire", + "${dawn_root}/src/dawn_native", + "${dawn_root}/src/dawn_wire", "${dawn_shaderc_dir}:libshaderc", ] libs = [] @@ -149,15 +149,14 @@ test("dawn_unittests") { "${dawn_root}/src/common", "${dawn_root}/src/dawn:dawncpp", "${dawn_root}/src/dawn:libdawn_proc", - "${dawn_root}/src/dawn_native:libdawn_native", - "${dawn_root}/src/dawn_native:libdawn_native_sources", - "${dawn_root}/src/dawn_wire:libdawn_wire", + "${dawn_root}/src/dawn_native", + "${dawn_root}/src/dawn_native:dawn_native_sources", + "${dawn_root}/src/dawn_wire", "third_party:gmock_and_gtest", ] - # Add internal Dawn Native headers and config for internal unittests. - deps += [ "${dawn_root}/src/dawn_native:libdawn_native_headers" ] - configs += [ "${dawn_root}/src/dawn_native:libdawn_native_internal" ] + # Add internal dawn_native config for internal unittests. + configs += [ "${dawn_root}/src/dawn_native:dawn_native_internal" ] sources = get_target_outputs(":mock_webgpu_gen") sources += [ @@ -251,8 +250,8 @@ source_set("dawn_end2end_tests_sources") { "${dawn_root}/src/common", "${dawn_root}/src/dawn:dawncpp", "${dawn_root}/src/dawn:libdawn_proc", - "${dawn_root}/src/dawn_native:libdawn_native", - "${dawn_root}/src/dawn_wire:libdawn_wire", + "${dawn_root}/src/dawn_native", + "${dawn_root}/src/dawn_wire", "third_party:gmock_and_gtest", ] @@ -338,7 +337,7 @@ source_set("dawn_end2end_tests_sources") { } source_set("dawn_white_box_tests_sources") { - configs += [ "${dawn_root}/src/dawn_native:libdawn_native_internal" ] + configs += [ "${dawn_root}/src/dawn_native:dawn_native_internal" ] testonly = true deps = [ @@ -346,12 +345,12 @@ source_set("dawn_white_box_tests_sources") { "${dawn_root}/src/common", "${dawn_root}/src/dawn:dawncpp", "${dawn_root}/src/dawn:libdawn_proc", - "${dawn_root}/src/dawn_native:libdawn_native_sources", + "${dawn_root}/src/dawn_native:dawn_native_sources", - # Static because the tests both link against and have libdawn_native + # Static because the tests both link against and have dawn_native # sources. MSVC errors when both importing and exporting symbols. - "${dawn_root}/src/dawn_native:libdawn_native_static", - "${dawn_root}/src/dawn_wire:libdawn_wire", + "${dawn_root}/src/dawn_native:dawn_native_static", + "${dawn_root}/src/dawn_wire", "third_party:gmock_and_gtest", ] @@ -401,8 +400,8 @@ test("dawn_end2end_tests") { "${dawn_root}/src/common", "${dawn_root}/src/dawn:dawncpp", "${dawn_root}/src/dawn:libdawn_proc", - "${dawn_root}/src/dawn_native:libdawn_native", - "${dawn_root}/src/dawn_wire:libdawn_wire", + "${dawn_root}/src/dawn_native", + "${dawn_root}/src/dawn_wire", "third_party:gmock_and_gtest", ] @@ -438,9 +437,9 @@ test("dawn_perf_tests") { "${dawn_root}/src/common", "${dawn_root}/src/dawn:dawncpp", "${dawn_root}/src/dawn:libdawn_proc", - "${dawn_root}/src/dawn_native:libdawn_native", + "${dawn_root}/src/dawn_native", "${dawn_root}/src/dawn_platform", - "${dawn_root}/src/dawn_wire:libdawn_wire", + "${dawn_root}/src/dawn_wire", "third_party:gmock_and_gtest", ] @@ -496,7 +495,7 @@ if (dawn_standalone) { deps = [ ":dawn_glfw", "${dawn_root}/src/common", - "${dawn_root}/src/dawn_native:libdawn_native", + "${dawn_root}/src/dawn_native", ] libs = [] @@ -545,8 +544,8 @@ if (dawn_standalone) { "${dawn_root}/src/common", "${dawn_root}/src/dawn:dawncpp", "${dawn_root}/src/dawn:libdawn_proc", - "${dawn_root}/src/dawn_native:libdawn_native", - "${dawn_root}/src/dawn_wire:libdawn_wire", + "${dawn_root}/src/dawn_native", + "${dawn_root}/src/dawn_wire", ] public_configs = [ "${dawn_root}/src/common:dawn_internal" ] } @@ -641,19 +640,19 @@ group("dawn_fuzzers") { group("libdawn_native") { deps = [ - "src/dawn_native:libdawn_native", + "src/dawn_native", ] } group("libdawn_native_sources") { deps = [ - "src/dawn_native:libdawn_native_sources", + "src/dawn_native:dawn_native_sources", ] } group("libdawn_wire") { deps = [ - "src/dawn_wire:libdawn_wire", + "src/dawn_wire", ] } diff --git a/docs/debug_markers.md b/docs/debug_markers.md index 06b3dde681..8b2404a423 100644 --- a/docs/debug_markers.md +++ b/docs/debug_markers.md @@ -47,4 +47,4 @@ To enable marker functionality, you must launch your application from XCode and ## OpenGL -Debug markers on OpenGL are not implemented and will result in a silent no-op. This is due to low adoption of the GL_EXT_debug_marker extension in Linux device drivers. \ No newline at end of file +Debug markers on OpenGL are not implemented and will result in a silent no-op. This is due to low adoption of the GL_EXT_debug_marker extension in Linux device drivers. diff --git a/src/dawn_native/BUILD.gn b/src/dawn_native/BUILD.gn index 7ce83e24bd..0f6cbc5e1b 100644 --- a/src/dawn_native/BUILD.gn +++ b/src/dawn_native/BUILD.gn @@ -35,7 +35,7 @@ if (use_swiftshader) { import("${dawn_swiftshader_dir}/src/Vulkan/vulkan.gni") } -config("libdawn_native_internal") { +config("dawn_native_internal") { configs = [ "${dawn_root}/src/common:dawn_internal" ] # Suppress warnings that Metal isn't in the deployment target of Chrome: @@ -53,7 +53,7 @@ config("libdawn_native_internal") { } } -config("libdawn_native_weak_framework") { +config("dawn_native_weak_framework") { if (is_mac && dawn_enable_metal) { ldflags = [ "-weak_framework", @@ -62,7 +62,7 @@ config("libdawn_native_weak_framework") { } } -dawn_json_generator("libdawn_native_utils_gen") { +dawn_json_generator("dawn_native_utils_gen") { target = "dawn_native_utils" outputs = [ "src/dawn_native/ProcTable.cpp", @@ -74,7 +74,7 @@ dawn_json_generator("libdawn_native_utils_gen") { } if (dawn_enable_opengl) { - dawn_generator("libdawn_native_opengl_loader_gen") { + dawn_generator("dawn_native_opengl_loader_gen") { script = "${dawn_root}/generator/opengl_loader_generator.py" args = [ "--gl-xml", @@ -90,9 +90,9 @@ if (dawn_enable_opengl) { } } -# Public libdawn_native headers so they can be publically visible for -# dependencies of libdawn_native -source_set("libdawn_native_headers") { +# Public dawn_native headers so they can be publicly visible for +# dependencies of dawn_native +source_set("dawn_native_headers") { public_deps = [ "${dawn_root}/src/dawn:dawncpp_headers", ] @@ -111,13 +111,13 @@ source_set("libdawn_native_headers") { ] } -# The meat of the compilation for libdawn_native so that we can cheaply have +# The meat of the compilation for dawn_native so that we can cheaply have # shared_library / static_library versions of it. It compiles all the files # except those that define exported symbols. -source_set("libdawn_native_sources") { +source_set("dawn_native_sources") { deps = [ - ":libdawn_native_headers", - ":libdawn_native_utils_gen", + ":dawn_native_headers", + ":dawn_native_utils_gen", "${dawn_root}/src/common", "${dawn_shaderc_dir}:spirv_cross", "${dawn_spirv_tools_dir}:spvtools_val", @@ -126,17 +126,17 @@ source_set("libdawn_native_sources") { libs = [] data_deps = [] - configs += [ ":libdawn_native_internal" ] + configs += [ ":dawn_native_internal" ] - # Dependencies that are needed to compile libdawn_native entry points in + # Dependencies that are needed to compile dawn_native entry points in # FooBackend.cpp need to be public deps so they are propagated to the - # libdawn_native target + # dawn_native target public_deps = [ "${dawn_root}/src/dawn_platform", "${dawn_shaderc_dir}:libshaderc_spvc", ] - sources = get_target_outputs(":libdawn_native_utils_gen") + sources = get_target_outputs(":dawn_native_utils_gen") sources += [ "Adapter.cpp", "Adapter.h", @@ -387,10 +387,10 @@ source_set("libdawn_native_sources") { if (dawn_enable_opengl) { public_deps += [ - ":libdawn_native_opengl_loader_gen", + ":dawn_native_opengl_loader_gen", "${dawn_root}/third_party:khronos_platform", ] - sources += get_target_outputs(":libdawn_native_opengl_loader_gen") + sources += get_target_outputs(":dawn_native_opengl_loader_gen") sources += [ "opengl/BackendGL.cpp", "opengl/BackendGL.h", @@ -554,26 +554,26 @@ source_set("libdawn_native_sources") { } } -# The static and shared libraries for libdawn_native. Most of the files are -# already compiled in libdawn_native_sources, but we still need to compile +# The static and shared libraries for dawn_native. Most of the files are +# already compiled in dawn_native_sources, but we still need to compile # files defining exported symbols. -dawn_component("libdawn_native") { +dawn_component("dawn_native") { DEFINE_PREFIX = "DAWN_NATIVE" #Make headers publically visible public_deps = [ - ":libdawn_native_headers", + ":dawn_native_headers", ] deps = [ - ":libdawn_native_sources", + ":dawn_native_sources", "${dawn_root}/src/common", ] sources = [ "DawnNative.cpp", ] - configs = [ ":libdawn_native_internal" ] - public_configs = [ ":libdawn_native_weak_framework" ] + configs = [ ":dawn_native_internal" ] + public_configs = [ ":dawn_native_weak_framework" ] if (dawn_enable_d3d12) { sources += [ "d3d12/D3D12Backend.cpp" ] @@ -601,3 +601,10 @@ dawn_component("libdawn_native") { } } } + +# Temporary group for a 3-way patch with Chromium +group("libdawn_native_headers") { + deps = [ + ":dawn_native_headers", + ] +} diff --git a/src/dawn_wire/BUILD.gn b/src/dawn_wire/BUILD.gn index bb82056ca5..ea5b42e5e4 100644 --- a/src/dawn_wire/BUILD.gn +++ b/src/dawn_wire/BUILD.gn @@ -17,9 +17,9 @@ import("../../scripts/dawn_overrides_with_defaults.gni") import("${dawn_root}/generator/dawn_generator.gni") import("${dawn_root}/scripts/dawn_component.gni") -# Public libdawn_wire headers so they can be publically visible for -# dependencies of libdawn_wire -source_set("libdawn_wire_headers") { +# Public dawn_wire headers so they can be publically visible for +# dependencies of dawn_wire +source_set("dawn_wire_headers") { public_deps = [ "${dawn_root}/src/dawn:dawn_headers", ] @@ -32,7 +32,7 @@ source_set("libdawn_wire_headers") { ] } -dawn_json_generator("libdawn_wire_gen") { +dawn_json_generator("dawn_wire_gen") { target = "dawn_wire" outputs = [ "src/dawn_wire/WireCmd_autogen.h", @@ -50,16 +50,16 @@ dawn_json_generator("libdawn_wire_gen") { ] } -dawn_component("libdawn_wire") { +dawn_component("dawn_wire") { DEFINE_PREFIX = "DAWN_WIRE" deps = [ - ":libdawn_wire_gen", + ":dawn_wire_gen", "${dawn_root}/src/common", ] configs = [ "${dawn_root}/src/common:dawn_internal" ] - sources = get_target_outputs(":libdawn_wire_gen") + sources = get_target_outputs(":dawn_wire_gen") sources += [ "WireClient.cpp", "WireDeserializeAllocator.cpp", @@ -90,6 +90,13 @@ dawn_component("libdawn_wire") { # Make headers publicly visible public_deps = [ - ":libdawn_wire_headers", + ":dawn_wire_headers", + ] +} + +# Temporary group for a 3-way patch with Chromium +group("libdawn_wire_headers") { + deps = [ + ":dawn_wire_headers", ] } diff --git a/src/fuzzers/BUILD.gn b/src/fuzzers/BUILD.gn index 02f707f0fd..65164b9d5e 100644 --- a/src/fuzzers/BUILD.gn +++ b/src/fuzzers/BUILD.gn @@ -88,8 +88,8 @@ static_library("dawn_wire_server_fuzzer_common") { "${dawn_root}/src/common", "${dawn_root}/src/dawn:dawncpp", "${dawn_root}/src/dawn:libdawn_proc", - "${dawn_root}/src/dawn_native:libdawn_native_static", - "${dawn_root}/src/dawn_wire:libdawn_wire_static", + "${dawn_root}/src/dawn_native:dawn_native_static", + "${dawn_root}/src/dawn_wire:dawn_wire_static", ] } diff --git a/src/tests/unittests/GetProcAddressTests.cpp b/src/tests/unittests/GetProcAddressTests.cpp index e18309c370..fe454465da 100644 --- a/src/tests/unittests/GetProcAddressTests.cpp +++ b/src/tests/unittests/GetProcAddressTests.cpp @@ -22,7 +22,7 @@ namespace { - // libdawn_wire and libdawn_native contain duplicated code for the handling of GetProcAddress + // dawn_wire and dawn_native contain duplicated code for the handling of GetProcAddress // so we run the tests against both implementations. This enum is used as a test parameters to // know which implementation to test. enum class DawnFlavor { diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn index af046c876f..3610eddcdc 100644 --- a/third_party/BUILD.gn +++ b/third_party/BUILD.gn @@ -17,7 +17,7 @@ import("../scripts/dawn_features.gni") import("../scripts/dawn_overrides_with_defaults.gni") ############################################################################### -# Third-party dependencies needed by libdawn_native +# 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.