Skip to content

Commit

Permalink
[llvm] add more backend options, fix issues (microsoft#11268)
Browse files Browse the repository at this point in the history
* [llvm] add more backend options, fix microsoft#11158

* [llvm] disable optional dependencies to libxml2 and zlib (merge PR microsoft#11180)

* [llvm] update version

* [llvm] fix copy-paste typo

* [llvm] disable dl library on Windows, fixes microsoft#11309
  • Loading branch information
yurybura authored May 15, 2020
1 parent 0b3cc39 commit 99a832a
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 8 deletions.
29 changes: 28 additions & 1 deletion ports/llvm/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: llvm
Version: 10.0.0-1
Version: 10.0.0-2
Homepage: https://llvm.org/
Description: The LLVM Compiler Infrastructure
Supports: !uwp
Expand All @@ -17,15 +17,39 @@ Description: Build with all backends.
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-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.

Expand All @@ -35,6 +59,9 @@ 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.

Expand Down
57 changes: 50 additions & 7 deletions ports/llvm/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ if("clang" IN_LIST FEATURES OR "clang-tools-extra" IN_LIST FEATURES)
-DCLANG_ENABLE_STATIC_ANALYZER=OFF
)
endif()
if(VCPKG_TARGET_IS_WINDOWS)
list(APPEND FEATURE_OPTIONS
# Disable dl library on Windows
-DDL_LIBRARY_PATH:FILEPATH=
)
endif()
endif()
if("clang-tools-extra" IN_LIST FEATURES)
list(APPEND LLVM_ENABLE_PROJECTS "clang-tools-extra")
Expand Down Expand Up @@ -93,15 +99,39 @@ else()
if("target-aarch64" IN_LIST FEATURES)
list(APPEND LLVM_TARGETS_TO_BUILD "AArch64")
endif()
if("target-amdgpu" IN_LIST FEATURES)
list(APPEND LLVM_TARGETS_TO_BUILD "AMDGPU")
endif()
if("target-arm" IN_LIST FEATURES)
list(APPEND LLVM_TARGETS_TO_BUILD "ARM")
endif()
if("target-bpf" IN_LIST FEATURES)
list(APPEND LLVM_TARGETS_TO_BUILD "BPF")
endif()
if("target-hexagon" IN_LIST FEATURES)
list(APPEND LLVM_TARGETS_TO_BUILD "Hexagon")
endif()
if("target-lanai" IN_LIST FEATURES)
list(APPEND LLVM_TARGETS_TO_BUILD "Lanai")
endif()
if("target-mips" IN_LIST FEATURES)
list(APPEND LLVM_TARGETS_TO_BUILD "Mips")
endif()
if("target-msp430" IN_LIST FEATURES)
list(APPEND LLVM_TARGETS_TO_BUILD "MSP430")
endif()
if("target-nvptx" IN_LIST FEATURES)
list(APPEND LLVM_TARGETS_TO_BUILD "NVPTX")
endif()
if("target-powerpc" IN_LIST FEATURES)
list(APPEND LLVM_TARGETS_TO_BUILD "PowerPC")
endif()
if("target-riscv" IN_LIST FEATURES)
list(APPEND LLVM_TARGETS_TO_BUILD "RISCV")
endif()
if("target-sparc" IN_LIST FEATURES)
list(APPEND LLVM_TARGETS_TO_BUILD "Sparc")
endif()
if("target-systemz" IN_LIST FEATURES)
list(APPEND LLVM_TARGETS_TO_BUILD "SystemZ")
endif()
Expand All @@ -111,6 +141,9 @@ else()
if("target-x86" IN_LIST FEATURES)
list(APPEND LLVM_TARGETS_TO_BUILD "X86")
endif()
if("target-xcore" IN_LIST FEATURES)
list(APPEND LLVM_TARGETS_TO_BUILD "XCore")
endif()
endif()

# Detect target to build if not specified
Expand All @@ -126,7 +159,7 @@ if("${LLVM_TARGETS_TO_BUILD}" STREQUAL "")
endif()
endif()

# Use comma-separated string for enabled projects instead of semicolon-separated string.
# Use comma-separated string instead of semicolon-separated string.
# See https://github.com/microsoft/vcpkg/issues/4320
string(REPLACE ";" "," LLVM_ENABLE_PROJECTS "${LLVM_ENABLE_PROJECTS}")
string(REPLACE ";" "," LLVM_TARGETS_TO_BUILD "${LLVM_TARGETS_TO_BUILD}")
Expand Down Expand Up @@ -167,11 +200,16 @@ vcpkg_fixup_cmake_targets(CONFIG_PATH share/llvm)
vcpkg_fixup_cmake_targets(CONFIG_PATH share/clang TARGET_PATH share/clang)

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(GLOB_RECURSE _release_targets
file(GLOB_RECURSE _llvm_release_targets
"${CURRENT_PACKAGES_DIR}/share/llvm/*-release.cmake"
"${CURRENT_PACKAGES_DIR}/share/clang/*-release.cmake"
)
foreach(_target IN LISTS _release_targets)
set(_clang_release_targets)
if("clang" IN_LIST FEATURES)
file(GLOB_RECURSE _clang_release_targets
"${CURRENT_PACKAGES_DIR}/share/clang/*-release.cmake"
)
endif()
foreach(_target IN LISTS _llvm_release_targets _clang_release_targets)
file(READ ${_target} _contents)
# LLVM tools should be located in the bin folder because llvm-config expects to be inside a bin dir.
# Rename `/tools/${PORT}` to `/bin` back because there is no way to avoid this in vcpkg_fixup_cmake_targets.
Expand All @@ -181,11 +219,16 @@ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
endif()

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(GLOB_RECURSE _debug_targets
file(GLOB_RECURSE _llvm_debug_targets
"${CURRENT_PACKAGES_DIR}/share/llvm/*-debug.cmake"
"${CURRENT_PACKAGES_DIR}/share/clang/*-debug.cmake"
)
foreach(_target IN LISTS _debug_targets)
set(_clang_debug_targets)
if("clang" IN_LIST FEATURES)
file(GLOB_RECURSE _clang_debug_targets
"${CURRENT_PACKAGES_DIR}/share/clang/*-debug.cmake"
)
endif()
foreach(_target IN LISTS _llvm_debug_targets _clang_debug_targets)
file(READ ${_target} _contents)
# LLVM tools should be located in the bin folder because llvm-config expects to be inside a bin dir.
# Rename `/tools/${PORT}` to `/bin` back because there is no way to avoid this in vcpkg_fixup_cmake_targets.
Expand Down

0 comments on commit 99a832a

Please sign in to comment.