From bc77410691a76de8491b06bf7322789878e8a7fb Mon Sep 17 00:00:00 2001 From: Mathieu Labussiere Date: Fri, 27 Jul 2018 15:38:38 -0400 Subject: [PATCH 1/2] [cmake] add openMP support --- CMakeLists.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 737eb600..9b95d355 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,6 +146,21 @@ include_directories(${libnabo_INCLUDE_DIRS}) set(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${libnabo_LIBRARIES}) message(STATUS "libnabo found, version ${libnabo_VERSION} (include=${libnabo_INCLUDE_DIRS} libs=${libnabo_LIBRARIES})") +#-------------------- +# DEPENDENCY: OpenMP (optional) +#-------------------- +set(USE_OPEN_MP TRUE CACHE BOOL "Set to FALSE to not use OpenMP") +if (USE_OPEN_MP) + find_package(OpenMP) + if (OPENMP_FOUND) + add_definitions(-fopenmp -DHAVE_OPENMP) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + if (CMAKE_COMPILER_IS_GNUCC) + set(EXTERNAL_LIBS ${EXTERNAL_LIBS} gomp) + message("-- OpenMP found, parallel computer enabled") + endif(CMAKE_COMPILER_IS_GNUCC) + endif(OPENMP_FOUND) +endif (USE_OPEN_MP) #-------------------- # DEPENDENCY: OpenCL (optional) From 2ad14b2a258a1f732ad7238e1663aa352cefde7c Mon Sep 17 00:00:00 2001 From: Mathieu Labussiere Date: Tue, 31 Jul 2018 10:40:49 -0400 Subject: [PATCH 2/2] [cmake] set default value of OpenMP flag to false --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b95d355..585bcc9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,7 +149,7 @@ message(STATUS "libnabo found, version ${libnabo_VERSION} (include=${libnabo_INC #-------------------- # DEPENDENCY: OpenMP (optional) #-------------------- -set(USE_OPEN_MP TRUE CACHE BOOL "Set to FALSE to not use OpenMP") +set(USE_OPEN_MP FALSE CACHE BOOL "Set to TRUE to use OpenMP") if (USE_OPEN_MP) find_package(OpenMP) if (OPENMP_FOUND)