aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephane Lajoie <dada@typicus.org>2017-07-09 19:47:35 -0400
committerStephane Lajoie <dada@typicus.org>2017-07-09 19:47:35 -0400
commitaea2734ad4c7fbe04bd5f35844aa72e4300d74fb (patch)
tree9d7c586f97ed27bf1bfa502862d21aab78219b15
parentc2f1a2af59d911b79dbe63a23815c4bfa472e2a6 (diff)
downloadvcpkg-aea2734ad4c7fbe04bd5f35844aa72e4300d74fb.tar.gz
vcpkg-aea2734ad4c7fbe04bd5f35844aa72e4300d74fb.zip
Patch CMakeLists to install CMake modules to share/llvm instead of lib/cmake/llvm. This works better than vcpkg_fixup_cmake_targets because other parts of the LLVM build system really want all the variables set correctly. Also set other options to prevent creation of any bin/* instead of removing them after the fact, for the same reason.
-rw-r--r--ports/llvm/install-cmake-modules-to-share.patch10
-rw-r--r--ports/llvm/portfile.cmake33
2 files changed, 21 insertions, 22 deletions
diff --git a/ports/llvm/install-cmake-modules-to-share.patch b/ports/llvm/install-cmake-modules-to-share.patch
new file mode 100644
index 000000000..b5193beca
--- /dev/null
+++ b/ports/llvm/install-cmake-modules-to-share.patch
@@ -0,0 +1,10 @@
+diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
+index ac4b0b7..13a271d 100644
+--- a/cmake/modules/CMakeLists.txt
++++ b/cmake/modules/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
++set(LLVM_INSTALL_PACKAGE_DIR share/llvm)
+ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+
+ # First for users who use an installed LLVM, create the LLVMExports.cmake file.
diff --git a/ports/llvm/portfile.cmake b/ports/llvm/portfile.cmake
index c09b66ff4..9edf7f2b1 100644
--- a/ports/llvm/portfile.cmake
+++ b/ports/llvm/portfile.cmake
@@ -1,15 +1,3 @@
-# Common Ambient Variables:
-# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
-# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
-# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT}
-# PORT = current port name (zlib, etc)
-# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc)
-# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic)
-# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic)
-# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
-# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm)
-#
-
# 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)
@@ -23,29 +11,30 @@ vcpkg_download_distfile(ARCHIVE
)
vcpkg_extract_source_archive(${ARCHIVE})
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES ${CMAKE_CURRENT_LIST_DIR}/install-cmake-modules-to-share.patch
+)
+
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DLLVM_TARGETS_TO_BUILD=X86
- -DLLVM_BUILD_TOOLS=OFF
- -DLLVM_BUILD_UTILS=OFF
+ -DLLVM_INCLUDE_TOOLS=OFF
+ -DLLVM_INCLUDE_UTILS=OFF
+ -DLLVM_INCLUDE_EXAMPLES=OFF
+ -DLLVM_INCLUDE_TESTS=OFF
-DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF
+ -DLLVM_TOOLS_INSTALL_DIR=tools
)
vcpkg_install_cmake()
-# Move cmake modules to correct vcpkg location and remove extra copy
-vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/llvm)
+# Remove extra copy of cmake modules and include files
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
-
-# Remove extra copies of include files in debug directory
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
-# Remove bin directories
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
-
# Remove one empty include subdirectory if it is indeed empty
file(GLOB MCANALYSISFILES ${CURRENT_PACKAGES_DIR}/include/llvm/MC/MCAnalysis/*)
if(NOT MCANALYSISFILES)