Skip to content

Commit 36f8265

Browse files
Merge pull request #347 from insertinterestingnamehere/cmake
Add CMake Options Needed By Chapel
2 parents a58b405 + 24a00df commit 36f8265

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ set(QTHREADS_DICT_TYPE shavit CACHE STRING "Which dictionary implementation to u
1010
set(QTHREADS_TIMER_TYPE gettimeofday CACHE STRING "Which timer implementation to use. Valid values are \"clock_gettime\", \"mach\", \"gettimeofday\", and \"gethrtime\".")
1111
set(QTHREADS_CONTEXT_SWAP_IMPL fastcontext CACHE STRING "Which context swap implementation to use. Valid values are \"system\" and \"fastcontext\".")
1212
set(HWLOC_INSTALL_DIR /usr/local CACHE PATH "Install path for hwloc library")
13+
set(QTHREADS_HWLOC_GET_TOPOLOGY_FUNCTION "" CACHE STRING "function to get hwloc topology (otherwise uses hwloc_topology_init and hwloc_topology_load)")
14+
set(QTHREADS_GUARD_PAGES OFF CACHE BOOL "Whether or not to guard memory pages to help with debugging stack overflows. Default is OFF.")
15+
set(QTHREADS_CONDWAIT_QUEUE OFF CACHE BOOL "Use a waiting queue based on pthread condition variables instead of a spin-based queue for inter-thread communication. Default is OFF.")
1316

1417
set(QTHREADS_SOURCES
1518
cacheline.c
@@ -98,6 +101,24 @@ target_compile_definitions(qthread
98101
PRIVATE QTHREAD_DEFAULT_STACK_SIZE=${QTHREADS_DEFAULT_STACK_SIZE}
99102
)
100103

104+
if(NOT "${QTHREADS_HWLOC_GET_TOPOLOGY_FUNCTION}" STREQUAL "")
105+
target_compile_definitions(qthread
106+
PRIVATE HWLOC_GET_TOPOLOGY_FUNCTION=${QTHREADS_HWLOC_GET_TOPOLOGY_FUNCTION}
107+
)
108+
endif()
109+
110+
if(QTHREADS_GUARD_PAGES)
111+
target_compile_definitions(qthread
112+
PRIVATE QTHREADS_GUARD_PAGES=1
113+
)
114+
endif()
115+
116+
if(QTHREADS_CONDWAIT_QUEUE)
117+
target_compile_definitions(qthread
118+
PRIVATE QTHREAD_CONDWAIT_BLOCKING_QUEUE=1
119+
)
120+
endif()
121+
101122
# CMAKE_INSTALL_LIBDIR is less reliable with CMake 3.21 and earlier.
102123
# In those case, it may be necessary for the end-user to specify it manually.
103124
install(

0 commit comments

Comments
 (0)