Skip to content

Linking with all LLVM libraries #53

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
55 changes: 9 additions & 46 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,53 +175,13 @@ link_directories(
${LLVM_LIBRARY_DIRS}
)

if (LLVM_LINK_LLVM_DYLIB)
set (LLVM_COMPONENTS LLVM)
else (LLVM_LINK_LLVM_DYLIB)
set (LLVM_COMPONENTS
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will cause linker error for LLVMSPIRVLib for systems that have LLVMSPIRV built into libLLVM.so

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 here explicitly as an external library
set(ADDITIONAL_LIBS LLVMSPIRVLib)
else()
# SPIRV-LLVM-Translator is built as part of LLVM build.
# We should add it to the list of LLVM components
list(APPEND LLVM_COMPONENTS SPIRVLib)
endif(USE_PREBUILT_LLVM AND NOT LLVMSPIRV_INCLUDED_IN_LLVM)
list(APPEND ADDITIONAL_LIBS LLVMSPIRVLib)
endif()

add_subdirectory(cl_headers)

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

DEPENDS CClangCompileOptions
LINK_COMPONENTS
${LLVM_COMPONENTS}
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 @@ -268,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 @@ -302,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