Skip to content

Commit b9d79a6

Browse files
committed
cmake: add OpenMP support
1 parent d2a30a8 commit b9d79a6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

cmake/DaemonFlags.cmake

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@ if (USE_FLOAT_EXCEPTIONS)
259259
add_definitions(-DDAEMON_USE_FLOAT_EXCEPTIONS)
260260
endif()
261261

262+
if (NOT NACL AND BUILD_CLIENT)
263+
option(USE_OPENMP "Use OpenMP to parallelize some tasks" OFF)
264+
endif()
265+
262266
if (MSVC)
263267
set_c_cxx_flag("/MP")
264268

@@ -267,6 +271,14 @@ if (MSVC)
267271
set_cxx_flag("/std:c++23preview")
268272
endif()
269273

274+
if (NOT NACL AND BUILD_CLIENT AND USE_OPENMP)
275+
try_cxx_flag(OPENMP "/openmp")
276+
277+
if (NOT FLAG_OPENMP)
278+
message(WARNING "Missing OpenMP")
279+
endif()
280+
endif()
281+
270282
if (USE_FAST_MATH)
271283
set_c_cxx_flag("/fp:fast")
272284
else()
@@ -362,6 +374,14 @@ else()
362374
endif()
363375
endif()
364376

377+
if (NOT NACL AND BUILD_CLIENT AND USE_OPENMP)
378+
try_cxx_flag(FOPENMP "-fopenmp")
379+
380+
if (NOT FLAG_FOPENMP)
381+
message(WARNING "Missing OpenMP")
382+
endif()
383+
endif()
384+
365385
if (NACL AND USE_NACL_SAIGO AND SAIGO_ARCH STREQUAL "arm")
366386
# This should be set for every build type because build type flags
367387
# are set after the other custom flags and then have the last word.

0 commit comments

Comments
 (0)