2015-07-16 00:05:30 +08:00
|
|
|
#
|
|
|
|
#//===----------------------------------------------------------------------===//
|
|
|
|
#//
|
|
|
|
#// The LLVM Compiler Infrastructure
|
|
|
|
#//
|
|
|
|
#// This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
#// Source Licenses. See LICENSE.txt for details.
|
|
|
|
#//
|
|
|
|
#//===----------------------------------------------------------------------===//
|
|
|
|
#
|
|
|
|
|
|
|
|
# LibompExports.cmake
|
|
|
|
# Copy library and header files into the exports/ subdirectory after library build
|
|
|
|
|
|
|
|
# Create the suffix for the export directory
|
|
|
|
# - Only add to suffix when not a default value
|
|
|
|
# - Example suffix: .deb.30.s1
|
|
|
|
# final export directory: exports/lin_32e.deb.30.s1/lib
|
|
|
|
# - These suffixes imply the build is a Debug, OpenMP 3.0, Stats-Gathering version of the library
|
|
|
|
set(libomp_suffix)
|
|
|
|
libomp_append(libomp_suffix .deb DEBUG_BUILD)
|
|
|
|
libomp_append(libomp_suffix .dia RELWITHDEBINFO_BUILD)
|
|
|
|
libomp_append(libomp_suffix .min MINSIZEREL_BUILD)
|
2016-06-15 01:57:47 +08:00
|
|
|
if(NOT "${LIBOMP_OMP_VERSION}" STREQUAL "45")
|
2015-07-16 00:57:19 +08:00
|
|
|
libomp_append(libomp_suffix .${LIBOMP_OMP_VERSION})
|
2015-07-16 00:05:30 +08:00
|
|
|
endif()
|
|
|
|
libomp_append(libomp_suffix .s1 LIBOMP_STATS)
|
|
|
|
libomp_append(libomp_suffix .ompt LIBOMP_OMPT_SUPPORT)
|
|
|
|
if(${LIBOMP_OMPT_SUPPORT})
|
2017-11-10 23:17:57 +08:00
|
|
|
libomp_append(libomp_suffix .optional LIBOMP_OMPT_OPTIONAL)
|
2015-07-16 00:05:30 +08:00
|
|
|
endif()
|
|
|
|
string(REPLACE ";" "" libomp_suffix "${libomp_suffix}")
|
|
|
|
|
|
|
|
# Set exports locations
|
|
|
|
if(${MIC})
|
2015-07-16 00:57:19 +08:00
|
|
|
set(libomp_platform "${LIBOMP_PERL_SCRIPT_OS}_${LIBOMP_MIC_ARCH}") # e.g., lin_knf, lin_knc
|
2015-07-16 00:05:30 +08:00
|
|
|
else()
|
2015-07-16 00:57:19 +08:00
|
|
|
if(${IA32})
|
|
|
|
set(libomp_platform "${LIBOMP_PERL_SCRIPT_OS}_32")
|
|
|
|
elseif(${INTEL64})
|
|
|
|
set(libomp_platform "${LIBOMP_PERL_SCRIPT_OS}_32e")
|
|
|
|
else()
|
|
|
|
set(libomp_platform "${LIBOMP_PERL_SCRIPT_OS}_${LIBOMP_ARCH}") # e.g., lin_arm, lin_ppc64
|
|
|
|
endif()
|
2015-07-16 00:05:30 +08:00
|
|
|
endif()
|
|
|
|
set(LIBOMP_EXPORTS_DIR "${LIBOMP_BASE_DIR}/exports")
|
|
|
|
set(LIBOMP_EXPORTS_PLATFORM_DIR "${LIBOMP_EXPORTS_DIR}/${libomp_platform}${libomp_suffix}")
|
|
|
|
set(LIBOMP_EXPORTS_CMN_DIR "${LIBOMP_EXPORTS_DIR}/common${libomp_suffix}/include")
|
|
|
|
set(LIBOMP_EXPORTS_INC_DIR "${LIBOMP_EXPORTS_PLATFORM_DIR}/include")
|
|
|
|
set(LIBOMP_EXPORTS_MOD_DIR "${LIBOMP_EXPORTS_PLATFORM_DIR}/include_compat")
|
|
|
|
set(LIBOMP_EXPORTS_LIB_DIR "${LIBOMP_EXPORTS_DIR}/${libomp_platform}${libomp_suffix}/lib")
|
|
|
|
|
|
|
|
# Put headers in exports/ directory post build
|
|
|
|
add_custom_command(TARGET omp POST_BUILD
|
2015-07-16 00:57:19 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBOMP_EXPORTS_CMN_DIR}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy omp.h ${LIBOMP_EXPORTS_CMN_DIR}
|
2015-07-16 00:05:30 +08:00
|
|
|
)
|
|
|
|
if(${LIBOMP_OMPT_SUPPORT})
|
2015-07-16 00:57:19 +08:00
|
|
|
add_custom_command(TARGET omp POST_BUILD
|
2019-01-15 23:36:53 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy omp-tools.h ${LIBOMP_EXPORTS_CMN_DIR}
|
2015-07-16 00:57:19 +08:00
|
|
|
)
|
2015-07-16 00:05:30 +08:00
|
|
|
endif()
|
|
|
|
if(${LIBOMP_FORTRAN_MODULES})
|
2015-07-16 00:57:19 +08:00
|
|
|
add_custom_command(TARGET libomp-mod POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBOMP_EXPORTS_MOD_DIR}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy omp_lib.mod ${LIBOMP_EXPORTS_MOD_DIR}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy omp_lib_kinds.mod ${LIBOMP_EXPORTS_MOD_DIR}
|
|
|
|
)
|
2016-10-01 06:05:45 +08:00
|
|
|
add_custom_command(TARGET omp POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy omp_lib.h ${LIBOMP_EXPORTS_CMN_DIR}
|
|
|
|
)
|
2015-07-16 00:05:30 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Copy OpenMP library into exports/ directory post build
|
|
|
|
if(WIN32)
|
2015-07-16 00:57:19 +08:00
|
|
|
get_target_property(LIBOMP_OUTPUT_DIRECTORY omp RUNTIME_OUTPUT_DIRECTORY)
|
2015-07-16 00:05:30 +08:00
|
|
|
else()
|
2015-07-16 00:57:19 +08:00
|
|
|
get_target_property(LIBOMP_OUTPUT_DIRECTORY omp LIBRARY_OUTPUT_DIRECTORY)
|
2015-07-16 00:05:30 +08:00
|
|
|
endif()
|
|
|
|
if(NOT LIBOMP_OUTPUT_DIRECTORY)
|
2015-07-16 00:57:19 +08:00
|
|
|
set(LIBOMP_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
2015-07-16 00:05:30 +08:00
|
|
|
endif()
|
|
|
|
add_custom_command(TARGET omp POST_BUILD
|
2015-07-16 00:57:19 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBOMP_EXPORTS_LIB_DIR}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${LIBOMP_OUTPUT_DIRECTORY}/${LIBOMP_LIB_FILE} ${LIBOMP_EXPORTS_LIB_DIR}
|
2015-07-16 00:05:30 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
# Copy Windows import library into exports/ directory post build
|
|
|
|
if(WIN32)
|
2015-07-16 00:57:19 +08:00
|
|
|
get_target_property(LIBOMPIMP_OUTPUT_DIRECTORY ompimp ARCHIVE_OUTPUT_DIRECTORY)
|
|
|
|
if(NOT LIBOMPIMP_OUTPUT_DIRECTORY)
|
|
|
|
set(LIBOMPIMP_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
endif()
|
|
|
|
add_custom_command(TARGET ompimp POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBOMP_EXPORTS_LIB_DIR}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${LIBOMPIMP_OUTPUT_DIRECTORY}/${LIBOMP_IMP_LIB_FILE} ${LIBOMP_EXPORTS_LIB_DIR}
|
|
|
|
)
|
2015-07-16 00:05:30 +08:00
|
|
|
endif()
|
|
|
|
|