CMake: tweak third-party imports.
- Match indentation in the whole third_party/CMakeLists.txt file - Import glslang after SPIRV-Tools to avoid a warning that HLSL code might be invalid. - Disable installs for glslang. - Fix casing of one "using Foo" Change-Id: Ia7b32501cb84e0fe2df9cde0762cee774ef65581 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90245 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
58c9dad06b
commit
f9f1c4b526
|
@ -26,7 +26,7 @@ if (NOT DAWN_JINJA2_DIR)
|
|||
message(FATAL_ERROR "Dawn: Missing dependencies for code generation, please ensure you have python-jinja2 installed.")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Dawn: Using jinja2 at ${DAWN_JINJA2_DIR}")
|
||||
message(STATUS "Dawn: using jinja2 at ${DAWN_JINJA2_DIR}")
|
||||
endif()
|
||||
|
||||
# Function to invoke a generator_lib.py generator.
|
||||
|
|
|
@ -23,24 +23,12 @@ if (NOT TARGET SPIRV-Headers)
|
|||
add_subdirectory(${DAWN_SPIRV_HEADERS_DIR} "${CMAKE_CURRENT_BINARY_DIR}/spirv-headers")
|
||||
endif()
|
||||
|
||||
if(${TINT_BUILD_GLSL_WRITER})
|
||||
if(${TINT_BUILD_SAMPLES})
|
||||
add_subdirectory("${DAWN_THIRD_PARTY_DIR}/vulkan-deps/glslang/src" "${CMAKE_CURRENT_BINARY_DIR}/glslang" EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Needs to come before SPIR-V Tools
|
||||
if ((${TINT_BUILD_SPIRV_TOOLS_FUZZER} OR ${TINT_BUILD_AST_FUZZER}) AND
|
||||
(NOT TARGET protobuf::libprotobuf OR NOT TARGET protobuf::protoc))
|
||||
set(protobuf_BUILD_TESTS OFF CACHE BOOL "Controls whether protobuf tests are built" FORCE)
|
||||
set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Controls whether a protobuf static runtime is built" FORCE)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/protobuf/cmake)
|
||||
endif()
|
||||
|
||||
if(${TINT_BUILD_SPV_READER} OR ${TINT_BUILD_SPV_WRITER})
|
||||
if (NOT IS_DIRECTORY "${SPIRV-Headers_SOURCE_DIR}")
|
||||
set(SPIRV-Headers_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/spirv-headers CACHE STRING "Source directory for SPIR-V headers")
|
||||
endif()
|
||||
(NOT TARGET protobuf::libprotobuf OR NOT TARGET protobuf::protoc))
|
||||
set(protobuf_BUILD_TESTS OFF CACHE BOOL "Controls whether protobuf tests are built" FORCE)
|
||||
set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Controls whether a protobuf static runtime is built" FORCE)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/protobuf/cmake)
|
||||
endif()
|
||||
|
||||
if (NOT TARGET SPIRV-Tools)
|
||||
|
@ -49,17 +37,22 @@ if (NOT TARGET SPIRV-Tools)
|
|||
set(SKIP_SPIRV_TOOLS_INSTALL ON CACHE BOOL "" FORCE)
|
||||
|
||||
if(${TINT_BUILD_SPV_READER} OR ${TINT_BUILD_SPV_WRITER})
|
||||
set(SPIRV_SKIP_TESTS ON CACHE BOOL "Controls whether SPIR-V tests are run" FORCE)
|
||||
set(SPIRV_WERROR OFF CACHE BOOL OFF FORCE)
|
||||
if (${TINT_BUILD_SPIRV_TOOLS_FUZZER})
|
||||
set(SPIRV_BUILD_FUZZER ON CACHE BOOL "Controls whether spirv-fuzz is built" FORCE)
|
||||
endif()
|
||||
set(SPIRV_SKIP_TESTS ON CACHE BOOL "Controls whether SPIR-V tests are run" FORCE)
|
||||
set(SPIRV_WERROR OFF CACHE BOOL OFF FORCE)
|
||||
if (${TINT_BUILD_SPIRV_TOOLS_FUZZER})
|
||||
set(SPIRV_BUILD_FUZZER ON CACHE BOOL "Controls whether spirv-fuzz is built" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "Dawn: using SPIRV-Tools at ${DAWN_SPIRV_TOOLS_DIR}")
|
||||
add_subdirectory(${DAWN_SPIRV_TOOLS_DIR} "${CMAKE_CURRENT_BINARY_DIR}/spirv-tools" EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET glslang AND ${TINT_BUILD_GLSL_WRITER} AND ${TINT_BUILD_SAMPLES})
|
||||
set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "" FORCE)
|
||||
add_subdirectory("${DAWN_THIRD_PARTY_DIR}/vulkan-deps/glslang/src" "${CMAKE_CURRENT_BINARY_DIR}/glslang" EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
if (NOT TARGET glfw)
|
||||
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
|
||||
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
|
@ -96,7 +89,7 @@ target_sources(dawn_vulkan_headers INTERFACE
|
|||
)
|
||||
target_include_directories(dawn_vulkan_headers INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/khronos")
|
||||
|
||||
if (${DAWN_ENABLE_SWIFTSHADER} AND NOT TARGET vk_swiftshader)
|
||||
if (NOT TARGET vk_swiftshader AND ${DAWN_ENABLE_SWIFTSHADER})
|
||||
set(SWIFTSHADER_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(SWIFTSHADER_BUILD_BENCHMARKS OFF CACHE BOOL "" FORCE)
|
||||
|
||||
|
@ -105,11 +98,11 @@ if (${DAWN_ENABLE_SWIFTSHADER} AND NOT TARGET vk_swiftshader)
|
|||
endif()
|
||||
|
||||
if (${TINT_BUILD_BENCHMARKS})
|
||||
set(BENCHMARK_ENABLE_TESTING FALSE CACHE BOOL FALSE FORCE)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/benchmark EXCLUDE_FROM_ALL)
|
||||
set(BENCHMARK_ENABLE_TESTING FALSE CACHE BOOL FALSE FORCE)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/benchmark EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
if (${TINT_BUILD_TESTS} AND NOT TARGET gmock)
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "Controls whether a shared run-time library should be used even when Google Test is built as static library" FORCE)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/googletest EXCLUDE_FROM_ALL)
|
||||
if (NOT TARGET gmock AND ${TINT_BUILD_TESTS})
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "Controls whether a shared run-time library should be used even when Google Test is built as static library" FORCE)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/googletest EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue