summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'openmp/runtime/cmake')
-rw-r--r--openmp/runtime/cmake/LibompMicroTests.cmake1
-rw-r--r--openmp/runtime/cmake/config-ix.cmake25
2 files changed, 23 insertions, 3 deletions
diff --git a/openmp/runtime/cmake/LibompMicroTests.cmake b/openmp/runtime/cmake/LibompMicroTests.cmake
index dd24748766b..4087703f387 100644
--- a/openmp/runtime/cmake/LibompMicroTests.cmake
+++ b/openmp/runtime/cmake/LibompMicroTests.cmake
@@ -175,6 +175,7 @@ elseif(APPLE)
set(libomp_expected_library_deps /usr/lib/libSystem.B.dylib)
elseif(WIN32)
set(libomp_expected_library_deps kernel32.dll)
+ libomp_append(libomp_expected_library_deps psapi.dll LIBOMP_OMPT_SUPPORT)
else()
if(${MIC})
set(libomp_expected_library_deps libc.so.6 libpthread.so.0 libdl.so.2)
diff --git a/openmp/runtime/cmake/config-ix.cmake b/openmp/runtime/cmake/config-ix.cmake
index 875b5519a26..9c7848b3bcf 100644
--- a/openmp/runtime/cmake/config-ix.cmake
+++ b/openmp/runtime/cmake/config-ix.cmake
@@ -13,6 +13,7 @@ include(CheckCCompilerFlag)
include(CheckCSourceCompiles)
include(CheckCXXCompilerFlag)
include(CheckLibraryExists)
+include(CheckIncludeFiles)
include(LibompCheckLinkerFlag)
include(LibompCheckFortranFlag)
@@ -187,8 +188,26 @@ else()
endif()
# Check if OMPT support is available
-if(NOT WIN32)
- set(LIBOMP_HAVE_OMPT_SUPPORT TRUE)
-else()
+# Currently, __builtin_frame_address() is required for OMPT
+# Weak attribute is required for Unices, LIBPSAPI is used for Windows
+check_c_source_compiles("int main(int argc, char** argv) {
+ void* p = __builtin_frame_address(0);
+ return 0;}" LIBOMP_HAVE___BUILTIN_FRAME_ADDRESS)
+check_c_source_compiles("__attribute__ ((weak)) int foo(int a) { return a*a; }
+ int main(int argc, char** argv) {
+ return foo(argc);}" LIBOMP_HAVE_WEAK_ATTRIBUTE)
+check_include_files("windows.h;psapi.h" LIBOMP_HAVE_PSAPI_H)
+check_library_exists(psapi EnumProcessModules "" LIBOMP_HAVE_LIBPSAPI)
+if(LIBOMP_HAVE_PSAPI_H AND LIBOMP_HAVE_LIBPSAPI)
+ set(LIBOMP_HAVE_PSAPI TRUE)
+endif()
+if(NOT LIBOMP_HAVE___BUILTIN_FRAME_ADDRESS)
set(LIBOMP_HAVE_OMPT_SUPPORT FALSE)
+else()
+ if(LIBOMP_HAVE_WEAK_ATTRIBUTE OR LIBOMP_HAVE_PSAPI)
+ set(LIBOMP_HAVE_OMPT_SUPPORT TRUE)
+ else()
+ set(LIBOMP_HAVE_OMPT_SUPPORT FALSE)
+ endif()
endif()
+
OpenPOWER on IntegriCloud