[PATCH] D51748: cmake: Refactor add_llvm_loadable_module()
Tom Stellard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 7 18:55:10 PDT 2018
tstellar updated this revision to Diff 164560.
tstellar added a comment.
Add custom install targets for modules.
Repository:
rL LLVM
https://reviews.llvm.org/D51748
Files:
cmake/modules/AddLLVM.cmake
Index: cmake/modules/AddLLVM.cmake
===================================================================
--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -612,20 +612,22 @@
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})
endif()
# 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()
@@ -637,7 +639,7 @@
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO" 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)
@@ -671,37 +673,11 @@
endmacro(add_llvm_library name)
macro(add_llvm_loadable_module name)
- llvm_add_library(${name} MODULE ${ARGN})
+ add_llvm_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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51748.164560.patch
Type: text/x-patch
Size: 2653 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180908/92d86304/attachment.bin>
More information about the llvm-commits
mailing list