[Openmp-commits] [PATCH] D85210: [OpenMP] Don't use MSVC workaround with MinGW
Mateusz MikuĊa via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Tue Aug 4 07:12:26 PDT 2020
mati865 created this revision.
mati865 added a project: OpenMP.
Herald added subscribers: openmp-commits, mstorsjo, guansong, yaxunl, mgorny.
mati865 requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D85210
Files:
openmp/runtime/cmake/LibompExports.cmake
openmp/runtime/cmake/LibompMicroTests.cmake
openmp/runtime/src/CMakeLists.txt
Index: openmp/runtime/src/CMakeLists.txt
===================================================================
--- openmp/runtime/src/CMakeLists.txt
+++ openmp/runtime/src/CMakeLists.txt
@@ -202,21 +202,27 @@
IMPORT_PREFIX "" IMPORT_SUFFIX "" # control generated import library name when building omp
ARCHIVE_OUTPUT_NAME ${LIBOMP_GENERATED_IMP_LIB_FILENAME}
)
- # Get generated import library from creating omp
- get_target_property(LIBOMP_IMPORT_LIB_DIRECTORY omp ARCHIVE_OUTPUT_DIRECTORY)
- if(LIBOMP_IMPORT_LIB_DIRECTORY)
+
+ if(MSVC)
+ # Get generated import library from creating omp
+ get_target_property(LIBOMP_IMPORT_LIB_DIRECTORY omp ARCHIVE_OUTPUT_DIRECTORY)
+ if(LIBOMP_IMPORT_LIB_DIRECTORY)
set(LIBOMP_GENERATED_IMP_LIB ${LIBOMP_IMPORT_LIB_DIRECTORY}/${LIBOMP_GENERATED_IMP_LIB_FILENAME})
- else()
+ else()
set(LIBOMP_GENERATED_IMP_LIB ${CMAKE_CURRENT_BINARY_DIR}/${LIBOMP_GENERATED_IMP_LIB_FILENAME})
- endif()
- set_source_files_properties(${LIBOMP_GENERATED_IMP_LIB} PROPERTIES GENERATED TRUE EXTERNAL_OBJECT TRUE)
- # Create new import library that is just the previously created one + kmp_import.cpp
- add_library(ompimp STATIC ${LIBOMP_GENERATED_IMP_LIB} kmp_import.cpp)
- set_target_properties(ompimp PROPERTIES
+ endif()
+ set_source_files_properties(${LIBOMP_GENERATED_IMP_LIB} PROPERTIES GENERATED TRUE EXTERNAL_OBJECT TRUE)
+ # Create new import library that is just the previously created one + kmp_import.cpp
+ add_library(ompimp STATIC ${LIBOMP_GENERATED_IMP_LIB} kmp_import.cpp)
+ set_target_properties(ompimp PROPERTIES
PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_IMP_LIB_FILE}"
LINKER_LANGUAGE C
- )
- add_dependencies(ompimp omp) # ensure generated import library is created first
+ )
+ add_dependencies(ompimp omp) # ensure generated import library is created first
+ set(LIBOMP_IMP_LIB_TARGET ompimp)
+ else()
+ set(LIBOMP_IMP_LIB_TARGET omp)
+ endif()
# Create def file to designate exported functions
libomp_get_gdflags(LIBOMP_GDFLAGS) # generate-def.pl flags (Windows only)
@@ -290,7 +296,7 @@
endif()
if(WIN32)
install(TARGETS omp RUNTIME DESTINATION bin)
- install(TARGETS ompimp ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}")
+ install(TARGETS ${LIBOMP_IMP_LIB_TARGET} ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}")
# Create aliases (regular copies) of the library for backwards compatibility
set(LIBOMP_ALIASES "libiomp5md")
foreach(alias IN LISTS LIBOMP_ALIASES)
Index: openmp/runtime/cmake/LibompMicroTests.cmake
===================================================================
--- openmp/runtime/cmake/LibompMicroTests.cmake
+++ openmp/runtime/cmake/LibompMicroTests.cmake
@@ -40,7 +40,7 @@
# get library location
if(WIN32)
get_target_property(LIBOMP_OUTPUT_DIRECTORY omp RUNTIME_OUTPUT_DIRECTORY)
- get_target_property(LIBOMPIMP_OUTPUT_DIRECTORY ompimp ARCHIVE_OUTPUT_DIRECTORY)
+ get_target_property(LIBOMPIMP_OUTPUT_DIRECTORY ${LIBOMP_IMP_LIB_TARGET} ARCHIVE_OUTPUT_DIRECTORY)
if(NOT LIBOMPIMP_OUTPUT_DIRECTORY)
set(LIBOMPIMP_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
Index: openmp/runtime/cmake/LibompExports.cmake
===================================================================
--- openmp/runtime/cmake/LibompExports.cmake
+++ openmp/runtime/cmake/LibompExports.cmake
@@ -83,11 +83,11 @@
# Copy Windows import library into exports/ directory post build
if(WIN32)
- get_target_property(LIBOMPIMP_OUTPUT_DIRECTORY ompimp ARCHIVE_OUTPUT_DIRECTORY)
+ get_target_property(LIBOMPIMP_OUTPUT_DIRECTORY ${LIBOMP_IMP_LIB_TARGET} ARCHIVE_OUTPUT_DIRECTORY)
if(NOT LIBOMPIMP_OUTPUT_DIRECTORY)
set(LIBOMPIMP_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif()
- add_custom_command(TARGET ompimp POST_BUILD
+ add_custom_command(TARGET ${LIBOMP_IMP_LIB_TARGET} 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}
)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85210.282913.patch
Type: text/x-patch
Size: 4065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200804/904209f4/attachment.bin>
More information about the Openmp-commits
mailing list