From de743cc4d6a82459e286cd8bb4a1f066c5703076 Mon Sep 17 00:00:00 2001 From: Alan Baker Date: Fri, 6 Dec 2019 15:26:02 -0500 Subject: [PATCH] Add variables to specify the clspv and llvm dirs * Allow building amber with a clspv outside the amber tree --- src/CMakeLists.txt | 2 +- third_party/CMakeLists.txt | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8b5dc7804..7aeee3fda 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -83,7 +83,7 @@ endif() if (${AMBER_ENABLE_CLSPV}) target_include_directories(libamber PRIVATE - "${PROJECT_SOURCE_DIR}/third_party/clspv/include" + "${clspv_SOURCE_DIR}/clspv/include" ) target_link_libraries(libamber diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 356acb111..20781f614 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -131,14 +131,21 @@ if (${AMBER_ENABLE_DXC}) endif() if (${AMBER_ENABLE_CLSPV}) - set(CLSPV_LLVM_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/clspv-llvm/llvm" CACHE STRING "") - set(CLSPV_CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/clspv-llvm/clang" CACHE STRING "") + if (NOT DEFINED AMBER_CLSPV_DIR) + set(AMBER_CLSPV_DIR "${CMAKE_CURRENT_SOURCE_DIR}/clspv") + endif() + if (NOT DEFINED AMBER_CLSPV_LLVM_DIR) + set(AMBER_CLSPV_LLVM_DIR "${CMAKE_CURRENT_SOURCE_DIR}/clspv-llvm") + endif() + + set(CLSPV_LLVM_SOURCE_DIR "${AMBER_CLSPV_LLVM_DIR}/llvm" CACHE STRING "") + set(CLSPV_CLANG_SOURCE_DIR "${AMBER_CLSPV_LLVM_DIR}/clang" CACHE STRING "") set(SPIRV_HEADERS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/spirv-headers" CACHE STRING "") set(SPIRV_TOOLS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools" CACHE STRING "") set(LINKER_SUPPORTS_COLOR_DIAGNOSTICS 0 CACHE INTERNAL 0 FORCE) set(LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN ON CACHE STRING "") - set(LLVM_BUILD_STATIC ON CACHE BOOL "") + set(LLVM_BUILD_STATIC OFF CACHE BOOL "") set(LLVM_INCLUDE_BENCHMARKS OFF CACHE BOOL "") set(LLVM_INCLUDE_DOCS OFF CACHE BOOL "") set(LLVM_INCLUDE_EXAMPLES OFF CACHE BOOL "") @@ -146,5 +153,5 @@ if (${AMBER_ENABLE_CLSPV}) set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "") set(LLVM_INCLUDE_UTILS OFF CACHE BOOL "") - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/clspv) + add_subdirectory(${AMBER_CLSPV_DIR} ${CMAKE_CURRENT_BINARY_DIR}/clspv) endif()