Commit 6480d4e1 by Dan Sinclair

[cmake] Check for deps before adding.

When embedding SwitftShader into a third party application, the top level cmake files may already include googletest and SPIRV-Tools. This CL updates the SwiftShader tests to only try to pull in googletest if the `gtest` target is not found and only pull in SPIRV-Tools if the `SPIRV-Tools` target is not found. Change-Id: I3c3ebb528725017dbbb80aa05b01ee2de8d4a2d1 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/26788Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarDan Sinclair <dsinclair@google.com>
parent 25ec7b0c
......@@ -109,13 +109,15 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Initialize submodules
###########################################################
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/googletest/.git)
message(WARNING "
third_party/googletest submodule missing.
Running 'git submodule update --init' to download it:
")
execute_process(COMMAND git submodule update --init)
if (NOT TARGET gtest)
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/googletest/.git)
message(WARNING "
third_party/googletest submodule missing.
Running 'git submodule update --init' to download it:
")
execute_process(COMMAND git submodule update --init)
endif()
endif()
###########################################################
......@@ -2234,11 +2236,13 @@ if(BUILD_GLES_CM)
endif()
if(BUILD_VULKAN)
# This variable is also used by SPIRV-Tools to locate SPIRV-Headers
set(SPIRV-Headers_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/SPIRV-Headers")
list(APPEND VULKAN_INCLUDE_DIR "${SPIRV-Headers_SOURCE_DIR}/include")
if (NOT TARGET SPIRV-Tools)
# This variable is also used by SPIRV-Tools to locate SPIRV-Headers
set(SPIRV-Headers_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/SPIRV-Headers")
list(APPEND VULKAN_INCLUDE_DIR "${SPIRV-Headers_SOURCE_DIR}/include")
add_subdirectory(third_party/SPIRV-Tools)
add_subdirectory(third_party/SPIRV-Tools)
endif()
add_library(libvk_swiftshader SHARED ${VULKAN_LIST})
set_target_properties(libvk_swiftshader PROPERTIES
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment