|
1 | 1 | cmake_minimum_required(VERSION 3.13.4)
|
2 | 2 |
|
| 3 | +include(CheckIncludeFileCXX) |
| 4 | + |
3 | 5 | file(READ "VERSION.txt" comgr_ver_file)
|
4 | 6 |
|
5 | 7 | string(REGEX MATCH "#COMGR_VERSION_MAJOR\n([0-9]*)" _ ${comgr_ver_file})
|
@@ -169,16 +171,31 @@ set(AMD_COMGR_PRIVATE_COMPILE_DEFINITIONS ${LLVM_DEFINITIONS})
|
169 | 171 | set(AMD_COMGR_PUBLIC_LINKER_OPTIONS)
|
170 | 172 | set(AMD_COMGR_PRIVATE_LINKER_OPTIONS)
|
171 | 173 |
|
| 174 | +list(APPEND AMD_COMGR_PRIVATE_COMPILE_DEFINITIONS "AMD_COMGR_GIT_COMMIT=${AMD_COMGR_GIT_COMMIT}") |
| 175 | +list(APPEND AMD_COMGR_PRIVATE_COMPILE_DEFINITIONS "AMD_COMGR_GIT_BRANCH=${AMD_COMGR_GIT_BRANCH}") |
| 176 | +message("----COMGR_GIT_COMMIT: ${AMD_COMGR_GIT_COMMIT}") |
| 177 | +message("----COMGR_GIT_BRANCH: ${AMD_COMGR_GIT_BRANCH}") |
| 178 | +message("") |
| 179 | + |
172 | 180 | option(COMGR_DISABLE_SPIRV "To disable SPIRV in Comgr" OFF)
|
| 181 | + |
| 182 | +if (NOT COMGR_DISABLE_SPIRV) |
| 183 | + # TODO: Explore switching this to CHECK_INCLUDE_FILE_CXX() macro |
| 184 | + if (NOT EXISTS "${LLVM_INCLUDE_DIRS}/LLVMSPIRVLib/LLVMSPIRVLib.h") |
| 185 | + message("-- LLVMSPIRVLib/LLVMSPIRVLib.h not found") |
| 186 | + set(COMGR_DISABLE_SPIRV ON) |
| 187 | + else() |
| 188 | + message("-- LLVMSPIRVLib/LLVMSPIRVLib.h found") |
| 189 | + endif() |
| 190 | +endif() |
| 191 | + |
173 | 192 | if(${COMGR_DISABLE_SPIRV})
|
174 | 193 | list(APPEND AMD_COMGR_PRIVATE_COMPILE_DEFINITIONS "COMGR_DISABLE_SPIRV")
|
| 194 | + message("-- Comgr SPIRV Disabled") |
| 195 | +else() |
| 196 | + message("-- Comgr SPIRV Enabled") |
175 | 197 | endif()
|
176 | 198 |
|
177 |
| -list(APPEND AMD_COMGR_PRIVATE_COMPILE_OPTIONS "-DAMD_COMGR_GIT_COMMIT=${AMD_COMGR_GIT_COMMIT}") |
178 |
| -list(APPEND AMD_COMGR_PRIVATE_COMPILE_OPTIONS "-DAMD_COMGR_GIT_BRANCH=${AMD_COMGR_GIT_BRANCH}") |
179 |
| -message("----COMGR_GIT_COMMIT: ${AMD_COMGR_GIT_COMMIT}") |
180 |
| -message("----COMGR_GIT_BRANCH: ${AMD_COMGR_GIT_BRANCH}") |
181 |
| -message("") |
182 | 199 |
|
183 | 200 | if (UNIX)
|
184 | 201 | list(APPEND AMD_COMGR_PRIVATE_COMPILE_OPTIONS
|
@@ -392,11 +409,9 @@ set(LLD_LIBS
|
392 | 409 | lldCommon)
|
393 | 410 |
|
394 | 411 | if (${COMGR_DISABLE_SPIRV})
|
395 |
| - message("-- Comgr SPIRV Disabled") |
396 | 412 | set(SPIRV_DYNAMIC_LIB "")
|
397 | 413 | set(SPIRV_STATIC_LIB "")
|
398 | 414 | else()
|
399 |
| - message("-- Comgr SPIRV Enabled") |
400 | 415 | set(SPIRV_DYNAMIC_LIB "LLVMSPIRVAMDLib")
|
401 | 416 | set(SPIRV_STATIC_LIB "SPIRVAMDLib")
|
402 | 417 | endif()
|
|
0 commit comments