Make Dawn "gn check" by default (except SPIRV-Tools)
This required adding some missing dependencies, splitting public headers
of libdawn_[native|wire] so they aren't hidden in the
libdawn_[native|wire]_sources targets, and making unittests depend on
sources directly instead of static libraries (which is almost equivalent).
As a byproduct, Empty.cpp is no longer needed and is removed.
diff --git a/.gn b/.gn
index 84eeec7..48fab83 100644
--- a/.gn
+++ b/.gn
@@ -19,3 +19,10 @@
clang_use_chrome_plugins = false
use_sysroot = true
}
+
+check_targets = [
+ # Everything in BUILD.gn
+ "//:*",
+ # Everything in third_party/BUILD.gn
+ "//third_party/:*",
+]
diff --git a/BUILD.gn b/BUILD.gn
index 470e514..d81b722 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -201,6 +201,9 @@
]
configs += [ ":dawn_internal" ]
+ deps = [
+ ":dawn_headers",
+ ]
}
###############################################################################
@@ -212,6 +215,11 @@
target_type = "source_set"
public_configs = [ ":libdawn_public" ]
+ sources = [
+ "src/include/dawn/EnumClassBitmasks.h",
+ "src/include/dawn/dawn_export.h",
+ "src/include/dawn/dawn_wsi.h",
+ ]
}
dawn_generator("libdawn") {
@@ -219,11 +227,6 @@
target_type = "shared_library"
defines = [ "DAWN_IMPLEMENTATION" ]
- sources = [
- "src/include/dawn/EnumClassBitmasks.h",
- "src/include/dawn/dawn_export.h",
- "src/include/dawn/dawn_wsi.h",
- ]
public_deps = [
":dawn_headers",
@@ -342,17 +345,43 @@
]
}
+# Public libdawn_native headers so they can be publically visible for
+# dependencies of libdawn_native
+source_set("libdawn_native_headers") {
+ public_deps = [
+ ":dawn_headers",
+ ]
+ sources = [
+ "src/include/dawn_native/DawnNative.h",
+ "src/include/dawn_native/dawn_native_export.h",
+
+ # Include all backend's public headers so that dependencies can include
+ # them even when the backends are disabled.
+ "src/include/dawn_native/D3D12Backend.h",
+ "src/include/dawn_native/MetalBackend.h",
+ "src/include/dawn_native/NullBackend.h",
+ "src/include/dawn_native/OpenGLBackend.h",
+ "src/include/dawn_native/VulkanBackend.h",
+ ]
+}
+
# The meat of the compilation for libdawn_native so that we can cheaply have
# shared_library / static_library / component versions of it.
source_set("libdawn_native_sources") {
deps = [
":dawn_common",
- ":dawn_headers",
":libdawn_native_utils",
":spirv_cross",
]
- configs += [ ":libdawn_native_internal" ]
+ # Put the internal config public so that unittests can see internal headers
+ public_configs = [ ":libdawn_native_internal" ]
+
+ # Set the headers as a public dependency so they are visible to unittests
+ public_deps = [
+ ":libdawn_native_headers",
+ ]
+
libs = []
sources = [
@@ -413,16 +442,6 @@
"src/dawn_native/Texture.h",
"src/dawn_native/ToBackend.h",
"src/dawn_native/dawn_platform.h",
- "src/include/dawn_native/DawnNative.h",
- "src/include/dawn_native/dawn_native_export.h",
-
- # Include all backend's public headers so that dependencies can include
- # them even when the backends are disabled.
- "src/include/dawn_native/D3D12Backend.h",
- "src/include/dawn_native/MetalBackend.h",
- "src/include/dawn_native/NullBackend.h",
- "src/include/dawn_native/OpenGLBackend.h",
- "src/include/dawn_native/VulkanBackend.h",
]
if (dawn_enable_d3d12) {
@@ -630,6 +649,11 @@
deps = [
":libdawn_native_sources",
]
+
+ #Make headers publically visible
+ public_deps = [
+ ":libdawn_native_headers",
+ ]
public_configs = [ ":libdawn_public" ]
# Tell dependents where to find this shared library
@@ -642,24 +666,22 @@
}
}
-# The static library for libdawn_native for use by unittests
-static_library("libdawn_native_static") {
- deps = [
- ":libdawn_native_sources",
- ]
-
- sources = [
- "src/Empty.cpp",
- ]
-
- # Put the internal config public so that unittests can see internal headers
- public_configs = [ ":libdawn_native_internal" ]
-}
-
###############################################################################
# libdawn_wire.so
###############################################################################
+# Public libdawn_wire headers so they can be publically visible for
+# dependencies of libdawn_wire
+source_set("libdawn_wire_headers") {
+ public_deps = [
+ ":dawn_headers",
+ ]
+ sources = [
+ "src/include/dawn_wire/Wire.h",
+ "src/include/dawn_wire/dawn_wire_export.h",
+ ]
+}
+
# The meat of the compilation for libdawn_wire so that we can cheaply have
# shared_library / static_library / component versions of it.
dawn_generator("libdawn_wire_sources") {
@@ -669,13 +691,11 @@
configs = [ ":dawn_internal" ]
deps = [
":dawn_common",
- ":dawn_headers",
+ ":libdawn_wire_headers",
]
defines = [ "DAWN_WIRE_IMPLEMENTATION" ]
sources = [
"src/dawn_wire/WireCmd.h",
- "src/include/dawn_wire/Wire.h",
- "src/include/dawn_wire/dawn_wire_export.h",
]
}
@@ -683,6 +703,11 @@
deps = [
":libdawn_wire_sources",
]
+
+ #Make headers publically visible
+ public_deps = [
+ ":libdawn_wire_headers",
+ ]
public_configs = [ ":libdawn_public" ]
# Tell dependents where to find this shared library
@@ -716,6 +741,7 @@
deps = [
":dawn_common",
":libdawn_native",
+ ":libdawn_wire",
"third_party:glfw",
"third_party:libshaderc",
]
@@ -775,9 +801,10 @@
}
deps = [
+ ":dawn_common",
":dawn_utils",
":libdawn",
- ":libdawn_native_static",
+ ":libdawn_native_sources",
":libdawn_wire",
":mock_dawn",
"third_party:gmock",
@@ -828,6 +855,7 @@
}
deps = [
+ ":dawn_common",
":dawn_utils",
":libdawn",
":libdawn_native",
diff --git a/src/Empty.cpp b/src/Empty.cpp
deleted file mode 100644
index c35419c..0000000
--- a/src/Empty.cpp
+++ /dev/null
@@ -1,16 +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.
-
-// This is an empty file used as a workaround for OSX's libtool requiring that a response file
-// contains at least one file.
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index 81a1375..07ebd47 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -283,7 +283,6 @@
"${glfw_dir}/include/GLFW/glfw3.h",
"${glfw_dir}/include/GLFW/glfw3native.h",
"${glfw_dir}/src/context.c",
- "${glfw_dir}/src/glfw_config.h",
"${glfw_dir}/src/init.c",
"${glfw_dir}/src/input.c",
"${glfw_dir}/src/internal.h",