Skip to content

Linking with all LLVM libraries #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 10 additions & 48 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,54 +175,13 @@ link_directories(
${LLVM_LIBRARY_DIRS}
)

if (LLVM_LINK_LLVM_DYLIB)
set (LLVM_LIBS LLVM)
else (LLVM_LINK_LLVM_DYLIB)
set (LLVM_LIBS
Analysis
AsmParser
AsmPrinter
BitReader
BitWriter
CodeGen
Core
IRReader
InstCombine
Instrumentation
MC
MCDisassembler
MCParser
ObjCARCOpts
Object
Option
ProfileData
ScalarOpts
SelectionDAG
Support
Target
TransformUtils
Vectorize
X86AsmParser
X86AsmPrinter
X86CodeGen
X86Desc
X86Disassembler
X86Info
X86Utils)
endif (LLVM_LINK_LLVM_DYLIB)

set(ADDITIONAL_LIBS )
set(ADDITIONAL_LIBS ${CMAKE_DL_LIBS})

if(USE_PREBUILT_LLVM AND NOT LLVMSPIRV_INCLUDED_IN_LLVM)
if(NOT LLVMSPIRVLib IN_LIST LLVM_AVAILABLE_LIBS)
# SPIRV-LLVM-Translator is not included into LLVM as a component.
# So, we need to list it there explicitly as a library
set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} LLVMSPIRVLib)
elseif(NOT LLVM_LINK_LLVM_DYLIB)
# SPIRV-LLVM-Translator is included into LLVM as a component, but
# LLVM components is not linked together into an umbrella library.
# So, we need to list SPIRV-LLVM-Translator there explicitly as a component
set(LLVM_LIBS ${LLVM_LIBS} SPIRVLib)
endif(USE_PREBUILT_LLVM AND NOT LLVMSPIRV_INCLUDED_IN_LLVM)
# So, we need to list it here explicitly as an external library
list(APPEND ADDITIONAL_LIBS LLVMSPIRVLib)
endif()

add_subdirectory(cl_headers)

Expand All @@ -235,7 +194,7 @@ add_llvm_library(${TARGET_NAME} SHARED

DEPENDS CClangCompileOptions
LINK_COMPONENTS
${LLVM_LIBS}
all
LINK_LIBS
# The list of clang libraries is taken from clang makefile
# (build/tools/clang/tools/driver/CMakeFiles/clang.dir/link.txt)
Expand Down Expand Up @@ -269,7 +228,7 @@ add_llvm_library(${TARGET_NAME} SHARED
clangLex
clangBasic
${ADDITIONAL_LIBS}
${CMAKE_DL_LIBS})
)

# Configure resource file on Windows
if (WIN32)
Expand Down Expand Up @@ -303,6 +262,9 @@ if (WIN32)
"RC_PRODUCT_NAME=\"${RC_PRODUCT_NAME}\""
"RC_PRODUCT_VERSION=\"${RC_FILE_VERSION}\""
"RC_COPYRIGHT=\"Copyright ${RC_CHAR_C} 2018 Intel Corporation. All rights reserved.\"")
elseif(UNIX)
set_property(TARGET ${TARGET_NAME} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,--no-undefined")
endif(WIN32)

install(FILES common_clang.h
Expand Down