@@ -9,10 +9,10 @@ if (NOT "SPIRV" IN_LIST LLVM_TARGETS_TO_BUILD)
9
9
message (FATAL_ERROR "Building SPIRV-Tools tests is unsupported without the SPIR-V target" )
10
10
endif ()
11
11
12
- # SPIRV_DIS and SPIRV_VAL variables can be used to provide paths to existing
13
- # spirv-dis and spirv-val binaries, respectively. Otherwise, build them from
12
+ # SPIRV_DIS, SPIRV_VAL, SPIRV_AS and SPIRV_LINK variables can be used to provide paths to existing
13
+ # spirv-dis, spirv-val, spirv-as, and spirv-link binaries, respectively. Otherwise, build them from
14
14
# SPIRV-Tools source.
15
- if (NOT SPIRV_DIS OR NOT SPIRV_VAL OR NOT SPIRV_AS)
15
+ if (NOT SPIRV_DIS OR NOT SPIRV_VAL OR NOT SPIRV_AS OR NOT SPIRV_LINK )
16
16
include (ExternalProject)
17
17
18
18
set (BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} /SPIRVTools-bin)
@@ -21,8 +21,8 @@ if (NOT SPIRV_DIS OR NOT SPIRV_VAL OR NOT SPIRV_AS)
21
21
GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Tools.git
22
22
GIT_TAG main
23
23
BINARY_DIR ${BINARY_DIR}
24
- BUILD_COMMAND ${CMAKE_COMMAND} --build ${BINARY_DIR} --target spirv-dis spirv-val spirv-as
25
- BUILD_BYPRODUCTS ${BINARY_DIR} /tools/spirv-dis ${BINARY_DIR} /tools/spirv-val ${BINARY_DIR} /tools/spirv-as
24
+ BUILD_COMMAND ${CMAKE_COMMAND} --build ${BINARY_DIR} --target spirv-dis spirv-val spirv-as spirv-link
25
+ BUILD_BYPRODUCTS ${BINARY_DIR} /tools/spirv-dis ${BINARY_DIR} /tools/spirv-val ${BINARY_DIR} /tools/spirv-as ${BINARY_DIR} /tools/spirv-link
26
26
DOWNLOAD_COMMAND git clone https://github.com/KhronosGroup/SPIRV-Tools.git SPIRVTools &&
27
27
cd SPIRVTools &&
28
28
${Python3_EXECUTABLE} utils/git-sync-deps
@@ -43,7 +43,7 @@ else ()
43
43
set (LLVM_LINK_OR_COPY copy)
44
44
endif ()
45
45
46
- # Link the provided or just built spirv-dis and spirv-val binaries.
46
+ # Link the provided or just built binaries.
47
47
if (SPIRV_DIS)
48
48
add_custom_target (spirv-dis
49
49
COMMAND ${CMAKE_COMMAND} -E ${LLVM_LINK_OR_COPY} "${SPIRV_DIS} " "${LLVM_RUNTIME_OUTPUT_INTDIR} /spirv-dis" )
@@ -73,3 +73,13 @@ else ()
73
73
DEPENDS SPIRVTools
74
74
)
75
75
endif ()
76
+
77
+ if (SPIRV_LINK)
78
+ add_custom_target (spirv-link
79
+ COMMAND ${CMAKE_COMMAND} -E ${LLVM_LINK_OR_COPY} "${SPIRV_LINK} " "${LLVM_RUNTIME_OUTPUT_INTDIR} /spirv-link" )
80
+ else ()
81
+ add_custom_target (spirv-link
82
+ COMMAND ${CMAKE_COMMAND} -E ${LLVM_LINK_OR_COPY} "${BINARY_DIR} /tools/spirv-link${CMAKE_EXECUTABLE_SUFFIX} " "${LLVM_RUNTIME_OUTPUT_INTDIR} /spirv-link${CMAKE_EXECUTABLE_SUFFIX} "
83
+ DEPENDS SPIRVTools
84
+ )
85
+ endif ()
0 commit comments