File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -179,12 +179,24 @@ message("")
179179option (COMGR_DISABLE_SPIRV "To disable SPIRV in Comgr" OFF )
180180
181181if (NOT COMGR_DISABLE_SPIRV)
182- # TODO: Explore switching this to CHECK_INCLUDE_FILE_CXX() macro
183- if (NOT EXISTS "${LLVM_INCLUDE_DIRS} /LLVMSPIRVLib/LLVMSPIRVLib.h" )
182+ # Candidate include paths for LLVMSPIRVLib.h:
183+ # 1. ${LLVM_INCLUDE_DIRS}/LLVMSPIRVLib (standalone build)
184+ # 2. ${LLVM_EXTERNAL_SPIRV_LLVM_TRANSLATOR_SOURCE_DIR}/include (external project)
185+ # 3. ${CMAKE_SOURCE_DIR}/projects/SPIRV-LLVM-Translator/include (usual location)
186+ find_path (
187+ FOUND_SPIRV_INCLUDE_DIR
188+ LLVMSPIRVLib.h
189+ PATHS
190+ "${LLVM_INCLUDE_DIRS} /LLVMSPIRVLib"
191+ "${LLVM_EXTERNAL_SPIRV_LLVM_TRANSLATOR_SOURCE_DIR} /include"
192+ "${CMAKE_SOURCE_DIR} /projects/SPIRV-LLVM-Translator/include"
193+ NO_DEFAULT_PATH
194+ )
195+ if (NOT EXISTS "${FOUND_SPIRV_INCLUDE_DIR} /LLVMSPIRVLib.h" )
184196 message ("-- LLVMSPIRVLib/LLVMSPIRVLib.h not found" )
185197 set (COMGR_DISABLE_SPIRV ON )
186198 else ()
187- message ("-- LLVMSPIRVLib/LLVMSPIRVLib.h found" )
199+ message ("-- LLVMSPIRVLib/LLVMSPIRVLib.h found at ${FOUND_SPIRV_INCLUDE_DIR} " )
188200 endif ()
189201endif ()
190202
@@ -195,7 +207,7 @@ else()
195207 message ("-- Comgr SPIRV Enabled" )
196208 target_include_directories (amd_comgr
197209 PRIVATE
198- "${LLVM_INCLUDE_DIRS} /LLVMSPIRVLib " )
210+ "${FOUND_SPIRV_INCLUDE_DIR} " )
199211endif ()
200212
201213
You can’t perform that action at this time.
0 commit comments