summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/cmake/modules/AddLLVM.cmake47
-rw-r--r--llvm/docs/CMake.rst4
-rw-r--r--llvm/docs/WritingAnLLVMPass.rst2
-rw-r--r--llvm/lib/Transforms/Hello/CMakeLists.txt2
-rw-r--r--llvm/tools/bugpoint-passes/CMakeLists.txt2
-rw-r--r--llvm/tools/gold/CMakeLists.txt2
-rw-r--r--llvm/unittests/Passes/CMakeLists.txt2
7 files changed, 17 insertions, 44 deletions
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index c5aa961a292..497d0854321 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -616,11 +616,13 @@ endfunction()
macro(add_llvm_library name)
cmake_parse_arguments(ARG
- "SHARED;BUILDTREE_ONLY"
+ "SHARED;BUILDTREE_ONLY;MODULE"
""
""
${ARGN})
- if( BUILD_SHARED_LIBS OR ARG_SHARED )
+ if(ARG_MODULE)
+ llvm_add_library(${name} MODULE ${ARG_UNPARSED_ARGUMENTS})
+ elseif( BUILD_SHARED_LIBS OR ARG_SHARED )
llvm_add_library(${name} SHARED ${ARG_UNPARSED_ARGUMENTS})
else()
llvm_add_library(${name} ${ARG_UNPARSED_ARGUMENTS})
@@ -629,7 +631,7 @@ macro(add_llvm_library name)
# Libraries that are meant to only be exposed via the build tree only are
# never installed and are only exported as a target in the special build tree
# config file.
- if (NOT ARG_BUILDTREE_ONLY)
+ if (NOT ARG_BUILDTREE_ONLY AND NOT ARG_MODULE)
set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} )
endif()
@@ -642,7 +644,7 @@ macro(add_llvm_library name)
${name} STREQUAL "OptRemarks" OR
(LLVM_LINK_LLVM_DYLIB AND ${name} STREQUAL "LLVM"))
set(install_dir lib${LLVM_LIBDIR_SUFFIX})
- if(ARG_SHARED OR BUILD_SHARED_LIBS)
+ if(ARG_MODULE OR ARG_SHARED OR BUILD_SHARED_LIBS)
if(WIN32 OR CYGWIN OR MINGW)
set(install_type RUNTIME)
set(install_dir bin)
@@ -673,43 +675,14 @@ macro(add_llvm_library name)
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
endif()
set_target_properties(${name} PROPERTIES FOLDER "Libraries")
-endmacro(add_llvm_library name)
-
-macro(add_llvm_loadable_module name)
- llvm_add_library(${name} MODULE ${ARGN})
if(NOT TARGET ${name})
# Add empty "phony" target
add_custom_target(${name})
- else()
- if( EXCLUDE_FROM_ALL )
- set_target_properties( ${name} PROPERTIES EXCLUDE_FROM_ALL ON)
- else()
- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
- if(WIN32 OR CYGWIN)
- # DLL platform
- set(dlldir "bin")
- else()
- set(dlldir "lib${LLVM_LIBDIR_SUFFIX}")
- endif()
-
- if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
- NOT LLVM_DISTRIBUTION_COMPONENTS)
- set(export_to_llvmexports EXPORT LLVMExports)
- set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True)
- endif()
-
- install(TARGETS ${name}
- ${export_to_llvmexports}
- LIBRARY DESTINATION ${dlldir}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
- endif()
- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
- endif()
endif()
-
- set_target_properties(${name} PROPERTIES FOLDER "Loadable modules")
-endmacro(add_llvm_loadable_module name)
-
+ if (ARG_MODULE)
+ set_target_properties(${name} PROPERTIES FOLDER "Loadable modules")
+ endif()
+endmacro(add_llvm_library name)
macro(add_llvm_executable name)
cmake_parse_arguments(ARG
diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst
index f4f67db4d7e..d27c0a8222c 100644
--- a/llvm/docs/CMake.rst
+++ b/llvm/docs/CMake.rst
@@ -774,7 +774,7 @@ Contents of ``<project dir>/<pass name>/CMakeLists.txt``:
Note if you intend for this pass to be merged into the LLVM source tree at some
point in the future it might make more sense to use LLVM's internal
-``add_llvm_loadable_module`` function instead by...
+``add_llvm_library`` function with he MODULE argument instead by...
Adding the following to ``<project dir>/CMakeLists.txt`` (after
@@ -789,7 +789,7 @@ And then changing ``<project dir>/<pass name>/CMakeLists.txt`` to
.. code-block:: cmake
- add_llvm_loadable_module(LLVMPassname
+ add_llvm_library(LLVMPassname MODULE
Pass.cpp
)
diff --git a/llvm/docs/WritingAnLLVMPass.rst b/llvm/docs/WritingAnLLVMPass.rst
index 41f400740e8..19dc6c11c9b 100644
--- a/llvm/docs/WritingAnLLVMPass.rst
+++ b/llvm/docs/WritingAnLLVMPass.rst
@@ -55,7 +55,7 @@ copy the following into ``CMakeLists.txt``:
.. code-block:: cmake
- add_llvm_loadable_module( LLVMHello
+ add_llvm_library( LLVMHello MODULE
Hello.cpp
PLUGIN_TOOL
diff --git a/llvm/lib/Transforms/Hello/CMakeLists.txt b/llvm/lib/Transforms/Hello/CMakeLists.txt
index 4a55dd9c04b..d9cd33a4938 100644
--- a/llvm/lib/Transforms/Hello/CMakeLists.txt
+++ b/llvm/lib/Transforms/Hello/CMakeLists.txt
@@ -10,7 +10,7 @@ if(WIN32 OR CYGWIN)
set(LLVM_LINK_COMPONENTS Core Support)
endif()
-add_llvm_loadable_module( LLVMHello
+add_llvm_library( LLVMHello MODULE
Hello.cpp
DEPENDS
diff --git a/llvm/tools/bugpoint-passes/CMakeLists.txt b/llvm/tools/bugpoint-passes/CMakeLists.txt
index e32b0a3aa34..56a7eacebf1 100644
--- a/llvm/tools/bugpoint-passes/CMakeLists.txt
+++ b/llvm/tools/bugpoint-passes/CMakeLists.txt
@@ -14,7 +14,7 @@ if(WIN32 OR CYGWIN)
set(LLVM_LINK_COMPONENTS Core)
endif()
-add_llvm_loadable_module( BugpointPasses
+add_llvm_library( BugpointPasses MODULE
TestPasses.cpp
DEPENDS
diff --git a/llvm/tools/gold/CMakeLists.txt b/llvm/tools/gold/CMakeLists.txt
index d2580329aca..72f76558c08 100644
--- a/llvm/tools/gold/CMakeLists.txt
+++ b/llvm/tools/gold/CMakeLists.txt
@@ -11,7 +11,7 @@ if( LLVM_ENABLE_PIC AND LLVM_BINUTILS_INCDIR )
IPO
)
- add_llvm_loadable_module(LLVMgold
+ add_llvm_library(LLVMgold MODULE
gold-plugin.cpp
)
diff --git a/llvm/unittests/Passes/CMakeLists.txt b/llvm/unittests/Passes/CMakeLists.txt
index 415f3a71734..7e898763373 100644
--- a/llvm/unittests/Passes/CMakeLists.txt
+++ b/llvm/unittests/Passes/CMakeLists.txt
@@ -15,7 +15,7 @@ export_executable_symbols(PluginsTests)
target_link_libraries(PluginsTests PRIVATE LLVMTestingSupport)
set(LLVM_LINK_COMPONENTS)
-add_llvm_loadable_module(TestPlugin
+add_llvm_library(TestPlugin MODULE
TestPlugin.cpp
)
OpenPOWER on IntegriCloud