From a3fff6b8f6d210f3f8a71cdd32c7413a1226609c Mon Sep 17 00:00:00 2001 From: hbruintjes Date: Thu, 21 Apr 2016 16:20:04 +0200 Subject: [PATCH] Look for CLN and GiNaC, enable them if found Former-commit-id: 45cb58477c87449171e5685676648a69dcfa12db --- CMakeLists.txt | 41 ++++++++++++++++++++++++++++++- resources/cmake/FindCLN.cmake | 43 +++++++++++++++++++++++++++++++++ resources/cmake/FindGiNaC.cmake | 24 ++++++++++++++++++ 3 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 resources/cmake/FindCLN.cmake create mode 100644 resources/cmake/FindGiNaC.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a3cb1094..511797a05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -326,6 +326,26 @@ message(STATUS "StoRM - Linking with CUDD") #message("StoRM - CUDD include dir: ${CUDD_INCLUDE_DIR}") include_directories(${CUDD_INCLUDE_DIR}) +############################################################# +## +## CLN +## +############################################################# + +find_package(CLN QUIET) + +if(CLN_FOUND) + set(STORM_HAVE_CLN ON) + message(STATUS "StoRM - Linking with CLN") + include_directories("${CLN_INCLUDE_DIR}") + list(APPEND STORM_LINK_LIBRARIES ${CLN_LIBRARIES}) +else() + set(STORM_HAVE_CLN OFF) + if(NOT GMP_FOUND) + message(FATAL_ERROR "StoRM - Neither CLN nor GMP found") + endif() +endif() + ############################################################# ## ## carl @@ -337,7 +357,7 @@ if(USE_CARL) find_package(carl QUIET REQUIRED) if(carl_FOUND) set(STORM_HAVE_CARL ON) - message(STATUS "StoRM - Linking with carl.") + message(STATUS "StoRM - Linking with carl") include_directories("${carl_INCLUDE_DIR}") list(APPEND STORM_LINK_LIBRARIES ${carl_LIBRARIES}) else() @@ -363,6 +383,25 @@ if(smtrat_FOUND) list(APPEND STORM_LINK_LIBRARIES ${smtrat_LIBRARIES}) endif() +############################################################# +## +## GiNaC +## +############################################################# + +find_package(GiNaC QUIET) + +if(GiNaC_FOUND) + set(STORM_HAVE_GINAC ON) + message(STATUS "StoRM - Linking with GiNaC") + # Right now only link with GiNaC for carl + #include_directories("${GINAC_INCLUDE_DIR}") + list(APPEND STORM_LINK_LIBRARIES ${GINAC_LIBRARIES}) +else() + set(STORM_HAVE_GINAC OFF) + #TODO: Check if CARL actually requires the use of GiNaC +endif() + ############################################################# ## ## MathSAT (optional) diff --git a/resources/cmake/FindCLN.cmake b/resources/cmake/FindCLN.cmake new file mode 100644 index 000000000..2bb284648 --- /dev/null +++ b/resources/cmake/FindCLN.cmake @@ -0,0 +1,43 @@ +# - Try to find libcln +# Once done this will define +# CLN_FOUND - System has cln +# CLN_INCLUDE_DIR - The cln include directory +# CLN_LIBRARIES - The libraries needed to use cln +# CLN_VERSION_STRING - The version of cln ("major.minor.patch") + +# use pkg-config to get the directories and then use these values +# in the find_path() and find_library() calls +find_package(PkgConfig QUIET) +PKG_CHECK_MODULES(PC_CLN QUIET cln) + +find_path(CLN_INCLUDE_DIR NAMES cln/cln.h + HINTS + ${PC_CLN_INCLUDEDIR} + ${PC_CLN_INCLUDE_DIRS} + PATH_SUFFIXES cln + ) + +find_library(CLN_LIBRARIES NAMES cln + HINTS + ${PC_CLN_LIBDIR} + ${PC_CLN_LIBRARY_DIRS} + ) + +if(PC_CLN_VERSION) + set(CLN_VERSION_STRING ${PC_CLN_VERSION}) +elseif(CLN_INCLUDE_DIR AND EXISTS "${CLN_INCLUDE_DIR}/version.h") + file(STRINGS "${CLN_INCLUDE_DIR}/version.h" cln_version + REGEX "^#define[\t ]+CL_VERSION[\t ]+.+") + string(REGEX REPLACE "^#define[\t ]+CL_VERSION[\t ]+(.+)" "\\1" + CLN_VERSION_STRING "${cln_version}") + unset(cln_version) +endif() + +# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if +# all listed variables are TRUE +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(CLN + REQUIRED_VARS CLN_LIBRARIES CLN_INCLUDE_DIR + VERSION_VAR CLN_VERSION_STRING) + +mark_as_advanced(CLN_INCLUDE_DIR CLN_LIBRARIES) diff --git a/resources/cmake/FindGiNaC.cmake b/resources/cmake/FindGiNaC.cmake new file mode 100644 index 000000000..abea0e59b --- /dev/null +++ b/resources/cmake/FindGiNaC.cmake @@ -0,0 +1,24 @@ +set( GINAC_FOUND FALSE ) + +find_path( GINAC_INCLUDE_DIR ginac.h + /usr/include/ginac + /usr/local/include/ginac + /opt/local/include/ginac + $ENV{UNITTESTXX_PATH}/src + $ENV{UNITTESTXX_INCLUDE_PATH} ) + +find_library( GINAC_LIBRARIES NAMES ginac PATHS + /usr/lib + /usr/local/lib + /opt/local/lib + $ENV{UNITTESTXX_PATH} + ENV{UNITTESTXX_LIBRARY_PATH} ) + +if( GINAC_INCLUDE_DIR AND GINAC_LIBRARIES ) + SET( GINAC_FOUND TRUE ) +ENDIF (GINAC_INCLUDE_DIR AND GINAC_LIBRARIES) + + +MARK_AS_ADVANCED ( GINAC_INCLUDE_DIR + GINAC_LIBRARIES + )