diff options
| -rw-r--r-- | llvm/cmake/modules/AddLLVM.cmake | 5 | ||||
| -rw-r--r-- | llvm/cmake/modules/HandleLLVMOptions.cmake | 3 | ||||
| -rw-r--r-- | runtimes/CMakeLists.txt | 6 |
3 files changed, 11 insertions, 3 deletions
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index 828de4bd9940..e18ec23fc76f 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -1,4 +1,7 @@ -include(GNUInstallDirs) +if(NOT LLVM_RUNTIMES_GPU_BUILD) + include(GNUInstallDirs) +endif() + include(LLVMDistributionSupport) include(LLVMProcessSources) include(LLVM-Config) diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake index 08ff49ded57a..eca2962cf820 100644 --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -122,8 +122,7 @@ endif() # If we are targeting a GPU architecture in a runtimes build we want to ignore # all the standard flag handling. -if("${LLVM_RUNTIMES_TARGET}" MATCHES "^amdgcn" OR - "${LLVM_RUNTIMES_TARGET}" MATCHES "^nvptx64") +if(LLVM_RUNTIMES_GPU_BUILD) return() endif() diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt index 634ffe710b06..29b47b862c21 100644 --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -151,6 +151,12 @@ endif() # Avoid checking whether the compiler is working. set(LLVM_COMPILER_CHECKED ON) +# This can be used to detect whether we're targeting a GPU architecture. +if("${LLVM_RUNTIMES_TARGET}" MATCHES "^amdgcn" OR + "${LLVM_RUNTIMES_TARGET}" MATCHES "^nvptx64") + set(LLVM_RUNTIMES_GPU_BUILD ON) +endif() + # Handle common options used by all runtimes. include(AddLLVM) include(HandleLLVMOptions) |
