File tree Expand file tree Collapse file tree 5 files changed +29
-0
lines changed Expand file tree Collapse file tree 5 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -251,3 +251,28 @@ if (NOT LIBOMPTARGET_CUDA_TOOLKIT_ROOT_DIR_PRESET AND
251
251
endif ()
252
252
endif ()
253
253
endif ()
254
+
255
+ if (OPENMP_STANDALONE_BUILD )
256
+ # This duplicates code from llvm/cmake/config-ix.cmake
257
+ if ( WIN32 AND NOT CYGWIN )
258
+ # We consider Cygwin as another Unix
259
+ set (PURE_WINDOWS 1 )
260
+ endif ()
261
+
262
+ # library checks
263
+ if ( NOT PURE_WINDOWS )
264
+ check_library_exists (pthread pthread_create "" HAVE_LIBPTHREAD )
265
+ endif ()
266
+
267
+ if (HAVE_LIBPTHREAD )
268
+ # We want to find pthreads library and at the moment we do want to
269
+ # have it reported as '-l<lib>' instead of '-pthread'.
270
+ # TODO: switch to -pthread once the rest of the build system can deal with it.
271
+ set (CMAKE_THREAD_PREFER_PTHREAD TRUE )
272
+ set (THREADS_HAVE_PTHREAD_ARG Off )
273
+ find_package (Threads REQUIRED )
274
+ set (OPENMP_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT} )
275
+ endif ()
276
+ else ()
277
+ set (OPENMP_PTHREAD_LIB ${LLVM_PTHREAD_LIB} )
278
+ endif ()
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "${tmachine}$")
46
46
${LIBOMPTARGET_DEP_LIBFFI_LIBRARIES}
47
47
${LIBOMPTARGET_DEP_LIBELF_LIBRARIES}
48
48
dl
49
+ ${OPENMP_PTHREAD_LIB}
49
50
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR} /../exports" )
50
51
51
52
list (APPEND LIBOMPTARGET_TESTED_PLUGINS
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ target_link_libraries(omptarget.rtl.cuda
52
52
MemoryManager
53
53
${LIBOMPTARGET_DEP_LIBRARIES}
54
54
${LIBOMPTARGET_DEP_LIBELF_LIBRARIES}
55
+ ${OPENMP_PTHREAD_LIB}
55
56
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR} /../exports"
56
57
"-Wl,-z,defs" )
57
58
Original file line number Diff line number Diff line change @@ -27,4 +27,5 @@ add_executable(openmp-offloading-server
27
27
target_link_libraries (openmp-offloading-server
28
28
grpc++
29
29
protobuf
30
+ ${OPENMP_PTHREAD_LIB}
30
31
"-ldl" "-lomp" "-fopenmp" "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR} /../../exports" ${LIBOMPTARGET_DEP_LIBELF_LIBRARIES} )
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ target_link_libraries(omptarget.rtl.rpc
35
35
grpc++
36
36
protobuf
37
37
"-ldl"
38
+ ${OPENMP_PTHREAD_LIB}
38
39
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR} /../../exports" )
39
40
40
41
# Report to the parent scope that we are building a plugin for RPC.
You can’t perform that action at this time.
0 commit comments