diff --git a/ports/llvm-12/0001-fix-install-paths.patch b/ports/llvm-12/0002-fix-install-paths.patch similarity index 96% rename from ports/llvm-12/0001-fix-install-paths.patch rename to ports/llvm-12/0002-fix-install-paths.patch index ef8a08b6..84d973f6 100644 --- a/ports/llvm-12/0001-fix-install-paths.patch +++ b/ports/llvm-12/0002-fix-install-paths.patch @@ -63,10 +63,10 @@ index fa505a533762..90413be34120 100644 get_property(LLD_EXPORTS GLOBAL PROPERTY LLD_EXPORTS) diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake -index 97c9980c7de3..52bb6aac73a6 100644 +index b74adc11ade9..0638aea2f8f6 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake -@@ -1015,7 +1015,7 @@ function(process_llvm_pass_plugins) +@@ -974,7 +974,7 @@ function(process_llvm_pass_plugins) ## Part 1: Extension header to be included whenever we need extension # processing. @@ -76,7 +76,7 @@ index 97c9980c7de3..52bb6aac73a6 100644 file(WRITE "${llvm_cmake_builddir}/LLVMConfigExtensions.cmake" diff --git a/llvm/cmake/modules/CMakeLists.txt b/llvm/cmake/modules/CMakeLists.txt -index 505dc9a29d70..612c3997107e 100644 +index 4b8879f65fe4..9e097ab223b5 100644 --- a/llvm/cmake/modules/CMakeLists.txt +++ b/llvm/cmake/modules/CMakeLists.txt @@ -1,4 +1,4 @@ @@ -104,7 +104,7 @@ index b9fb9adce2ea..85a54f699f30 100644 get_property(MLIR_EXPORTS GLOBAL PROPERTY MLIR_EXPORTS) diff --git a/polly/cmake/CMakeLists.txt b/polly/cmake/CMakeLists.txt -index 7cc129ba2e90..9776391cd535 100644 +index 211f95512717..2abe3803f910 100644 --- a/polly/cmake/CMakeLists.txt +++ b/polly/cmake/CMakeLists.txt @@ -1,7 +1,7 @@ @@ -118,7 +118,7 @@ index 7cc129ba2e90..9776391cd535 100644 set(POLLY_EXPORTS_FILE_NAME "PollyExports-$>.cmake") else() diff --git a/pstl/CMakeLists.txt b/pstl/CMakeLists.txt -index 8bea8843589b..3658c0a4414a 100644 +index 8e6e1354707b..2ae7f7090025 100644 --- a/pstl/CMakeLists.txt +++ b/pstl/CMakeLists.txt @@ -81,10 +81,10 @@ install(TARGETS ParallelSTL diff --git a/ports/llvm-12/0002-fix-openmp-debug.patch b/ports/llvm-12/0003-fix-openmp-debug.patch similarity index 91% rename from ports/llvm-12/0002-fix-openmp-debug.patch rename to ports/llvm-12/0003-fix-openmp-debug.patch index 2c693e91..adf3c8ad 100644 --- a/ports/llvm-12/0002-fix-openmp-debug.patch +++ b/ports/llvm-12/0003-fix-openmp-debug.patch @@ -1,3 +1,6 @@ + openmp/runtime/src/CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt index 822f9ca2b825..814e25864610 100644 --- a/openmp/runtime/src/CMakeLists.txt diff --git a/ports/llvm-12/0003-fix-dr-1734.patch b/ports/llvm-12/0004-fix-dr-1734.patch similarity index 99% rename from ports/llvm-12/0003-fix-dr-1734.patch rename to ports/llvm-12/0004-fix-dr-1734.patch index 14194989..adfbe5a1 100644 --- a/ports/llvm-12/0003-fix-dr-1734.patch +++ b/ports/llvm-12/0004-fix-dr-1734.patch @@ -5,7 +5,7 @@ index b7d48e8e1ad..53ba24efc00 100644 @@ -177,7 +177,8 @@ class is_trivially_copyable { (has_deleted_copy_assign || has_trivial_copy_assign) && (has_deleted_copy_constructor || has_trivial_copy_constructor); - + -#ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE + // due to DR 1734, a type can be std::is_trivially_copyable but not llvm::is_trivially_copyable +#if 0 diff --git a/ports/llvm-12/0004-fix-tools-path.patch b/ports/llvm-12/0005-fix-tools-path.patch similarity index 99% rename from ports/llvm-12/0004-fix-tools-path.patch rename to ports/llvm-12/0005-fix-tools-path.patch index 704cf7df..bdfad617 100644 --- a/ports/llvm-12/0004-fix-tools-path.patch +++ b/ports/llvm-12/0005-fix-tools-path.patch @@ -9,6 +9,6 @@ index 53ba24efc00..0badcafe000 100644 CurrentExecPrefix = - sys::path::parent_path(sys::path::parent_path(CurrentPath)).str(); + sys::path::parent_path(sys::path::parent_path(sys::path::parent_path(CurrentPath))).str(); - + // Check to see if we are inside a development tree by comparing to possible // locations (prefix style or CMake style). diff --git a/ports/llvm-12/0005-fix-compiler-rt-install-path.patch b/ports/llvm-12/0007-fix-compiler-rt-install-path.patch similarity index 90% rename from ports/llvm-12/0005-fix-compiler-rt-install-path.patch rename to ports/llvm-12/0007-fix-compiler-rt-install-path.patch index 48e5297b..28660462 100644 --- a/ports/llvm-12/0005-fix-compiler-rt-install-path.patch +++ b/ports/llvm-12/0007-fix-compiler-rt-install-path.patch @@ -4,10 +4,10 @@ 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt -index b2c0ce8dd4a0..f36e1578198d 100644 +index 0692fe75a441..65f72c2da7da 100644 --- a/clang/lib/Headers/CMakeLists.txt +++ b/clang/lib/Headers/CMakeLists.txt -@@ -215,7 +215,7 @@ set_target_properties(clang-resource-headers PROPERTIES +@@ -208,7 +208,7 @@ set_target_properties(clang-resource-headers PROPERTIES FOLDER "Misc" RUNTIME_OUTPUT_DIRECTORY "${output_dir}") @@ -17,7 +17,7 @@ index b2c0ce8dd4a0..f36e1578198d 100644 install( FILES ${files} ${generated_files} diff --git a/clang/runtime/CMakeLists.txt b/clang/runtime/CMakeLists.txt -index 61bbbf8faedd..1d913da1170b 100644 +index 61bbbf8faedd..f6d0b73d9913 100644 --- a/clang/runtime/CMakeLists.txt +++ b/clang/runtime/CMakeLists.txt @@ -82,7 +82,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND EXISTS ${COMPILER_RT_SRC_ROOT}/) @@ -30,10 +30,10 @@ index 61bbbf8faedd..1d913da1170b 100644 -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DLLVM_LIBDIR_SUFFIX=${LLVM_LIBDIR_SUFFIX} diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake -index 1edab43e7c0d..65c4835caa33 100644 +index 964dd598f102..7379a1ba06d1 100644 --- a/compiler-rt/cmake/base-config-ix.cmake +++ b/compiler-rt/cmake/base-config-ix.cmake -@@ -42,7 +42,7 @@ if (LLVM_TREE_AVAILABLE) +@@ -43,7 +43,7 @@ if (LLVM_TREE_AVAILABLE) # Setup the paths where compiler-rt runtimes and headers should be stored. set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}) set(COMPILER_RT_EXEC_OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) diff --git a/ports/llvm-12/0006-fix-libcxx-install.patch b/ports/llvm-12/0008-fix-libcxx-install.patch similarity index 100% rename from ports/llvm-12/0006-fix-libcxx-install.patch rename to ports/llvm-12/0008-fix-libcxx-install.patch diff --git a/ports/llvm-12/0007-fix-tools-install-path.patch b/ports/llvm-12/0009-fix-tools-install-path.patch similarity index 100% rename from ports/llvm-12/0007-fix-tools-install-path.patch rename to ports/llvm-12/0009-fix-tools-install-path.patch diff --git a/ports/llvm-12/0010-fix-libffi.patch b/ports/llvm-12/0010-fix-libffi.patch new file mode 100644 index 00000000..e9882559 --- /dev/null +++ b/ports/llvm-12/0010-fix-libffi.patch @@ -0,0 +1,16 @@ + llvm/cmake/config-ix.cmake | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake +index 818fafbce148..66fc9f509ac7 100644 +--- a/llvm/cmake/config-ix.cmake ++++ b/llvm/cmake/config-ix.cmake +@@ -335,7 +335,7 @@ if( LLVM_ENABLE_FFI ) + message(FATAL_ERROR "libffi includes are not found.") + endif() + +- find_library(FFI_LIBRARY_PATH ffi PATHS ${FFI_LIBRARY_DIR}) ++ find_library(FFI_LIBRARY_PATH NAMES ffi libffi PATHS ${FFI_LIBRARY_DIR}) + if( NOT FFI_LIBRARY_PATH ) + message(FATAL_ERROR "libffi is not found.") + endif() diff --git a/ports/llvm-12/0011-fix-libxml2.patch b/ports/llvm-12/0011-fix-libxml2.patch new file mode 100644 index 00000000..b5deff09 --- /dev/null +++ b/ports/llvm-12/0011-fix-libxml2.patch @@ -0,0 +1,34 @@ + clang/tools/c-index-test/CMakeLists.txt | 6 +----- + lldb/cmake/modules/LLDBConfig.cmake | 2 +- + 2 files changed, 2 insertions(+), 6 deletions(-) + +diff --git a/clang/tools/c-index-test/CMakeLists.txt b/clang/tools/c-index-test/CMakeLists.txt +index ceef4b086..40b9e9955 100644 +--- a/clang/tools/c-index-test/CMakeLists.txt ++++ b/clang/tools/c-index-test/CMakeLists.txt +@@ -40,11 +40,7 @@ set_target_properties(c-index-test + + # If libxml2 is available, make it available for c-index-test. + if (CLANG_HAVE_LIBXML) +- if ((CMAKE_OSX_SYSROOT) AND (EXISTS ${CMAKE_OSX_SYSROOT}/${LIBXML2_INCLUDE_DIR})) +- include_directories(SYSTEM ${CMAKE_OSX_SYSROOT}/${LIBXML2_INCLUDE_DIR}) +- else() +- include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR}) +- endif() ++ include_directories(SYSTEM ${LIBXML2_INCLUDE_DIRS}) + target_link_libraries(c-index-test PRIVATE ${LIBXML2_LIBRARIES}) + endif() + +diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake +index 2fdf1502d..beeeeb9b1 100644 +--- a/lldb/cmake/modules/LLDBConfig.cmake ++++ b/lldb/cmake/modules/LLDBConfig.cmake +@@ -214,7 +214,7 @@ if (LLDB_ENABLE_LZMA) + endif() + + if (LLDB_ENABLE_LIBXML2) +- include_directories(${LIBXML2_INCLUDE_DIR}) ++ include_directories(${LIBXML2_INCLUDE_DIRS}) + endif() + + include_directories(BEFORE diff --git a/ports/llvm-12/CONTROL b/ports/llvm-12/CONTROL deleted file mode 100644 index 0e362415..00000000 --- a/ports/llvm-12/CONTROL +++ /dev/null @@ -1,141 +0,0 @@ -Source: llvm-12 -Version: 12.0.1 -Homepage: https://llvm.org/ -Description: The LLVM Compiler Infrastructure -Supports: !uwp -Build-Depends: llvm-vcpkg-common, llvm-12[core, compiler-rt] (linux|osx) -Default-Features: tools, clang, mlir, enable-rtti, enable-z3, enable-eh, enable-assertions, disable-abi-breaking-checks, disable-terminfo, libcxx, libcxxabi, target-aarch64, target-arm, target-nvptx, target-sparc, target-x86 - -Feature: tools -Description: Build LLVM tools. - -Feature: utils -Description: Build LLVM utils. - -Feature: default-targets -Description: Build with platform-specific default targets -Build-Depends: llvm-12[core,target-x86] (x86|x64), llvm-12[core,target-arm] (arm&!arm64), llvm-12[core,target-aarch64] (arm64), llvm-12[core,target-all] (!x86&!x64&!arm&!arm64) - -Feature: target-all -Description: Build with all backends. -Build-Depends: llvm-12[core,target-aarch64,target-amdgpu,target-arm,target-bpf,target-hexagon,target-lanai,target-mips,target-msp430,target-nvptx,target-powerpc,target-riscv,target-sparc,target-systemz,target-webassembly,target-x86,target-xcore] - -Feature: target-aarch64 -Description: Build with AArch64 backend. - -Feature: target-amdgpu -Description: Build with AMDGPU backend. - -Feature: target-arm -Description: Build with ARM backend. - -Feature: target-avr -Description: Build with AVR backend. - -Feature: target-bpf -Description: Build with BPF backend. - -Feature: target-hexagon -Description: Build with Hexagon backend. - -Feature: target-lanai -Description: Build with Lanai backend. - -Feature: target-mips -Description: Build with Mips backend. - -Feature: target-msp430 -Description: Build with MSP430 backend. - -Feature: target-nvptx -Description: Build with NVPTX backend. - -Feature: target-powerpc -Description: Build with PowerPC backend. - -Feature: target-riscv -Description: Build with RISCV backend. - -Feature: target-sparc -Description: Build with Sparc backend. - -Feature: target-systemz -Description: Build with SystemZ backend. - -Feature: target-webassembly -Description: Build with WebAssembly backend. - -Feature: target-x86 -Description: Build with X86 backend. - -Feature: target-xcore -Description: Build with XCore backend. - -Feature: enable-rtti -Description: Build LLVM with run-time type information. - -Feature: enable-assertions -Description: Build LLVM with assertions. - -Feature: disable-assertions -Description: Build LLVM without assertions. - -Feature: enable-terminfo -Description: Build LLVM with linking to terminfo. -Build-Depends: ncurses - -Feature: disable-terminfo -Description: Build LLVM without linking to terminfo. - -Feature: enable-abi-breaking-checks -Description: Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_ON. - -Feature: disable-abi-breaking-checks -Description: Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_OFF. - -Feature: clang -Description: Build C Language Family Front-end. - -Feature: disable-clang-static-analyzer -Description: Build without static analyzer. - -Feature: clang-tools-extra -Description: Build Clang tools. - -Feature: compiler-rt -Description: Build compiler's runtime libraries. - -Feature: flang -Description: Build Fortran front end. -Build-Depends: llvm-12[core,mlir] - -Feature: lld -Description: Build LLVM linker. - -Feature: lldb -Description: Build LLDB debugger. - -Feature: mlir -Build-Depends: llvm-12[core,utils] -Description: Build Multi-Level IR Compiler Framework. - -Feature: openmp -Description: Build LLVM OpenMP libraries. -Build-Depends: llvm-12[core,utils] - -Feature: polly -Description: Build polyhedral optimizations for LLVM. -Build-Depends: llvm-12[core,utils] - -Feature: enable-z3 -Description: Compile with Z3 SMT solver support for Clang static analyzer. -Build-Depends: z3, llvm-12[core,clang] - -Feature: libcxx -Description: Build libcxx runtime - -Feature: libcxxabi -Description: Build libcxxabi runtime - -Feature: enable-eh -Description: Build LLVM with exception handler turned on. diff --git a/ports/llvm-12/clang_usage b/ports/llvm-12/clang_usage new file mode 100644 index 00000000..f239721f --- /dev/null +++ b/ports/llvm-12/clang_usage @@ -0,0 +1,5 @@ +The package clang provides CMake targets: + + find_package(Clang CONFIG REQUIRED) + target_include_directories(main PRIVATE ${CLANG_INCLUDE_DIRS}) + target_link_libraries(main PRIVATE clangBasic clangLex clangParse clangAST ...) diff --git a/ports/llvm-12/flang_usage b/ports/llvm-12/flang_usage new file mode 100644 index 00000000..b3cb0859 --- /dev/null +++ b/ports/llvm-12/flang_usage @@ -0,0 +1,5 @@ +The package flang provides CMake targets: + + find_package(Flang CONFIG REQUIRED) + target_include_directories(main PRIVATE ${FLANG_INCLUDE_DIRS}) + target_link_libraries(main PRIVATE flangFrontend flangFrontendTool ...) diff --git a/ports/llvm-12/lld_usage b/ports/llvm-12/lld_usage new file mode 100644 index 00000000..92c8d10a --- /dev/null +++ b/ports/llvm-12/lld_usage @@ -0,0 +1,5 @@ +The package lld provides CMake targets: + + find_package(LLD CONFIG REQUIRED) + target_include_directories(main PRIVATE ${LLD_INCLUDE_DIRS}) + target_link_libraries(main PRIVATE lldCommon lldCore lldDriver ...) diff --git a/ports/llvm-12/llvm_usage b/ports/llvm-12/llvm_usage new file mode 100644 index 00000000..72d57dbf --- /dev/null +++ b/ports/llvm-12/llvm_usage @@ -0,0 +1,15 @@ +The package llvm provides CMake targets: + + find_package(LLVM CONFIG REQUIRED) + + list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}") + include(HandleLLVMOptions) + add_definitions(${LLVM_DEFINITIONS}) + + target_include_directories(main PRIVATE ${LLVM_INCLUDE_DIRS}) + + # Find the libraries that correspond to the LLVM components that we wish to use + llvm_map_components_to_libnames(llvm_libs Support Core IRReader ...) + + # Link against LLVM libraries + target_link_libraries(main PRIVATE ${llvm_libs}) diff --git a/ports/llvm-12/mlir_usage b/ports/llvm-12/mlir_usage new file mode 100644 index 00000000..da45a161 --- /dev/null +++ b/ports/llvm-12/mlir_usage @@ -0,0 +1,5 @@ +The package lld provides CMake targets: + + find_package(MLIR CONFIG REQUIRED) + target_include_directories(main PRIVATE ${MLIR_INCLUDE_DIRS}) + target_link_libraries(main PRIVATE MLIRIR MLIRParser MLIRPass MLIRSupport ...) diff --git a/ports/llvm-12/portfile.cmake b/ports/llvm-12/portfile.cmake index 910c0ef8..c9b79f84 100644 --- a/ports/llvm-12/portfile.cmake +++ b/ports/llvm-12/portfile.cmake @@ -9,13 +9,15 @@ vcpkg_from_github( SHA512 6eb0dc18e2c25935fabfdfc48b0114be0939158dfdef7b85b395fe2e71042672446af0e68750aae003c9847d10d1f63316fe95d3df738d18f249174292b1b9e1 HEAD_REF main PATCHES - 0001-fix-install-paths.patch - 0002-fix-openmp-debug.patch - 0003-fix-dr-1734.patch - 0004-fix-tools-path.patch - 0005-fix-compiler-rt-install-path.patch - 0006-fix-libcxx-install.patch - 0007-fix-tools-install-path.patch + 0002-fix-install-paths.patch + 0003-fix-openmp-debug.patch + 0004-fix-dr-1734.patch + 0005-fix-tools-path.patch + 0007-fix-compiler-rt-install-path.patch + 0008-fix-libcxx-install.patch + 0009-fix-tools-install-path.patch + 0010-fix-libffi.patch + 0011-fix-libxml2.patch 0020-remove-FindZ3.cmake.patch 0021-fix-FindZ3.cmake.patch 0022-llvm-config-bin-path.patch diff --git a/ports/llvm-12/vcpkg.json b/ports/llvm-12/vcpkg.json new file mode 100644 index 00000000..05c5cb0a --- /dev/null +++ b/ports/llvm-12/vcpkg.json @@ -0,0 +1,360 @@ +{ + "name": "llvm-12", + "version": "12.0.1", + "description": "The LLVM Compiler Infrastructure.", + "homepage": "https://llvm.org", + "supports": "!uwp & !(arm & windows)", + "dependencies": [ + "llvm-vcpkg-common", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "clang", + "compiler-rt", + "default-options", + "default-targets", + "libcxx", + "mlir", + "tools" + ], + "features": { + "clang": { + "description": "Include C Language Family Front-end.", + "dependencies": [ + { + "name": "llvm-12", + "default-features": false, + "features": [ + "compiler-rt", + "tools" + ] + } + ] + }, + "clang-tools-extra": { + "description": "Include Clang tools." + }, + "compiler-rt": { + "description": "Include compiler's runtime libraries." + }, + "default-options": { + "description": "Build with default options.", + "dependencies": [ + { + "name": "llvm-12", + "default-features": false, + "features": [ + "disable-abi-breaking-checks", + "enable-assertions", + "enable-bindings", + "enable-eh", + "enable-threads", + "enable-z3", + "enable-zlib" + ] + } + ] + }, + "default-targets": { + "description": "Build with platform-specific default targets.", + "dependencies": [ + { + "name": "llvm-12", + "default-features": false, + "features": [ + "target-aarch64" + ], + "platform": "arm64" + }, + { + "name": "llvm-12", + "default-features": false, + "features": [ + "target-x86" + ], + "platform": "x86 | x64" + }, + { + "name": "llvm-12", + "default-features": false, + "features": [ + "target-arm" + ], + "platform": "arm & !arm64" + }, + { + "name": "llvm-12", + "default-features": false, + "features": [ + "target-all" + ], + "platform": "!x86 & !x64 & !arm & !arm64" + } + ] + }, + "disable-abi-breaking-checks": { + "description": "Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_OFF." + }, + "disable-assertions": { + "description": "Build LLVM without assertions." + }, + "disable-clang-static-analyzer": { + "description": "Build without static analyzer." + }, + "enable-abi-breaking-checks": { + "description": "Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_ON." + }, + "enable-assertions": { + "description": "Build LLVM with assertions." + }, + "enable-bindings": { + "description": "Build bindings." + }, + "enable-eh": { + "description": "Build LLVM with exception handler.", + "dependencies": [ + { + "name": "llvm-12", + "default-features": false, + "features": [ + "enable-rtti" + ] + } + ] + }, + "enable-ffi": { + "description": "Build LLVM with FFI.", + "dependencies": [ + "libffi" + ] + }, + "enable-libxml2": { + "description": "Build with LibXml2.", + "dependencies": [ + "libxml2" + ] + }, + "enable-rtti": { + "description": "Build LLVM with run-time type information." + }, + "enable-terminfo": { + "description": "Use terminfo database if available." + }, + "enable-threads": { + "description": "Use threads if available." + }, + "enable-zlib": { + "description": "Build with ZLib.", + "dependencies": [ + "zlib" + ] + }, + "enable-z3": { + "description": "Compile with Z3 SMT solver support for Clang static analyzer.", + "dependencies": [ + "z3", + { + "name": "llvm-12", + "default-features": false, + "features": [ + "clang" + ] + } + ] + }, + "flang": { + "description": "Include Fortran front end.", + "dependencies": [ + { + "name": "llvm-12", + "default-features": false, + "features": [ + "clang", + "mlir", + "tools" + ] + } + ] + }, + "libclc": { + "description": "Include OpenCL library." + }, + "libcxx": { + "description": "Include libcxx library.", + "dependencies": [ + { + "name": "llvm-12", + "default-features": false, + "features": [ + "libcxxabi" + ] + } + ] + }, + "libcxxabi": { + "description": "Include libcxxabi library." + }, + "libunwind": { + "description": "Include libunwind library." + }, + "lld": { + "description": "Include LLVM linker.", + "dependencies": [ + { + "name": "llvm-12", + "default-features": false, + "features": [ + "tools" + ] + } + ] + }, + "lldb": { + "description": "Include LLVM debugger.", + "dependencies": [ + { + "name": "llvm-12", + "default-features": false, + "features": [ + "tools" + ] + } + ] + }, + "mlir": { + "description": "Include MLIR (Multi-Level IR Compiler Framework) project.", + "dependencies": [ + { + "name": "llvm-12", + "default-features": false, + "features": [ + "tools" + ] + } + ] + }, + "openmp": { + "description": "Include LLVM OpenMP libraries.", + "dependencies": [ + { + "name": "llvm-12", + "default-features": false, + "features": [ + "utils" + ] + } + ] + }, + "parallel-libs": { + "description": "Include parallel-libs project." + }, + "polly": { + "description": "Include Polly (Polyhedral optimizations for LLVM) project.", + "dependencies": [ + { + "name": "llvm-12", + "default-features": false, + "features": [ + "tools", + "utils" + ] + } + ] + }, + "pstl": { + "description": "Include pstl (Parallel STL) library." + }, + "target-aarch64": { + "description": "Build with AArch64 backend." + }, + "target-all": { + "description": "Build with all backends.", + "dependencies": [ + { + "name": "llvm-12", + "default-features": false, + "features": [ + "target-aarch64", + "target-amdgpu", + "target-arm", + "target-avr", + "target-bpf", + "target-hexagon", + "target-lanai", + "target-mips", + "target-msp430", + "target-nvptx", + "target-powerpc", + "target-riscv", + "target-sparc", + "target-systemz", + "target-webassembly", + "target-x86", + "target-xcore" + ] + } + ] + }, + "target-amdgpu": { + "description": "Build with AMDGPU backend." + }, + "target-arm": { + "description": "Build with ARM backend." + }, + "target-avr": { + "description": "Build with AVR backend." + }, + "target-bpf": { + "description": "Build with BPF backend." + }, + "target-hexagon": { + "description": "Build with Hexagon backend." + }, + "target-lanai": { + "description": "Build with Lanai backend." + }, + "target-mips": { + "description": "Build with Mips backend." + }, + "target-msp430": { + "description": "Build with MSP430 backend." + }, + "target-nvptx": { + "description": "Build with NVPTX backend." + }, + "target-powerpc": { + "description": "Build with PowerPC backend." + }, + "target-riscv": { + "description": "Build with RISC-V backend." + }, + "target-sparc": { + "description": "Build with Sparc backend." + }, + "target-systemz": { + "description": "Build with SystemZ backend." + }, + "target-webassembly": { + "description": "Build with WebAssembly backend." + }, + "target-x86": { + "description": "Build with X86 backend." + }, + "target-xcore": { + "description": "Build with XCore backend." + }, + "tools": { + "description": "Build LLVM tools." + }, + "utils": { + "description": "Build LLVM utils." + } + } +} diff --git a/ports/llvm-13/0001-fix-install-paths.patch b/ports/llvm-13/0002-fix-install-paths.patch similarity index 93% rename from ports/llvm-13/0001-fix-install-paths.patch rename to ports/llvm-13/0002-fix-install-paths.patch index c2f214d2..3582bcbf 100644 --- a/ports/llvm-13/0001-fix-install-paths.patch +++ b/ports/llvm-13/0002-fix-install-paths.patch @@ -1,3 +1,13 @@ + clang/cmake/modules/CMakeLists.txt | 4 ++-- + flang/cmake/modules/CMakeLists.txt | 4 ++-- + lld/cmake/modules/CMakeLists.txt | 4 ++-- + llvm/cmake/modules/AddLLVM.cmake | 2 +- + llvm/cmake/modules/CMakeLists.txt | 2 +- + mlir/cmake/modules/CMakeLists.txt | 4 ++-- + polly/cmake/CMakeLists.txt | 4 ++-- + pstl/CMakeLists.txt | 4 ++-- + 8 files changed, 14 insertions(+), 14 deletions(-) + diff --git a/clang/cmake/modules/CMakeLists.txt b/clang/cmake/modules/CMakeLists.txt index 561665d58cad..3c73878a4483 100644 --- a/clang/cmake/modules/CMakeLists.txt diff --git a/ports/llvm-13/0002-fix-openmp-debug.patch b/ports/llvm-13/0003-fix-openmp-debug.patch similarity index 91% rename from ports/llvm-13/0002-fix-openmp-debug.patch rename to ports/llvm-13/0003-fix-openmp-debug.patch index d6b9197d..3eff4fa5 100644 --- a/ports/llvm-13/0002-fix-openmp-debug.patch +++ b/ports/llvm-13/0003-fix-openmp-debug.patch @@ -1,3 +1,6 @@ + openmp/runtime/src/CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt index bdb867e352f7..16a13fa959ea 100644 --- a/openmp/runtime/src/CMakeLists.txt diff --git a/ports/llvm-13/0003-fix-dr-1734.patch b/ports/llvm-13/0004-fix-dr-1734.patch similarity index 88% rename from ports/llvm-13/0003-fix-dr-1734.patch rename to ports/llvm-13/0004-fix-dr-1734.patch index 8b0a9bb4..e8bd159b 100644 --- a/ports/llvm-13/0003-fix-dr-1734.patch +++ b/ports/llvm-13/0004-fix-dr-1734.patch @@ -1,3 +1,6 @@ + llvm/include/llvm/Support/type_traits.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + diff --git a/llvm/include/llvm/Support/type_traits.h b/llvm/include/llvm/Support/type_traits.h index 7b7d5d991f3f..332864c1907e 100644 --- a/llvm/include/llvm/Support/type_traits.h diff --git a/ports/llvm-13/0004-fix-tools-path.patch b/ports/llvm-13/0005-fix-tools-path.patch similarity index 87% rename from ports/llvm-13/0004-fix-tools-path.patch rename to ports/llvm-13/0005-fix-tools-path.patch index bc89e33d..06fc8fc2 100644 --- a/ports/llvm-13/0004-fix-tools-path.patch +++ b/ports/llvm-13/0005-fix-tools-path.patch @@ -1,3 +1,6 @@ + llvm/tools/llvm-config/llvm-config.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp index 1a2f04552d13..9370c5e28206 100644 --- a/llvm/tools/llvm-config/llvm-config.cpp diff --git a/ports/llvm-13/0005-fix-compiler-rt-install-path.patch b/ports/llvm-13/0007-fix-compiler-rt-install-path.patch similarity index 92% rename from ports/llvm-13/0005-fix-compiler-rt-install-path.patch rename to ports/llvm-13/0007-fix-compiler-rt-install-path.patch index d4886472..6a585cd4 100644 --- a/ports/llvm-13/0005-fix-compiler-rt-install-path.patch +++ b/ports/llvm-13/0007-fix-compiler-rt-install-path.patch @@ -1,3 +1,8 @@ + clang/lib/Headers/CMakeLists.txt | 2 +- + clang/runtime/CMakeLists.txt | 2 +- + compiler-rt/cmake/base-config-ix.cmake | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt index 8131f6005dc2..9afef2e5a4e7 100644 --- a/clang/lib/Headers/CMakeLists.txt diff --git a/ports/llvm-13/0006-fix-tools-install-path.patch b/ports/llvm-13/0009-fix-tools-install-path.patch similarity index 84% rename from ports/llvm-13/0006-fix-tools-install-path.patch rename to ports/llvm-13/0009-fix-tools-install-path.patch index 3e5695f1..bfc5c5fc 100644 --- a/ports/llvm-13/0006-fix-tools-install-path.patch +++ b/ports/llvm-13/0009-fix-tools-install-path.patch @@ -1,3 +1,18 @@ + clang-tools-extra/modularize/CMakeLists.txt | 2 +- + clang/cmake/modules/AddClang.cmake | 2 +- + clang/tools/c-index-test/CMakeLists.txt | 2 +- + clang/tools/clang-format/CMakeLists.txt | 2 +- + clang/tools/scan-build/CMakeLists.txt | 2 +- + clang/tools/scan-view/CMakeLists.txt | 2 +- + clang/utils/hmaptool/CMakeLists.txt | 2 +- + flang/cmake/modules/AddFlang.cmake | 2 +- + flang/tools/f18/CMakeLists.txt | 4 ++-- + flang/tools/flang-driver/CMakeLists.txt | 2 +- + lld/cmake/modules/AddLLD.cmake | 2 +- + lld/tools/lld/CMakeLists.txt | 2 +- + lldb/cmake/modules/AddLLDB.cmake | 2 +- + 13 files changed, 14 insertions(+), 14 deletions(-) + diff --git a/clang-tools-extra/modularize/CMakeLists.txt b/clang-tools-extra/modularize/CMakeLists.txt index 4caae81c49b6..8c459c51cc34 100644 --- a/clang-tools-extra/modularize/CMakeLists.txt @@ -118,6 +133,16 @@ index 239859b5e5b9..12d00f904f8a 100644 - install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/flang DESTINATION bin) + install(PROGRAMS ${CMAKE_BINARY_DIR}/bin/flang DESTINATION tools/llvm) endif() +diff --git a/flang/tools/flang-driver/CMakeLists.txt b/flang/tools/flang-driver/CMakeLists.txt +index 4c7ad220d223..f4206913e76f 100644 +--- a/flang/tools/flang-driver/CMakeLists.txt ++++ b/flang/tools/flang-driver/CMakeLists.txt +@@ -27,4 +27,4 @@ clang_target_link_libraries(flang-new + clangBasic + ) + +-install(TARGETS flang-new DESTINATION bin) ++install(TARGETS flang-new DESTINATION tools/llvm) diff --git a/lld/cmake/modules/AddLLD.cmake b/lld/cmake/modules/AddLLD.cmake index 9883475d1aa5..48e46586f387 100644 --- a/lld/cmake/modules/AddLLD.cmake diff --git a/ports/llvm-13/0010-fix-libffi.patch b/ports/llvm-13/0010-fix-libffi.patch new file mode 100644 index 00000000..93d0cb4d --- /dev/null +++ b/ports/llvm-13/0010-fix-libffi.patch @@ -0,0 +1,16 @@ + llvm/cmake/config-ix.cmake | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake +index dd0aaadb47c7..279435b5b27d 100644 +--- a/llvm/cmake/config-ix.cmake ++++ b/llvm/cmake/config-ix.cmake +@@ -343,7 +343,7 @@ if( LLVM_ENABLE_FFI ) + message(FATAL_ERROR "libffi includes are not found.") + endif() + +- find_library(FFI_LIBRARY_PATH ffi PATHS ${FFI_LIBRARY_DIR}) ++ find_library(FFI_LIBRARY_PATH NAMES ffi libffi PATHS ${FFI_LIBRARY_DIR}) + if( NOT FFI_LIBRARY_PATH ) + message(FATAL_ERROR "libffi is not found.") + endif() diff --git a/ports/llvm-13/0011-fix-libxml2.patch b/ports/llvm-13/0011-fix-libxml2.patch new file mode 100644 index 00000000..d3f953f3 --- /dev/null +++ b/ports/llvm-13/0011-fix-libxml2.patch @@ -0,0 +1,34 @@ + clang/tools/c-index-test/CMakeLists.txt | 6 +----- + lldb/cmake/modules/LLDBConfig.cmake | 2 +- + 2 files changed, 2 insertions(+), 6 deletions(-) + +diff --git a/clang/tools/c-index-test/CMakeLists.txt b/clang/tools/c-index-test/CMakeLists.txt +index ceef4b08637c..40b9e995597f 100644 +--- a/clang/tools/c-index-test/CMakeLists.txt ++++ b/clang/tools/c-index-test/CMakeLists.txt +@@ -40,11 +40,7 @@ set_target_properties(c-index-test + + # If libxml2 is available, make it available for c-index-test. + if (CLANG_HAVE_LIBXML) +- if ((CMAKE_OSX_SYSROOT) AND (EXISTS ${CMAKE_OSX_SYSROOT}/${LIBXML2_INCLUDE_DIR})) +- include_directories(SYSTEM ${CMAKE_OSX_SYSROOT}/${LIBXML2_INCLUDE_DIR}) +- else() +- include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR}) +- endif() ++ include_directories(SYSTEM ${LIBXML2_INCLUDE_DIRS}) + target_link_libraries(c-index-test PRIVATE ${LIBXML2_LIBRARIES}) + endif() + +diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake +index b62cd7d24438..a8c78ee1bccd 100644 +--- a/lldb/cmake/modules/LLDBConfig.cmake ++++ b/lldb/cmake/modules/LLDBConfig.cmake +@@ -215,7 +215,7 @@ if (LLDB_ENABLE_LZMA) + endif() + + if (LLDB_ENABLE_LIBXML2) +- include_directories(${LIBXML2_INCLUDE_DIR}) ++ include_directories(${LIBXML2_INCLUDE_DIRS}) + endif() + + include_directories(BEFORE diff --git a/ports/llvm-13/CONTROL b/ports/llvm-13/CONTROL deleted file mode 100644 index fd1e74f3..00000000 --- a/ports/llvm-13/CONTROL +++ /dev/null @@ -1,141 +0,0 @@ -Source: llvm-13 -Version: 13.0.0 -Homepage: https://llvm.org/ -Description: The LLVM Compiler Infrastructure -Supports: !uwp -Build-Depends: llvm-vcpkg-common, llvm-13[core, compiler-rt] (linux|osx) -Default-Features: tools, clang, mlir, enable-rtti, enable-z3, enable-eh, enable-assertions, disable-abi-breaking-checks, disable-terminfo, libcxx, libcxxabi, target-aarch64, target-arm, target-nvptx, target-sparc, target-x86 - -Feature: tools -Description: Build LLVM tools. - -Feature: utils -Description: Build LLVM utils. - -Feature: default-targets -Description: Build with platform-specific default targets -Build-Depends: llvm-13[core,target-x86] (x86|x64), llvm-13[core,target-arm] (arm&!arm64), llvm-13[core,target-aarch64] (arm64), llvm-13[core,target-all] (!x86&!x64&!arm&!arm64) - -Feature: target-all -Description: Build with all backends. -Build-Depends: llvm-13[core,target-aarch64,target-amdgpu,target-arm,target-bpf,target-hexagon,target-lanai,target-mips,target-msp430,target-nvptx,target-powerpc,target-riscv,target-sparc,target-systemz,target-webassembly,target-x86,target-xcore] - -Feature: target-aarch64 -Description: Build with AArch64 backend. - -Feature: target-amdgpu -Description: Build with AMDGPU backend. - -Feature: target-arm -Description: Build with ARM backend. - -Feature: target-avr -Description: Build with AVR backend. - -Feature: target-bpf -Description: Build with BPF backend. - -Feature: target-hexagon -Description: Build with Hexagon backend. - -Feature: target-lanai -Description: Build with Lanai backend. - -Feature: target-mips -Description: Build with Mips backend. - -Feature: target-msp430 -Description: Build with MSP430 backend. - -Feature: target-nvptx -Description: Build with NVPTX backend. - -Feature: target-powerpc -Description: Build with PowerPC backend. - -Feature: target-riscv -Description: Build with RISCV backend. - -Feature: target-sparc -Description: Build with Sparc backend. - -Feature: target-systemz -Description: Build with SystemZ backend. - -Feature: target-webassembly -Description: Build with WebAssembly backend. - -Feature: target-x86 -Description: Build with X86 backend. - -Feature: target-xcore -Description: Build with XCore backend. - -Feature: enable-rtti -Description: Build LLVM with run-time type information. - -Feature: enable-assertions -Description: Build LLVM with assertions. - -Feature: disable-assertions -Description: Build LLVM without assertions. - -Feature: enable-terminfo -Description: Build LLVM with linking to terminfo. -Build-Depends: ncurses - -Feature: disable-terminfo -Description: Build LLVM without linking to terminfo. - -Feature: enable-abi-breaking-checks -Description: Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_ON. - -Feature: disable-abi-breaking-checks -Description: Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_OFF. - -Feature: clang -Description: Build C Language Family Front-end. - -Feature: disable-clang-static-analyzer -Description: Build without static analyzer. - -Feature: clang-tools-extra -Description: Build Clang tools. - -Feature: compiler-rt -Description: Build compiler's runtime libraries. - -Feature: flang -Description: Build Fortran front end. -Build-Depends: llvm-13[core,mlir] - -Feature: lld -Description: Build LLVM linker. - -Feature: lldb -Description: Build LLDB debugger. - -Feature: mlir -Build-Depends: llvm-13[core,utils] -Description: Build Multi-Level IR Compiler Framework. - -Feature: openmp -Description: Build LLVM OpenMP libraries. -Build-Depends: llvm-13[core,utils] - -Feature: polly -Description: Build polyhedral optimizations for LLVM. -Build-Depends: llvm-13[core,utils] - -Feature: enable-z3 -Description: Compile with Z3 SMT solver support for Clang static analyzer. -Build-Depends: z3, llvm-13[core,clang] - -Feature: libcxx -Description: Build libcxx runtime - -Feature: libcxxabi -Description: Build libcxxabi runtime - -Feature: enable-eh -Description: Build LLVM with exception handler turned on. diff --git a/ports/llvm-13/clang_usage b/ports/llvm-13/clang_usage new file mode 100644 index 00000000..f239721f --- /dev/null +++ b/ports/llvm-13/clang_usage @@ -0,0 +1,5 @@ +The package clang provides CMake targets: + + find_package(Clang CONFIG REQUIRED) + target_include_directories(main PRIVATE ${CLANG_INCLUDE_DIRS}) + target_link_libraries(main PRIVATE clangBasic clangLex clangParse clangAST ...) diff --git a/ports/llvm-13/flang_usage b/ports/llvm-13/flang_usage new file mode 100644 index 00000000..b3cb0859 --- /dev/null +++ b/ports/llvm-13/flang_usage @@ -0,0 +1,5 @@ +The package flang provides CMake targets: + + find_package(Flang CONFIG REQUIRED) + target_include_directories(main PRIVATE ${FLANG_INCLUDE_DIRS}) + target_link_libraries(main PRIVATE flangFrontend flangFrontendTool ...) diff --git a/ports/llvm-13/lld_usage b/ports/llvm-13/lld_usage new file mode 100644 index 00000000..92c8d10a --- /dev/null +++ b/ports/llvm-13/lld_usage @@ -0,0 +1,5 @@ +The package lld provides CMake targets: + + find_package(LLD CONFIG REQUIRED) + target_include_directories(main PRIVATE ${LLD_INCLUDE_DIRS}) + target_link_libraries(main PRIVATE lldCommon lldCore lldDriver ...) diff --git a/ports/llvm-13/llvm_usage b/ports/llvm-13/llvm_usage new file mode 100644 index 00000000..72d57dbf --- /dev/null +++ b/ports/llvm-13/llvm_usage @@ -0,0 +1,15 @@ +The package llvm provides CMake targets: + + find_package(LLVM CONFIG REQUIRED) + + list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}") + include(HandleLLVMOptions) + add_definitions(${LLVM_DEFINITIONS}) + + target_include_directories(main PRIVATE ${LLVM_INCLUDE_DIRS}) + + # Find the libraries that correspond to the LLVM components that we wish to use + llvm_map_components_to_libnames(llvm_libs Support Core IRReader ...) + + # Link against LLVM libraries + target_link_libraries(main PRIVATE ${llvm_libs}) diff --git a/ports/llvm-13/mlir_usage b/ports/llvm-13/mlir_usage new file mode 100644 index 00000000..da45a161 --- /dev/null +++ b/ports/llvm-13/mlir_usage @@ -0,0 +1,5 @@ +The package lld provides CMake targets: + + find_package(MLIR CONFIG REQUIRED) + target_include_directories(main PRIVATE ${MLIR_INCLUDE_DIRS}) + target_link_libraries(main PRIVATE MLIRIR MLIRParser MLIRPass MLIRSupport ...) diff --git a/ports/llvm-13/portfile.cmake b/ports/llvm-13/portfile.cmake index 08381e54..f708ca85 100644 --- a/ports/llvm-13/portfile.cmake +++ b/ports/llvm-13/portfile.cmake @@ -9,12 +9,14 @@ vcpkg_from_github( SHA512 8004c05d32b9720fb3391783621690c1df9bd1e97e72cbff9192ed88a84b0acd303b61432145fa917b5b5e548c8cee29b24ef8547dcc8677adf4816e7a8a0eb2 HEAD_REF main PATCHES - 0001-fix-install-paths.patch - 0002-fix-openmp-debug.patch - 0003-fix-dr-1734.patch - 0004-fix-tools-path.patch - 0005-fix-compiler-rt-install-path.patch - 0006-fix-tools-install-path.patch + 0002-fix-install-paths.patch + 0003-fix-openmp-debug.patch + 0004-fix-dr-1734.patch + 0005-fix-tools-path.patch + 0007-fix-compiler-rt-install-path.patch + 0009-fix-tools-install-path.patch + 0010-fix-libffi.patch + 0011-fix-libxml2.patch 0020-remove-FindZ3.cmake.patch 0021-fix-FindZ3.cmake.patch 0022-llvm-config-bin-path.patch diff --git a/ports/llvm-13/vcpkg.json b/ports/llvm-13/vcpkg.json new file mode 100644 index 00000000..9206bcf5 --- /dev/null +++ b/ports/llvm-13/vcpkg.json @@ -0,0 +1,360 @@ +{ + "name": "llvm-13", + "version": "13.0.0", + "description": "The LLVM Compiler Infrastructure.", + "homepage": "https://llvm.org", + "supports": "!uwp & !(arm & windows)", + "dependencies": [ + "llvm-vcpkg-common", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "clang", + "compiler-rt", + "default-options", + "default-targets", + "libcxx", + "mlir", + "tools" + ], + "features": { + "clang": { + "description": "Include C Language Family Front-end.", + "dependencies": [ + { + "name": "llvm-13", + "default-features": false, + "features": [ + "compiler-rt", + "tools" + ] + } + ] + }, + "clang-tools-extra": { + "description": "Include Clang tools." + }, + "compiler-rt": { + "description": "Include compiler's runtime libraries." + }, + "default-options": { + "description": "Build with default options.", + "dependencies": [ + { + "name": "llvm-13", + "default-features": false, + "features": [ + "disable-abi-breaking-checks", + "enable-assertions", + "enable-bindings", + "enable-eh", + "enable-threads", + "enable-z3", + "enable-zlib" + ] + } + ] + }, + "default-targets": { + "description": "Build with platform-specific default targets.", + "dependencies": [ + { + "name": "llvm-13", + "default-features": false, + "features": [ + "target-aarch64" + ], + "platform": "arm64" + }, + { + "name": "llvm-13", + "default-features": false, + "features": [ + "target-x86" + ], + "platform": "x86 | x64" + }, + { + "name": "llvm-13", + "default-features": false, + "features": [ + "target-arm" + ], + "platform": "arm & !arm64" + }, + { + "name": "llvm-13", + "default-features": false, + "features": [ + "target-all" + ], + "platform": "!x86 & !x64 & !arm & !arm64" + } + ] + }, + "disable-abi-breaking-checks": { + "description": "Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_OFF." + }, + "disable-assertions": { + "description": "Build LLVM without assertions." + }, + "disable-clang-static-analyzer": { + "description": "Build without static analyzer." + }, + "enable-abi-breaking-checks": { + "description": "Build LLVM with LLVM_ABI_BREAKING_CHECKS=FORCE_ON." + }, + "enable-assertions": { + "description": "Build LLVM with assertions." + }, + "enable-bindings": { + "description": "Build bindings." + }, + "enable-eh": { + "description": "Build LLVM with exception handler.", + "dependencies": [ + { + "name": "llvm-13", + "default-features": false, + "features": [ + "enable-rtti" + ] + } + ] + }, + "enable-ffi": { + "description": "Build LLVM with FFI.", + "dependencies": [ + "libffi" + ] + }, + "enable-libxml2": { + "description": "Build with LibXml2.", + "dependencies": [ + "libxml2" + ] + }, + "enable-rtti": { + "description": "Build LLVM with run-time type information." + }, + "enable-terminfo": { + "description": "Use terminfo database if available." + }, + "enable-threads": { + "description": "Use threads if available." + }, + "enable-zlib": { + "description": "Build with ZLib.", + "dependencies": [ + "zlib" + ] + }, + "enable-z3": { + "description": "Compile with Z3 SMT solver support for Clang static analyzer.", + "dependencies": [ + "z3", + { + "name": "llvm-13", + "default-features": false, + "features": [ + "clang" + ] + } + ] + }, + "flang": { + "description": "Include Fortran front end.", + "dependencies": [ + { + "name": "llvm-13", + "default-features": false, + "features": [ + "clang", + "mlir", + "tools" + ] + } + ] + }, + "libclc": { + "description": "Include OpenCL library." + }, + "libcxx": { + "description": "Include libcxx library.", + "dependencies": [ + { + "name": "llvm-13", + "default-features": false, + "features": [ + "libcxxabi" + ] + } + ] + }, + "libcxxabi": { + "description": "Include libcxxabi library." + }, + "libunwind": { + "description": "Include libunwind library." + }, + "lld": { + "description": "Include LLVM linker.", + "dependencies": [ + { + "name": "llvm-13", + "default-features": false, + "features": [ + "tools" + ] + } + ] + }, + "lldb": { + "description": "Include LLVM debugger.", + "dependencies": [ + { + "name": "llvm-13", + "default-features": false, + "features": [ + "tools" + ] + } + ] + }, + "mlir": { + "description": "Include MLIR (Multi-Level IR Compiler Framework) project.", + "dependencies": [ + { + "name": "llvm-13", + "default-features": false, + "features": [ + "tools" + ] + } + ] + }, + "openmp": { + "description": "Include LLVM OpenMP libraries.", + "dependencies": [ + { + "name": "llvm-13", + "default-features": false, + "features": [ + "utils" + ] + } + ] + }, + "parallel-libs": { + "description": "Include parallel-libs project." + }, + "polly": { + "description": "Include Polly (Polyhedral optimizations for LLVM) project.", + "dependencies": [ + { + "name": "llvm-13", + "default-features": false, + "features": [ + "tools", + "utils" + ] + } + ] + }, + "pstl": { + "description": "Include pstl (Parallel STL) library." + }, + "target-aarch64": { + "description": "Build with AArch64 backend." + }, + "target-all": { + "description": "Build with all backends.", + "dependencies": [ + { + "name": "llvm-13", + "default-features": false, + "features": [ + "target-aarch64", + "target-amdgpu", + "target-arm", + "target-avr", + "target-bpf", + "target-hexagon", + "target-lanai", + "target-mips", + "target-msp430", + "target-nvptx", + "target-powerpc", + "target-riscv", + "target-sparc", + "target-systemz", + "target-webassembly", + "target-x86", + "target-xcore" + ] + } + ] + }, + "target-amdgpu": { + "description": "Build with AMDGPU backend." + }, + "target-arm": { + "description": "Build with ARM backend." + }, + "target-avr": { + "description": "Build with AVR backend." + }, + "target-bpf": { + "description": "Build with BPF backend." + }, + "target-hexagon": { + "description": "Build with Hexagon backend." + }, + "target-lanai": { + "description": "Build with Lanai backend." + }, + "target-mips": { + "description": "Build with Mips backend." + }, + "target-msp430": { + "description": "Build with MSP430 backend." + }, + "target-nvptx": { + "description": "Build with NVPTX backend." + }, + "target-powerpc": { + "description": "Build with PowerPC backend." + }, + "target-riscv": { + "description": "Build with RISC-V backend." + }, + "target-sparc": { + "description": "Build with Sparc backend." + }, + "target-systemz": { + "description": "Build with SystemZ backend." + }, + "target-webassembly": { + "description": "Build with WebAssembly backend." + }, + "target-x86": { + "description": "Build with X86 backend." + }, + "target-xcore": { + "description": "Build with XCore backend." + }, + "tools": { + "description": "Build LLVM tools." + }, + "utils": { + "description": "Build LLVM utils." + } + } +} diff --git a/ports/llvm-vcpkg-common/CONTROL b/ports/llvm-vcpkg-common/CONTROL index 656f8bb6..d606dba9 100644 --- a/ports/llvm-vcpkg-common/CONTROL +++ b/ports/llvm-vcpkg-common/CONTROL @@ -1,4 +1,4 @@ Source: llvm-vcpkg-common -Version: 1 -Port-Version: 1 +Version: 2 +Port-Version: 0 Description: A common build script for building all LLVM versions with vcpkg diff --git a/ports/llvm-vcpkg-common/llvm-common-build.cmake b/ports/llvm-vcpkg-common/llvm-common-build.cmake index 172f4cee..be79f447 100644 --- a/ports/llvm-vcpkg-common/llvm-common-build.cmake +++ b/ports/llvm-vcpkg-common/llvm-common-build.cmake @@ -16,8 +16,12 @@ vcpkg_check_features( utils LLVM_INCLUDE_UTILS utils LLVM_INSTALL_UTILS enable-rtti LLVM_ENABLE_RTTI - enable-z3 LLVM_ENABLE_Z3_SOLVER + enable-ffi LLVM_ENABLE_FFI + enable-terminfo LLVM_ENABLE_TERMINFO + enable-threads LLVM_ENABLE_THREADS enable-eh LLVM_ENABLE_EH + enable-bindings LLVM_ENABLE_BINDINGS + enable-z3 LLVM_ENABLE_Z3_SOLVER ) # Linking with gold is better than /bin/ld @@ -45,6 +49,12 @@ if(VCPKG_TARGET_IS_LINUX) endif() endif() +if(VCPKG_USE_SANITIZER) + list(APPEND FEATURE_OPTIONS + -DLLVM_USE_SANITIZER=${VCPKG_USE_SANITIZER} + ) +endif() + # LLVM generates CMake error due to Visual Studio version 16.4 is known to miscompile part of LLVM. # LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON disables this error. # See https://developercommunity.visualstudio.com/content/problem/845933/miscompile-boolean-condition-deduced-to-be-always.html @@ -53,11 +63,24 @@ list(APPEND FEATURE_OPTIONS -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON ) -if(VCPKG_USE_SANITIZER) - list(APPEND FEATURE_OPTIONS - -DLLVM_USE_SANITIZER=${VCPKG_USE_SANITIZER} +# Force enable or disable external libraries +set(llvm_external_libraries + zlib + libxml2 +) +foreach(external_library IN LISTS llvm_external_libraries) + string(TOLOWER "enable-${external_library}" feature_name) + string(TOUPPER "LLVM_ENABLE_${external_library}" define_name) + if(feature_name IN_LIST FEATURES) + list(APPEND FEATURE_OPTIONS + -D${define_name}=FORCE_ON ) -endif() + else() + list(APPEND FEATURE_OPTIONS + -D${define_name}=OFF + ) + endif() +endforeach() # By default assertions are enabled for Debug configuration only. if("enable-assertions" IN_LIST FEATURES) @@ -72,18 +95,6 @@ elseif("disable-assertions" IN_LIST FEATURES) ) endif() -if("enable-terminfo" IN_LIST FEATURES) - # Force enable terminfo for all configurations. - list(APPEND FEATURE_OPTIONS - -DLLVM_ENABLE_TERMINFO=ON - ) -elseif("disable-terminfo" IN_LIST FEATURES) - # Force disable terminfo for all configurations. - list(APPEND FEATURE_OPTIONS - -DLLVM_ENABLE_TERMINFO=OFF - ) -endif() - # LLVM_ABI_BREAKING_CHECKS can be WITH_ASSERTS (default), FORCE_ON or FORCE_OFF. # By default abi-breaking checks are enabled if assertions are enabled. if("enable-abi-breaking-checks" IN_LIST FEATURES) @@ -131,12 +142,6 @@ if("clang-tools-extra" IN_LIST FEATURES) endif() if("compiler-rt" IN_LIST FEATURES) list(APPEND LLVM_ENABLE_PROJECTS "compiler-rt") - if(VCPKG_TARGET_IS_OSX AND LLVM_VERSION_MAJOR LESS_EQUAL 10) - # prevent compiler_rt from opportunistically trying to build arm64, which fails - # See: https://trac.macports.org/ticket/61477 - # and https://github.com/macports/macports-ports/pull/9139 - list(APPEND FEATURE_OPTIONS "-DDARWIN_osx_ARCHS=x86_64\;x86_64h") - endif() endif() if("flang" IN_LIST FEATURES) # Disable Flang on Windows (see http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html). @@ -171,21 +176,12 @@ if("libcxx" IN_LIST FEATURES) -DLIBCXX_ENABLE_SHARED=YES ) endif() - #if(VCPKG_TARGET_IS_WINDOWS) - # message(FATAL_ERROR "Building libcxx with MSVC is not supported. Disable it until issues are fixed.") - #endif() list(APPEND LLVM_ENABLE_PROJECTS "libcxx") endif() if("libcxxabi" IN_LIST FEATURES) - #if(VCPKG_TARGET_IS_WINDOWS) - # message(FATAL_ERROR "Building libcxxabi with MSVC is not supported. Disable it until issues are fixed.") - #endif() list(APPEND LLVM_ENABLE_PROJECTS "libcxxabi") endif() if("libunwind" IN_LIST FEATURES) - if(VCPKG_TARGET_IS_WINDOWS) - message(FATAL_ERROR "Building libunwind with MSVC is not supported. Disable it until issues are fixed.") - endif() list(APPEND LLVM_ENABLE_PROJECTS "libunwind") endif() if("lld" IN_LIST FEATURES) @@ -205,9 +201,8 @@ if("openmp" IN_LIST FEATURES) list(APPEND LLVM_ENABLE_PROJECTS "openmp") # Perl is required for the OpenMP run-time vcpkg_find_acquire_program(PERL) - list(APPEND FEATURE_OPTIONS - "-DPERL_EXECUTABLE=${PERL}" - ) + get_filename_component(PERL_PATH ${PERL} DIRECTORY) + vcpkg_add_to_path(${PERL_PATH}) if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") list(APPEND FEATURE_OPTIONS -DLIBOMP_DEFAULT_LIB_NAME=libompd @@ -259,26 +254,41 @@ vcpkg_find_acquire_program(PYTHON3) get_filename_component(PYTHON3_DIR ${PYTHON3} DIRECTORY) vcpkg_add_to_path(${PYTHON3_DIR}) -# Version-specific options -set(VERSION_OPTIONS) -if(LLVM_VERSION_MAJOR GREATER_EQUAL 9) - list(APPEND VERSION_OPTIONS "-DCMAKE_CXX_STANDARD=14") +if(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "${VCPKG_DETECTED_CMAKE_SYSTEM_PROCESSOR}") + # TODO: support more targets and OS + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + if(VCPKG_TARGET_IS_OSX) + list(APPEND CROSS_OPTIONS -DLLVM_HOST_TRIPLE=arm64-apple-darwin20.3.0) + list(APPEND CROSS_OPTIONS -DLLVM_DEFAULT_TARGET_TRIPLE=arm64-apple-darwin20.3.0) + elseif(VCPKG_TARGET_IS_WINDOWS) + list(APPEND CROSS_OPTIONS -DLLVM_HOST_TRIPLE=arm64-pc-win32) + list(APPEND CROSS_OPTIONS -DLLVM_DEFAULT_TARGET_TRIPLE=arm64-pc-win32) + + # Remove if PR #16111 is merged + list(APPEND CROSS_OPTIONS -DCMAKE_CROSSCOMPILING=ON) + list(APPEND CROSS_OPTIONS -DCMAKE_SYSTEM_PROCESSOR:STRING=ARM64) + list(APPEND CROSS_OPTIONS -DCMAKE_SYSTEM_NAME:STRING=Windows) + endif() + list(APPEND CROSS_OPTIONS -DLLVM_TARGET_ARCH=AArch64) + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + if(VCPKG_TARGET_IS_OSX) + list(APPEND CROSS_OPTIONS -DLLVM_HOST_TRIPLE=x86_64-apple-darwin20.3.0) + list(APPEND CROSS_OPTIONS -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-apple-darwin20.3.0) + endif() + list(APPEND CROSS_OPTIONS -DLLVM_TARGET_ARCH=X86) + endif() endif() -vcpkg_configure_cmake( +vcpkg_cmake_configure( SOURCE_PATH ${SOURCE_PATH}/llvm PREFER_NINJA OPTIONS ${FEATURE_OPTIONS} - ${VERSION_OPTIONS} + ${CROSS_OPTIONS} -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_BUILD_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_BUILD_TESTS=OFF - # Disable optional dependencies to libxml2, zlib, and libedit. - -DLLVM_ENABLE_LIBXML2=OFF - -DLLVM_ENABLE_ZLIB=OFF - -DLLVM_ENABLE_LIBEDIT=OFF # Disable linking to Windows PDB analysis library (hard-coded path in LLVMExports.cmake) -DLLVM_ENABLE_DIA_SDK=OFF # Force TableGen to be built with optimization. This will significantly improve build time. @@ -296,53 +306,63 @@ vcpkg_configure_cmake( -DCMAKE_DEBUG_POSTFIX=d ) -vcpkg_install_cmake() +vcpkg_cmake_install(ADD_BIN_TO_PATH) -vcpkg_fixup_cmake_targets(CONFIG_PATH "share/llvm" TARGET_PATH "share/llvm") -file(INSTALL ${SOURCE_PATH}/llvm/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) +function(llvm_cmake_package_config_fixup package_name) + cmake_parse_arguments("arg" "DO_NOT_DELETE_PARENT_CONFIG_PATH" "FEATURE_NAME" "" ${ARGN}) + if(NOT DEFINED arg_FEATURE_NAME) + set(arg_FEATURE_NAME ${package_name}) + endif() + if("${arg_FEATURE_NAME}" STREQUAL "${PORT}" OR "${arg_FEATURE_NAME}" IN_LIST FEATURES) + set(args) + list(APPEND args PACKAGE_NAME "${package_name}") + if(arg_DO_NOT_DELETE_PARENT_CONFIG_PATH) + list(APPEND args "DO_NOT_DELETE_PARENT_CONFIG_PATH") + endif() + vcpkg_cmake_config_fixup(${args}) + file(INSTALL "${SOURCE_PATH}/${package_name}/LICENSE.TXT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${package_name}" RENAME copyright) + if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${package_name}_usage") + file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/${package_name}_usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${package_name}" RENAME usage) + endif() + endif() +endfunction() +llvm_cmake_package_config_fixup("clang" DO_NOT_DELETE_PARENT_CONFIG_PATH) +llvm_cmake_package_config_fixup("flang" DO_NOT_DELETE_PARENT_CONFIG_PATH) +llvm_cmake_package_config_fixup("lld" DO_NOT_DELETE_PARENT_CONFIG_PATH) +llvm_cmake_package_config_fixup("mlir" DO_NOT_DELETE_PARENT_CONFIG_PATH) +llvm_cmake_package_config_fixup("polly" DO_NOT_DELETE_PARENT_CONFIG_PATH) +llvm_cmake_package_config_fixup("ParallelSTL" FEATURE_NAME "pstl" DO_NOT_DELETE_PARENT_CONFIG_PATH) +llvm_cmake_package_config_fixup("llvm") -if("clang" IN_LIST FEATURES) - vcpkg_fixup_cmake_targets(CONFIG_PATH "share/clang" TARGET_PATH "share/clang" DO_NOT_DELETE_PARENT_CONFIG_PATH) - file(INSTALL ${SOURCE_PATH}/clang/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/clang RENAME copyright) -endif() +set(empty_dirs) if("clang-tools-extra" IN_LIST FEATURES) - # Remove empty include directory include/clang-tidy/plugin - file(GLOB_RECURSE INCLUDE_CLANG_TIDY_PLUGIN_FILES "${CURRENT_PACKAGES_DIR}/include/clang-tidy/plugin/*") - if(NOT INCLUDE_CLANG_TIDY_PLUGIN_FILES) - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/clang-tidy/plugin") - endif() + list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/clang-tidy/plugin") endif() if("flang" IN_LIST FEATURES) - vcpkg_fixup_cmake_targets(CONFIG_PATH "share/flang" TARGET_PATH "share/flang" DO_NOT_DELETE_PARENT_CONFIG_PATH) - file(INSTALL ${SOURCE_PATH}/flang/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/flang RENAME copyright) - # Remove empty include directory /include/flang/Config - file(GLOB_RECURSE INCLUDE_FLANG_CONFIG_FILES "${CURRENT_PACKAGES_DIR}/include/flang/Config/*") - if(NOT INCLUDE_FLANG_CONFIG_FILES) - file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/flang/Config") - endif() -endif() - -if("lld" IN_LIST FEATURES) - vcpkg_fixup_cmake_targets(CONFIG_PATH "share/lld" TARGET_PATH "share/lld" DO_NOT_DELETE_PARENT_CONFIG_PATH) - file(INSTALL ${SOURCE_PATH}/lld/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/lld RENAME copyright) -endif() - -if("mlir" IN_LIST FEATURES) - vcpkg_fixup_cmake_targets(CONFIG_PATH "share/mlir" TARGET_PATH "share/mlir" DO_NOT_DELETE_PARENT_CONFIG_PATH) - file(INSTALL ${SOURCE_PATH}/mlir/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/mlir RENAME copyright) -endif() - -if("polly" IN_LIST FEATURES) - vcpkg_fixup_cmake_targets(CONFIG_PATH "share/polly" TARGET_PATH "share/polly" DO_NOT_DELETE_PARENT_CONFIG_PATH) - file(INSTALL ${SOURCE_PATH}/polly/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/polly RENAME copyright) + list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Config") + list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/CMakeFiles") + list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Optimizer/CMakeFiles") + list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Optimizer/CodeGen/CMakeFiles") + list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Optimizer/Dialect/CMakeFiles") + list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/flang/Optimizer/Transforms/CMakeFiles") endif() -if("pstl" IN_LIST FEATURES) - vcpkg_fixup_cmake_targets(CONFIG_PATH "share/ParallelSTL" TARGET_PATH "share/ParallelSTL" DO_NOT_DELETE_PARENT_CONFIG_PATH) - file(INSTALL ${SOURCE_PATH}/pstl/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/ParallelSTL RENAME copyright) +if(empty_dirs) + foreach(empty_dir IN LISTS empty_dirs) + if(NOT EXISTS "${empty_dir}") + message(SEND_ERROR "Directory '${empty_dir}' is not exist. Please remove it from the checking.") + else() + file(GLOB_RECURSE files_in_dir "${empty_dir}/*") + if(files_in_dir) + message(SEND_ERROR "Directory '${empty_dir}' is not empty. Please remove it from the checking.") + else() + file(REMOVE_RECURSE "${empty_dir}") + endif() + endif() + endforeach() endif() vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/llvm)