From 0cb12e2ca713d8c8c1a90ff2175579f366efde73 Mon Sep 17 00:00:00 2001 From: Guillaume Pasero <guillaume.pasero@c-s.fr> Date: Wed, 13 Dec 2017 17:15:34 +0100 Subject: [PATCH] COMP: enhance Shark detection with cblas, dynlib,... --- CMake/FindShark.cmake | 26 ++++++++++++------- .../ThirdParty/Shark/otb-module-init.cmake | 4 +++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/CMake/FindShark.cmake b/CMake/FindShark.cmake index 59bef138f7..1fda9fdf6a 100644 --- a/CMake/FindShark.cmake +++ b/CMake/FindShark.cmake @@ -97,17 +97,25 @@ if(SHARK_CONFIG_FILE) "${SHARK_VERSION_MAJOR}.${SHARK_VERSION_MINOR}.${SHARK_VERSION_PATCH}") endif() -set(SHARK_USE_OPENMP_matched) -#define SHARK_USE_OPENMP +# Check if Shark was built with OpenMP, CBLAS, DYNLIB, ... file(STRINGS "${SHARK_INCLUDE_DIR}/shark/Core/Shark.h" SHARK_H_CONTENTS) -string(REGEX MATCH - "#define.SHARK_USE_OPENMP" - SHARK_USE_OPENMP_matched "${SHARK_H_CONTENTS}") -if(SHARK_USE_OPENMP_matched) - if(NOT OTB_USE_OPENMP) - message(WARNING "Shark library is built with OpenMP and you have OTB_USE_OPENMP set to OFF.") - endif() +if(SHARK_H_CONTENTS MATCHES "#define.SHARK_USE_OPENMP") + set(SHARK_USE_OPENMP 1) +else() + set(SHARK_USE_OPENMP 0) +endif() + +if(SHARK_H_CONTENTS MATCHES "#define.SHARK_USE_CBLAS") + set(SHARK_USE_CBLAS 1) +else() + set(SHARK_USE_CBLAS 0) +endif() + +if(SHARK_H_CONTENTS MATCHES "#define.SHARK_USE_DYNLIB") + set(SHARK_USE_DYNLIB 1) +else() + set(SHARK_USE_DYNLIB 0) endif() INCLUDE(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) diff --git a/Modules/ThirdParty/Shark/otb-module-init.cmake b/Modules/ThirdParty/Shark/otb-module-init.cmake index 6bdd8c6a31..23ec6090c7 100644 --- a/Modules/ThirdParty/Shark/otb-module-init.cmake +++ b/Modules/ThirdParty/Shark/otb-module-init.cmake @@ -20,4 +20,8 @@ find_package ( Shark REQUIRED ) +if(SHARK_USE_OPENMP AND NOT OTB_USE_OPENMP) + message(WARNING "Shark library is built with OpenMP and you have OTB_USE_OPENMP set to OFF.") +endif() + mark_as_advanced( Shark_DIR ) -- GitLab