Add GN build for tests and their third party deps.
This commit is contained in:
parent
c978fe8d15
commit
649e2feda4
264
BUILD.gn
264
BUILD.gn
|
@ -12,7 +12,9 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import("//build_overrides/dawn.gni")
|
import("scripts/dawn_overrides_with_defaults.gni")
|
||||||
|
|
||||||
|
import("//testing/test.gni")
|
||||||
|
|
||||||
declare_args() {
|
declare_args() {
|
||||||
# Enable Dawn's ASSERTs even in release builds
|
# Enable Dawn's ASSERTs even in release builds
|
||||||
|
@ -131,7 +133,7 @@ template("dawn_generator") {
|
||||||
}
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Dawn headers and libdawn.so
|
# Common dawn libraries and configs
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
config("libdawn_public") {
|
config("libdawn_public") {
|
||||||
|
@ -141,33 +143,6 @@ config("libdawn_public") {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
dawn_generator("dawn_headers") {
|
|
||||||
target = "dawn_headers"
|
|
||||||
target_type = "source_set"
|
|
||||||
|
|
||||||
public_configs = [ ":libdawn_public" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
dawn_generator("libdawn") {
|
|
||||||
target = "libdawn"
|
|
||||||
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",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# Common dawn libraries and configs
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
config("dawn_internal") {
|
config("dawn_internal") {
|
||||||
include_dirs = [ "src" ]
|
include_dirs = [ "src" ]
|
||||||
|
|
||||||
|
@ -195,6 +170,16 @@ config("dawn_internal") {
|
||||||
configs = [ ":libdawn_public" ]
|
configs = [ ":libdawn_public" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Executable needs an rpath to find our shared libraries on OSX
|
||||||
|
config("dawn_shared_library_public") {
|
||||||
|
if (is_mac) {
|
||||||
|
ldflags = [
|
||||||
|
"-rpath",
|
||||||
|
"@executable_path/",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static_library("dawn_common") {
|
static_library("dawn_common") {
|
||||||
sources = [
|
sources = [
|
||||||
"src/common/Assert.cpp",
|
"src/common/Assert.cpp",
|
||||||
|
@ -218,6 +203,42 @@ static_library("dawn_common") {
|
||||||
configs += [ ":dawn_internal" ]
|
configs += [ ":dawn_internal" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Dawn headers and libdawn.so
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
dawn_generator("dawn_headers") {
|
||||||
|
target = "dawn_headers"
|
||||||
|
target_type = "source_set"
|
||||||
|
|
||||||
|
public_configs = [ ":libdawn_public" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
dawn_generator("libdawn") {
|
||||||
|
target = "libdawn"
|
||||||
|
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",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Tell dependents where to find this shared library
|
||||||
|
if (is_mac) {
|
||||||
|
ldflags = [
|
||||||
|
"-install_name",
|
||||||
|
"@rpath/${target_name}.dylib",
|
||||||
|
]
|
||||||
|
public_configs = [ ":dawn_shared_library_public" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Third-party dependencies needed by libdawn_native
|
# Third-party dependencies needed by libdawn_native
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
@ -248,12 +269,12 @@ static_library("spirv_cross") {
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
"${dawn_spirv_cross_dir}/GLSL.std.450.h",
|
"${dawn_spirv_cross_dir}/GLSL.std.450.h",
|
||||||
"${dawn_spirv_cross_dir}/spirv_common.hpp",
|
"${dawn_spirv_cross_dir}/spirv.hpp",
|
||||||
"${dawn_spirv_cross_dir}/spirv_cfg.cpp",
|
"${dawn_spirv_cross_dir}/spirv_cfg.cpp",
|
||||||
"${dawn_spirv_cross_dir}/spirv_cfg.hpp",
|
"${dawn_spirv_cross_dir}/spirv_cfg.hpp",
|
||||||
|
"${dawn_spirv_cross_dir}/spirv_common.hpp",
|
||||||
"${dawn_spirv_cross_dir}/spirv_cross.cpp",
|
"${dawn_spirv_cross_dir}/spirv_cross.cpp",
|
||||||
"${dawn_spirv_cross_dir}/spirv_cross.hpp",
|
"${dawn_spirv_cross_dir}/spirv_cross.hpp",
|
||||||
"${dawn_spirv_cross_dir}/spirv.hpp",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
need_glsl_cross = dawn_enable_opengl
|
need_glsl_cross = dawn_enable_opengl
|
||||||
|
@ -610,6 +631,15 @@ shared_library("libdawn_native") {
|
||||||
":libdawn_native_sources",
|
":libdawn_native_sources",
|
||||||
]
|
]
|
||||||
public_configs = [ ":libdawn_public" ]
|
public_configs = [ ":libdawn_public" ]
|
||||||
|
|
||||||
|
# Tell dependents where to find this shared library
|
||||||
|
if (is_mac) {
|
||||||
|
ldflags = [
|
||||||
|
"-install_name",
|
||||||
|
"@rpath/${target_name}.dylib",
|
||||||
|
]
|
||||||
|
public_configs += [ ":dawn_shared_library_public" ]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# The static library for libdawn_native for use by unittests
|
# The static library for libdawn_native for use by unittests
|
||||||
|
@ -654,4 +684,176 @@ shared_library("libdawn_wire") {
|
||||||
":libdawn_wire_sources",
|
":libdawn_wire_sources",
|
||||||
]
|
]
|
||||||
public_configs = [ ":libdawn_public" ]
|
public_configs = [ ":libdawn_public" ]
|
||||||
|
|
||||||
|
# Tell dependents where to find this shared library
|
||||||
|
if (is_mac) {
|
||||||
|
ldflags = [
|
||||||
|
"-install_name",
|
||||||
|
"@rpath/${target_name}.dylib",
|
||||||
|
]
|
||||||
|
public_configs += [ ":dawn_shared_library_public" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Utils for tests and samples
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
static_library("dawn_utils") {
|
||||||
|
configs += [ ":dawn_internal" ]
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
"src/utils/BackendBinding.cpp",
|
||||||
|
"src/utils/BackendBinding.h",
|
||||||
|
"src/utils/DawnHelpers.cpp",
|
||||||
|
"src/utils/DawnHelpers.h",
|
||||||
|
"src/utils/SystemUtils.cpp",
|
||||||
|
"src/utils/SystemUtils.h",
|
||||||
|
"src/utils/TerribleCommandBuffer.cpp",
|
||||||
|
"src/utils/TerribleCommandBuffer.h",
|
||||||
|
]
|
||||||
|
libs = []
|
||||||
|
deps = [
|
||||||
|
":dawn_common",
|
||||||
|
":libdawn_native",
|
||||||
|
"third_party:glfw",
|
||||||
|
"third_party:libshaderc",
|
||||||
|
]
|
||||||
|
|
||||||
|
if (dawn_enable_d3d12) {
|
||||||
|
sources += [ "src/utils/D3D12Binding.cpp" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dawn_enable_metal) {
|
||||||
|
sources += [ "src/utils/MetalBinding.mm" ]
|
||||||
|
libs += [
|
||||||
|
"Metal.framework",
|
||||||
|
"QuartzCore.framework",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Suppress warnings that Metal isn't in the deployment target of Chrome
|
||||||
|
if (is_mac) {
|
||||||
|
cflags_objcc = [ "-Wno-unguarded-availability" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dawn_enable_null) {
|
||||||
|
sources += [ "src/utils/NullBinding.cpp" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dawn_enable_opengl) {
|
||||||
|
sources += [ "src/utils/OpenGLBinding.cpp" ]
|
||||||
|
deps += [ ":glad" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dawn_enable_vulkan) {
|
||||||
|
sources += [ "src/utils/VulkanBinding.cpp" ]
|
||||||
|
deps += [ ":vulkan_headers" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Dawn test targets
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
dawn_generator("mock_dawn") {
|
||||||
|
testonly = true
|
||||||
|
target = "mock_dawn"
|
||||||
|
target_type = "source_set"
|
||||||
|
|
||||||
|
deps = [
|
||||||
|
":dawn_headers",
|
||||||
|
"third_party:gmock",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
test("dawn_unittests") {
|
||||||
|
configs += [ ":dawn_internal" ]
|
||||||
|
|
||||||
|
if (is_linux) {
|
||||||
|
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
deps = [
|
||||||
|
":dawn_utils",
|
||||||
|
":libdawn",
|
||||||
|
":libdawn_native_static",
|
||||||
|
":libdawn_wire",
|
||||||
|
":mock_dawn",
|
||||||
|
"third_party:gmock",
|
||||||
|
"third_party:gtest",
|
||||||
|
]
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
"src/tests/UnittestsMain.cpp",
|
||||||
|
"src/tests/unittests/BitSetIteratorTests.cpp",
|
||||||
|
"src/tests/unittests/CommandAllocatorTests.cpp",
|
||||||
|
"src/tests/unittests/EnumClassBitmasksTests.cpp",
|
||||||
|
"src/tests/unittests/ErrorTests.cpp",
|
||||||
|
"src/tests/unittests/MathTests.cpp",
|
||||||
|
"src/tests/unittests/ObjectBaseTests.cpp",
|
||||||
|
"src/tests/unittests/PerStageTests.cpp",
|
||||||
|
"src/tests/unittests/RefCountedTests.cpp",
|
||||||
|
"src/tests/unittests/ResultTests.cpp",
|
||||||
|
"src/tests/unittests/SerialQueueTests.cpp",
|
||||||
|
"src/tests/unittests/ToBackendTests.cpp",
|
||||||
|
"src/tests/unittests/WireTests.cpp",
|
||||||
|
"src/tests/unittests/validation/BindGroupValidationTests.cpp",
|
||||||
|
"src/tests/unittests/validation/BlendStateValidationTests.cpp",
|
||||||
|
"src/tests/unittests/validation/BufferValidationTests.cpp",
|
||||||
|
"src/tests/unittests/validation/CommandBufferValidationTests.cpp",
|
||||||
|
"src/tests/unittests/validation/ComputeValidationTests.cpp",
|
||||||
|
"src/tests/unittests/validation/CopyCommandsValidationTests.cpp",
|
||||||
|
"src/tests/unittests/validation/DepthStencilStateValidationTests.cpp",
|
||||||
|
"src/tests/unittests/validation/DynamicStateCommandValidationTests.cpp",
|
||||||
|
"src/tests/unittests/validation/InputStateValidationTests.cpp",
|
||||||
|
"src/tests/unittests/validation/PushConstantsValidationTests.cpp",
|
||||||
|
"src/tests/unittests/validation/RenderPassDescriptorValidationTests.cpp",
|
||||||
|
"src/tests/unittests/validation/RenderPipelineValidationTests.cpp",
|
||||||
|
"src/tests/unittests/validation/ValidationTest.cpp",
|
||||||
|
"src/tests/unittests/validation/ValidationTest.h",
|
||||||
|
"src/tests/unittests/validation/VertexBufferValidationTests.cpp",
|
||||||
|
]
|
||||||
|
|
||||||
|
if (dawn_enable_d3d12) {
|
||||||
|
sources += [ "src/tests/unittests/d3d12CopySplitTests.cpp" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test("dawn_end2end_tests") {
|
||||||
|
configs += [ ":dawn_internal" ]
|
||||||
|
|
||||||
|
if (is_linux) {
|
||||||
|
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
deps = [
|
||||||
|
":dawn_utils",
|
||||||
|
":libdawn",
|
||||||
|
":libdawn_native",
|
||||||
|
":libdawn_wire",
|
||||||
|
"third_party:glfw",
|
||||||
|
"third_party:gtest",
|
||||||
|
]
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
"src/tests/DawnTest.cpp",
|
||||||
|
"src/tests/DawnTest.h",
|
||||||
|
"src/tests/End2EndTestsMain.cpp",
|
||||||
|
"src/tests/end2end/BasicTests.cpp",
|
||||||
|
"src/tests/end2end/BlendStateTests.cpp",
|
||||||
|
"src/tests/end2end/BufferTests.cpp",
|
||||||
|
"src/tests/end2end/ComputeCopyStorageBufferTests.cpp",
|
||||||
|
"src/tests/end2end/CopyTests.cpp",
|
||||||
|
"src/tests/end2end/DepthStencilStateTests.cpp",
|
||||||
|
"src/tests/end2end/DrawElementsTests.cpp",
|
||||||
|
"src/tests/end2end/IndexFormatTests.cpp",
|
||||||
|
"src/tests/end2end/InputStateTests.cpp",
|
||||||
|
"src/tests/end2end/PrimitiveTopologyTests.cpp",
|
||||||
|
"src/tests/end2end/PushConstantTests.cpp",
|
||||||
|
"src/tests/end2end/RenderPassLoadOpTests.cpp",
|
||||||
|
"src/tests/end2end/SamplerTests.cpp",
|
||||||
|
"src/tests/end2end/ScissorTests.cpp",
|
||||||
|
"src/tests/end2end/ViewportOrientationTests.cpp",
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
26
DEPS
26
DEPS
|
@ -21,16 +21,40 @@ deps = {
|
||||||
'condition': 'dawn_standalone',
|
'condition': 'dawn_standalone',
|
||||||
},
|
},
|
||||||
|
|
||||||
# GTest and GMock
|
# Testing, GTest and GMock
|
||||||
'{dawn_root}/testing': {
|
'{dawn_root}/testing': {
|
||||||
'url': '{chromium_git}/chromium/src/testing@4d706fd80be9e8989aec5235540e7b46d0672826',
|
'url': '{chromium_git}/chromium/src/testing@4d706fd80be9e8989aec5235540e7b46d0672826',
|
||||||
'condition': 'dawn_standalone',
|
'condition': 'dawn_standalone',
|
||||||
},
|
},
|
||||||
|
'third_party/googletest': {
|
||||||
|
'url': '{github_git}/google/googletest.git@98a0d007d7092b72eea0e501bb9ad17908a1a036',
|
||||||
|
'condition': 'dawn_standalone',
|
||||||
|
},
|
||||||
|
|
||||||
# SPIRV-Cross
|
# SPIRV-Cross
|
||||||
'{dawn_root}/third_party/spirv-cross': {
|
'{dawn_root}/third_party/spirv-cross': {
|
||||||
'url': '{github_git}/Kangz/SPIRV-Cross.git@694cad533296df02b4562f4a5a20cba1d1a9dbaf',
|
'url': '{github_git}/Kangz/SPIRV-Cross.git@694cad533296df02b4562f4a5a20cba1d1a9dbaf',
|
||||||
|
'condition': 'dawn_standalone',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# SPIRV compiler dependencies: SPIRV-Tools, SPIRV-headers, glslang and shaderc
|
||||||
|
'{dawn_root}/third_party/SPIRV-Tools': {
|
||||||
|
'url': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Tools.git@eda2cfbe128e5b71e9a0131f816ade5186ad6420',
|
||||||
|
'condition': 'dawn_standalone',
|
||||||
|
},
|
||||||
|
'{dawn_root}/third_party/spirv-headers': {
|
||||||
|
'url': '{chromium_git}/external/github.com/KhronosGroup/SPIRV-Headers.git@ff684ffc6a35d2a58f0f63108877d0064ea33feb',
|
||||||
|
'condition': 'dawn_standalone',
|
||||||
|
},
|
||||||
|
'{dawn_root}/third_party/glslang': {
|
||||||
|
'url': '{chromium_git}/external/github.com/google/glslang.git@29619b2312f7bc862221749f3f4d37c3e6a0dee2',
|
||||||
|
'condition': 'dawn_standalone',
|
||||||
|
},
|
||||||
|
'{dawn_root}/third_party/shaderc': {
|
||||||
|
'url': '{chromium_git}/external/github.com/google/shaderc.git@30af9f9899aefd018669e81a5b8e605d14d40431',
|
||||||
|
'condition': 'dawn_standalone',
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hooks = [
|
hooks = [
|
||||||
|
|
|
@ -12,8 +12,21 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# Whether we are building from Dawn's repository
|
# These are variables that are overridable by projects that include Dawn.
|
||||||
|
# The values in this file are the defaults for when we are building from
|
||||||
|
# Dawn's repository.
|
||||||
|
|
||||||
|
# Whether we are building from Dawn's repository.
|
||||||
|
# MUST be set to false in other projects.
|
||||||
dawn_standalone = true
|
dawn_standalone = true
|
||||||
|
|
||||||
# Where to find SPIRV-Cross if we aren't in standalone
|
# Defaults for these are set again in dawn_overrides_with_defaults.gni so that
|
||||||
|
# users of Dawn don't have to set dirs if they happen to use the same as Dawn.
|
||||||
|
|
||||||
|
# The paths to Dawn's dependencies
|
||||||
dawn_spirv_cross_dir = "//third_party/spirv-cross"
|
dawn_spirv_cross_dir = "//third_party/spirv-cross"
|
||||||
|
dawn_googletest_dir = "//third_party/googletest"
|
||||||
|
dawn_glslang_dir = "//third_party/glslang"
|
||||||
|
dawn_spirv_tools_dir = "//third_party/SPIRV-Tools"
|
||||||
|
dawn_shaderc_dir = "//third_party/shaderc"
|
||||||
|
dawn_glfw_dir = "//third_party/glfw"
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# We are building inside Dawn
|
||||||
|
spirv_tools_standalone = false
|
||||||
|
|
||||||
|
# Paths to SPIRV-Tools dependencies in Dawn
|
||||||
|
spirv_tools_googletest_dir = "//third_party/googletest"
|
||||||
|
spirv_tools_spirv_headers_dir = "//third_party/spirv-headers"
|
|
@ -0,0 +1,45 @@
|
||||||
|
# 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 files imports the overrides for Dawn but sets the defaults so that
|
||||||
|
# projects including Dawn don't have to set dirs if they happen to use the
|
||||||
|
# same.
|
||||||
|
# It takes advantage of GN's variable scoping rules to define global variables
|
||||||
|
# inside if constructs.
|
||||||
|
|
||||||
|
import("//build_overrides/dawn.gni")
|
||||||
|
|
||||||
|
if (!defined(dawn_spirv_cross_dir)) {
|
||||||
|
dawn_spirv_cross_dir = "//third_party/spirv-cross"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defined(dawn_googletest_dir)) {
|
||||||
|
dawn_googletest_dir = "//third_party/googletest"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defined(dawn_glslang_dir)) {
|
||||||
|
dawn_glslang_dir = "//third_party/glslang"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defined(dawn_spirv_tools_dir)) {
|
||||||
|
dawn_spirv_tools_dir = "//third_party/SPIRV-Tools"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defined(dawn_shaderc_dir)) {
|
||||||
|
dawn_shaderc_dir = "//third_party/shaderc"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!defined(dawn_glfw_dir)) {
|
||||||
|
dawn_glfw_dir = "//third_party/glfw"
|
||||||
|
}
|
|
@ -0,0 +1,371 @@
|
||||||
|
# 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("../scripts/dawn_overrides_with_defaults.gni")
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Gtest Gmock - build targets when outside of Chrome
|
||||||
|
# TODO(cwallez@chromium.org): Adapt them to build with Chromium's harness
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
googletest_dir = dawn_googletest_dir
|
||||||
|
|
||||||
|
config("gtest_config") {
|
||||||
|
include_dirs = [
|
||||||
|
"${googletest_dir}/googletest",
|
||||||
|
"${googletest_dir}/googletest/include",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
static_library("gtest") {
|
||||||
|
testonly = true
|
||||||
|
sources = [
|
||||||
|
"${googletest_dir}/googletest/src/gtest-all.cc",
|
||||||
|
]
|
||||||
|
public_configs = [ ":gtest_config" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
config("gmock_config") {
|
||||||
|
include_dirs = [
|
||||||
|
"${googletest_dir}/googlemock",
|
||||||
|
"${googletest_dir}/googlemock/include",
|
||||||
|
"${googletest_dir}/googletest/include",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
static_library("gmock") {
|
||||||
|
testonly = true
|
||||||
|
sources = [
|
||||||
|
"${googletest_dir}/googlemock/src/gmock-all.cc",
|
||||||
|
]
|
||||||
|
public_configs = [ ":gmock_config" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# GLSLang - good enough build targets
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
glslang_dir = dawn_glslang_dir
|
||||||
|
spirv_tools_dir = dawn_spirv_tools_dir
|
||||||
|
|
||||||
|
config("glslang_public") {
|
||||||
|
include_dirs = [ glslang_dir ]
|
||||||
|
}
|
||||||
|
|
||||||
|
static_library("glslang_static") {
|
||||||
|
defines = []
|
||||||
|
|
||||||
|
public_configs = [ ":glslang_public" ]
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
"${glslang_dir}/OGLCompilersDLL/InitializeDll.cpp",
|
||||||
|
"${glslang_dir}/OGLCompilersDLL/InitializeDll.h",
|
||||||
|
"${glslang_dir}/SPIRV/GLSL.ext.EXT.h",
|
||||||
|
"${glslang_dir}/SPIRV/GLSL.ext.KHR.h",
|
||||||
|
"${glslang_dir}/SPIRV/GLSL.std.450.h",
|
||||||
|
"${glslang_dir}/SPIRV/GlslangToSpv.cpp",
|
||||||
|
"${glslang_dir}/SPIRV/GlslangToSpv.h",
|
||||||
|
"${glslang_dir}/SPIRV/InReadableOrder.cpp",
|
||||||
|
"${glslang_dir}/SPIRV/Logger.cpp",
|
||||||
|
"${glslang_dir}/SPIRV/Logger.h",
|
||||||
|
"${glslang_dir}/SPIRV/SPVRemapper.cpp",
|
||||||
|
"${glslang_dir}/SPIRV/SPVRemapper.h",
|
||||||
|
"${glslang_dir}/SPIRV/SpvBuilder.cpp",
|
||||||
|
"${glslang_dir}/SPIRV/SpvBuilder.h",
|
||||||
|
"${glslang_dir}/SPIRV/bitutils.h",
|
||||||
|
"${glslang_dir}/SPIRV/disassemble.cpp",
|
||||||
|
"${glslang_dir}/SPIRV/disassemble.h",
|
||||||
|
"${glslang_dir}/SPIRV/doc.cpp",
|
||||||
|
"${glslang_dir}/SPIRV/doc.h",
|
||||||
|
"${glslang_dir}/SPIRV/hex_float.h",
|
||||||
|
"${glslang_dir}/SPIRV/spirv.hpp",
|
||||||
|
"${glslang_dir}/SPIRV/spvIR.h",
|
||||||
|
"${glslang_dir}/glslang/GenericCodeGen/CodeGen.cpp",
|
||||||
|
"${glslang_dir}/glslang/GenericCodeGen/Link.cpp",
|
||||||
|
"${glslang_dir}/glslang/Include/BaseTypes.h",
|
||||||
|
"${glslang_dir}/glslang/Include/Common.h",
|
||||||
|
"${glslang_dir}/glslang/Include/ConstantUnion.h",
|
||||||
|
"${glslang_dir}/glslang/Include/InfoSink.h",
|
||||||
|
"${glslang_dir}/glslang/Include/InitializeGlobals.h",
|
||||||
|
"${glslang_dir}/glslang/Include/PoolAlloc.h",
|
||||||
|
"${glslang_dir}/glslang/Include/ResourceLimits.h",
|
||||||
|
"${glslang_dir}/glslang/Include/ShHandle.h",
|
||||||
|
"${glslang_dir}/glslang/Include/Types.h",
|
||||||
|
"${glslang_dir}/glslang/Include/arrays.h",
|
||||||
|
"${glslang_dir}/glslang/Include/intermediate.h",
|
||||||
|
"${glslang_dir}/glslang/Include/revision.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/Constant.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/InfoSink.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/Initialize.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/Initialize.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/IntermTraverse.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/Intermediate.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/LiveTraverser.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/ParseContextBase.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/ParseHelper.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/ParseHelper.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/PoolAlloc.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/RemoveTree.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/RemoveTree.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/Scan.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/Scan.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/ScanContext.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/ShaderLang.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/SymbolTable.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/SymbolTable.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/Versions.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/Versions.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/attribute.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/attribute.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/gl_types.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/glslang.y",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/glslang_tab.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/glslang_tab.cpp.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/intermOut.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/iomapper.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/iomapper.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/limits.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/linkValidate.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/localintermediate.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/parseConst.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/parseVersions.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/preprocessor/Pp.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/preprocessor/PpAtom.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/preprocessor/PpContext.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/preprocessor/PpContext.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/preprocessor/PpScanner.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/preprocessor/PpTokens.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/preprocessor/PpTokens.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/propagateNoContraction.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/propagateNoContraction.h",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/reflection.cpp",
|
||||||
|
"${glslang_dir}/glslang/MachineIndependent/reflection.h",
|
||||||
|
"${glslang_dir}/glslang/OSDependent/osinclude.h",
|
||||||
|
"${glslang_dir}/glslang/Public/ShaderLang.h",
|
||||||
|
]
|
||||||
|
|
||||||
|
cflags_cc = [
|
||||||
|
"-Wno-ignored-qualifiers",
|
||||||
|
"-Wno-unused-variable",
|
||||||
|
]
|
||||||
|
|
||||||
|
deps = [
|
||||||
|
"${spirv_tools_dir}:spvtools_opt",
|
||||||
|
]
|
||||||
|
|
||||||
|
if (is_win) {
|
||||||
|
sources += [ "${glslang_dir}/glslang/OSDependent/Windows/ossource.cpp" ]
|
||||||
|
defines += [ "GLSLANG_OSINCLUDE_WIN32" ]
|
||||||
|
} else {
|
||||||
|
sources += [ "${glslang_dir}/glslang/OSDependent/Unix/ossource.cpp" ]
|
||||||
|
defines += [ "GLSLANG_OSINCLUDE_UNIX" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Shaderc - good enough build targets
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
shaderc_dir = dawn_shaderc_dir
|
||||||
|
|
||||||
|
config("shaderc_util_public") {
|
||||||
|
include_dirs = [ "${shaderc_dir}/libshaderc_util/include" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
static_library("shaderc_util") {
|
||||||
|
public_configs = [ ":shaderc_util_public" ]
|
||||||
|
deps = [
|
||||||
|
":glslang_static",
|
||||||
|
"${spirv_tools_dir}:spvtools",
|
||||||
|
]
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
"${shaderc_dir}/libshaderc_util/include/libshaderc_util/counting_includer.h",
|
||||||
|
"${shaderc_dir}/libshaderc_util/include/libshaderc_util/file_finder.h",
|
||||||
|
"${shaderc_dir}/libshaderc_util/include/libshaderc_util/format.h",
|
||||||
|
"${shaderc_dir}/libshaderc_util/include/libshaderc_util/io.h",
|
||||||
|
"${shaderc_dir}/libshaderc_util/include/libshaderc_util/message.h",
|
||||||
|
"${shaderc_dir}/libshaderc_util/include/libshaderc_util/mutex.h",
|
||||||
|
"${shaderc_dir}/libshaderc_util/include/libshaderc_util/resources.h",
|
||||||
|
"${shaderc_dir}/libshaderc_util/include/libshaderc_util/spirv_tools_wrapper.h",
|
||||||
|
"${shaderc_dir}/libshaderc_util/include/libshaderc_util/string_piece.h",
|
||||||
|
"${shaderc_dir}/libshaderc_util/include/libshaderc_util/universal_unistd.h",
|
||||||
|
"${shaderc_dir}/libshaderc_util/include/libshaderc_util/version_profile.h",
|
||||||
|
"${shaderc_dir}/libshaderc_util/src/compiler.cc",
|
||||||
|
"${shaderc_dir}/libshaderc_util/src/file_finder.cc",
|
||||||
|
"${shaderc_dir}/libshaderc_util/src/io.cc",
|
||||||
|
"${shaderc_dir}/libshaderc_util/src/message.cc",
|
||||||
|
"${shaderc_dir}/libshaderc_util/src/resources.cc",
|
||||||
|
"${shaderc_dir}/libshaderc_util/src/shader_stage.cc",
|
||||||
|
"${shaderc_dir}/libshaderc_util/src/spirv_tools_wrapper.cc",
|
||||||
|
"${shaderc_dir}/libshaderc_util/src/version_profile.cc",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
config("shaderc_public") {
|
||||||
|
include_dirs = [ "${shaderc_dir}/libshaderc/include" ]
|
||||||
|
defines = [ "SHADERC_SHAREDLIB" ]
|
||||||
|
|
||||||
|
# Executable needs an rpath to find our shared libraries on OSX
|
||||||
|
if (is_mac) {
|
||||||
|
ldflags = [
|
||||||
|
"-rpath",
|
||||||
|
"@executable_path/",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shared_library("libshaderc") {
|
||||||
|
public_configs = [ ":shaderc_public" ]
|
||||||
|
deps = [
|
||||||
|
":glslang_static",
|
||||||
|
":shaderc_util",
|
||||||
|
"${spirv_tools_dir}:spvtools",
|
||||||
|
"${spirv_tools_dir}:spvtools_val",
|
||||||
|
]
|
||||||
|
defines = [ "SHADERC_IMPLEMENTATION" ]
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
"${shaderc_dir}/libshaderc/include/shaderc/shaderc.h",
|
||||||
|
"${shaderc_dir}/libshaderc/include/shaderc/shaderc.hpp",
|
||||||
|
"${shaderc_dir}/libshaderc/src/shaderc.cc",
|
||||||
|
"${shaderc_dir}/libshaderc/src/shaderc_private.h",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Tell dependents where to find this shared library
|
||||||
|
if (is_mac) {
|
||||||
|
ldflags = [
|
||||||
|
"-install_name",
|
||||||
|
"@rpath/${target_name}.dylib",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# GLFW - good enough build targets
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
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" ]
|
||||||
|
|
||||||
|
cflags_c = [ "-Wno-sign-compare" ]
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
"${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",
|
||||||
|
"${glfw_dir}/src/monitor.c",
|
||||||
|
"${glfw_dir}/src/vulkan.c",
|
||||||
|
"${glfw_dir}/src/window.c",
|
||||||
|
]
|
||||||
|
libs = []
|
||||||
|
|
||||||
|
if (is_win) {
|
||||||
|
sources += [
|
||||||
|
"${glfw_dir}/src/egl_context.c",
|
||||||
|
"${glfw_dir}/src/egl_context.h",
|
||||||
|
"${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_time.c",
|
||||||
|
"${glfw_dir}/src/win32_tls.c",
|
||||||
|
"${glfw_dir}/src/win32_window.c",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_linux || is_mac) {
|
||||||
|
sources += [
|
||||||
|
"${glfw_dir}/src/posix_tls.c",
|
||||||
|
"${glfw_dir}/src/posix_tls.h",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_linux) {
|
||||||
|
sources += [
|
||||||
|
"${glfw_dir}/src/egl_context.c",
|
||||||
|
"${glfw_dir}/src/egl_context.h",
|
||||||
|
"${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",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue