Fix the CMake build because of CMP0077

Prior to CMake 3.12 option() is a cache variable operation which meant
that the overriding of third_party project variables in
third_party/CMakeLists.txt needs to write to the cache.

Also remove a couple extra commas that were causing warnings.

Bug: None
Change-Id: I35efce70cf3e0cb923ebdbad654b2b9883b8f734
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19280
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2020-04-10 17:04:31 +00:00 committed by Commit Bot service account
parent d11cc3961a
commit 42450c6d1c
3 changed files with 24 additions and 23 deletions

View File

@ -17,7 +17,8 @@ cmake_minimum_required(VERSION 3.10)
# When upgrading to CMake 3.11 we can remove DAWN_DUMMY_FILE because source-less add_library
# becomes available.
# When upgrading to CMake 3.12 we should add CONFIGURE_DEPENDS to DawnGenerator to rerun CMake in
# case any of the generator files changes.
# case any of the generator files changes. We should also remove the CACHE "" FORCE stuff to
# override options in third_party dependencies.
project(
Dawn

View File

@ -178,8 +178,8 @@ if (DAWN_ENABLE_D3D12)
"d3d12/D3D12Error.h"
"d3d12/D3D12Info.cpp"
"d3d12/D3D12Info.h"
"d3d12/DescriptorHeapAllocationD3D12.cpp",
"d3d12/DescriptorHeapAllocationD3D12.h",
"d3d12/DescriptorHeapAllocationD3D12.cpp"
"d3d12/DescriptorHeapAllocationD3D12.h"
"d3d12/DescriptorHeapAllocator.cpp"
"d3d12/DescriptorHeapAllocator.h"
"d3d12/DeviceD3D12.cpp"
@ -213,8 +213,8 @@ if (DAWN_ENABLE_D3D12)
"d3d12/SamplerD3D12.h"
"d3d12/ShaderModuleD3D12.cpp"
"d3d12/ShaderModuleD3D12.h"
"d3d12/ShaderVisibleDescriptorAllocatorD3D12.cpp",
"d3d12/ShaderVisibleDescriptorAllocatorD3D12.h",
"d3d12/ShaderVisibleDescriptorAllocatorD3D12.cpp"
"d3d12/ShaderVisibleDescriptorAllocatorD3D12.h"
"d3d12/StagingBufferD3D12.cpp"
"d3d12/StagingBufferD3D12.h"
"d3d12/SwapChainD3D12.cpp"

View File

@ -13,27 +13,27 @@
# limitations under the License.
if (NOT TARGET SPIRV-Headers)
set(SPIRV_HEADERS_SKIP_EXAMPLES ON)
set(SPIRV_HEADERS_SKIP_INSTALL ON)
set(SPIRV_HEADERS_SKIP_EXAMPLES ON CACHE BOOL "" FORCE)
set(SPIRV_HEADERS_SKIP_INSTALL ON CACHE BOOL "" FORCE)
message(STATUS "Dawn: using SPIRV-Headers at ${DAWN_SPIRV_HEADERS_DIR}")
add_subdirectory(${DAWN_SPIRV_HEADERS_DIR})
endif()
if (NOT TARGET SPIRV-Tools)
set(SPIRV_SKIP_TESTS ON)
set(SPIRV_SKIP_EXECUTABLES ON)
set(SKIP_SPIRV_TOOLS_INSTALL ON)
set(SPIRV_SKIP_TESTS ON CACHE BOOL "" FORCE)
set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "" FORCE)
set(SKIP_SPIRV_TOOLS_INSTALL ON CACHE BOOL "" FORCE)
message(STATUS "Dawn: using SPIRV-Tools at ${DAWN_SPIRV_TOOLS_DIR}")
add_subdirectory(${DAWN_SPIRV_TOOLS_DIR})
endif()
if (NOT TARGET glslang)
set(SKIP_GLSLANG_INSTALL ON)
set(ENABLE_SPVREMAPPER OFF)
set(ENABLE_GLSLANG_BINARIES OFF)
set(ENABLE_CTEST OFF)
set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "" FORCE)
set(ENABLE_SPVREMAPPER OFF CACHE BOOL "" FORCE)
set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "" FORCE)
set(ENABLE_CTEST OFF CACHE BOOL "" FORCE)
message(STATUS "Dawn: using GLSLang at ${DAWN_GLSLANG_DIR}")
add_subdirectory(${DAWN_GLSLANG_DIR})
@ -44,19 +44,19 @@ if (TARGET shaderc)
message(FATAL_ERROR "Dawn: If shaderc is configured before Dawn, it must include SPVC")
endif()
else()
set(SHADERC_SKIP_TESTS ON)
set(SHADERC_SKIP_INSTALL ON)
set(SHADERC_ENABLE_SPVC ON)
set(SHADERC_SKIP_TESTS ON CACHE BOOL "" FORCE)
set(SHADERC_SKIP_INSTALL ON CACHE BOOL "" FORCE)
set(SHADERC_ENABLE_SPVC ON CACHE BOOL "" FORCE)
# Change the default value of SHADERC_ENABLE_SHARED_CRT to ON as that's what matches the
# CMake defaults better.
if(MSVC)
option(SHADERC_ENABLE_SHARED_CRT "Use the shared CRT instead of the static CRT" ON)
option(SHADERC_ENABLE_SHARED_CRT "Use the shared CRT instead of the static CRT" ON CACHE BOOL "" FORCE)
endif()
# Let SPVC's CMakeLists.txt deal with configuring SPIRV-Cross
set(SPIRV_CROSS_ENABLE_TESTS OFF)
set(SHADERC_SPIRV_CROSS_DIR "${DAWN_SPIRV_CROSS_DIR}")
set(SPIRV_CROSS_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
set(SHADERC_SPIRV_CROSS_DIR "${DAWN_SPIRV_CROSS_DIR}" CACHE BOOL "" FORCE)
message(STATUS "Dawn: using shaderc[_spvc] at ${DAWN_SHADERC_DIR}")
message(STATUS "Dawn: - with SPIRV-Cross at ${DAWN_SPIRV_CROSS_DIR}")
@ -65,9 +65,9 @@ endif()
if (DAWN_BUILD_EXAMPLES)
if (NOT TARGET glfw)
set(GLFW_BUILD_DOCS OFF)
set(GLFW_BUILD_TESTS OFF)
set(GLFW_BUILD_EXAMPLES OFF)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
message(STATUS "Dawn: using GLFW at ${DAWN_GLFW_DIR}")
add_subdirectory(${DAWN_GLFW_DIR})