Skip to content

Commit 47e8279

Browse files
committed
CMake: detect OpenMP and use if available.
This is a missing part of commit b4e1ce4.
1 parent b4e1ce4 commit 47e8279

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "X8
9696
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLOAT_FLAGS}")
9797
endif()
9898

99+
# We use OpenMP to speed up some geometric operations, but it's optional.
100+
include(FindOpenMP)
101+
if(OpenMP_FOUND)
102+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
103+
else()
104+
message(WARNING "OpenMP not found, geometric operations will be single-threaded")
105+
endif()
106+
99107
if(APPLE OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
100108
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
101109
endif()

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ add_dependencies(solvespace-core
224224
q3d_header)
225225

226226
target_link_libraries(solvespace-core
227+
${OpenMP_CXX_LIBRARIES}
227228
dxfrw
228229
${util_LIBRARIES}
229230
${ZLIB_LIBRARY}

0 commit comments

Comments
 (0)