• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1if(ENABLE_LLVM_SHARED)
2set(llvm_libs "LLVM")
3else()
4set(llvm_raw_libs bitwriter bpfcodegen debuginfodwarf irreader linker
5  mcjit objcarcopts option passes lto)
6if(ENABLE_LLVM_NATIVECODEGEN)
7set(llvm_raw_libs ${llvm_raw_libs} nativecodegen)
8endif()
9list(FIND LLVM_AVAILABLE_LIBS "LLVMCoverage" _llvm_coverage)
10if (${_llvm_coverage} GREATER -1)
11  list(APPEND llvm_raw_libs coverage)
12endif()
13list(FIND LLVM_AVAILABLE_LIBS "LLVMCoroutines" _llvm_coroutines)
14if (${_llvm_coroutines} GREATER -1)
15  list(APPEND llvm_raw_libs coroutines)
16endif()
17if (${LLVM_PACKAGE_VERSION} VERSION_EQUAL 6 OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER 6)
18  list(APPEND llvm_raw_libs bpfasmparser)
19  list(APPEND llvm_raw_libs bpfdisassembler)
20endif()
21llvm_map_components_to_libnames(_llvm_libs ${llvm_raw_libs})
22llvm_expand_dependencies(llvm_libs ${_llvm_libs})
23endif()
24
25# order is important
26set(clang_libs
27  ${libclangFrontend}
28  ${libclangSerialization}
29  ${libclangDriver})
30
31if (${LLVM_PACKAGE_VERSION} VERSION_EQUAL 8 OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER 8)
32  list(APPEND clang_libs ${libclangASTMatchers})
33endif()
34
35list(APPEND clang_libs
36  ${libclangParse}
37  ${libclangSema}
38  ${libclangCodeGen}
39  ${libclangAnalysis}
40  ${libclangRewrite}
41  ${libclangEdit}
42  ${libclangAST}
43  ${libclangLex}
44  ${libclangBasic})
45
46# prune unused llvm static library stuff when linking into the new .so
47set(_exclude_flags)
48foreach(_lib ${clang_libs})
49  get_filename_component(_lib ${_lib} NAME)
50  set(_exclude_flags "${_exclude_flags} -Wl,--exclude-libs=${_lib}")
51endforeach(_lib)
52set(clang_lib_exclude_flags "${_exclude_flags}")
53
54set(_exclude_flags)
55foreach(_lib ${llvm_libs})
56  get_filename_component(_lib ${_lib} NAME)
57  set(_exclude_flags "${_exclude_flags} -Wl,--exclude-libs=lib${_lib}.a")
58endforeach(_lib)
59set(llvm_lib_exclude_flags "${_exclude_flags}")
60