mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 10:25:28 +00:00
Split examples, test and utils in their own BUILD.gn
The basic change was to copy-paste targets in the new BUILD.gn files and fixup paths / add includes. There's a couple more changes that had to be done at the same time: - Multiple files need to know if GLFW is supported so the variable was moved to dawn_features.gni. - The gtest_and_gmock target used to abstract between Dawn's copy of GTest/GMock is only needed by tests and was moved in src/tests/BUILD.gn. - A leftover dawn_end2end_tests target is left in the main BUILD.gn file that is an exact copy of the on in src/tests/BUILD.gn. This is because the GN path is hardcoded in Chromium's isolate_map.pyl that also can't support GN groups. The only way to move a target I could figure out was to duplicate it temporarily. Bug: chromium:1064305 Change-Id: I96820e9d6510b8c9b9112c3e6cd8df2413f04287 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19201 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
ab2c84ffd2
commit
b31015b836
180
src/utils/BUILD.gn
Normal file
180
src/utils/BUILD.gn
Normal file
@@ -0,0 +1,180 @@
|
||||
# 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")
|
||||
|
||||
###############################################################################
|
||||
# GLFW wrapping target
|
||||
###############################################################################
|
||||
|
||||
# GLFW does not support ChromeOS, Android or Fuchsia, so provide a small mock
|
||||
# library that can be linked into the Dawn tests on these platforms. Otherwise,
|
||||
# use the real library from third_party/.
|
||||
if (dawn_supports_glfw_for_windowing) {
|
||||
group("dawn_glfw") {
|
||||
public_deps = [
|
||||
"${dawn_root}/third_party:glfw",
|
||||
]
|
||||
}
|
||||
} else if (is_fuchsia) {
|
||||
# The mock implementation of GLFW on Fuchsia
|
||||
config("dawn_glfw_public_config") {
|
||||
# Allow inclusion of <GLFW/glfw3.h>
|
||||
include_dirs = [ "${dawn_glfw_dir}/include" ]
|
||||
|
||||
# The GLFW/glfw3.h header includes <GL/gl.h> by default, but the latter
|
||||
# does not exist on Fuchsia. Defining GLFW_INCLUDE_NONE helps work around
|
||||
# the issue, but it needs to be defined for any file that includes the
|
||||
# header.
|
||||
defines = [
|
||||
"GLFW_INCLUDE_NONE",
|
||||
"GLFW_INCLUDE_VULKAN",
|
||||
]
|
||||
}
|
||||
|
||||
static_library("dawn_glfw") {
|
||||
sources = [
|
||||
# NOTE: The header below is required to pass "gn check".
|
||||
"${dawn_glfw_dir}/include/GLFW/glfw3.h",
|
||||
"Glfw3Fuchsia.cpp",
|
||||
]
|
||||
public_configs = [ ":dawn_glfw_public_config" ]
|
||||
deps = [
|
||||
"${dawn_root}/src/common",
|
||||
]
|
||||
}
|
||||
} else {
|
||||
# Just skip GLFW on other systems
|
||||
group("dawn_glfw") {
|
||||
}
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Utils for tests and samples
|
||||
###############################################################################
|
||||
|
||||
static_library("dawn_utils") {
|
||||
configs += [ "${dawn_root}/src/common:dawn_internal" ]
|
||||
|
||||
sources = [
|
||||
"ComboRenderBundleEncoderDescriptor.cpp",
|
||||
"ComboRenderBundleEncoderDescriptor.h",
|
||||
"ComboRenderPipelineDescriptor.cpp",
|
||||
"ComboRenderPipelineDescriptor.h",
|
||||
"SystemUtils.cpp",
|
||||
"SystemUtils.h",
|
||||
"TerribleCommandBuffer.cpp",
|
||||
"TerribleCommandBuffer.h",
|
||||
"TextureFormatUtils.cpp",
|
||||
"TextureFormatUtils.h",
|
||||
"Timer.h",
|
||||
"WGPUHelpers.cpp",
|
||||
"WGPUHelpers.h",
|
||||
]
|
||||
deps = [
|
||||
"${dawn_root}/src/common",
|
||||
"${dawn_root}/src/dawn_native",
|
||||
"${dawn_root}/src/dawn_wire",
|
||||
"${dawn_shaderc_dir}:libshaderc",
|
||||
]
|
||||
libs = []
|
||||
|
||||
if (is_win) {
|
||||
sources += [ "WindowsTimer.cpp" ]
|
||||
} else if (is_mac) {
|
||||
sources += [
|
||||
"OSXTimer.cpp",
|
||||
"ObjCUtils.h",
|
||||
"ObjCUtils.mm",
|
||||
]
|
||||
libs += [ "QuartzCore.framework" ]
|
||||
} else {
|
||||
sources += [ "PosixTimer.cpp" ]
|
||||
}
|
||||
|
||||
if (dawn_supports_glfw_for_windowing) {
|
||||
sources += [
|
||||
"GLFWUtils.cpp",
|
||||
"GLFWUtils.h",
|
||||
]
|
||||
deps += [ ":dawn_glfw" ]
|
||||
|
||||
if (dawn_enable_metal) {
|
||||
sources += [ "GLFWUtils_metal.mm" ]
|
||||
libs += [ "Metal.framework" ]
|
||||
}
|
||||
}
|
||||
|
||||
public_deps = [
|
||||
"${dawn_root}/src/dawn:dawncpp_headers",
|
||||
]
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Dawn samples, only in standalone builds
|
||||
###############################################################################
|
||||
|
||||
if (dawn_standalone) {
|
||||
# Library to handle the interaction of Dawn with GLFW windows in samples
|
||||
static_library("dawn_bindings") {
|
||||
configs += [ "${dawn_root}/src/common:dawn_internal" ]
|
||||
|
||||
sources = [
|
||||
"BackendBinding.cpp",
|
||||
"BackendBinding.h",
|
||||
]
|
||||
|
||||
public_deps = [
|
||||
"${dawn_root}/src/dawn:dawn_headers",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":dawn_glfw",
|
||||
"${dawn_root}/src/common",
|
||||
"${dawn_root}/src/dawn_native",
|
||||
]
|
||||
libs = []
|
||||
|
||||
if (dawn_enable_d3d12) {
|
||||
sources += [ "D3D12Binding.cpp" ]
|
||||
}
|
||||
|
||||
if (dawn_enable_metal) {
|
||||
sources += [ "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 += [ "NullBinding.cpp" ]
|
||||
}
|
||||
|
||||
if (dawn_enable_opengl) {
|
||||
sources += [ "OpenGLBinding.cpp" ]
|
||||
}
|
||||
|
||||
if (dawn_enable_vulkan) {
|
||||
sources += [ "VulkanBinding.cpp" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user