[Openmp-commits] [openmp] 30ce6fb - [OpenMP] Fix an OpenMP Windows build problem

Vadim Paretsky via Openmp-commits openmp-commits at lists.llvm.org
Mon Mar 27 17:24:33 PDT 2023


Author: Vadim Paretsky
Date: 2023-03-27T17:20:54-07:00
New Revision: 30ce6fbfaae4a6c03fe18d06163e696054a692cb

URL: https://github.com/llvm/llvm-project/commit/30ce6fbfaae4a6c03fe18d06163e696054a692cb
DIFF: https://github.com/llvm/llvm-project/commit/30ce6fbfaae4a6c03fe18d06163e696054a692cb.diff

LOG: [OpenMP] Fix an OpenMP Windows build problem

When building OpenMP as part of LLVM, CMAKE was generating incorrect
location references for OpenMP build's first step's artifacts being used
in regenerating its Windows import library in the second step. The fix is
to feed a dummy non-buildable, rather than buildable, source to CMAKE to
satisfy its source requirements removing the need to reference the first
step's artifacts in the second step altogether.

Differential Revision:https://reviews.llvm.org/D146894

Added: 
    openmp/runtime/src/kmp_dummy.txt

Modified: 
    openmp/runtime/src/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt
index 931975d9445b..502ec5a6b80b 100644
--- a/openmp/runtime/src/CMakeLists.txt
+++ b/openmp/runtime/src/CMakeLists.txt
@@ -295,14 +295,13 @@ if(WIN32)
           -o ${LIBOMPIMP_GENERATED_DEF_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/dllexports
       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dllexports ${LIBOMP_TOOLS_DIR}/generate-def.pl
     )
-    # while this is merely generating an import library off the one generated with the runtime dll,
-    # kmp_global.cpp will satisfy the librarian's apparent ask to see the actual exported DATA items
-    set_source_files_properties(${LIBOMP_GENERATED_IMP_LIB_FILENAME} PROPERTIES GENERATED TRUE EXTERNAL_OBJECT TRUE)
-    add_library(${LIBOMP_IMP_LIB_TARGET} STATIC ${LIBOMP_GENERATED_IMP_LIB_FILENAME} kmp_global.cpp)
+    # while this merely generates an import library off a def file, CMAKE still requires it to have a "source" so feed it a dummy one, 
+    # making it a .txt which CMAKE will filter out from the librarian (a .cpp will make lib.exe punt trying to resolve the .def symbols)
+    add_library(${LIBOMP_IMP_LIB_TARGET} STATIC kmp_dummy.txt)
     set_target_properties(${LIBOMP_IMP_LIB_TARGET} PROPERTIES
-        PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_IMP_LIB_FILE}" LINKER_LANGUAGE C
+        PREFIX "" SUFFIX "" OUTPUT_NAME "${LIBOMP_IMP_LIB_FILE}" LINKER_LANGUAGE ${LIBOMP_LINKER_LANGUAGE}
         STATIC_LIBRARY_OPTIONS "${CMAKE_LINK_DEF_FILE_FLAG}${CMAKE_CURRENT_BINARY_DIR}/${LIBOMPIMP_GENERATED_DEF_FILE}")
-    add_dependencies(${LIBOMP_IMP_LIB_TARGET} omp libompimp-needed-def-file)
+    add_dependencies(${LIBOMP_IMP_LIB_TARGET} libompimp-needed-def-file)
   endif()
 endif()
 

diff  --git a/openmp/runtime/src/kmp_dummy.txt b/openmp/runtime/src/kmp_dummy.txt
new file mode 100644
index 000000000000..0dce7617cf90
--- /dev/null
+++ b/openmp/runtime/src/kmp_dummy.txt
@@ -0,0 +1,13 @@
+/*
+ * kmp_dummy.txt -- dummy "source" file used in regenerating the Windows import library
+ */
+
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// end of file //


        


More information about the Openmp-commits mailing list