diff options
author | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2016-02-04 19:29:35 +0000 |
---|---|---|
committer | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2016-02-04 19:29:35 +0000 |
commit | fd74f90072f48a914df98ed46d0731c661149187 (patch) | |
tree | c40193e11209086be19f25181612054662f5e59f /openmp/runtime/src | |
parent | 7823fd2535ba0864962ff9cfbddca31272de420c (diff) | |
download | bcm5719-llvm-fd74f90072f48a914df98ed46d0731c661149187.tar.gz bcm5719-llvm-fd74f90072f48a914df98ed46d0731c661149187.zip |
Add LIBOMP_ENABLE_SHARED option for CMake
When building executables for Cray supercomputers, statically-linked executables
are preferred. This patch makes it possible to build the OpenMP runtime as an
archive for building statically-linked executables. The patch adds the flag
LIBOMP_ENABLE_SHARED, which defaults to true. When true, a build of the OpenMP
runtime yields dynamic libraries. When false, a build of the OpenMP runtime
yields static libraries. There is no setting that allows both kinds of libraries
to be built.
Patch by John Mellor-Crummey
Differential Revision: http://reviews.llvm.org/D16525
llvm-svn: 259817
Diffstat (limited to 'openmp/runtime/src')
-rw-r--r-- | openmp/runtime/src/CMakeLists.txt | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt index 91a8336b495..a0570300a82 100644 --- a/openmp/runtime/src/CMakeLists.txt +++ b/openmp/runtime/src/CMakeLists.txt @@ -136,7 +136,9 @@ endif() # Add the OpenMP library libomp_get_ldflags(LIBOMP_CONFIGURED_LDFLAGS) -add_library(omp SHARED ${LIBOMP_SOURCE_FILES}) + +add_library(omp ${LIBOMP_LIBRARY_KIND} ${LIBOMP_SOURCE_FILES}) + set_target_properties(omp PROPERTIES PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_LIB_FILE}" LINK_FLAGS "${LIBOMP_CONFIGURED_LDFLAGS}" @@ -156,9 +158,9 @@ endif() if(NOT WIN32) add_custom_command(TARGET omp POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink ${LIBOMP_LIB_FILE} - libgomp${CMAKE_SHARED_LIBRARY_SUFFIX} + libgomp${LIBOMP_LIBRARY_SUFFIX} COMMAND ${CMAKE_COMMAND} -E create_symlink ${LIBOMP_LIB_FILE} - libiomp5${CMAKE_SHARED_LIBRARY_SUFFIX} + libiomp5${LIBOMP_LIBRARY_SUFFIX} WORKING_DIRECTORY ${LIBOMP_LIBRARY_DIR} ) endif() @@ -285,17 +287,19 @@ if(WIN32) set(LIBOMP_ALIASES "libiomp5md") foreach(alias IN LISTS LIBOMP_ALIASES) install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_LIB_FILE}\" - \"${alias}${CMAKE_SHARED_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/bin)") + \"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/bin)") install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"${LIBOMP_IMP_LIB_FILE}\" - \"${alias}${CMAKE_STATIC_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/lib${LIBOMP_LIBDIR_SUFFIX})") + \"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \${CMAKE_INSTALL_PREFIX}/lib${LIBOMP_LIBDIR_SUFFIX})") endforeach() else() - install(TARGETS omp LIBRARY DESTINATION lib${LIBOMP_LIBDIR_SUFFIX}) + + install(TARGETS omp ${LIBOMP_INSTALL_KIND} DESTINATION lib${LIBOMP_LIBDIR_SUFFIX}) + # Create aliases (symlinks) of the library for backwards compatibility set(LIBOMP_ALIASES "libgomp;libiomp5") foreach(alias IN LISTS LIBOMP_ALIASES) install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E create_symlink \"${LIBOMP_LIB_FILE}\" - \"${alias}${CMAKE_SHARED_LIBRARY_SUFFIX}\" WORKING_DIRECTORY + \"${alias}${LIBOMP_LIBRARY_SUFFIX}\" WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/lib${LIBOMP_LIBDIR_SUFFIX})") endforeach() endif() |