Skip to content

Commit 9388dda

Browse files
authored
Fix build when linking against SPIRVLib with SPIR-V backend (#19580)
Cherry pick of KhronosGroup/SPIRV-LLVM-Translator#3274 Needed to fix shared library build. Signed-off-by: Sarnie, Nick <[email protected]>
1 parent 23f17dc commit 9388dda

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

llvm-spirv/lib/SPIRV/CMakeLists.txt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ set(SRC_LIST
4040
libSPIRV/SPIRVValue.cpp
4141
libSPIRV/SPIRVError.cpp
4242
)
43-
add_llvm_library(LLVMSPIRVLib
44-
${SRC_LIST}
45-
LINK_COMPONENTS
43+
44+
set(SPIRVLIB_LINK_COMPONENTS
4645
Analysis
4746
BitWriter
4847
CodeGen
@@ -54,6 +53,16 @@ add_llvm_library(LLVMSPIRVLib
5453
Support
5554
TargetParser
5655
TransformUtils
56+
)
57+
58+
if(SPIRV_BACKEND_FOUND)
59+
list(APPEND SPIRVLIB_LINK_COMPONENTS "SPIRVCodeGen")
60+
endif()
61+
62+
add_llvm_library(LLVMSPIRVLib
63+
${SRC_LIST}
64+
LINK_COMPONENTS
65+
${SPIRVLIB_LINK_COMPONENTS}
5766
DEPENDS
5867
intrinsics_gen
5968
)

llvm-spirv/tools/llvm-spirv/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ set(LLVM_LINK_COMPONENTS
1010
TransformUtils
1111
)
1212

13-
if(SPIRV_BACKEND_FOUND)
14-
list(APPEND LLVM_LINK_COMPONENTS "SPIRVCodeGen")
15-
endif()
16-
1713
# llvm_setup_rpath messes with the rpath making llvm-spirv not
1814
# executable from the build directory in out-of-tree builds
1915
set(add_llvm_tool_options)

0 commit comments

Comments
 (0)