diff options
author | Michael Kruse <llvm-project@meinersbur.de> | 2020-02-24 11:51:00 -0600 |
---|---|---|
committer | Hans Wennborg <hans@chromium.org> | 2020-02-26 19:40:12 +0100 |
commit | d7afdb596e865c11b853d8c5df7d96d594170e1c (patch) | |
tree | a377b68f7a91e41325e9a54094bc9b886dcf69d0 | |
parent | 5cfd30add460640264c7d88c4d837a2d4e0ae7b1 (diff) | |
download | bcm5719-llvm-d7afdb596e865c11b853d8c5df7d96d594170e1c.tar.gz bcm5719-llvm-d7afdb596e865c11b853d8c5df7d96d594170e1c.zip |
[CMake] Default to static linking for subprojects.
Pass plugins introduced in D61446 do not support dynamic linking on
Windows, hence the option LLVM_${name_upper}_LINK_INTO_TOOLS can only
work being set to "ON". Currently, it defaults to "OFF" such that such
plugins are inoperable by default on Windows. Change the default for
subprojects to follow LLVM_ENABLE_PROJECTS.
Reviewed By: serge-sans-paille, MaskRay
Differential Revision: https://reviews.llvm.org/D72372
(cherry picked from commit 6369b9bf31188bdd472299252deb6db3f650864b)
This is for PR45001.
-rw-r--r-- | llvm/cmake/modules/AddLLVM.cmake | 15 | ||||
-rw-r--r-- | polly/lib/CMakeLists.txt | 1 |
2 files changed, 14 insertions, 2 deletions
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index 32798b1b44a..8d674f93542 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -854,14 +854,25 @@ endmacro(add_llvm_executable name) # # If NO_MODULE is specified, when option LLVM_${name_upper}_LINK_INTO_TOOLS is set to OFF, # only an object library is built, and no module is built. This is specific to the Polly use case. +# +# The SUBPROJECT argument contains the LLVM project the plugin belongs +# to. If set, the plugin will link statically by default it if the +# project was enabled. function(add_llvm_pass_plugin name) cmake_parse_arguments(ARG - "NO_MODULE" "" "" + "NO_MODULE" "SUBPROJECT" "" ${ARGN}) string(TOUPPER ${name} name_upper) - option(LLVM_${name_upper}_LINK_INTO_TOOLS "Statically link ${name} into tools (if available)" OFF) + # Enable the plugin by default if it was explicitly enabled by the user. + # Note: If was set to "all", LLVM's CMakeLists.txt replaces it with a + # list of all projects, counting as explicitly enabled. + set(link_into_tools_default OFF) + if (ARG_SUBPROJECT AND LLVM_TOOL_${name_upper}_BUILD) + set(link_into_tools_default ON) + endif() + option(LLVM_${name_upper}_LINK_INTO_TOOLS "Statically link ${name} into tools (if available)" ${link_into_tools_default}) if(LLVM_${name_upper}_LINK_INTO_TOOLS) list(REMOVE_ITEM ARG_UNPARSED_ARGUMENTS BUILDTREE_ONLY) diff --git a/polly/lib/CMakeLists.txt b/polly/lib/CMakeLists.txt index ee0834cc8e3..35614973a5d 100644 --- a/polly/lib/CMakeLists.txt +++ b/polly/lib/CMakeLists.txt @@ -25,6 +25,7 @@ endif () # the sources them to be recompiled for each of them. add_llvm_pass_plugin(Polly NO_MODULE + SUBPROJECT Polly Analysis/DependenceInfo.cpp Analysis/PolyhedralInfo.cpp Analysis/ScopDetection.cpp |