diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e98325d..05c1bbf0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,14 @@ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "X8 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLOAT_FLAGS}") endif() +# We use OpenMP to speed up some geometric operations, but it's optional. +include(FindOpenMP) +if(OpenMP_FOUND) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") +else() + message(WARNING "OpenMP not found, geometric operations will be single-threaded") +endif() + if(APPLE OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 928b4522..4834a655 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -224,6 +224,7 @@ add_dependencies(solvespace-core q3d_header) target_link_libraries(solvespace-core + ${OpenMP_CXX_LIBRARIES} dxfrw ${util_LIBRARIES} ${ZLIB_LIBRARY}