2012-06-21 09:30:21 +08:00
|
|
|
set( LLVM_LINK_COMPONENTS
|
|
|
|
${LLVM_TARGETS_TO_BUILD}
|
2013-12-10 20:40:37 +08:00
|
|
|
Analysis
|
2014-07-01 10:42:02 +08:00
|
|
|
CodeGen
|
2013-12-10 20:40:37 +08:00
|
|
|
Core
|
|
|
|
IPA
|
|
|
|
IPO
|
|
|
|
InstCombine
|
|
|
|
Instrumentation
|
|
|
|
MC
|
|
|
|
MCParser
|
|
|
|
ObjCARCOpts
|
|
|
|
Option
|
|
|
|
ScalarOpts
|
|
|
|
Support
|
|
|
|
TransformUtils
|
|
|
|
Vectorize
|
2012-06-21 09:30:21 +08:00
|
|
|
)
|
|
|
|
|
2014-03-11 01:00:46 +08:00
|
|
|
option(CLANG_PLUGIN_SUPPORT "Build clang with plugin support" ON)
|
2014-03-08 09:19:37 +08:00
|
|
|
|
|
|
|
# Support plugins. This must be before add_clang_executable as it reads
|
|
|
|
# LLVM_NO_DEAD_STRIP.
|
2014-03-11 01:00:46 +08:00
|
|
|
if(CLANG_PLUGIN_SUPPORT)
|
2014-03-08 09:19:37 +08:00
|
|
|
set(LLVM_NO_DEAD_STRIP 1)
|
|
|
|
endif()
|
2014-03-08 08:41:53 +08:00
|
|
|
|
2012-06-21 09:30:21 +08:00
|
|
|
add_clang_executable(clang
|
|
|
|
driver.cpp
|
|
|
|
cc1_main.cpp
|
|
|
|
cc1as_main.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(clang
|
2011-02-12 07:46:38 +08:00
|
|
|
clangBasic
|
|
|
|
clangDriver
|
|
|
|
clangFrontend
|
2013-12-10 20:40:37 +08:00
|
|
|
clangFrontendTool
|
2009-03-24 10:52:57 +08:00
|
|
|
)
|
|
|
|
|
2011-02-26 03:24:02 +08:00
|
|
|
set_target_properties(clang PROPERTIES VERSION ${CLANG_EXECUTABLE_VERSION})
|
2014-03-08 09:19:37 +08:00
|
|
|
|
|
|
|
# Support plugins.
|
2014-03-11 01:00:46 +08:00
|
|
|
if(CLANG_PLUGIN_SUPPORT)
|
2015-03-20 01:45:12 +08:00
|
|
|
export_executable_symbols(clang)
|
2014-03-08 09:19:37 +08:00
|
|
|
endif()
|
2011-02-26 03:24:02 +08:00
|
|
|
|
2012-07-21 00:40:09 +08:00
|
|
|
add_dependencies(clang clang-headers)
|
|
|
|
|
2009-11-20 00:42:34 +08:00
|
|
|
if(UNIX)
|
|
|
|
set(CLANGXX_LINK_OR_COPY create_symlink)
|
2012-02-10 04:02:46 +08:00
|
|
|
# Create a relative symlink
|
|
|
|
set(clang_binary "clang${CMAKE_EXECUTABLE_SUFFIX}")
|
2009-11-20 00:42:34 +08:00
|
|
|
else()
|
|
|
|
set(CLANGXX_LINK_OR_COPY copy)
|
2014-01-19 21:00:01 +08:00
|
|
|
set(clang_binary "${LLVM_RUNTIME_OUTPUT_INTDIR}/clang${CMAKE_EXECUTABLE_SUFFIX}")
|
2009-11-20 00:42:34 +08:00
|
|
|
endif()
|
|
|
|
|
2009-11-19 13:46:45 +08:00
|
|
|
# Create the clang++ symlink in the build directory.
|
2014-01-19 21:00:01 +08:00
|
|
|
set(clang_pp "${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++${CMAKE_EXECUTABLE_SUFFIX}")
|
2011-11-21 08:00:48 +08:00
|
|
|
add_custom_command(TARGET clang POST_BUILD
|
2014-01-03 01:11:02 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E ${CLANGXX_LINK_OR_COPY} "${clang_binary}" "${clang_pp}"
|
2014-01-19 21:00:01 +08:00
|
|
|
WORKING_DIRECTORY "${LLVM_RUNTIME_OUTPUT_INTDIR}")
|
2011-02-26 03:24:02 +08:00
|
|
|
|
2011-02-06 05:37:37 +08:00
|
|
|
set_property(DIRECTORY APPEND
|
|
|
|
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clang_pp})
|
2009-11-19 13:46:45 +08:00
|
|
|
|
2013-07-20 04:33:20 +08:00
|
|
|
# Create the clang-cl symlink in the build directory.
|
2014-01-19 21:00:01 +08:00
|
|
|
set(clang_cl "${LLVM_RUNTIME_OUTPUT_INTDIR}/clang-cl${CMAKE_EXECUTABLE_SUFFIX}")
|
2013-07-20 04:33:20 +08:00
|
|
|
add_custom_command(TARGET clang POST_BUILD
|
2014-01-03 01:11:02 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E ${CLANGXX_LINK_OR_COPY} "${clang_binary}" "${clang_cl}"
|
2014-01-19 21:00:01 +08:00
|
|
|
WORKING_DIRECTORY "${LLVM_RUNTIME_OUTPUT_INTDIR}")
|
2013-07-20 04:33:20 +08:00
|
|
|
|
|
|
|
set_property(DIRECTORY APPEND
|
|
|
|
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${clang_cl})
|
|
|
|
|
2009-08-23 13:28:29 +08:00
|
|
|
install(TARGETS clang
|
|
|
|
RUNTIME DESTINATION bin)
|
2009-11-19 13:46:45 +08:00
|
|
|
|
2013-07-20 04:33:20 +08:00
|
|
|
# Create the clang++ and clang-cl symlinks at installation time.
|
2010-10-18 00:10:32 +08:00
|
|
|
install(SCRIPT clang_symlink.cmake -DCMAKE_INSTALL_PREFIX=\"${CMAKE_INSTALL_PREFIX}\")
|
2013-08-20 15:09:51 +08:00
|
|
|
|
|
|
|
# Configure plist creation for OS X.
|
|
|
|
set (TOOL_INFO_PLIST "Info.plist" CACHE STRING "Plist name")
|
|
|
|
if (APPLE)
|
|
|
|
if (CLANG_VENDOR)
|
|
|
|
set(TOOL_INFO_NAME "${CLANG_VENDOR} clang")
|
|
|
|
else()
|
|
|
|
set(TOOL_INFO_NAME "clang")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(TOOL_INFO_UTI "${CLANG_VENDOR_UTI}")
|
|
|
|
set(TOOL_INFO_VERSION "${CLANG_VERSION}")
|
|
|
|
if (LLVM_SUBMIT_VERSION)
|
|
|
|
set(TOOL_INFO_BUILD_VERSION
|
|
|
|
"${LLVM_SUBMIT_VERSION}.${LLVM_SUBMIT_SUBVERSION}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(TOOL_INFO_PLIST_OUT "${CMAKE_CURRENT_BINARY_DIR}/${TOOL_INFO_PLIST}")
|
|
|
|
target_link_libraries(clang
|
|
|
|
"-Wl,-sectcreate,__TEXT,__info_plist,${TOOL_INFO_PLIST_OUT}")
|
|
|
|
configure_file("${TOOL_INFO_PLIST}.in" "${TOOL_INFO_PLIST_OUT}" @ONLY)
|
|
|
|
|
|
|
|
set(TOOL_INFO_UTI)
|
|
|
|
set(TOOL_INFO_NAME)
|
|
|
|
set(TOOL_INFO_VERSION)
|
|
|
|
set(TOOL_INFO_BUILD_VERSION)
|
|
|
|
endif()
|
2013-08-20 15:41:18 +08:00
|
|
|
|
|
|
|
if(CLANG_ORDER_FILE)
|
|
|
|
target_link_libraries(clang "-Wl,-order_file,${CLANG_ORDER_FILE}")
|
|
|
|
endif()
|
|
|
|
|
2014-03-14 12:04:27 +08:00
|
|
|
if(WITH_POLLY AND LINK_POLLY_INTO_TOOLS)
|
|
|
|
target_link_libraries(clang Polly)
|
|
|
|
if(POLLY_LINK_LIBS)
|
|
|
|
foreach(lib ${POLLY_LINK_LIBS})
|
|
|
|
target_link_libraries(clang ${lib})
|
|
|
|
endforeach(lib)
|
|
|
|
endif(POLLY_LINK_LIBS)
|
|
|
|
endif(WITH_POLLY AND LINK_POLLY_INTO_TOOLS)
|