mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-22 10:16:43 +00:00
cmake: Remove add_llvm_loadable_module()
Summary: This function is very similar to add_llvm_library(), so this patch merges it into add_llvm_library() and replaces all calls to add_llvm_loadable_module(lib ...) with add_llvm_library(lib MODULE ...) Reviewers: philip.pfaffe, beanz, chandlerc Reviewed By: philip.pfaffe Subscribers: chapuni, mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D51748 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349839 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
819c36d535
commit
69e8318af3
@ -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
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user