Remove support for CMake builds

This also removes support for Travis and AppVeyor, as well as git
submodules for dependencies.

It also adjusts .gitignore to include dependencies (submodules are
implicitly ignored but are removed in this commit).

Finally, removes some CMake-specific code from the code generator.

BUG=

Change-Id: I4ebc04e530a574b412ef0ca81e4672db01f0ed92
Reviewed-on: https://dawn-review.googlesource.com/c/2040
Reviewed-by: Stephen White <senorblanco@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2018-10-31 10:53:11 +00:00 committed by Commit Bot service account
parent 84cde51741
commit 146edf5bec
22 changed files with 14 additions and 1230 deletions

View File

@ -1,20 +0,0 @@
clone_depth: 50
configuration:
- Debug
image:
- Visual Studio 2017
install:
- pip install jinja2
- git submodule update --init --recursive
build_script:
- mkdir build
- cd build
- cmake -DDAWN_USE_WERROR=1 -DDAWN_ENABLE_VULKAN=1 ..
- cmake --build . -- /verbosity:minimal
# TODO(cwallez@chromium.org) test on more than Debug.
- Debug\dawn_unittests.exe

26
.gitignore vendored
View File

@ -1,29 +1,27 @@
# Autogenerated files due to apparent VS2017 bug:
# https://gitlab.kitware.com/cmake/cmake/issues/16458
*.dir
x86
x64
# Directories added by the standalone GN build
# Directories added by gclient sync and the GN build
.gclient
.gclient_entries
build
buildtools
testing
third_party/SPIRV-Tools/
third_party/binutils/
third_party/clang-format/
third_party/glfw/
third_party/glm/
third_party/glslang/
third_party/googletest/
third_party/jinja2/
third_party/llvm-build
third_party/markupsafe/
third_party/shaderc/
third_party/spirv-cross/
third_party/spirv-headers/
third_party/stb/
tools
out
# Modified from https://www.gitignore.io/api/vim,macos,linux,emacs,cmake,windows,sublimetext,visualstudio,visualstudiocode
### CMake ###
# These files are generated if an in-source build is attempted, even though
# it's disallowed.
CMakeCache.txt
CMakeFiles
# Modified from https://www.gitignore.io/api/vim,macos,linux,emacs,windows,sublimetext,visualstudio,visualstudiocode
### Emacs ###
*~

27
.gitmodules vendored
View File

@ -1,27 +0,0 @@
[submodule "external/glfw"]
path = third_party/glfw
url = https://github.com/glfw/glfw.git
[submodule "external/googletest"]
path = third_party/googletest
url = https://github.com/google/googletest.git
[submodule "external/glslang"]
path = third_party/glslang
url = https://github.com/google/glslang.git
[submodule "external/shaderc"]
path = third_party/shaderc
url = https://github.com/google/shaderc.git
[submodule "external/spirv-tools"]
path = third_party/spirv-tools
url = https://github.com/KhronosGroup/SPIRV-Tools.git
[submodule "external/spirv-headers"]
path = third_party/spirv-headers
url = https://github.com/KhronosGroup/SPIRV-Headers.git
[submodule "external/spirv-cross"]
path = third_party/spirv-cross
url = https://github.com/KhronosGroup/SPIRV-Cross.git
[submodule "external/stb"]
path = third_party/stb
url = https://github.com/nothings/stb.git
[submodule "external/glm"]
path = third_party/glm
url = https://github.com/g-truc/glm.git

View File

@ -1,75 +0,0 @@
os:
- linux
- osx
# If linux, use precise
dist: trusty
sudo: false
language:
- cpp
python:
- "2.7"
env:
- BUILD_TYPE=Debug
- BUILD_TYPE=Release
compiler:
- clang
cache:
- pip
addons:
# Everything under apt is only used on linux
apt:
sources:
# PPA for clang 6.0
- llvm-toolchain-trusty-6.0
# PPA for clang-format 8
- llvm-toolchain-trusty
# PPA for a more recen libstdc++
- ubuntu-toolchain-r-test
packages:
# Get recent compilers
- clang-6.0
# Pull a recent version of libstdc++
- libstdc++-6-dev
# Ninja builds are faster
- ninja-build
# Required for the code generator, unfortunately this is jinja2 2.6 which lacks some of the options we use
- python-jinja2
# Required dependency for GLFW on Linux
- xorg-dev
# Format using the latest and greatest
- clang-format-8
before_install:
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi
install:
# Install dependencies required on OSX
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install ninja; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then pip2 install --user jinja2; fi
script:
# Use the more recent compilers we just installed
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$CXX" == "clang++" ]; then export CXX="clang++-6.0" CC="clang-6.0"; fi
# Build
- mkdir -p build
- cd build
- cmake --version
- cmake -G "Ninja" -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DDAWN_USE_WERROR=1 ..
- cmake --build . -- -j 1
# Test
- ./dawn_unittests
# Get out of the build dir
- cd ..
# Lint
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then ./scripts/travis_lint_format.sh clang-format-8; fi

View File

@ -1,252 +0,0 @@
# Copyright 2017 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.
cmake_minimum_required(VERSION 2.8)
project(dawn C CXX)
# List TARGET_OBJECTS in SOURCES target property.
cmake_policy(SET CMP0051 NEW)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR
"In-source builds are unsupported. Use another directory, like build/, "
"as your CMake build directory.\n"
"Note: CMakeFiles/ and CMakeCache.txt may have been generated in the "
"source directory. These may be removed.")
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
"Build type (Debug, Release, RelWithDebInfo, MinSizeRel)" FORCE)
endif()
################################################################################
# Configuration options
################################################################################
option(DAWN_USE_WERROR "Treat warnings as error (useful for CI)" 0)
# Default values for the backend-enabling options
set(ENABLE_D3D12 OFF)
set(ENABLE_METAL OFF)
set(ENABLE_OPENGL OFF)
set(ENABLE_VULKAN OFF)
if (WIN32)
set(ENABLE_D3D12 ON)
set(ENABLE_OPENGL ON)
set(ENABLE_VULKAN ON)
elseif(APPLE)
set(ENABLE_METAL ON)
elseif(UNIX)
set(ENABLE_OPENGL ON)
set(ENABLE_VULKAN ON)
endif()
option(DAWN_ENABLE_D3D12 "Enable compilation of the D3D12 backend" ${ENABLE_D3D12})
option(DAWN_ENABLE_METAL "Enable compilation of the Metal backend" ${ENABLE_METAL})
option(DAWN_ENABLE_NULL "Enable compilation of the Null backend" ON)
option(DAWN_ENABLE_OPENGL "Enable compilation of the OpenGL backend" ${ENABLE_OPENGL})
option(DAWN_ENABLE_VULKAN "Enable compilation of the Vulkan backend" ${ENABLE_VULKAN})
option(DAWN_ALWAYS_ASSERT "Enable assertions on all build types" OFF)
option(DAWN_USE_CPP17 "Use some optional C++17 features for compile-time checks" OFF)
################################################################################
# Precompute compile flags and defines, functions to set them
################################################################################
set(DAWN_FLAGS "")
set(DAWN_DEFS "")
set(DAWN_INTERNAL_FLAGS "")
set(DAWN_INTERNAL_DEFS "")
set(DAWN_GENERATED_FLAGS "")
set(DAWN_ENABLE_ASSERTS $<OR:$<CONFIG:Debug>,$<BOOL:${DAWN_ALWAYS_ASSERT}>>)
list(APPEND DAWN_DEFS $<${DAWN_ENABLE_ASSERTS}:DAWN_ENABLE_ASSERTS>)
if (DAWN_USE_CPP17)
list(APPEND DAWN_INTERNAL_DEFS "DAWN_CPP_VERSION=17")
else()
list(APPEND DAWN_INTERNAL_DEFS "DAWN_CPP_VERSION=14")
endif()
if (DAWN_ENABLE_D3D12)
list(APPEND DAWN_INTERNAL_DEFS "DAWN_ENABLE_BACKEND_D3D12")
endif()
if (DAWN_ENABLE_METAL)
list(APPEND DAWN_INTERNAL_DEFS "DAWN_ENABLE_BACKEND_METAL")
endif()
if (DAWN_ENABLE_NULL)
list(APPEND DAWN_INTERNAL_DEFS "DAWN_ENABLE_BACKEND_NULL")
endif()
if (DAWN_ENABLE_OPENGL)
list(APPEND DAWN_INTERNAL_DEFS "DAWN_ENABLE_BACKEND_OPENGL")
endif()
if (DAWN_ENABLE_VULKAN)
list(APPEND DAWN_INTERNAL_DEFS "DAWN_ENABLE_BACKEND_VULKAN")
endif()
if (WIN32)
# Define NOMINMAX to prevent conflicts between std::min/max and the min/max macros in WinDef.h
list(APPEND DAWN_DEFS "NOMINMAX")
# Avoid Windows.h including a lot of headers
list(APPEND DAWN_DEFS "WIN32_LEAN_AND_MEAN")
# Remove compile error where the mock Dawn creates too many sections for the old obj format.
list(APPEND DAWN_FLAGS "/bigobj")
endif()
if (MSVC)
list(APPEND DAWN_FLAGS "/std:c++14")
list(APPEND DAWN_FLAGS "/EHsc")
list(APPEND DAWN_FLAGS "/MP")
list(APPEND DAWN_INTERNAL_FLAGS "/W4")
# Allow declarations hiding members as it is used all over Dawn
list(APPEND DAWN_INTERNAL_FLAGS "/wd4458")
list(APPEND DAWN_INTERNAL_FLAGS "/wd4996") # Allow deprecated functions like strncpy
list(APPEND DAWN_GENERATED_FLAGS "/wd4702") # Allow unreachable code
list(APPEND DAWN_GENERATED_FLAGS "/wd4189") # Allow unused variable
if(DAWN_USE_WERROR)
list(APPEND DAWN_INTERNAL_FLAGS "/WX")
endif()
else()
# Activate C++14 only on C++ files, not C files.
list(APPEND DAWN_FLAGS "$<$<COMPILE_LANGUAGE:CXX>:-std=c++14>")
# enable -Wold-style-cast on C++
list(APPEND DAWN_FLAGS "$<$<COMPILE_LANGUAGE:CXX>:-Wold-style-cast>")
list(APPEND DAWN_FLAGS "-fvisibility=hidden" "$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>" "-fno-exceptions")
list(APPEND DAWN_FLAGS "-fPIC")
list(APPEND DAWN_INTERNAL_FLAGS "-Wall" "-Wextra")
list(APPEND DAWN_INTERNAL_FLAGS "-pedantic")
list(APPEND DAWN_GENERATED_FLAGS "-Wno-unused-variable" "-Wno-unused-function")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# don't break the build on older clang versions
list(APPEND DAWN_INTERNAL_FLAGS "-Wno-error=unknown-warning-option")
# GCC's conversion warnings are less useful than clang's
list(APPEND DAWN_INTERNAL_FLAGS "-Wconversion" "-Wno-sign-conversion")
# disable a clang-only -pedantic warning
list(APPEND DAWN_INTERNAL_FLAGS "-Wno-gnu-zero-variadic-macro-arguments")
# additional potentially useful warnings (feel free to remove if they prove un-useful)
list(APPEND DAWN_INTERNAL_FLAGS "-Wextra-semi")
list(APPEND DAWN_INTERNAL_FLAGS "-Wstrict-aliasing")
list(APPEND DAWN_INTERNAL_FLAGS "-Wunreachable-code")
list(APPEND DAWN_GENERATED_FLAGS "-Wno-unreachable-code")
# Probably okay to enable if we establish a field naming convention:
#list(APPEND DAWN_INTERNAL_FLAGS "-Wshadow")
endif()
if(DAWN_USE_WERROR)
list(APPEND DAWN_INTERNAL_FLAGS "-Werror")
endif()
endif()
function(DawnExternalTarget folder target)
set_property(TARGET ${target} APPEND PROPERTY COMPILE_OPTIONS ${DAWN_FLAGS})
set_property(TARGET ${target} APPEND PROPERTY COMPILE_DEFINITIONS ${DAWN_DEFS})
set_property(TARGET ${target} PROPERTY FOLDER "dawn/${folder}")
endfunction()
function(DawnInternalTarget folder target)
DawnExternalTarget("${folder}" ${target})
set_property(TARGET ${target} APPEND PROPERTY COMPILE_OPTIONS ${DAWN_INTERNAL_FLAGS})
set_property(TARGET ${target} APPEND PROPERTY COMPILE_DEFINITIONS ${DAWN_INTERNAL_DEFS})
# Common include directories shared by all internal targets
target_include_directories(${target} PRIVATE ${SRC_DIR} ${GENERATED_DIR} ${INCLUDE_DIR})
# All internal targets require the headers to have been generated
add_dependencies(${target} dawn_headers)
# Group the target sources by folder to have folders show in Visual Studio
if (MSVC)
get_target_property(targetSources ${target} SOURCES)
foreach(sourceFile IN ITEMS ${targetSources})
if (IS_ABSOLUTE "${sourceFile}")
file(RELATIVE_PATH sourceFile "${CMAKE_CURRENT_SOURCE_DIR}" "${sourceFile}")
endif()
get_filename_component(sourceDir "${sourceFile}" PATH)
string(REPLACE "/" "\\" sourceDir "${sourceDir}")
source_group("${sourceDir}" FILES "${sourceFile}")
endforeach()
endif()
endfunction()
# Enable the creation of folders for Visual Studio projects
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Output shared libs and executables directly in the build directory
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
################################################################################
# Generate the C and C++ Dawn APIs
################################################################################
set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/include)
set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
add_subdirectory(generator)
# Dawn header generation is in its own target so that it can be set as a build dependency for all
# internal targets
Generate(
LIB_NAME dawn_headers
LIB_TYPE OBJECT
FOLDER ""
PRINT_NAME "Dawn headers"
COMMAND_LINE_ARGS
${GENERATOR_COMMON_ARGS}
-T dawn_headers
)
# Older versions of CMake aren't able to know which linker to use without this and fail.
set_property(TARGET dawn_headers PROPERTY LINKER_LANGUAGE "CXX")
# libdawn.so/dll/dylib which contains the static proctable C interface and its C++ wrapper
Generate(
LIB_NAME libdawn_autogen
LIB_TYPE OBJECT
FOLDER "libdawn"
PRINT_NAME "libdawn"
COMMAND_LINE_ARGS
${GENERATOR_COMMON_ARGS}
-T libdawn
)
target_compile_definitions(libdawn_autogen PRIVATE DAWN_IMPLEMENTATION)
add_library(libdawn SHARED
$<TARGET_OBJECTS:libdawn_autogen>
${INCLUDE_DIR}/dawn/dawn_export.h
${INCLUDE_DIR}/dawn/dawn_wsi.h
${INCLUDE_DIR}/dawn/EnumClassBitmasks.h
)
set_property(TARGET libdawn PROPERTY OUTPUT_NAME "dawn")
target_include_directories(libdawn PUBLIC ${GENERATED_DIR} ${INCLUDE_DIR})
DawnInternalTarget("libdawn" libdawn)
################################################################################
# Call to other CMakeLists.txt
################################################################################
add_subdirectory(third_party)
add_subdirectory(src/common)
add_subdirectory(src/dawn_native)
add_subdirectory(src/dawn_wire)
add_subdirectory(src/utils)
add_subdirectory(src/tests)
add_subdirectory(examples)

View File

@ -1,54 +0,0 @@
# Copyright 2017 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.
add_library(sample_utils
SampleUtils.cpp
SampleUtils.h
)
target_link_libraries(sample_utils utils dawn_wire)
DawnInternalTarget("examples" sample_utils)
function(add_dawn_sample target sources)
add_executable(${target} ${sources})
target_link_libraries(${target} sample_utils)
target_include_directories(${target} SYSTEM PRIVATE ${GLM_INCLUDE_DIR})
target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${target} PRIVATE ${GLM_INCLUDE_DIR} ${TINYGLTFLOADER_INCLUDE_DIR})
DawnInternalTarget("examples" ${target})
# Suppress some warnings in our sample dependencies
if (MSVC)
# nonstandard extension used: nameless struct/union -- for GLM
set_property(TARGET ${target} APPEND PROPERTY COMPILE_OPTIONS "/wd4201")
# declaration hides global declaration -- for GLM
set_property(TARGET ${target} APPEND PROPERTY COMPILE_OPTIONS "/wd4459")
# = conversion possible loss of data -- for STB image
set_property(TARGET ${target} APPEND PROPERTY COMPILE_OPTIONS "/wd4244")
# declaration hides previous declaration -- for STB image
set_property(TARGET ${target} APPEND PROPERTY COMPILE_OPTIONS "/wd4456")
# declaration hides previous declaration -- for picojson
set_property(TARGET ${target} APPEND PROPERTY COMPILE_OPTIONS "/wd4706")
else()
# re-enable old style casts -- for GLM
set_property(TARGET ${target} APPEND PROPERTY COMPILE_OPTIONS "-Wno-old-style-cast")
endif()
endfunction()
add_dawn_sample(CHelloTriangle CHelloTriangle.cpp)
add_dawn_sample(CppHelloTriangle CppHelloTriangle.cpp)
add_dawn_sample(ComputeBoids ComputeBoids.cpp)
add_dawn_sample(Animometer Animometer.cpp)
add_dawn_sample(CubeReflection CubeReflection.cpp)
add_dawn_sample(glTFViewer glTFViewer/glTFViewer.cpp)

View File

@ -1,77 +0,0 @@
# Copyright 2017 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.
find_package(PythonInterp REQUIRED)
include(CMakeParseArguments)
# Check for Jinja2
message(STATUS "${PYTHON_EXECUTABLE}")
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import jinja2"
RESULT_VARIABLE RET
)
if (NOT RET EQUAL 0)
message(FATAL_ERROR "Missing dependencies for code generation, please ensure you have python-jinja2 installed.")
endif()
function(Generate)
set(oneValueArgs LIB_NAME LIB_TYPE PRINT_NAME EXECUTABLE FOLDER)
set(multiValueArgs COMMAND_LINE_ARGS EXTRA_DEPS EXTRA_SOURCES)
cmake_parse_arguments(G "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
execute_process(
COMMAND ${G_COMMAND_LINE_ARGS} --print-dependencies
OUTPUT_VARIABLE DEPENDENCIES
RESULT_VARIABLE RET
)
if (NOT RET EQUAL 0)
message(STATUS ${RET})
message(FATAL_ERROR "Failed to get the dependencies for ${G_PRINT_NAME}.")
endif()
execute_process(
COMMAND ${G_COMMAND_LINE_ARGS} --print-outputs
OUTPUT_VARIABLE OUTPUTS
RESULT_VARIABLE RET
)
if (NOT RET EQUAL 0)
message(FATAL_ERROR "Failed to get the outputs for ${G_PRINT_NAME}.")
endif()
add_custom_command(
COMMAND ${G_COMMAND_LINE_ARGS}
DEPENDS ${DEPENDENCIES} ${G_EXTRA_DEPS}
OUTPUT ${OUTPUTS}
COMMENT "Generating files for ${G_PRINT_NAME}."
)
add_library(${G_LIB_NAME} ${G_LIB_TYPE}
${G_EXTRA_SOURCES}
${OUTPUTS}
)
DawnInternalTarget("${G_FOLDER}" ${G_LIB_NAME})
set_property(TARGET ${G_LIB_NAME} APPEND PROPERTY COMPILE_OPTIONS ${DAWN_GENERATED_FLAGS})
endfunction()
set(GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
set(GENERATOR_COMMON_ARGS
${PYTHON_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/main.py
${PROJECT_SOURCE_DIR}/dawn.json
-t ${CMAKE_CURRENT_SOURCE_DIR}/templates
-o ${CMAKE_CURRENT_BINARY_DIR}
PARENT_SCOPE
)

View File

@ -503,16 +503,6 @@ def get_renders_for_targets(api_params, targets):
return renders
def output_to_files(outputs, output_dir):
for output in outputs:
output_file = output_dir + os.path.sep + output.name
directory = os.path.dirname(output_file)
if not os.path.exists(directory):
os.makedirs(directory)
with open(output_file, 'w') as outfile:
outfile.write(output.content)
def output_to_json(outputs, output_json):
json_root = {}
for output in outputs:
@ -535,15 +525,10 @@ def main():
parser.add_argument('json', metavar='DAWN_JSON', nargs=1, type=str, help ='The DAWN JSON definition to use.')
parser.add_argument('-t', '--template-dir', default='templates', type=str, help='Directory with template files.')
parser.add_argument('-T', '--targets', required=True, type=str, help='Comma-separated subset of targets to output. Available targets: ' + ', '.join(allowed_targets))
# Arguments used only for the GN build
parser.add_argument(kExtraPythonPath, default=None, type=str, help='Additional python path to set before loading Jinja2')
parser.add_argument('--output-json-tarball', default=None, type=str, help='Name of the "JSON tarball" to create (tar is too annoying to use in python).')
parser.add_argument('--depfile', default=None, type=str, help='Name of the Ninja depfile to create for the JSON tarball')
parser.add_argument('--expected-outputs-file', default=None, type=str, help="File to compare outputs with and fail if it doesn't match")
# Arguments used only for the CMake build
parser.add_argument('-o', '--output-dir', default=None, type=str, help='Output directory for the generated source files.')
parser.add_argument('--print-dependencies', action='store_true', help='Prints a space separated list of file dependencies, used for CMake integration')
parser.add_argument('--print-outputs', action='store_true', help='Prints a space separated list of file outputs, used for CMake integration')
args = parser.parse_args()
@ -555,27 +540,8 @@ def main():
targets = args.targets.split(',')
renders = get_renders_for_targets(api_params, targets)
# Print outputs and dependencies for CMake
if args.print_dependencies:
dependencies = set(
[os.path.abspath(args.template_dir + os.path.sep + render.template) for render in renders] +
[os.path.abspath(args.json[0])] +
[os.path.realpath(__file__)]
)
dependencies = [dependency.replace('\\', '/') for dependency in dependencies]
sys.stdout.write(';'.join(dependencies))
return 0
if args.print_outputs:
outputs = set(
[os.path.abspath(args.output_dir + os.path.sep + render.output) for render in renders]
)
outputs = [output.replace('\\', '/') for output in outputs]
sys.stdout.write(';'.join(outputs))
return 0
# The caller wants to assert that the outputs are what it expects.
# Load the file and compare with our renders. GN-only.
# Load the file and compare with our renders.
if args.expected_outputs_file != None:
with open(args.expected_outputs_file) as f:
expected = set([line.strip() for line in f.readlines()])
@ -590,11 +556,7 @@ def main():
outputs = do_renders(renders, args.template_dir)
# CMake only: output all the files directly.
if args.output_dir != None:
output_to_files(outputs, args.output_dir)
# GN only: output the tarball and its depfile
# Output the tarball and its depfile
if args.output_json_tarball != None:
output_to_json(outputs, args.output_json_tarball)

View File

@ -1,37 +0,0 @@
# Copyright 2017 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.
set(COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR})
list(APPEND COMMON_SOURCES
${COMMON_DIR}/Assert.cpp
${COMMON_DIR}/Assert.h
${COMMON_DIR}/BitSetIterator.h
${COMMON_DIR}/Compiler.h
${COMMON_DIR}/DynamicLib.cpp
${COMMON_DIR}/DynamicLib.h
${COMMON_DIR}/HashUtils.h
${COMMON_DIR}/Math.cpp
${COMMON_DIR}/Math.h
${COMMON_DIR}/Platform.h
${COMMON_DIR}/Result.h
${COMMON_DIR}/Serial.h
${COMMON_DIR}/SerialQueue.h
${COMMON_DIR}/SwapChainUtils.h
${COMMON_DIR}/vulkan_platform.h
${COMMON_DIR}/windows_with_undefs.h
)
add_library(dawn_common STATIC ${COMMON_SOURCES})
DawnInternalTarget("" dawn_common)

View File

@ -1,409 +0,0 @@
# Copyright 2017 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.
set(DAWN_NATIVE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(D3D12_DIR ${CMAKE_CURRENT_SOURCE_DIR}/d3d12)
set(METAL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/metal)
set(NULL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/null)
set(OPENGL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/opengl)
set(VULKAN_DIR ${CMAKE_CURRENT_SOURCE_DIR}/vulkan)
set(DAWN_NATIVE_INCLUDE_DIR ${INCLUDE_DIR}/dawn_native)
Generate(
LIB_NAME dawn_native_utils_autogen
LIB_TYPE STATIC
FOLDER "dawn_native"
PRINT_NAME "Autogenerated dawn_native utilities"
COMMAND_LINE_ARGS
${GENERATOR_COMMON_ARGS}
-T dawn_native_utils
)
set(DAWN_NATIVE_SOURCES)
set(DAWN_NATIVE_DEPS dawn_common spirv_cross dawn_native_utils_autogen SPIRV-Tools)
set(DAWN_NATIVE_INCLUDE_DIRS ${SPIRV_CROSS_INCLUDE_DIR} ${SPIRV_TOOLS_INCLUDE_DIR})
################################################################################
# OpenGL Backend
################################################################################
if (DAWN_ENABLE_OPENGL)
list(APPEND DAWN_NATIVE_DEPS glad)
list(APPEND DAWN_NATIVE_INCLUDE_DIRS ${GLAD_INCLUDE_DIR})
list(APPEND DAWN_NATIVE_SOURCES
${OPENGL_DIR}/BlendStateGL.cpp
${OPENGL_DIR}/BlendStateGL.h
${OPENGL_DIR}/BufferGL.cpp
${OPENGL_DIR}/BufferGL.h
${OPENGL_DIR}/CommandBufferGL.cpp
${OPENGL_DIR}/CommandBufferGL.h
${OPENGL_DIR}/ComputePipelineGL.cpp
${OPENGL_DIR}/ComputePipelineGL.h
${OPENGL_DIR}/DepthStencilStateGL.cpp
${OPENGL_DIR}/DepthStencilStateGL.h
${OPENGL_DIR}/DeviceGL.cpp
${OPENGL_DIR}/DeviceGL.h
${OPENGL_DIR}/Forward.h
${OPENGL_DIR}/InputStateGL.cpp
${OPENGL_DIR}/InputStateGL.h
${OPENGL_DIR}/PersistentPipelineStateGL.cpp
${OPENGL_DIR}/PersistentPipelineStateGL.h
${OPENGL_DIR}/PipelineGL.cpp
${OPENGL_DIR}/PipelineGL.h
${OPENGL_DIR}/PipelineLayoutGL.cpp
${OPENGL_DIR}/PipelineLayoutGL.h
${OPENGL_DIR}/QueueGL.cpp
${OPENGL_DIR}/QueueGL.h
${OPENGL_DIR}/RenderPipelineGL.cpp
${OPENGL_DIR}/RenderPipelineGL.h
${OPENGL_DIR}/SamplerGL.cpp
${OPENGL_DIR}/SamplerGL.h
${OPENGL_DIR}/ShaderModuleGL.cpp
${OPENGL_DIR}/ShaderModuleGL.h
${OPENGL_DIR}/SwapChainGL.cpp
${OPENGL_DIR}/SwapChainGL.h
${OPENGL_DIR}/TextureGL.cpp
${OPENGL_DIR}/TextureGL.h
${DAWN_NATIVE_INCLUDE_DIR}/OpenGLBackend.h
)
endif()
################################################################################
# Null Backend
################################################################################
if (DAWN_ENABLE_NULL)
list(APPEND DAWN_NATIVE_SOURCES
${NULL_DIR}/NullBackend.cpp
${NULL_DIR}/NullBackend.h
${DAWN_NATIVE_INCLUDE_DIR}/NullBackend.h
)
endif()
################################################################################
# Metal Backend
################################################################################
if (DAWN_ENABLE_METAL)
list(APPEND DAWN_NATIVE_DEPS "-framework Metal" "-framework Cocoa")
list(APPEND DAWN_NATIVE_SOURCES
${METAL_DIR}/BlendStateMTL.mm
${METAL_DIR}/BlendStateMTL.h
${METAL_DIR}/BufferMTL.mm
${METAL_DIR}/BufferMTL.h
${METAL_DIR}/CommandBufferMTL.mm
${METAL_DIR}/CommandBufferMTL.h
${METAL_DIR}/ComputePipelineMTL.mm
${METAL_DIR}/ComputePipelineMTL.h
${METAL_DIR}/DepthStencilStateMTL.mm
${METAL_DIR}/DepthStencilStateMTL.h
${METAL_DIR}/DeviceMTL.mm
${METAL_DIR}/DeviceMTL.h
${METAL_DIR}/Forward.h
${METAL_DIR}/InputStateMTL.mm
${METAL_DIR}/InputStateMTL.h
${METAL_DIR}/PipelineLayoutMTL.mm
${METAL_DIR}/PipelineLayoutMTL.h
${METAL_DIR}/QueueMTL.mm
${METAL_DIR}/QueueMTL.h
${METAL_DIR}/RenderPipelineMTL.mm
${METAL_DIR}/RenderPipelineMTL.h
${METAL_DIR}/ResourceUploader.mm
${METAL_DIR}/ResourceUploader.h
${METAL_DIR}/SamplerMTL.mm
${METAL_DIR}/SamplerMTL.h
${METAL_DIR}/ShaderModuleMTL.mm
${METAL_DIR}/ShaderModuleMTL.h
${METAL_DIR}/SwapChainMTL.mm
${METAL_DIR}/SwapChainMTL.h
${METAL_DIR}/TextureMTL.mm
${METAL_DIR}/TextureMTL.h
${DAWN_NATIVE_INCLUDE_DIR}/MetalBackend.h
)
endif()
################################################################################
# D3D12 Backend
################################################################################
if (DAWN_ENABLE_D3D12)
# WIN10_SDK_PATH will be something like C:\Program Files (x86)\Windows Kits\10
get_filename_component(WIN10_SDK_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]" ABSOLUTE CACHE)
# TEMP_WIN10_SDK_VERSION will be something like ${CMAKE_CURRENT_SOURCE_DIR}\10.0.14393 or ${CMAKE_CURRENT_SOURCE_DIR}\10.0.14393.0
get_filename_component(TEMP_WIN10_SDK_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;ProductVersion]" ABSOLUTE CACHE)
# strip off ${CMAKE_CURRENT_SOURCE_DIR} to get just the version number
get_filename_component(WIN10_SDK_VERSION ${TEMP_WIN10_SDK_VERSION} NAME)
# WIN10_SDK_VERSION will be something like 10.0.14393 or 10.0.14393.0; we need the one that matches the directory name.
if (IS_DIRECTORY "${WIN10_SDK_PATH}/Include/${WIN10_SDK_VERSION}.0")
set(WIN10_SDK_VERSION "${WIN10_SDK_VERSION}.0")
endif()
# Find the d3d12 and dxgi include path, it will typically look something like this.
# C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\um\d3d12.h
# C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\shared\dxgi1_4.h
find_path(D3D12_INCLUDE_DIR # Set variable D3D12_INCLUDE_DIR
d3d12.h # Find a path with d3d12.h
HINTS "${WIN10_SDK_PATH}/Include/${WIN10_SDK_VERSION}/um"
DOC "path to WIN10 SDK header files"
HINTS
)
find_path(DXGI_INCLUDE_DIR # Set variable DXGI_INCLUDE_DIR
dxgi1_4.h # Find a path with dxgi1_4.h
HINTS "${WIN10_SDK_PATH}/Include/${WIN10_SDK_VERSION}/shared"
DOC "path to WIN10 SDK header files"
HINTS
)
if (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM" )
set(WIN10_SDK_LIB_PATH ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/arm)
elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM64" )
set(WIN10_SDK_LIB_PATH ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/arm64)
elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*Win64" )
set(WIN10_SDK_LIB_PATH ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/x64)
else()
set(WIN10_SDK_LIB_PATH ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/x86)
endif()
find_library(D3D12_LIBRARY NAMES d3d12.lib HINTS ${WIN10_SDK_LIB_PATH})
find_library(DXGI_LIBRARY NAMES dxgi.lib HINTS ${WIN10_SDK_LIB_PATH})
find_library(D3DCOMPILER_LIBRARY NAMES d3dcompiler.lib HINTS ${WIN10_SDK_LIB_PATH})
list(APPEND D3D12_LIBRARIES
${D3D12_LIBRARY}
${DXGI_LIBRARY}
${D3DCOMPILER_LIBRARY}
)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
find_library(DXGUID_LIBRARY NAMES dxguid.lib HINTS ${WIN10_SDK_LIB_PATH})
list(APPEND D3D12_LIBRARIES ${DXGUID_LIBRARY})
endif()
list(APPEND DAWN_NATIVE_DEPS ${D3D12_LIBRARIES})
list(APPEND DAWN_NATIVE_INCLUDE_DIRS ${D3D12_INCLUDE_DIR} ${DXGI_INCLUDE_DIR})
list(APPEND DAWN_NATIVE_SOURCES
${D3D12_DIR}/d3d12_platform.h
${D3D12_DIR}/BindGroupD3D12.cpp
${D3D12_DIR}/BindGroupD3D12.h
${D3D12_DIR}/BindGroupLayoutD3D12.cpp
${D3D12_DIR}/BindGroupLayoutD3D12.h
${D3D12_DIR}/BlendStateD3D12.cpp
${D3D12_DIR}/BlendStateD3D12.h
${D3D12_DIR}/BufferD3D12.cpp
${D3D12_DIR}/BufferD3D12.h
${D3D12_DIR}/CommandAllocatorManager.cpp
${D3D12_DIR}/CommandAllocatorManager.h
${D3D12_DIR}/CommandBufferD3D12.cpp
${D3D12_DIR}/CommandBufferD3D12.h
${D3D12_DIR}/ComputePipelineD3D12.cpp
${D3D12_DIR}/ComputePipelineD3D12.h
${D3D12_DIR}/DepthStencilStateD3D12.cpp
${D3D12_DIR}/DepthStencilStateD3D12.h
${D3D12_DIR}/DescriptorHeapAllocator.cpp
${D3D12_DIR}/DescriptorHeapAllocator.h
${D3D12_DIR}/DeviceD3D12.cpp
${D3D12_DIR}/DeviceD3D12.h
${D3D12_DIR}/Forward.h
${D3D12_DIR}/InputStateD3D12.cpp
${D3D12_DIR}/InputStateD3D12.h
${D3D12_DIR}/NativeSwapChainImplD3D12.cpp
${D3D12_DIR}/NativeSwapChainImplD3D12.h
${D3D12_DIR}/PipelineLayoutD3D12.cpp
${D3D12_DIR}/PipelineLayoutD3D12.h
${D3D12_DIR}/PlatformFunctions.cpp
${D3D12_DIR}/PlatformFunctions.h
${D3D12_DIR}/QueueD3D12.cpp
${D3D12_DIR}/QueueD3D12.h
${D3D12_DIR}/RenderPassDescriptorD3D12.cpp
${D3D12_DIR}/RenderPassDescriptorD3D12.h
${D3D12_DIR}/RenderPipelineD3D12.cpp
${D3D12_DIR}/RenderPipelineD3D12.h
${D3D12_DIR}/ResourceAllocator.cpp
${D3D12_DIR}/ResourceAllocator.h
${D3D12_DIR}/ResourceUploader.cpp
${D3D12_DIR}/ResourceUploader.h
${D3D12_DIR}/SamplerD3D12.cpp
${D3D12_DIR}/SamplerD3D12.h
${D3D12_DIR}/ShaderModuleD3D12.cpp
${D3D12_DIR}/ShaderModuleD3D12.h
${D3D12_DIR}/SwapChainD3D12.cpp
${D3D12_DIR}/SwapChainD3D12.h
${D3D12_DIR}/TextureCopySplitter.cpp
${D3D12_DIR}/TextureCopySplitter.h
${D3D12_DIR}/TextureD3D12.cpp
${D3D12_DIR}/TextureD3D12.h
${DAWN_NATIVE_INCLUDE_DIR}/D3D12Backend.h
)
endif()
################################################################################
# Vulkan Backend
################################################################################
if (DAWN_ENABLE_VULKAN)
list(APPEND DAWN_NATIVE_INCLUDE_DIRS ${VULKAN_HEADERS_INCLUDE_DIR})
list(APPEND DAWN_NATIVE_SOURCES
${VULKAN_DIR}/BindGroupVk.cpp
${VULKAN_DIR}/BindGroupVk.h
${VULKAN_DIR}/BindGroupLayoutVk.cpp
${VULKAN_DIR}/BindGroupLayoutVk.h
${VULKAN_DIR}/BlendStateVk.cpp
${VULKAN_DIR}/BlendStateVk.h
${VULKAN_DIR}/BufferUploader.cpp
${VULKAN_DIR}/BufferUploader.h
${VULKAN_DIR}/BufferVk.cpp
${VULKAN_DIR}/BufferVk.h
${VULKAN_DIR}/CommandBufferVk.cpp
${VULKAN_DIR}/CommandBufferVk.h
${VULKAN_DIR}/ComputePipelineVk.cpp
${VULKAN_DIR}/ComputePipelineVk.h
${VULKAN_DIR}/DeviceVk.cpp
${VULKAN_DIR}/DeviceVk.h
${VULKAN_DIR}/DepthStencilStateVk.cpp
${VULKAN_DIR}/DepthStencilStateVk.h
${VULKAN_DIR}/FencedDeleter.cpp
${VULKAN_DIR}/FencedDeleter.h
${VULKAN_DIR}/Forward.h
${VULKAN_DIR}/InputStateVk.cpp
${VULKAN_DIR}/InputStateVk.h
${VULKAN_DIR}/MemoryAllocator.cpp
${VULKAN_DIR}/MemoryAllocator.h
${VULKAN_DIR}/NativeSwapChainImplVk.cpp
${VULKAN_DIR}/NativeSwapChainImplVk.h
${VULKAN_DIR}/PipelineLayoutVk.cpp
${VULKAN_DIR}/PipelineLayoutVk.h
${VULKAN_DIR}/QueueVk.cpp
${VULKAN_DIR}/QueueVk.h
${VULKAN_DIR}/RenderPassCache.cpp
${VULKAN_DIR}/RenderPassCache.h
${VULKAN_DIR}/RenderPassDescriptorVk.cpp
${VULKAN_DIR}/RenderPassDescriptorVk.h
${VULKAN_DIR}/RenderPipelineVk.cpp
${VULKAN_DIR}/RenderPipelineVk.h
${VULKAN_DIR}/SamplerVk.cpp
${VULKAN_DIR}/SamplerVk.h
${VULKAN_DIR}/ShaderModuleVk.cpp
${VULKAN_DIR}/ShaderModuleVk.h
${VULKAN_DIR}/SwapChainVk.cpp
${VULKAN_DIR}/SwapChainVk.h
${VULKAN_DIR}/TextureVk.cpp
${VULKAN_DIR}/TextureVk.h
${VULKAN_DIR}/VulkanFunctions.cpp
${VULKAN_DIR}/VulkanFunctions.h
${VULKAN_DIR}/VulkanInfo.cpp
${VULKAN_DIR}/VulkanInfo.h
${DAWN_NATIVE_INCLUDE_DIR}/VulkanBackend.h
)
endif()
################################################################################
# Common sources and definition of the library
################################################################################
list(APPEND DAWN_NATIVE_SOURCES
${DAWN_NATIVE_DIR}/dawn_platform.h
${DAWN_NATIVE_DIR}/BindGroup.cpp
${DAWN_NATIVE_DIR}/BindGroup.h
${DAWN_NATIVE_DIR}/BindGroupLayout.cpp
${DAWN_NATIVE_DIR}/BindGroupLayout.h
${DAWN_NATIVE_DIR}/BlendState.cpp
${DAWN_NATIVE_DIR}/BlendState.h
${DAWN_NATIVE_DIR}/Builder.cpp
${DAWN_NATIVE_DIR}/Builder.h
${DAWN_NATIVE_DIR}/Buffer.cpp
${DAWN_NATIVE_DIR}/Buffer.h
${DAWN_NATIVE_DIR}/Commands.cpp
${DAWN_NATIVE_DIR}/Commands.h
${DAWN_NATIVE_DIR}/CommandAllocator.cpp
${DAWN_NATIVE_DIR}/CommandAllocator.h
${DAWN_NATIVE_DIR}/CommandBuffer.cpp
${DAWN_NATIVE_DIR}/CommandBuffer.h
${DAWN_NATIVE_DIR}/ComputePassEncoder.cpp
${DAWN_NATIVE_DIR}/ComputePassEncoder.h
${DAWN_NATIVE_DIR}/ComputePipeline.cpp
${DAWN_NATIVE_DIR}/ComputePipeline.h
${DAWN_NATIVE_DIR}/CommandBufferStateTracker.cpp
${DAWN_NATIVE_DIR}/CommandBufferStateTracker.h
${DAWN_NATIVE_DIR}/DawnNative.cpp
${DAWN_NATIVE_DIR}/DepthStencilState.cpp
${DAWN_NATIVE_DIR}/DepthStencilState.h
${DAWN_NATIVE_DIR}/Device.cpp
${DAWN_NATIVE_DIR}/Device.h
${DAWN_NATIVE_DIR}/Error.cpp
${DAWN_NATIVE_DIR}/Error.h
${DAWN_NATIVE_DIR}/ErrorData.cpp
${DAWN_NATIVE_DIR}/ErrorData.h
${DAWN_NATIVE_DIR}/Forward.h
${DAWN_NATIVE_DIR}/InputState.cpp
${DAWN_NATIVE_DIR}/InputState.h
${DAWN_NATIVE_DIR}/ObjectBase.cpp
${DAWN_NATIVE_DIR}/ObjectBase.h
${DAWN_NATIVE_DIR}/PassResourceUsage.h
${DAWN_NATIVE_DIR}/PerStage.cpp
${DAWN_NATIVE_DIR}/PerStage.h
${DAWN_NATIVE_DIR}/Pipeline.cpp
${DAWN_NATIVE_DIR}/Pipeline.h
${DAWN_NATIVE_DIR}/PipelineLayout.cpp
${DAWN_NATIVE_DIR}/PipelineLayout.h
${DAWN_NATIVE_DIR}/ProgrammablePassEncoder.cpp
${DAWN_NATIVE_DIR}/ProgrammablePassEncoder.h
${DAWN_NATIVE_DIR}/Queue.cpp
${DAWN_NATIVE_DIR}/Queue.h
${DAWN_NATIVE_DIR}/RefCounted.cpp
${DAWN_NATIVE_DIR}/RefCounted.h
${DAWN_NATIVE_DIR}/RenderPassDescriptor.cpp
${DAWN_NATIVE_DIR}/RenderPassDescriptor.h
${DAWN_NATIVE_DIR}/RenderPassEncoder.cpp
${DAWN_NATIVE_DIR}/RenderPassEncoder.h
${DAWN_NATIVE_DIR}/RenderPipeline.cpp
${DAWN_NATIVE_DIR}/RenderPipeline.h
${DAWN_NATIVE_DIR}/Sampler.cpp
${DAWN_NATIVE_DIR}/Sampler.h
${DAWN_NATIVE_DIR}/ShaderModule.cpp
${DAWN_NATIVE_DIR}/ShaderModule.h
${DAWN_NATIVE_DIR}/SwapChain.cpp
${DAWN_NATIVE_DIR}/SwapChain.h
${DAWN_NATIVE_DIR}/Texture.cpp
${DAWN_NATIVE_DIR}/Texture.h
${DAWN_NATIVE_DIR}/ToBackend.h
${DAWN_NATIVE_INCLUDE_DIR}/dawn_native_export.h
${DAWN_NATIVE_INCLUDE_DIR}/DawnNative.h
)
# We want to produce both a static and a shared libdawn_native library. The static one is for
# unittests that need access to all the symbols of the library. The shared one is for the other
# users that access libdawn_native through the regular interface.
# We use a CMake "OBJECT" library type which allows precompiling the source files and reusing
# them for both the static and the shared library. Recent CMake versions make it so if you
# depend on an OBJECT library you get its dependencies and source files, which is very similar to
# GN's source_set. However the versions of CMake on our test bots is too old and doesn't support
# this, so instead we duplicate the deps everywhere.
add_library(libdawn_native_objects OBJECT ${DAWN_NATIVE_SOURCES})
DawnInternalTarget("dawn_native" libdawn_native_objects)
target_compile_definitions(libdawn_native_objects PRIVATE DAWN_NATIVE_IMPLEMENTATION SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS)
target_include_directories(libdawn_native_objects PRIVATE ${DAWN_NATIVE_INCLUDE_DIRS})
add_dependencies(libdawn_native_objects dawn_native_utils_autogen)
add_library(libdawn_native SHARED $<TARGET_OBJECTS:libdawn_native_objects>)
DawnInternalTarget("dawn_native" libdawn_native)
target_link_libraries(libdawn_native PRIVATE ${DAWN_NATIVE_DEPS})
set_property(TARGET libdawn_native PROPERTY OUTPUT_NAME "dawn_native")
add_library(libdawn_native_static STATIC $<TARGET_OBJECTS:libdawn_native_objects>)
DawnInternalTarget("dawn_native" libdawn_native_static)
target_link_libraries(libdawn_native_static ${DAWN_NATIVE_DEPS})

View File

@ -1,37 +0,0 @@
# Copyright 2017 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.
set(DAWN_WIRE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(DAWN_WIRE_INCLUDE_DIR ${INCLUDE_DIR}/dawn_wire)
Generate(
LIB_NAME dawn_wire_autogen
LIB_TYPE OBJECT
FOLDER "wire"
PRINT_NAME "dawn_wire autogenerated files"
COMMAND_LINE_ARGS
${GENERATOR_COMMON_ARGS}
-T dawn_wire
)
target_compile_definitions(dawn_wire_autogen PRIVATE DAWN_WIRE_IMPLEMENTATION)
add_library(dawn_wire SHARED
$<TARGET_OBJECTS:dawn_wire_autogen>
${DAWN_WIRE_DIR}/WireCmd.h
${DAWN_WIRE_INCLUDE_DIR}/Wire.h
${DAWN_WIRE_INCLUDE_DIR}/dawn_wire_export.h
)
target_link_libraries(dawn_wire PRIVATE dawn_common)
target_compile_definitions(dawn_wire PRIVATE DAWN_WIRE_IMPLEMENTATION)
DawnInternalTarget("wire" dawn_wire)

View File

@ -1,94 +0,0 @@
# Copyright 2017 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.
Generate(
LIB_NAME mock_dawn
LIB_TYPE STATIC
FOLDER "tests"
PRINT_NAME libMockDawn
COMMAND_LINE_ARGS
${GENERATOR_COMMON_ARGS}
-T mock_dawn
)
target_link_libraries(mock_dawn gtest)
set(TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(UNITTESTS_DIR ${TESTS_DIR}/unittests)
set(VALIDATION_TESTS_DIR ${UNITTESTS_DIR}/validation)
set(END2END_TESTS_DIR ${TESTS_DIR}/end2end)
list(APPEND UNITTEST_SOURCES
${UNITTESTS_DIR}/BitSetIteratorTests.cpp
${UNITTESTS_DIR}/CommandAllocatorTests.cpp
${UNITTESTS_DIR}/EnumClassBitmasksTests.cpp
${UNITTESTS_DIR}/ErrorTests.cpp
${UNITTESTS_DIR}/MathTests.cpp
${UNITTESTS_DIR}/ObjectBaseTests.cpp
${UNITTESTS_DIR}/PerStageTests.cpp
${UNITTESTS_DIR}/RefCountedTests.cpp
${UNITTESTS_DIR}/ResultTests.cpp
${UNITTESTS_DIR}/SerialQueueTests.cpp
${UNITTESTS_DIR}/ToBackendTests.cpp
${UNITTESTS_DIR}/WireTests.cpp
${VALIDATION_TESTS_DIR}/BindGroupValidationTests.cpp
${VALIDATION_TESTS_DIR}/BlendStateValidationTests.cpp
${VALIDATION_TESTS_DIR}/BufferValidationTests.cpp
${VALIDATION_TESTS_DIR}/CommandBufferValidationTests.cpp
${VALIDATION_TESTS_DIR}/ComputeValidationTests.cpp
${VALIDATION_TESTS_DIR}/CopyCommandsValidationTests.cpp
${VALIDATION_TESTS_DIR}/DepthStencilStateValidationTests.cpp
${VALIDATION_TESTS_DIR}/DynamicStateCommandValidationTests.cpp
${VALIDATION_TESTS_DIR}/InputStateValidationTests.cpp
${VALIDATION_TESTS_DIR}/PushConstantsValidationTests.cpp
${VALIDATION_TESTS_DIR}/RenderPassDescriptorValidationTests.cpp
${VALIDATION_TESTS_DIR}/RenderPipelineValidationTests.cpp
${VALIDATION_TESTS_DIR}/ShaderModuleValidationTests.cpp
${VALIDATION_TESTS_DIR}/VertexBufferValidationTests.cpp
${VALIDATION_TESTS_DIR}/ValidationTest.cpp
${VALIDATION_TESTS_DIR}/ValidationTest.h
${TESTS_DIR}/UnittestsMain.cpp
)
if (DAWN_ENABLE_D3D12)
list(APPEND UNITTEST_SOURCES
${UNITTESTS_DIR}/d3d12/CopySplitTests.cpp
)
endif()
add_executable(dawn_unittests ${UNITTEST_SOURCES})
target_link_libraries(dawn_unittests dawn_common gtest libdawn_native_static mock_dawn dawn_wire utils)
DawnInternalTarget("tests" dawn_unittests)
add_executable(dawn_end2end_tests
${END2END_TESTS_DIR}/BasicTests.cpp
${END2END_TESTS_DIR}/BufferTests.cpp
${END2END_TESTS_DIR}/BlendStateTests.cpp
${END2END_TESTS_DIR}/ComputeCopyStorageBufferTests.cpp
${END2END_TESTS_DIR}/CopyTests.cpp
${END2END_TESTS_DIR}/DrawElementsTests.cpp
${END2END_TESTS_DIR}/DepthStencilStateTests.cpp
${END2END_TESTS_DIR}/IndexFormatTests.cpp
${END2END_TESTS_DIR}/InputStateTests.cpp
${END2END_TESTS_DIR}/PrimitiveTopologyTests.cpp
${END2END_TESTS_DIR}/PushConstantTests.cpp
${END2END_TESTS_DIR}/RenderPassLoadOpTests.cpp
${END2END_TESTS_DIR}/ScissorTests.cpp
${END2END_TESTS_DIR}/SamplerTests.cpp
${END2END_TESTS_DIR}/ViewportOrientationTests.cpp
${TESTS_DIR}/End2EndTestsMain.cpp
${TESTS_DIR}/DawnTest.cpp
${TESTS_DIR}/DawnTest.h
)
target_link_libraries(dawn_end2end_tests dawn_common dawn_wire gtest utils)
DawnInternalTarget("tests" dawn_end2end_tests)

View File

@ -1,85 +0,0 @@
# Copyright 2017 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.
set(UTILS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
list(APPEND UTILS_SOURCES
${UTILS_DIR}/BackendBinding.cpp
${UTILS_DIR}/BackendBinding.h
${UTILS_DIR}/DawnHelpers.cpp
${UTILS_DIR}/DawnHelpers.h
${UTILS_DIR}/SystemUtils.cpp
${UTILS_DIR}/SystemUtils.h
${UTILS_DIR}/TerribleCommandBuffer.cpp
${UTILS_DIR}/TerribleCommandBuffer.h
)
list(APPEND UTILS_DEPS
dawn_common
libdawn_native
shaderc_shared
libdawn
glfw
)
set(UTILS_INCLUDE_DIRS)
if (DAWN_ENABLE_D3D12)
list(APPEND UTILS_SOURCES
${UTILS_DIR}/D3D12Binding.cpp
)
endif()
if (DAWN_ENABLE_METAL)
list(APPEND UTILS_SOURCES
${UTILS_DIR}/MetalBinding.mm
)
list(APPEND UTILS_DEPS
"-framework Metal"
"-framework QuartzCore"
)
endif()
if (DAWN_ENABLE_NULL)
list(APPEND UTILS_SOURCES
${UTILS_DIR}/NullBinding.cpp
)
endif()
if (DAWN_ENABLE_OPENGL)
list(APPEND UTILS_SOURCES
${UTILS_DIR}/OpenGLBinding.cpp
)
list(APPEND UTILS_DEPS
glad
)
endif()
if (DAWN_ENABLE_VULKAN)
list(APPEND UTILS_SOURCES
${UTILS_DIR}/VulkanBinding.cpp
)
list(APPEND UTILS_INCLUDE_DIRS
${VULKAN_HEADERS_INCLUDE_DIR}
)
endif()
add_library(utils STATIC ${UTILS_SOURCES})
target_link_libraries(utils ${UTILS_DEPS})
target_include_directories(utils PRIVATE ${UTILS_INCLUDE_DIRS})
DawnInternalTarget("" utils)
if(NOT MSVC)
# allow C-style casts -- for shaderc
set_property(TARGET utils APPEND PROPERTY COMPILE_OPTIONS "-Wno-old-style-cast")
endif()

1
third_party/glfw vendored

@ -1 +0,0 @@
Subproject commit 096efdf798896cff80a0b2db08d7398b703406fe

1
third_party/glm vendored

@ -1 +0,0 @@
Subproject commit 06f084063fd6d9aa2ef6904517650700ae47b63d

1
third_party/glslang vendored

@ -1 +0,0 @@
Subproject commit a08f465d5398518e9a6aeebd4775604a4c10e381

@ -1 +0,0 @@
Subproject commit 98a0d007d7092b72eea0e501bb9ad17908a1a036

1
third_party/shaderc vendored

@ -1 +0,0 @@
Subproject commit 909f0d3d31e7e7c8f39b40ba0e1dd7f99b749776

@ -1 +0,0 @@
Subproject commit a7697446b12666da353bb2bdafa792d988fb268c

@ -1 +0,0 @@
Subproject commit d5b2e1255f706ce1f88812217e9a554f299848af

@ -1 +0,0 @@
Subproject commit 1225324ae2450623e62621b91b380644f84c16d1

1
third_party/stb vendored

@ -1 +0,0 @@
Subproject commit c7110588a4d24c4bb5155c184fbb77dd90b3116e