From ca92d8631ba541482a921dccced2f6375471841b Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Wed, 21 Feb 2018 13:17:35 +0000 Subject: [PATCH] configuration --- CMakeLists.txt | 12 +-- cmake/Config.cmake | 4 +- cmake/FindGecode.cmake | 10 +- cmake/FindPostgreSQL.cmake | 192 ------------------------------------- cmake/FindSqlite3.cmake | 101 ------------------- cmake/java.cmake | 11 ++- cmake/python.cmake | 10 +- docs/CMakeLists.txt | 8 -- 8 files changed, 29 insertions(+), 319 deletions(-) delete mode 100644 cmake/FindPostgreSQL.cmake delete mode 100644 cmake/FindSqlite3.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index ac568778d..1030d7145 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ cmake_policy(VERSION 3.4) set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/cmake") set(ANACONDA $ENV{CONDA_BUILD} CACHE BOOL "Anaconda Environment") -message(STATUS "ANACONDA found: ${ANACONDA}") +#message(STATUS "ANACONDA found: ${ANACONDA}") include(CheckIncludeFiles) include(CheckLibraryExists) @@ -596,7 +596,7 @@ endif (GMP_FOUND) if (READLINE_FOUND) target_link_libraries(libYap ${READLINE_LIBRARIES}) # required for configure - + endif () if (WIN32) @@ -655,7 +655,7 @@ MY_set_target_properties(libYap ) -#utf-8 is not an option +#utf-8 is not aPconn option # we use the nice UTF-8 package #available at the Julia project @@ -726,7 +726,9 @@ OPTION(WITH_CPLINT " Enable the cplint probabilistic language" ON) OPTION(WITH_HORUS " Enable the CLPBN and PFL probabilistic languages" ON) -OPTION(WITH_DOCS " Enable documentation, requires doxygen-yap" ON) +find_host_package(Doxygen) + +option(WITH_DOCS "Create and install the HTML based API documentation (requires Doxygen)" ${DOXYGEN_FOUND}) IF (WITH_CLPBN) add_subDIRECTORY(packages/CLPBN) @@ -903,5 +905,3 @@ include(Config ) feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES INCLUDE_QUIET_PACKAGES ) - - diff --git a/cmake/Config.cmake b/cmake/Config.cmake index 3d1cd25ac..89331f891 100644 --- a/cmake/Config.cmake +++ b/cmake/Config.cmake @@ -98,6 +98,8 @@ check_include_file(winsock2.h HAVE_WINSOCK2_H) check_include_file(winsock.h HAVE_WINSOCK_H) check_include_file(wordexp.h HAVE_WORDEXP_H) +check_include_file(Python.h HAVE_PYTHON_H) + check_type_size("short int" SIZEOF_SHORT_INT) check_type_size("int" SIZEOF_INT) check_type_size("long int" SIZEOF_LONG) @@ -391,7 +393,7 @@ git_describe(GIT_DESCRIBE) include(TestSTDC) if (WITH_READLINE) - + check_include_files( "stdio.h;readline/readline.h" HAVE_READLINE_READLINE_H ) check_include_files( "stdio.h;readline/history.h" HAVE_READLINE_HISTORY_H ) check_function_exists( add_history HAVE_ADD_HISTORY ) diff --git a/cmake/FindGecode.cmake b/cmake/FindGecode.cmake index 402767dee..789f14870 100644 --- a/cmake/FindGecode.cmake +++ b/cmake/FindGecode.cmake @@ -8,16 +8,14 @@ find_file(GECODE_CONFIG gecode/support/config.hpp PATHS ${GECODE_ROOT_DIR}/incl find_library(GECODE_LIBRARY NAMES gecodekernel PATHS ${GECODE_ROOT_DIR}/lib ${CMAKE_INSTALL_PREFIX}/lib /usr/local/lib /opt/local/lib /usr}/lib) find_library(GECODE_SUPPORT_LIBRARY NAMES gecodesupport PATHS ${GECODE_ROOT_DIR}/lib ${CMAKE_INSTALL_PREFIX}/lib /usr/local/lib /opt/local/lib /usr}/include) -if(GECODE_CONFIG) - file(STRINGS ${GECODE_CONFIG} GECODE_LINE_VERSION REGEX "^#define GECODE_VERSION .*") - string(REGEX MATCH "[0-9].[0-9].[0-9]" GECODE_VERSION ${GECODE_LINE_VERSION}) -endif() if(GECODE_INCLUDE_DIR AND GECODE_LIBRARY AND GECODE_SUPPORT_LIBRARY) set(GECODE_FOUND Yes) -endif() -if(GECODE_FOUND) +if( GECODE_CONFIG AND GECODE_INCLUDE_DIR AND GECODE_LIBRARY) + file(STRINGS ${GECODE_CONFIG} GECODE_LINE_VERSION REGEX "^#define GECODE_VERSION .*") + string(REGEX MATCH "[0-9].[0-9].[0-9]" GECODE_VERSION ${GECODE_LINE_VERSION}) +endif() set(GECODE_LIBRARIES ${GECODE_LIBRARY} ${GECODE_SUPPORT_LIBRARY}) set(GECODE_INCLUDE_DIRS ${GECODE_INCLUDE_DIR}) find_library(GECODE_DRIVER_LIBRARY gecodedriver PATHS ${CMAKE_INSTALL_PREFIX}/lib) diff --git a/cmake/FindPostgreSQL.cmake b/cmake/FindPostgreSQL.cmake deleted file mode 100644 index fa972ca8d..000000000 --- a/cmake/FindPostgreSQL.cmake +++ /dev/null @@ -1,192 +0,0 @@ -#.rst: -# FindPostgreSQL -# -------------- -# -# Find the PostgreSQL installation. -# -# This module defines -# -# :: -# -# PostgreSQL_LIBRARIES - the PostgreSQL libraries needed for linking -# PostgreSQL_INCLUDE_DIRS - the directories of the PostgreSQL headers -# PostgreSQL_LIBRARY_DIRS - the link directories for PostgreSQL libraries -# PostgreSQL_VERSION_STRING - the version of PostgreSQL found (since CMake 2.8.8) - -#============================================================================= -# Copyright 2004-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# ---------------------------------------------------------------------------- -# History: -# This module is derived from the module originally found in the VTK source tree. -# -# ---------------------------------------------------------------------------- -# Note: -# PostgreSQL_ADDITIONAL_VERSIONS is a variable that can be used to set the -# version mumber of the implementation of PostgreSQL. -# In Windows the default installation of PostgreSQL uses that as part of the path. -# E.g C:\Program Files\PostgreSQL\8.4. -# Currently, the following version numbers are known to this module: -# "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0" -# -# To use this variable just do something like this: -# set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4") -# before calling find_package(PostgreSQL) in your CMakeLists.txt file. -# This will mean that the versions you set here will be found first in the order -# specified before the default ones are searched. -# -# ---------------------------------------------------------------------------- -# You may need to manually set: -# PostgreSQL_INCLUDE_DIR - the path to where the PostgreSQL include files are. -# PostgreSQL_LIBRARY_DIR - The path to where the PostgreSQL library files are. -# If FindPostgreSQL.cmake cannot find the include files or the library files. -# -# ---------------------------------------------------------------------------- -# The following variables are set if PostgreSQL is found: -# PostgreSQL_FOUND - Set to true when PostgreSQL is found. -# PostgreSQL_INCLUDE_DIRS - Include directories for PostgreSQL -# PostgreSQL_LIBRARY_DIRS - Link directories for PostgreSQL libraries -# PostgreSQL_LIBRARIES - The PostgreSQL libraries. -# -# ---------------------------------------------------------------------------- -# If you have installed PostgreSQL in a non-standard location. -# (Please note that in the following comments, it is assumed that -# points to the root directory of the include directory of PostgreSQL.) -# Then you have three options. -# 1) After CMake runs, set PostgreSQL_INCLUDE_DIR to /include and -# PostgreSQL_LIBRARY_DIR to wherever the library pq (or libpq in windows) is -# 2) Use CMAKE_INCLUDE_PATH to set a path to /PostgreSQL<-version>. This will allow find_path() -# to locate PostgreSQL_INCLUDE_DIR by utilizing the PATH_SUFFIXES option. e.g. In your CMakeLists.txt file -# set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "/include") -# 3) Set an environment variable called ${PostgreSQL_ROOT} that points to the root of where you have -# installed PostgreSQL, e.g. . -# -# ---------------------------------------------------------------------------- - -set(PostgreSQL_INCLUDE_PATH_DESCRIPTION "top-level directory containing the PostgreSQL include directories. E.g /usr/local/include/PostgreSQL/8.4 or C:/Program Files/PostgreSQL/8.4/include") -set(PostgreSQL_INCLUDE_DIR_MESSAGE "Set the PostgreSQL_INCLUDE_DIR cmake cache entry to the ${PostgreSQL_INCLUDE_PATH_DESCRIPTION}") -set(PostgreSQL_LIBRARY_PATH_DESCRIPTION "top-level directory containing the PostgreSQL libraries.") -set(PostgreSQL_LIBRARY_DIR_MESSAGE "Set the PostgreSQL_LIBRARY_DIR cmake cache entry to the ${PostgreSQL_LIBRARY_PATH_DESCRIPTION}") -set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to where PostgreSQL is found on the machine E.g C:/Program Files/PostgreSQL/8.4") - - -set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS} - "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") - -# Define additional search paths for root directories. -set( PostgreSQL_ROOT_DIRECTORIES - ENV PostgreSQL_ROOT - ${PostgreSQL_ROOT} -) -foreach(suffix ${PostgreSQL_KNOWN_VERSIONS}) - if(WIN32) - list(APPEND PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES - "PostgreSQL/${suffix}/lib") - list(APPEND PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES - "PostgreSQL/${suffix}/include") - list(APPEND PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES - "PostgreSQL/${suffix}/include/server") - endif() - if(UNIX) - list(APPEND PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES - "postgresql/${suffix}/server") - endif() -endforeach() - -# -# Look for an installation. -# -find_path(PostgreSQL_INCLUDE_DIR - NAMES libpq-fe.h - PATHS - # Look in other places. - ${PostgreSQL_ROOT_DIRECTORIES} - PATH_SUFFIXES - pgsql - postgresql - include - ${PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES} - # Help the user find it if we cannot. - DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}" -) - -find_path(PostgreSQL_TYPE_INCLUDE_DIR - NAMES catalog/pg_type.h - PATHS - # Look in other places. - ${PostgreSQL_ROOT_DIRECTORIES} - PATH_SUFFIXES - postgresql - pgsql/server - postgresql/server - include/server - ${PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES} - # Help the user find it if we cannot. - DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}" -) - -# The PostgreSQL library. -set (PostgreSQL_LIBRARY_TO_FIND pq) -# Setting some more prefixes for the library -set (PostgreSQL_LIB_PREFIX "") -if ( WIN32 ) - set (PostgreSQL_LIB_PREFIX ${PostgreSQL_LIB_PREFIX} "lib") - set (PostgreSQL_LIBRARY_TO_FIND ${PostgreSQL_LIB_PREFIX}${PostgreSQL_LIBRARY_TO_FIND}) -endif() - -find_library(PostgreSQL_LIBRARY - NAMES ${PostgreSQL_LIBRARY_TO_FIND} - PATHS - ${PostgreSQL_ROOT_DIRECTORIES} - PATH_SUFFIXES - lib - ${PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES} - # Help the user find it if we cannot. - DOC "The ${PostgreSQL_LIBRARY_DIR_MESSAGE}" -) -get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH) - -if (PostgreSQL_INCLUDE_DIR) - # Some platforms include multiple pg_config.hs for multi-lib configurations - # This is a temporary workaround. A better solution would be to compile - # a dummy c file and extract the value of the symbol. - file(GLOB _PG_CONFIG_HEADERS "${PostgreSQL_INCLUDE_DIR}/pg_config*.h") - foreach(_PG_CONFIG_HEADER ${_PG_CONFIG_HEADERS}) - if(EXISTS "${_PG_CONFIG_HEADER}") - file(STRINGS "${_PG_CONFIG_HEADER}" pgsql_version_str - REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"") - if(pgsql_version_str) - string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*" - "\\1" PostgreSQL_VERSION_STRING "${pgsql_version_str}") - break() - endif() - endif() - endforeach() - unset(pgsql_version_str) -endif() - -# Did we find anything? -#nclude(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) -find_package_handle_standard_args(PostgreSQL - REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR - VERSION_VAR PostgreSQL_VERSION_STRING) -set(PostgreSQL_FOUND ${POSTGRESQL_FOUND}) - -# Now try to get the include and library path. -if(PostgreSQL_FOUND) - set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR} ${PostgreSQL_TYPE_INCLUDE_DIR} ) - set(PostgreSQL_LIBRARY_DIRS ${PostgreSQL_LIBRARY_DIR} ) - set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY_TO_FIND}) -endif() - -mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR PostgreSQL_LIBRARY ) diff --git a/cmake/FindSqlite3.cmake b/cmake/FindSqlite3.cmake deleted file mode 100644 index b505f6810..000000000 --- a/cmake/FindSqlite3.cmake +++ /dev/null @@ -1,101 +0,0 @@ -# - Try to find Sqlite3 -# Once done this will define -# -# SQLITE3_FOUND - system has Sqlite3 -# SQLITE3_INCLUDE_DIRS - the Sqlite3 include directory -# SQLITE3_LIBRARIES - Link these to use Sqlite3 -# SQLITE3_DEFINITIONS - Compiler switches required for using Sqlite3 -# -# Copyright (c) 2008 Andreas Schneider -# -# Redistribution and use is allowed according to the terms of the New -# BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# - - -if (SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS) - # in cache already - set(SQLITE3_FOUND TRUE) -else (SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS) - # use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls - if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) - include(UsePkgConfig) - pkgconfig(sqlite3 _SQLITE3_INCLUDEDIR _SQLITE3_LIBDIR _SQLITE3_LDFLAGS _SQLITE3_CFLAGS) - else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) - find_package(PkgConfig) - if (PKG_CONFIG_FOUND) - pkg_check_modules(_SQLITE3 sqlite3) - endif (PKG_CONFIG_FOUND) - endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) - find_path(SQLITE3_INCLUDE_DIR - NAMES - sqlite3.h - PATHS - #! brew is better than default - /usr/local/opt/sqlite/include - ${_SQLITE3_INCLUDEDIR} - /usr/include - /usr/local/include - /opt/local/include - /sw/include - NO_DEFAULT_PATH - ) - - find_path(SQLITE3_INCLUDE_DIR - NAMES - sqlite3.h - ) - - find_library(SQLITE3_LIBRARY - NAMES - sqlite3 - PATHS - /usr/local/opt/sqlite/lib - ${_SQLITE3_LIBDIR} - /usr/lib - /usr/local/lib - /opt/local/lib - /sw/lib - NO_DEFAULT_PATH - ) - - find_library(SQLITE3_LIBRARY - NAMES - sqlite3 - ) - - if (SQLITE3_LIBRARY) - set(SQLITE3_FOUND TRUE) - endif (SQLITE3_LIBRARY) - - set(SQLITE3_INCLUDE_DIRS - ${SQLITE3_INCLUDE_DIR} - ) - - if (SQLITE3_FOUND) - set(SQLITE3_LIBRARIES - ${SQLITE3_LIBRARIES} - ${SQLITE3_LIBRARY} - ) - endif (SQLITE3_FOUND) - - if (SQLITE3_INCLUDE_DIRS AND SQLITE3_LIBRARIES) - set(SQLITE3_FOUND TRUE) - endif (SQLITE3_INCLUDE_DIRS AND SQLITE3_LIBRARIES) - - if (SQLITE3_FOUND) - if (NOT Sqlite3_FIND_QUIETLY) - message(STATUS "Found Sqlite3: ${SQLITE3_LIBRARIES}") - endif (NOT Sqlite3_FIND_QUIETLY) - else (SQLITE3_FOUND) - if (Sqlite3_FIND_REQUIRED) - message(SYSTEM_ERROR_FATAL "Could not find Sqlite3") - endif (Sqlite3_FIND_REQUIRED) - endif (SQLITE3_FOUND) - - # show the SQLITE3_INCLUDE_DIRS and SQLITE3_LIBRARIES variables only in the advanced view - mark_as_advanced(SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES) - -endif (SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS) diff --git a/cmake/java.cmake b/cmake/java.cmake index 470a81e6b..e493c894d 100644 --- a/cmake/java.cmake +++ b/cmake/java.cmake @@ -4,7 +4,7 @@ option(WITH_JAVA "Try to use Java (currently Java 6,7,8)" ON) if (WITH_JAVA) #detect java setup, as it is shared between different installations. -find_package(Java 1.5 COMPONENTS Runtime Development) +find_package(Java 8 COMPONENTS Runtime Development) # find_package(Java COMPONENTS Development) # find_package(Java COMPONENTS Runtime) #find_package(JavaLibs) @@ -12,6 +12,14 @@ find_package(Java 1.5 COMPONENTS Runtime Development) if (Java_Development_FOUND) + find_package(JNI) + + if (NOT JNI_FOUND) + +set (JAVA_HOME ${JAVA_INCLUDE_PATH}/..) + +endif() + find_package(JNI) if (JNI_FOUND) @@ -52,4 +60,3 @@ endif (JNI_FOUND) endif (Java_Development_FOUND) endif(WITH_JAVA) - diff --git a/cmake/python.cmake b/cmake/python.cmake index 2b4aeac53..7c9322e97 100644 --- a/cmake/python.cmake +++ b/cmake/python.cmake @@ -31,14 +31,18 @@ set( PYTHON_INCLUDE_DIRS $ENV{PYTHON_INCLUDE_DIRS} CACHE PATH "MINGW/MSYS2" FOR set (PYTHONLIBS_VERSION_STRING $ENV{PY_VER} CACHE STRING "MINGW/MSYS2" FORCE ) list (APPEND CMAKE_REQUIRED_INCLUDES ${PYTHON_INCLUDE_PATH}) - else() find_package(PythonInterp) + find_package(PythonLibs) + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; sysconfig.get_paths()['include']" + OUTPUT_VARIABLE PYTHON_INCLUDE_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE) + list (APPEND CMAKE_REQUIRED_INCLUDES + ${PYTHON_INCLUDE_PATH}) endif() -check_include_file(Python.h HAVE_PYTHON_H) IF (PYTHONLIBS_FOUND) add_subDIRECTORY (packages/python) -ENDIF() \ No newline at end of file +ENDIF() diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 6a54b5fe0..765680d56 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -3,17 +3,9 @@ if (WITH_DOCS) -find_host_package(Doxygen) -option(WITH_DOCS "Create and install the HTML based API documentation (requires Doxygen)" ${DOXYGEN_FOUND}) - - if(NOT DOXYGEN_FOUND) - message(FATAL_ERROR "Doxygen is needed to build the documentation.") - endif() set (TOP_DIR YES) -set (PACKAGES raptor) - set(DOCS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/docs) SET (CMAKE_HTML_EXTRA_