Hello would it be possible to include a fix to explicitly disable OpenMP if requested by the user? The default would still remain the same... Attached you'll find a proposed patch.
reference: https://bugs.gentoo.org/show_bug.cgi?id=926788 Thanks in advance! BR, Markus -- A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ --- You received this message because you are subscribed to the Google Groups "hugin and other free panoramic software" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/hugin-ptx/20240324100306.4cb1bf20%40xps13-2021.home.
# HG changeset patch # User Markus Meier <[email protected]> # Date 1711270614 -3600 # Sun Mar 24 09:56:54 2024 +0100 # Branch openmp_option # Node ID e7a6f1dbaa42b3e135d9dd284a720eec943a993e # Parent 226f2191ba877255b973e45aecc432757f8b1724 Add option to control OpenMP dependency find this has been reported in Gentoo. it would be nice to not have an automatic dependency, in case OpenMP is installed, but the user would like to disable support. https://bugs.gentoo.org/show_bug.cgi?id=926788 diff -r 226f2191ba87 -r e7a6f1dbaa42 CMakeLists.txt --- a/CMakeLists.txt Tue Mar 12 19:26:38 2024 +0100 +++ b/CMakeLists.txt Sun Mar 24 09:56:54 2024 +0100 @@ -443,24 +443,27 @@ ENDIF() # Check for OpenMP -IF(APPLE) - #we need a special search routine for mac, see changes in file CMakeModules/FindOpenMPMac.cmake - FIND_PACKAGE(OpenMPMac) -ELSE() - FIND_PACKAGE(OpenMP) -ENDIF() -IF(OPENMP_FOUND) - MESSAGE(STATUS "Compiler supports OpenMP. Activating support for it.") - ADD_COMPILE_OPTIONS(${OpenMP_CXX_FLAGS}) - SET(HAVE_OPENMP TRUE) - IF(OpenMP_CXX_FLAGS AND NOT MSVC) - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}") - SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}") - SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}") +OPTION(ENABLE_OPENMP "Enable OpenMP support" ON) +if(ENABLE_OPENMP) + IF(APPLE) + #we need a special search routine for mac, see changes in file CMakeModules/FindOpenMPMac.cmake + FIND_PACKAGE(OpenMPMac) + ELSE() + FIND_PACKAGE(OpenMP) ENDIF() -ELSE() - MESSAGE(WARNING "Compiler does not support OpenMP. OpenMP is required for multi-threaded processes. So only single threaded execution is compiled now.") -ENDIF() + IF(OPENMP_FOUND) + MESSAGE(STATUS "Compiler supports OpenMP. Activating support for it.") + ADD_COMPILE_OPTIONS(${OpenMP_CXX_FLAGS}) + SET(HAVE_OPENMP TRUE) + IF(OpenMP_CXX_FLAGS AND NOT MSVC) + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}") + SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}") + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OpenMP_CXX_FLAGS}") + ENDIF() + ELSE() + MESSAGE(WARNING "Compiler does not support OpenMP. OpenMP is required for multi-threaded processes. So only single threaded execution is compiled now.") + ENDIF() +ENDIF(ENABLE_OPENMP) IF(WIN32) # HTML Helpworkshop for creating help file
