Commit a3ab26e6 authored by Samuel Debionne's avatar Samuel Debionne

Make GSL dependency optional (ON by default for backward compatibility)

parent 29a05820
Pipeline #7101 passed with stages
in 5 minutes and 58 seconds
......@@ -73,8 +73,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
# Threads lib required
find_package(Threads REQUIRED)
# GSL required
find_package(GSL REQUIRED)
# Enable GSL processing
option(PROCESSLIB_ENABLE_GSL "enable GSL related processing?" ON)
if(PROCESSLIB_ENABLE_GSL)
find_package(GSL REQUIRED)
endif(PROCESSLIB_ENABLE_GSL)
# Enable python binding code compilation using sip generator
option(PROCESSLIB_ENABLE_PYTHON "compile python binding code?" ${LIMA_ENABLE_PYTHON})
......@@ -164,10 +167,16 @@ set_target_properties(processlib PROPERTIES
VERSION "${PROJECT_VERSION}"
SOVERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
target_link_libraries(processlib
PUBLIC GSL::gsl
PUBLIC GSL::gslcblas
)
if(PROCESSLIB_ENABLE_GSL)
target_link_libraries(processlib
PUBLIC GSL::gsl
PUBLIC GSL::gslcblas
)
else()
target_compile_definitions(processlib
PUBLIC PROCESSLIB_WITHOUT_GSL
)
endif(PROCESSLIB_ENABLE_GSL)
# The following might work with cmake 3.12
# Add the library processlib definition
......@@ -177,8 +186,6 @@ target_link_libraries(processlib
# PRIVATE core
# PRIVATE tasks)
target_include_directories(processlib PRIVATE ${GSL_INCLUDE_DIRS})
target_include_directories(processlib PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/core/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tasks/include>"
......@@ -208,6 +215,10 @@ endif()
if(PROCESSLIB_ENABLE_PYTHON)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/sip/processlib.sip sip/processlib.sip COPYONLY)
set(SIP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tasks/sip")
# Disable BPM is GLS is not enabled
if(NOT PROCESSLIB_ENABLE_GSL)
set(SIP_DISABLE_FEATURES "BPM_SUPPORT")
endif(NOT PROCESSLIB_ENABLE_GSL)
add_sip_python_module(processlib "${CMAKE_CURRENT_BINARY_DIR}/sip/processlib.sip")
target_include_directories(python_module_processlib PRIVATE ${PYTHON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/sip)
target_link_libraries(python_module_processlib PRIVATE processlib)
......
......@@ -20,7 +20,7 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#ifndef WITHOUT_GSL
#ifndef PROCESSLIB_WITHOUT_GSL
#include <gsl/gsl_errno.h>
#include "processlib/GslErrorMgr.h"
#include "processlib/PoolThreadMgr.h"
......@@ -82,4 +82,4 @@ void GslErrorMgr::_error_handler(const char *reason,
aTmpBuffer));
get()._lastGslErrno.insert(ErrnoType::value_type(pthread_self(),gsl_errno));
}
#endif //WITHOUT_GSL
#endif //PROCESSLIB_WITHOUT_GSL
......@@ -22,7 +22,7 @@
//###########################################################################
#ifndef __BPM_H__
#define __BPM_H__
#ifndef WITHOUT_GSL
#ifndef PROCESSLIB_WITHOUT_GSL
#include "processlib/SinkTask.h"
namespace Tasks
......@@ -164,5 +164,5 @@ namespace Tasks
{
};
}
#endif // WITHOUT_GSL
#endif // PROCESSLIB_WITHOUT_GSL
#endif
......@@ -20,7 +20,7 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#ifndef WITHOUT_GSL
#ifndef PROCESSLIB_WITHOUT_GSL
#include <cstring>
#include <gsl/gsl_fft_complex.h>
......@@ -760,4 +760,4 @@ extern "C"
}
}
#endif
#endif //WITHOUT_GSL
#endif //PROCESSLIB_WITHOUT_GSL
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment