Skip to content

Commit 14dc712

Browse files
committed
Resolve some build issues
Name of SPIRV-LLVM-Translator library was incorrect for some use cases. Also, the correct list of clang libraries was occasionaly reverted in a92b0fd - reverted it back to the right state.
1 parent 35f893b commit 14dc712

File tree

1 file changed

+39
-16
lines changed

1 file changed

+39
-16
lines changed

CMakeLists.txt

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ link_directories(
176176
)
177177

178178
if (LLVM_LINK_LLVM_DYLIB)
179-
set (LLVM_LIBS LLVM)
179+
set (LLVM_COMPONENTS LLVM)
180180
else (LLVM_LINK_LLVM_DYLIB)
181-
set (LLVM_LIBS
181+
set (LLVM_COMPONENTS
182182
Analysis
183183
AsmParser
184184
AsmPrinter
@@ -211,9 +211,18 @@ else (LLVM_LINK_LLVM_DYLIB)
211211
X86Utils)
212212
endif (LLVM_LINK_LLVM_DYLIB)
213213

214-
if(NOT LLVM_LINK_LLVM_DYLIB OR (USE_PREBUILT_LLVM AND NOT LLVMSPIRV_INCLUDED_IN_LLVM))
215-
set(LLVM_LIBS ${LLVM_LIBS} SPIRVLib)
216-
endif(NOT LLVM_LINK_LLVM_DYLIB OR (USE_PREBUILT_LLVM AND NOT LLVMSPIRV_INCLUDED_IN_LLVM))
214+
set(ADDITIONAL_LIBS )
215+
216+
if(USE_PREBUILT_LLVM AND NOT LLVMSPIRV_INCLUDED_IN_LLVM)
217+
# SPIRV-LLVM-Translator is not included into LLVM as a component.
218+
# So, we need to list it there explicitly as a library
219+
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} LLVMSPIRVLib)
220+
elseif(NOT LLVM_LINK_LLVM_DYLIB)
221+
# SPIRV-LLVM-Translator is included into LLVM as a component, but
222+
# LLVM components is not linked together into an umbrella library.
223+
# So, we need to list SPIRV-LLVM-Translator there explicitly as a component
224+
set(LLVM_COMPONENTS ${LLVM_LIBS} SPIRVLib)
225+
endif(USE_PREBUILT_LLVM AND NOT LLVMSPIRV_INCLUDED_IN_LLVM)
217226

218227
add_subdirectory(cl_headers)
219228

@@ -226,26 +235,40 @@ add_llvm_library(${TARGET_NAME} SHARED
226235

227236
DEPENDS CClangCompileOptions
228237
LINK_COMPONENTS
229-
${LLVM_LIBS}
238+
${LLVM_COMPONENTS}
230239
LINK_LIBS
231-
clangARCMigrate
232-
clangAST
233-
clangAnalysis
240+
# The list of clang libraries is taken from clang makefile
241+
# (build/tools/clang/tools/driver/CMakeFiles/clang.dir/link.txt)
242+
# All duplicate libraries are there on purpose
234243
clangBasic
235244
clangCodeGen
236245
clangDriver
237-
clangEdit
238246
clangFrontend
239247
clangFrontendTool
240-
clangLex
241-
clangParse
242-
clangRewrite
248+
clangCodeGen
243249
clangRewriteFrontend
244-
clangSema
245-
clangSerialization
250+
clangARCMigrate
251+
clangStaticAnalyzerFrontend
246252
clangStaticAnalyzerCheckers
247253
clangStaticAnalyzerCore
248-
clangStaticAnalyzerFrontend
254+
clangCrossTU
255+
clangIndex
256+
clangFrontend
257+
clangDriver
258+
clangParse
259+
clangSerialization
260+
clangSema
261+
clangAnalysis
262+
clangEdit
263+
clangFormat
264+
clangToolingInclusions
265+
clangToolingCore
266+
clangRewrite
267+
clangASTMatchers
268+
clangAST
269+
clangLex
270+
clangBasic
271+
${ADDITIONAL_LIBS}
249272
${CMAKE_DL_LIBS})
250273

251274
# Configure resource file on Windows

0 commit comments

Comments
 (0)