[llvm-branch-commits] [openmp] d11e173 - [OpenMP] Don't use MSVC workaround with MinGW
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Aug 5 10:37:18 PDT 2020
Author: AndreyChurbanov
Date: 2020-08-05T19:36:59+02:00
New Revision: d11e17309414b91c2e7dfc611f098041a62de201
URL: https://github.com/llvm/llvm-project/commit/d11e17309414b91c2e7dfc611f098041a62de201
DIFF: https://github.com/llvm/llvm-project/commit/d11e17309414b91c2e7dfc611f098041a62de201.diff
LOG: [OpenMP] Don't use MSVC workaround with MinGW
Patch by mati865 at gmail.com
Differential Revision: https://reviews.llvm.org/D85210
(cherry picked from commit 4a04bc8995639e1d333790518e4d42e0961f740e)
Added:
Modified:
openmp/runtime/cmake/LibompExports.cmake
openmp/runtime/cmake/LibompMicroTests.cmake
openmp/runtime/src/CMakeLists.txt
Removed:
################################################################################
diff --git a/openmp/runtime/cmake/LibompExports.cmake b/openmp/runtime/cmake/LibompExports.cmake
index f98de2631b83..44fb97631b28 100644
--- a/openmp/runtime/cmake/LibompExports.cmake
+++ b/openmp/runtime/cmake/LibompExports.cmake
@@ -83,11 +83,11 @@ add_custom_command(TARGET omp POST_BUILD
# 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}
)
diff --git a/openmp/runtime/cmake/LibompMicroTests.cmake b/openmp/runtime/cmake/LibompMicroTests.cmake
index dc44e2c1e2fc..1ca3412edc8e 100644
--- a/openmp/runtime/cmake/LibompMicroTests.cmake
+++ b/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()
diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt
index 1211441876eb..81275c0483dd 100644
--- a/openmp/runtime/src/CMakeLists.txt
+++ b/openmp/runtime/src/CMakeLists.txt
@@ -202,21 +202,27 @@ if(WIN32)
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)
- set(LIBOMP_GENERATED_IMP_LIB ${LIBOMP_IMPORT_LIB_DIRECTORY}/${LIBOMP_GENERATED_IMP_LIB_FILENAME})
+
+ 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()
+ 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
+ PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_IMP_LIB_FILE}"
+ LINKER_LANGUAGE C
+ )
+ add_dependencies(ompimp omp) # ensure generated import library is created first
+ set(LIBOMP_IMP_LIB_TARGET ompimp)
else()
- set(LIBOMP_GENERATED_IMP_LIB ${CMAKE_CURRENT_BINARY_DIR}/${LIBOMP_GENERATED_IMP_LIB_FILENAME})
+ set(LIBOMP_IMP_LIB_TARGET omp)
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
# Create def file to designate exported functions
libomp_get_gdflags(LIBOMP_GDFLAGS) # generate-def.pl flags (Windows only)
@@ -290,7 +296,7 @@ else()
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)
More information about the llvm-branch-commits
mailing list