Dawn: use CMake 3.13 as minimum version, remove placeholder file
Original change by Erin Melucci
Bug: None
Change-Id: I0e75df592fdb535197ab6ff00d111a453330853b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/159366
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index efac34c..d6a3008 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,22 +25,20 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-cmake_minimum_required(VERSION 3.10.2)
+# As per https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md
+cmake_minimum_required(VERSION 3.13)
-# - When upgrading to CMake 3.11 we can remove DAWN_PLACEHOLDER_FILE because source-less
-# add_library becomes available.
-# - When upgrading to CMake 3.12 we should add CONFIGURE_DEPENDS to DawnGenerator to rerun CMake
+# - Since we are past CMake 3.12 we can add CONFIGURE_DEPENDS to DawnGenerator to rerun CMake
# in case any of the generator files changes. We should also remove the CACHE "" FORCE stuff to
-# override options in third_party dependencies. We can also add the HOMEPAGE_URL entry to the
-# project `HOMEPAGE_URL "https://dawn.googlesource.com/dawn"`
+# override options in third_party dependencies.
# - When upgrading to CMake 3.20 we can take advantage of the GENERATED property being global in
# DawnGenerator. We should also use the path utilities in install_if_enabled.
-
project(
Dawn
DESCRIPTION "Dawn, a WebGPU implementation"
LANGUAGES C CXX
+ HOMEPAGE_URL "https://dawn.googlesource.com/dawn"
)
enable_testing()
@@ -63,8 +61,6 @@
set(DAWN_INCLUDE_DIR "${Dawn_SOURCE_DIR}/include")
set(DAWN_TEMPLATE_DIR "${DAWN_GENERATOR_DIR}/templates")
-set(DAWN_PLACEHOLDER_FILE "${DAWN_SRC_DIR}/Placeholder.cpp")
-
################################################################################
# Configuration options
################################################################################
diff --git a/src/Placeholder.cpp b/src/Placeholder.cpp
deleted file mode 100644
index 645bfc0..0000000
--- a/src/Placeholder.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2020 The Dawn & Tint Authors
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following disclaimer in the documentation
-// and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// CMake requires that targets contain at least on file. This file is used when we want to create
-// empty targets.
-
-int someSymbolToMakeXCodeHappy = 0;
diff --git a/src/dawn/CMakeLists.txt b/src/dawn/CMakeLists.txt
index fc4037b..4d8ec04 100644
--- a/src/dawn/CMakeLists.txt
+++ b/src/dawn/CMakeLists.txt
@@ -104,6 +104,7 @@
)
target_link_libraries(dawncpp_headers INTERFACE dawn_headers)
install_if_enabled(dawncpp_headers)
+
###############################################################################
# Dawn C++ wrapper
###############################################################################
@@ -114,15 +115,14 @@
RESULT_VARIABLE "DAWNCPP_GEN_SOURCES"
)
-add_library(dawncpp STATIC ${DAWN_PLACEHOLDER_FILE})
+add_library(dawncpp)
common_compile_options(dawncpp)
target_sources(dawncpp PRIVATE ${DAWNCPP_GEN_SOURCES})
target_link_libraries(dawncpp PUBLIC dawncpp_headers)
+install_if_enabled(dawncpp)
add_library(webgpu_cpp ALIAS dawncpp)
-install_if_enabled(dawncpp)
-
###############################################################################
# libdawn_proc
###############################################################################
@@ -133,7 +133,7 @@
RESULT_VARIABLE "DAWNPROC_GEN_SOURCES"
)
-add_library(dawn_proc ${DAWN_PLACEHOLDER_FILE})
+add_library(dawn_proc)
common_compile_options(dawn_proc)
target_compile_definitions(dawn_proc PRIVATE "WGPU_IMPLEMENTATION")
if(BUILD_SHARED_LIBS)
diff --git a/src/dawn/common/CMakeLists.txt b/src/dawn/common/CMakeLists.txt
index b630f6b..477ed12 100644
--- a/src/dawn/common/CMakeLists.txt
+++ b/src/dawn/common/CMakeLists.txt
@@ -41,7 +41,7 @@
RESULT_VARIABLE "DAWN_GPU_INFO_AUTOGEN_SOURCES"
)
-add_library(dawn_common STATIC ${DAWN_PLACEHOLDER_FILE})
+add_library(dawn_common STATIC)
common_compile_options(dawn_common)
target_sources(dawn_common PRIVATE
${DAWN_VERSION_AUTOGEN_SOURCES}
diff --git a/src/dawn/glfw/CMakeLists.txt b/src/dawn/glfw/CMakeLists.txt
index ff2c890..1cefdb2 100644
--- a/src/dawn/glfw/CMakeLists.txt
+++ b/src/dawn/glfw/CMakeLists.txt
@@ -27,7 +27,7 @@
if(DAWN_USE_GLFW)
-add_library(dawn_glfw STATIC ${DAWN_PLACEHOLDER_FILE})
+add_library(dawn_glfw STATIC)
common_compile_options(dawn_glfw)
target_sources(dawn_glfw
INTERFACE
diff --git a/src/dawn/native/CMakeLists.txt b/src/dawn/native/CMakeLists.txt
index 0628689..57b6d75 100644
--- a/src/dawn/native/CMakeLists.txt
+++ b/src/dawn/native/CMakeLists.txt
@@ -31,7 +31,7 @@
RESULT_VARIABLE "DAWN_NATIVE_UTILS_GEN_SOURCES"
)
-add_library(dawn_native ${DAWN_PLACEHOLDER_FILE})
+add_library(dawn_native)
common_compile_options(dawn_native)
target_compile_definitions(dawn_native PRIVATE "DAWN_NATIVE_IMPLEMENTATION")
@@ -764,7 +764,7 @@
RESULT_VARIABLE "WEBGPU_DAWN_NATIVE_PROC_GEN"
)
-add_library(webgpu_dawn ${DAWN_PLACEHOLDER_FILE})
+add_library(webgpu_dawn)
common_compile_options(webgpu_dawn)
target_link_libraries(webgpu_dawn PRIVATE dawn_native)
target_link_libraries(webgpu_dawn PUBLIC dawn_headers)
diff --git a/src/dawn/platform/CMakeLists.txt b/src/dawn/platform/CMakeLists.txt
index 5fd12f2..fe01130 100644
--- a/src/dawn/platform/CMakeLists.txt
+++ b/src/dawn/platform/CMakeLists.txt
@@ -25,7 +25,7 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-add_library(dawn_platform ${DAWN_PLACEHOLDER_FILE})
+add_library(dawn_platform)
common_compile_options(dawn_platform)
target_compile_definitions(dawn_platform PRIVATE "DAWN_PLATFORM_IMPLEMENTATION")
diff --git a/src/dawn/samples/CMakeLists.txt b/src/dawn/samples/CMakeLists.txt
index 1a043f7..2c30df0 100644
--- a/src/dawn/samples/CMakeLists.txt
+++ b/src/dawn/samples/CMakeLists.txt
@@ -25,7 +25,7 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-add_library(dawn_sample_utils STATIC ${DAWN_PLACEHOLDER_FILE})
+add_library(dawn_sample_utils STATIC)
common_compile_options(dawn_sample_utils)
target_sources(dawn_sample_utils PRIVATE
"SampleUtils.cpp"
diff --git a/src/dawn/utils/CMakeLists.txt b/src/dawn/utils/CMakeLists.txt
index 0b54134..891f1de 100644
--- a/src/dawn/utils/CMakeLists.txt
+++ b/src/dawn/utils/CMakeLists.txt
@@ -25,7 +25,7 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-add_library(dawn_utils STATIC ${DAWN_PLACEHOLDER_FILE})
+add_library(dawn_utils STATIC)
common_compile_options(dawn_utils)
target_sources(dawn_utils PRIVATE
"BinarySemaphore.cpp"
diff --git a/src/dawn/wire/CMakeLists.txt b/src/dawn/wire/CMakeLists.txt
index 2811e0c..123a8e9 100644
--- a/src/dawn/wire/CMakeLists.txt
+++ b/src/dawn/wire/CMakeLists.txt
@@ -31,7 +31,7 @@
RESULT_VARIABLE "DAWN_WIRE_GEN_SOURCES"
)
-add_library(dawn_wire ${DAWN_PLACEHOLDER_FILE})
+add_library(dawn_wire)
common_compile_options(dawn_wire)
target_compile_definitions(dawn_wire PRIVATE "DAWN_WIRE_IMPLEMENTATION")