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:
Corentin Wallez 2022-05-16 09:11:21 +00:00 committed by Dawn LUCI CQ
parent 58c9dad06b
commit f9f1c4b526
2 changed files with 21 additions and 28 deletions

View File

@ -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.

View File

@ -23,12 +23,6 @@ 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))
@ -37,12 +31,6 @@ if ((${TINT_BUILD_SPIRV_TOOLS_FUZZER} OR ${TINT_BUILD_AST_FUZZER}) AND
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()
endif()
if (NOT TARGET SPIRV-Tools)
set(SPIRV_SKIP_TESTS ON CACHE BOOL "" FORCE)
set(SPIRV_SKIP_EXECUTABLES ON CACHE BOOL "" FORCE)
@ -60,6 +48,11 @@ if (NOT TARGET SPIRV-Tools)
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)
@ -109,7 +102,7 @@ if (${TINT_BUILD_BENCHMARKS})
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/benchmark EXCLUDE_FROM_ALL)
endif()
if (${TINT_BUILD_TESTS} AND NOT TARGET gmock)
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()