diff --git a/openmp/libompd/src/CMakeLists.txt b/openmp/libompd/src/CMakeLists.txt index 0402a01772010..ba228d5181048 100644 --- a/openmp/libompd/src/CMakeLists.txt +++ b/openmp/libompd/src/CMakeLists.txt @@ -13,7 +13,8 @@ cmake_minimum_required(VERSION 3.20.0) add_library (ompd SHARED TargetValue.cpp omp-debug.cpp omp-state.cpp omp-icv.cpp) -target_link_libraries(ompd omp) # ensure generated import library is created first +# libompd must not link against libomp, there is no code dependency. +add_dependencies(ompd omp) # ensure generated import library is created first set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") diff --git a/openmp/libompd/src/omp-icv.cpp b/openmp/libompd/src/omp-icv.cpp index 4a2c2b6e8bc62..0288e963a6974 100644 --- a/openmp/libompd/src/omp-icv.cpp +++ b/openmp/libompd/src/omp-icv.cpp @@ -18,7 +18,9 @@ #include "omp.h" #include "ompd-private.h" #include "TargetValue.h" +#define OMPD_SKIP_HWLOC 1 #include "kmp.h" +#undef OMPD_SKIP_HWLOC #include /* The ICVs ompd-final-var and ompd-implicit-var below are for backward diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h index 259c57b5afbca..121e7e959129e 100644 --- a/openmp/runtime/src/kmp.h +++ b/openmp/runtime/src/kmp.h @@ -103,7 +103,8 @@ class kmp_stats_list; #define KMP_USE_HIER_SCHED KMP_AFFINITY_SUPPORTED #endif -#if KMP_USE_HWLOC && KMP_AFFINITY_SUPPORTED +// OMPD_SKIP_HWLOC used in libompd/omp-icv.cpp to avoid OMPD depending on hwloc +#if KMP_USE_HWLOC && KMP_AFFINITY_SUPPORTED && !defined(OMPD_SKIP_HWLOC) #include "hwloc.h" #ifndef HWLOC_OBJ_NUMANODE #define HWLOC_OBJ_NUMANODE HWLOC_OBJ_NODE @@ -689,7 +690,7 @@ typedef BOOL (*kmp_SetThreadGroupAffinity_t)(HANDLE, const GROUP_AFFINITY *, extern kmp_SetThreadGroupAffinity_t __kmp_SetThreadGroupAffinity; #endif /* KMP_OS_WINDOWS */ -#if KMP_USE_HWLOC +#if KMP_USE_HWLOC && !defined(OMPD_SKIP_HWLOC) extern hwloc_topology_t __kmp_hwloc_topology; extern int __kmp_hwloc_error; #endif