2017-07-02 07:24:11 +08:00
|
|
|
# LLVM documentation recommends always using static library linkage when
|
|
|
|
# building with Microsoft toolchain; it's also the default on other platforms
|
|
|
|
set(VCPKG_LIBRARY_LINKAGE static)
|
|
|
|
|
2017-12-01 04:43:45 +08:00
|
|
|
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
|
|
|
|
message(FATAL_ERROR "llvm cannot currently be built for UWP")
|
|
|
|
endif()
|
|
|
|
|
2017-07-02 07:24:11 +08:00
|
|
|
include(vcpkg_common_functions)
|
2017-09-23 00:22:49 +08:00
|
|
|
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/llvm-5.0.0.src)
|
2017-07-02 07:24:11 +08:00
|
|
|
vcpkg_download_distfile(ARCHIVE
|
2017-09-23 00:22:49 +08:00
|
|
|
URLS "http://releases.llvm.org/5.0.0/llvm-5.0.0.src.tar.xz"
|
|
|
|
FILENAME "llvm-5.0.0.src.tar.xz"
|
|
|
|
SHA512 e6d8fdcb5bf27bded814d02f39f69c6171bc3a512d5957c03e5ac2e231f903b7de87634b059bd5c5da670f7c3a8f7a538f6299225799f15f921857f1452f6b3a
|
2017-07-02 07:24:11 +08:00
|
|
|
)
|
|
|
|
vcpkg_extract_source_archive(${ARCHIVE})
|
|
|
|
|
2017-11-17 14:34:25 +08:00
|
|
|
vcpkg_download_distfile(CLANG_ARCHIVE
|
|
|
|
URLS "http://releases.llvm.org/5.0.0/cfe-5.0.0.src.tar.xz"
|
|
|
|
FILENAME "cfe-5.0.0.src.tar.xz"
|
|
|
|
SHA512 14acdd622310122b544c952ee5b932b7006d9d8424319f0e3974f2503d40a0cec4200fdd3d813a32ce0d877bcfbb9a5bd5c36f6142b4330e6c814f113ca2efe8
|
|
|
|
)
|
|
|
|
vcpkg_extract_source_archive(${CLANG_ARCHIVE} ${SOURCE_PATH}/tools)
|
|
|
|
|
|
|
|
if(NOT EXISTS ${SOURCE_PATH}/tools/clang)
|
|
|
|
file(RENAME ${SOURCE_PATH}/tools/cfe-5.0.0.src ${SOURCE_PATH}/tools/clang)
|
|
|
|
endif()
|
|
|
|
|
2017-07-10 07:47:35 +08:00
|
|
|
vcpkg_apply_patches(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
|
|
|
PATCHES ${CMAKE_CURRENT_LIST_DIR}/install-cmake-modules-to-share.patch
|
|
|
|
)
|
|
|
|
|
2017-10-19 20:26:47 +08:00
|
|
|
vcpkg_find_acquire_program(PYTHON3)
|
|
|
|
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
|
|
|
|
set(ENV{PATH} "$ENV{PATH};${PYTHON3_DIR}")
|
|
|
|
|
2017-07-02 07:24:11 +08:00
|
|
|
vcpkg_configure_cmake(
|
|
|
|
SOURCE_PATH ${SOURCE_PATH}
|
2017-07-03 22:00:36 +08:00
|
|
|
PREFER_NINJA
|
|
|
|
OPTIONS
|
2017-07-04 15:30:13 +08:00
|
|
|
-DLLVM_TARGETS_TO_BUILD=X86
|
2017-11-17 14:34:25 +08:00
|
|
|
-DLLVM_INCLUDE_TOOLS=ON
|
2017-07-10 07:47:35 +08:00
|
|
|
-DLLVM_INCLUDE_UTILS=OFF
|
|
|
|
-DLLVM_INCLUDE_EXAMPLES=OFF
|
|
|
|
-DLLVM_INCLUDE_TESTS=OFF
|
2017-07-04 15:30:13 +08:00
|
|
|
-DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF
|
2017-11-16 13:15:37 +08:00
|
|
|
-DLLVM_TOOLS_INSTALL_DIR=tools/llvm
|
2017-07-02 07:24:11 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_install_cmake()
|
|
|
|
|
2017-11-17 14:34:25 +08:00
|
|
|
file(GLOB EXE ${CURRENT_PACKAGES_DIR}/bin/*)
|
|
|
|
file(GLOB DEBUG_EXE ${CURRENT_PACKAGES_DIR}/debug/bin/*)
|
2018-01-04 12:12:49 +08:00
|
|
|
file(COPY ${EXE} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/llvm)
|
|
|
|
file(COPY ${DEBUG_EXE} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/tools/llvm)
|
2017-11-17 14:34:25 +08:00
|
|
|
file(REMOVE ${EXE})
|
|
|
|
file(REMOVE ${DEBUG_EXE})
|
|
|
|
|
2018-01-04 12:12:49 +08:00
|
|
|
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/clang TARGET_PATH share/clang)
|
2017-11-16 13:15:37 +08:00
|
|
|
vcpkg_fixup_cmake_targets(CONFIG_PATH share/llvm)
|
|
|
|
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/llvm)
|
|
|
|
|
|
|
|
file(REMOVE_RECURSE
|
|
|
|
${CURRENT_PACKAGES_DIR}/debug/include
|
|
|
|
${CURRENT_PACKAGES_DIR}/debug/tools
|
|
|
|
${CURRENT_PACKAGES_DIR}/debug/share
|
2017-11-17 14:34:25 +08:00
|
|
|
${CURRENT_PACKAGES_DIR}/debug/bin
|
|
|
|
${CURRENT_PACKAGES_DIR}/debug/msbuild-bin
|
|
|
|
${CURRENT_PACKAGES_DIR}/bin
|
|
|
|
${CURRENT_PACKAGES_DIR}/msbuild-bin
|
|
|
|
${CURRENT_PACKAGES_DIR}/tools/msbuild-bin
|
2017-11-16 13:15:37 +08:00
|
|
|
)
|
2017-07-02 07:24:11 +08:00
|
|
|
|
2017-07-08 10:23:19 +08:00
|
|
|
# Remove one empty include subdirectory if it is indeed empty
|
|
|
|
file(GLOB MCANALYSISFILES ${CURRENT_PACKAGES_DIR}/include/llvm/MC/MCAnalysis/*)
|
|
|
|
if(NOT MCANALYSISFILES)
|
|
|
|
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/llvm/MC/MCAnalysis)
|
|
|
|
endif()
|
2017-07-03 22:00:36 +08:00
|
|
|
|
2017-07-02 07:24:11 +08:00
|
|
|
# Handle copyright
|
2017-07-08 10:23:19 +08:00
|
|
|
file(INSTALL ${SOURCE_PATH}/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/llvm RENAME copyright)
|