[Openmp-commits] [openmp] [openmp] Add a dependency on the separate import library (PR #80449)

Martin Storsjö via Openmp-commits openmp-commits at lists.llvm.org
Fri Feb 2 07:39:32 PST 2024


https://github.com/mstorsjo created https://github.com/llvm/llvm-project/pull/80449

Currently, when doing e.g. "ninja check-openmp", the check-openmp target only depends on the target "omp", which builds the library. Thus by doing that, the separate import library "libomp.lib", which is generated directly from a def file, never gets created, unless one does a separate invocation first, that builds all targets.

To fix this, make the "omp" target depend on the target for the separate import library, whenever that is created/used.

>From 794a03939842ad97c3d0154ae672ef2b746007a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
Date: Wed, 31 Jan 2024 17:03:34 +0000
Subject: [PATCH] [openmp] Add a dependency on the separate import library

Currently, when doing e.g. "ninja check-openmp", the check-openmp
target only depends on the target "omp", which builds the library.
Thus by doing that, the separate import library "libomp.lib", which
is generated directly from a def file, never gets created, unless
one does a separate invocation first, that builds all targets.
---
 openmp/runtime/src/CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt
index 619d4f7ba4582..b0ecf1213dabe 100644
--- a/openmp/runtime/src/CMakeLists.txt
+++ b/openmp/runtime/src/CMakeLists.txt
@@ -306,6 +306,7 @@ if(WIN32)
         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} libompimp-needed-def-file)
+    add_dependencies(omp ${LIBOMP_IMP_LIB_TARGET})
   endif()
 endif()
 



More information about the Openmp-commits mailing list