This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/CMakeLists.txt

1021 lines
27 KiB
CMake
Raw Normal View History

2017-10-17 00:13:09 +01:00
2016-07-31 10:56:54 +01:00
# value of 3.4.0 or lower.
2017-06-13 13:34:17 +01:00
cmake_minimum_required(VERSION 3.4)
2014-12-14 12:05:43 +00:00
# Sets the version of CMake required to build the native
# library. You should either keep the default value or pass a
2018-11-16 14:02:56 +00:00
# value of 3.4.0 or lower.fg
2017-05-02 07:42:21 +01:00
include(CMakeToolsHelpers OPTIONAL)
2015-08-08 15:11:29 +01:00
2017-07-30 22:24:00 +01:00
include(FeatureSummary)
2017-10-17 00:13:09 +01:00
include(GNUInstallDirs)
2017-05-08 18:51:29 +01:00
2017-12-05 15:14:57 +00:00
project(YAP)
2018-02-22 09:33:43 +00:00
set(YAP_APP_DIR "${CMAKE_SOURCE_DIR}/../yaplib")
2017-10-17 00:13:09 +01:00
cmake_policy(VERSION 3.4)
2016-11-11 07:23:34 +00:00
2017-11-11 22:48:09 +00:00
set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/cmake")
2016-05-30 11:23:36 +01:00
2017-12-10 01:22:45 +00:00
set(ANACONDA $ENV{CONDA_BUILD} CACHE BOOL "Anaconda Environment")
2018-02-21 13:17:35 +00:00
#message(STATUS "ANACONDA found: ${ANACONDA}")
2017-11-10 23:08:35 +00:00
2016-07-31 10:56:54 +01:00
include(CheckIncludeFiles)
2015-06-19 01:30:13 +01:00
include(CheckLibraryExists)
include(CheckSymbolExists)
include(CheckTypeSize)
2016-07-31 10:56:54 +01:00
include(CMakeDependentOption)
include(MacroOptionalAddSubdirectory)
include(MacroOptionalFindPackage)
2017-07-30 22:24:00 +01:00
include(FeatureSummary)
2016-07-31 10:56:54 +01:00
include(FindPackageHandleStandardArgs)
2017-10-17 00:13:09 +01:00
# Optional Components
#
include(CheckIncludeFileCXX)
include(CheckFunctionExists)
include(CheckFunctionExists)
include(CheckPrototypeExists)
include(CheckVariableExists)
include(CheckCXXSourceCompiles)
include(TestBigEndian)
include(GetGitRevisionDescription)
2016-12-10 07:06:16 +00:00
2016-07-31 10:56:54 +01:00
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.z
# You can define libraries, and CMake builds it for you.
2016-07-31 10:56:54 +01:00
# Gradle automatically packages shared libraries with your APK.
2015-06-19 01:30:13 +01:00
2016-11-11 07:23:34 +00:00
#cross-compilation support
# Search packages for host system instead of packages for target system
# in case of cross compilation define these macro by toolchain file
2017-11-11 22:48:09 +00:00
if (NOT COMMAND find_host_package)
macro(find_host_package)
find_package(${ARGN})
endmacro()
2017-11-11 22:48:09 +00:00
endif ()
if (NOT COMMAND find_host_program)
macro(find_host_program)
find_program(${ARGN})
endmacro()
2017-11-11 22:48:09 +00:00
endif ()
2015-06-19 01:30:13 +01:00
2017-11-08 09:29:01 +00:00
if (POLICY CMP0003)
cmake_policy(SET CMP0003 NEW)
2017-11-11 22:48:09 +00:00
endif ()
2017-11-08 09:29:01 +00:00
if (POLICY CMP0068)
cmake_policy(SET CMP0068 NEW)
2019-01-18 03:49:42 +00:00
endif()
if (POLICY CMP0075)
cmake_policy(SET CMP0075 NEW)
2017-11-11 22:48:09 +00:00
endif ()
2017-11-08 09:29:01 +00:00
## options: compilation flags
2017-11-10 23:08:35 +00:00
option(BUILD_SHARED_LIBS "Build shared library" ON)
CMAKE_DEPENDENT_OPTION(WITH_SYSTEM_MMAP "Use MMAP for shared memory allocation" ON "NOT WITH_YAPOR_THOR" OFF)
CMAKE_DEPENDENT_OPTION(WITH_SYSTEM_SHM "Use SHM for shared memory allocation" ON "NOT WITH_YAPOR_THOR; NOT WITH_SYSTEM_MMAP" OFF)
OPTION(WITH_CALL_TRACER "support for procedure-call tracing" ${DEBUG})
option(WITH_YAP_DLL "compile YAP as a DLL" ON)
option(WITH_YAP_STATIC "compile YAP statically" OFF)
option(WITH_YAP_CONDOR "allow YAP to be used from condor" OFF)
option(WITH_YAP_DLL "compile YAP as a DLL" ON)
if (WITH_YAP_CONDOR)
set(WITH_YAP_STATIC ON)
set(WITH_YAP_DLL OFF)
endif ()
## options: libraries
option(WITH_THREADED_CODE "threaded code" ON)
2019-01-09 13:59:58 +00:00
if (NOT ANDROID)
option(WITH_MPI "Interface to OpenMPI/MPICH" ON)
2019-01-09 13:59:58 +00:00
endif()
option(WITH_JIT "just in Time Clause Compilation" OFF)
if (APPLE)
2018-10-24 13:15:19 +01:00
set(MACOSX_RPATH ON)
option(WITH_BREW "brew" ON)
2018-10-24 13:15:19 +01:00
if (WITH_BREW)
EXECUTE_PROCESS(COMMAND brew --prefix RESULT_VARIABLE DETECT_BREW OUTPUT_VARIABLE BREW_PREFIX ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
IF (${DETECT_BREW} EQUAL 0)
# "/opt/local" is where MacPorts lives, add `/lib` suffix and link
LINK_DIRECTORIES( ${BREW_PREFIX}/lib)
list(INSERT CMAKE_PREFIX_PATH pos
${BREW_PREFIX}/opt/gmp
${BREW_PREFIX}/opt/libxml2
${BREW_PREFIX}/opt/openmpi
${BREW_PREFIX}/opt/openssl
${BREW_PREFIX}/opt/postgresql
${BREW_PREFIX}/opt/python3
${BREW_PREFIX}/opt/readline
${BREW_PREFIX}/opt/swig
)
else()
option(WITH_MACPORTS "mac-ports" ON)
if (WITH_MACPORTS)
# Add MacPorts
# Detect if the "port" command is valid on this system; if so, return full path
EXECUTE_PROCESS(COMMAND which port RESULT_VARIABLE DETECT_MACPORTS OUTPUT_VARIABLE MACPORTS_PREFIX ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
IF (${DETECT_MACPORTS} EQUAL 0)
# "/opt/local/bin/port" doesn't have libs, so we get the parent directory
GET_FILENAME_COMPONENT(MACPORTS_PREFIX ${MACPORTS_PREFIX} DIRECTORY)
# "/opt/local/bin" doesn't have libs, so we get the parent directory
2019-01-09 09:32:09 +00:00
GET_FILENAME_COMPONENT(MACPORTS_PREFIX ${MACPORTS_PssREFIX} DIRECTORY)
2018-10-24 13:15:19 +01:00
# "/opt/local" is where MacPorts lives, add `/lib` suffix and link
LINK_DIRECTORIES(${LINK DIRECTORIES} ${MACPORTS_PREFIX}/lib)
endif()
endif()
endif()
endif()
endif()
2019-01-09 09:32:09 +00:00
OPTION(WITH_MYDDAS " Enable MYDDAS DBMS interface" ON)
2019-01-09 09:32:09 +00:00
if (ANDROID)
option (WITH_PACKAGES "packages and libraries that add value to YAP" OFF)
OPTION(WITH_SWIG " Enable SWIG interfaces to foreign languages" ON)
OPTION(WITH_SQLITE3 " Enable MYDDAS SQLITE3 driver" ON)
else()
option (WITH_PACKAGES "packages and libraries that add value to YAP" ON)
OPTION(WITH_SWIG " Enable SWIG interfaces to foreign languages" ${WITH_PACKAGES})
OPTION(WITH_SQLITE3 " Enable MYDDAS SQLITE3 driver" ${WITH_PACKAGES})
endif()
OPTION(WITH_MYSQL " Enable MYDDAS MYSQL driver" ${WITH_MYDDAS}})
2018-10-23 10:09:17 +01:00
OPTION(WITH_ODBC " Enable MYDDAS ODBC driver" ${WITH_MYDDAS})
OPTION(WITH_POSTGRES " Enable MYDDAS POSTGRES driver" ${WITH_MYDDAS})
2019-01-09 09:32:09 +00:00
IF (WITH_SWIG)
find_host_package(SWIG)
# macro_log_feature (SWIG_FOUND "Swig"
# "Use SWIG Interface Generator "
# "http://www.swig.org" ON)
ENDIF (WITH_SWIG)
2018-10-24 13:15:19 +01:00
OPTION(WITH_RAPTOR " Enable the RAPTOR RDF library" ${WITH_PACKAGES})
OPTION(WITH_XML2 " Enable the RAPTOR XML2 library" ${WITH_PACKAGES})
OPTION(WITH_XML " Enable the Prolog XML library" ${WITH_PACKAGES})
2019-01-09 09:32:09 +00:00
OPTION(WITH_CLPBN " Enable the CLPBN and PFL probabilistic languages" ${WITH_PACKAGES})
2018-10-23 10:09:17 +01:00
OPTION(WITH_HORUS " Enable the HORUS inference libraray for CLPBN and PFL" ${WITH_CLPBN})
2018-10-24 13:15:19 +01:00
option(WITH_PROBLOG "include Problog-I." ${WITH_PACKAGES})
OPTION(WITH_CPLINT " Enable the cplint probabilistic language" ${WITH_PACKAGES})
option(WITH_GECODE "interface gecode constraint solver" ${WITH_PACKAGES})
option(WITH_LBFGS "interface with lbfgs" ${WITH_PACKAGES})
option(WITH_PRISM "use PRISM system in YAP" ${WITH_PACKAGES})
option(WITH_PYTHON "Allow Python->YAP and YAP->Python" ${WITH_PACKAGES})
option(WITH_R "Use R Interface" ${WITH_PACKAGES})
2019-01-18 03:49:42 +00:00
option(WITH_JAVA "Try to use Java (currently Java )" ${WITH_PACKAGES})
2017-11-08 09:29:01 +00:00
2017-11-11 22:48:09 +00:00
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
2017-10-11 02:24:15 +01:00
#begining stuff for top CMakeLists
2016-06-02 11:52:22 +01:00
2017-11-11 22:48:09 +00:00
include(MacroLogFeature)
2016-05-30 11:23:36 +01:00
2017-10-11 02:24:15 +01:00
if (POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
2017-11-11 22:48:09 +00:00
endif ()
2017-10-11 02:24:15 +01:00
2019-01-09 09:32:09 +00:00
if (ANDROID)
function(add_to_dir list output)
endfunction(add_to_dir list output)
2017-10-11 02:24:15 +01:00
function(add_to_libgroup el list)
# add_custom_command( TARGET ${el} POST_BUILD
# COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${el}> ${CMAKE_BINARY_DIR}/packages/python/swig/yap4py
# DEPENDS ${el} )
2019-01-09 09:32:09 +00:00
#list(APPEND ${list} ${${el}})
#set(${list} ${${list}} CACHE INTERNAL "prolog dll files")
2017-11-11 22:48:09 +00:00
endfunction(add_to_libgroup el list)
2017-10-11 02:24:15 +01:00
function(add_to_corelibgroup el list)
# add_custom_command( TARGET ${el} POST_BUILD
# COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${el}> $<TARGET_SONAME_FILE:${el}> $<TARGET_LINKER_FILE:${el}> ${CMAKE_BINARY_DIR}/packages/python/swig/yap4py
# DEPENDS ${el} )
list(APPEND ${list} ${${el}})
set(${list} ${${list}} CACHE INTERNAL "prolog dll files")
2017-11-11 22:48:09 +00:00
endfunction(add_to_corelibgroup el list)
2017-10-11 02:24:15 +01:00
2019-01-09 09:32:09 +00:00
else()
function(add_to_dir list output)
endfunction(add_to_dir list output)
endif()
2017-10-11 02:24:15 +01:00
if (ANDROID_OLD)
macro(MY_add_custom_target)
endmacro()
2017-11-11 22:48:09 +00:00
else ()
macro(MY_add_custom_target)
add_custom_target(${ARGN})
endmacro()
2017-11-11 22:48:09 +00:00
endif ()
2017-10-11 02:24:15 +01:00
if (WIN32)
macro(add_component arg1)
add_library(${arg1} OBJECT ${ARGN})
endmacro()
2017-11-11 22:48:09 +00:00
else ()
macro(add_component arg1)
add_library(${arg1} OBJECT ${ARGN})
endmacro()
2017-11-11 22:48:09 +00:00
endif ()
macro(add_corelib arg1)
add_library(${arg1} SHARED ${ARGN})
add_to_corelibgroup(${arg1} YAP_DLLS)
2017-10-11 02:24:15 +01:00
endmacro()
if (ANDROID_OLD)
macro(MY_add_dependencies)
endmacro()
2017-11-11 22:48:09 +00:00
else ()
macro(MY_add_dependencies)
add_dependencies(${ARGN})
endmacro()
2017-11-11 22:48:09 +00:00
endif ()
2017-10-11 02:24:15 +01:00
if (ANDROID_OLD)
macro(MY_add_library)
endmacro()
2017-11-11 22:48:09 +00:00
else ()
macro(MY_add_library)
add_library(${ARGN})
endmacro()
2017-11-11 22:48:09 +00:00
endif ()
2017-10-11 02:24:15 +01:00
if (ANDROID)
macro(MY_add_subdirectory)
endmacro()
2017-11-11 22:48:09 +00:00
else ()
macro(MY_add_subdirectory)
add_subdirectory(${ARGN})
endmacro()
2017-11-11 22:48:09 +00:00
endif ()
2017-10-11 02:24:15 +01:00
if (ANDROID_OLD)
macro(MY_include)
endmacro()
2017-11-11 22:48:09 +00:00
else ()
macro(MY_include)
include(${ARGN})
endmacro()
2017-11-11 22:48:09 +00:00
endif ()
2017-10-11 02:24:15 +01:00
if (ANDROID)
macro(MY_install)
endmacro()
2017-11-11 22:48:09 +00:00
else ()
macro(MY_install)
install(${ARGN})
endmacro()
2017-11-11 22:48:09 +00:00
endif ()
2017-10-11 02:24:15 +01:00
if (ANDROID_OLD)
macro(MY_set_target_properties)
endmacro()
2017-11-11 22:48:09 +00:00
else ()
macro(MY_set_target_properties)
set_target_properties(${ARGN})
endmacro()
2017-11-11 22:48:09 +00:00
endif ()
2017-10-11 02:24:15 +01:00
if (ANDROID_OLD)
macro(MY_target_link_libraries)
endmacro()
2017-11-11 22:48:09 +00:00
else ()
macro(MY_target_link_libraries)
target_link_libraries(${ARGN})
endmacro()
2017-11-11 22:48:09 +00:00
endif ()
2017-10-11 02:24:15 +01:00
# where we have most scripts
# set path to additional CMake modules
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(disallow)
disallow_intree_builds()
# set(CMAKE_BUILD_TYPE Debug)
2017-11-08 09:29:01 +00:00
2019-01-09 09:32:09 +00:00
if ($ENV{CONDA_BUILD}x STREQUAL "1x" )
set(CMAKE_LIBRARY_ARCHITECTURE $ENV{PREFIX})
set(CMAKE_PREFIX_PATH $ENV{PREFIX})
set( R_COMMAND "$ENV{R}")
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS CONDA_BUILD=1)
set(YAP_IS_MOVABLE 1)
2017-10-17 00:13:09 +01:00
endif()
ADD_CUSTOM_TARGET(run_install COMMAND ${CMAKE_MAKE_PROGRAM} install)
2019-01-18 03:49:42 +00:00
list (APPEND CMAKE_REQUIRED_INCLUDES
${PREFIX}/include
${SYS_PREFIX}/include
)
2017-11-11 22:48:09 +00:00
set(prefix ${CMAKE_INSTALL_PREFIX}) #BINDIR})
set(docdir ${CMAKE_INSTALL_PREFIX}/share/docs) #MANDIR})
2017-10-11 02:24:15 +01:00
set(YAP_ROOTDIR ${prefix})
# erootdir -> rootdir
# libdir defined above
2017-12-05 15:14:57 +00:00
set(YAP_DATADIR ${CMAKE_INSTALL_FULL_DATADIR})
set(YAP_INCLUDEDIR ${CMAKE_INSTALL_FULL_INCLUDEDIR}/Yap)
2018-12-14 10:29:12 +00:00
set(YAP_BINDIR ${CMAKE_INSTALL_FULL_BINDIR})
2017-12-05 15:14:57 +00:00
set(YAP_LIBDIR ${CMAKE_INSTALL_FULL_LIBDIR})
set(YAP_DLLDIR ${CMAKE_INSTALL_FULL_LIBDIR}/Yap)
set(YAP_PLDIR ${CMAKE_INSTALL_FULL_DATADIR}/Yap)
2018-11-17 23:39:55 +00:00
set(YAP_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}/Yap)
2018-11-16 14:02:56 +00:00
set(YAP_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}/Yap)
2019-01-09 09:32:09 +00:00
if (ANDROID)
set(YAP_INSTALL_DATADIR ${CMAKE_SOURCE_DIR}/../yaplib/src/generated/assets/Yap)
else()
2018-11-16 14:02:56 +00:00
set(YAP_INSTALL_DATADIR ${CMAKE_INSTALL_DATADIR}/Yap)
2019-01-09 09:32:09 +00:00
endif()
2017-10-11 02:24:15 +01:00
#
#
2017-12-05 15:14:57 +00:00
# include( Sources )
2017-10-11 02:24:15 +01:00
#
2017-12-05 15:14:57 +00:00
# include( Model )
2017-10-11 02:24:15 +01:00
2017-12-05 15:14:57 +00:00
include(cudd )
2017-11-11 22:48:09 +00:00
set(pl_library "" CACHE INTERNAL "prolog library files")
set(pl_os_library "" CACHE INTERNAL "prolog os files")
set(pl_boot_library "" CACHE INTERNAL "prolog boot files")
2017-10-11 02:24:15 +01:00
2016-05-30 11:23:36 +01:00
2017-11-11 22:48:09 +00:00
find_package(GMP)
2017-10-17 00:13:09 +01:00
# GMP_FOUND - true if GMP/MPIR was found
# GMP_INCLUDE_DIRS - include search path
# GMP_LIBRARIES - libraries to link with
# GMP_LIBRARY_ #add_executable(test ${SOURCES})
2017-10-11 02:24:15 +01:00
2017-10-17 00:13:09 +01:00
list(APPEND YAP_SYSTEM_OPTIONS big_numbers)
2017-10-11 02:24:15 +01:00
2018-11-21 00:48:53 +00:00
if (GMP_INCLUDE_DIRS)
#config.h needs this (TODO: change in code latter)
include_directories(${GMP_INCLUDE_DIRS})
2018-11-21 00:48:53 +00:00
endif ()
2018-02-10 14:12:29 +00:00
2019-01-21 01:11:42 +00:00
# - Find the readline library
# This module defines
# READLINE_INCLUDE_DIR, path to readline/readline.h, etc.
# READLINE_LIBRARIES, the libraries required to use READLINE.
# READLINE_FOUND, If false, do not try to use READLINE.
# also defined, but not for general use are
# READLINE_readline_LIBRARY, where to find the READLINE library.
# READLINE_ncurses_LIBRARY, where to find the ncurses library [might not be defined]
2019-03-11 19:05:39 +00:00
if (ANDROID)
option (WITH_READLINE "use Readline" OFF)
else()
include(FindReadline)
2017-10-11 02:24:15 +01:00
2019-01-21 01:11:42 +00:00
option (WITH_READLINE "use Readline" ON)
# include subdirectories configuration
## after we have all functionality in
#
# ADD_SUBDIRECTORY(console/terminal)
2017-10-12 12:08:32 +01:00
2019-03-11 19:05:39 +00:00
if (READLINE_FOUND AND READLINE_INCLUDE_DIR)
2019-01-21 01:11:42 +00:00
List(APPEND YAP_SYSTEM_OPTIONS readline)
# required for configure
2019-01-21 01:11:42 +00:00
include_directories( ${READLINE_INCLUDE_DIR}
2019-01-18 03:49:42 +00:00
${READLINE_INCLUDE_DIR}/readline
)
endif ()
2019-03-11 19:05:39 +00:00
endif()
2017-10-11 02:24:15 +01:00
2019-01-24 19:03:18 +00:00
include_directories(
${CMAKE_SOURCE_DIR}/H
${CMAKE_SOURCE_DIR}/H/generated
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/os
${CMAKE_SOURCE_DIR}/OPTYap
${CMAKE_SOURCE_DIR}/utf8proc
${CMAKE_SOURCE_DIR}/JIT/HPP
2019-01-21 18:54:14 +00:00
${GMP_INCLUDE_DIRS}
2019-01-30 15:24:06 +00:00
${READLINE_INCLUDE_DIR}
2019-01-24 19:03:18 +00:00
${CMAKE_BINARY_DIR}
2019-01-21 18:54:14 +00:00
)
2019-01-24 19:03:18 +00:00
add_subdirectory( H )
2017-10-11 02:24:15 +01:00
#MPI STUFF
# library/mpi/mpi.c library/mpi/mpe.c
# library/lammpi/yap_mpi.c library/lammpi/hash.c library/lammpi/prologterms2c.c
# )
#WIN STUFF
# SET(PLCONS_SOURCES
# console/LGPL/pl-nt.c
# console/LGPL/pl-ntcon.c
# console/LGPL/pl-ntconsole.c
# console/LGPL/pl-ntmain.c
# )
set(YAP_FOUND ON)
set(YAP_MAJOR_VERSION 6)
2019-01-21 18:54:14 +00:00
set(YAP_MINOR_VERSION 5)
set(YAP_PATCH_VERSION 0)
2017-10-11 02:24:15 +01:00
set(YAP_FULL_VERSION
${YAP_MAJOR_VERSION}.${YAP_MINOR_VERSION}.${YAP_PATCH_VERSION})
2017-10-11 02:24:15 +01:00
set(YAP_FVERSION
${YAP_MAJOR_VERSION}.${YAP_MINOR_VERSION}.${YAP_PATCH_VERSION})
2017-10-11 02:24:15 +01:00
set(YAP_NUMERIC_VERSION
${YAP_MAJOR_VERSION}*10000+${YAP_MINOR_VERSION}*100+${YAP_PATCH_VERSION})
2017-10-11 02:24:15 +01:00
set(MYDDAS_VERSION MYDDAS-0.9.1)
2017-11-11 22:48:09 +00:00
site_name(YAP_SITE)
2017-10-11 02:24:15 +01:00
if (WIN32)
set(YAP_ARCH $ENV{PROCESSOR_ARCHITECTURE})
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "MS_WIN64=1")
set(YAP_SYSTEM_OPTIONS "windows " ${YAP_SYSTEM_OPTIONS})
2017-11-11 22:48:09 +00:00
endif ()
2017-10-11 02:24:15 +01:00
if (UNIX)
find_program(UNAME uname)
execute_process(
COMMAND ${UNAME} -m
OUTPUT_VARIABLE YAP_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
set(YAP_SYSTEM_OPTIONS "unix " ${YAP_SYSTEM_OPTIONS})
2017-11-11 22:48:09 +00:00
endif ()
2017-10-11 02:24:15 +01:00
#
2017-11-11 22:48:09 +00:00
set(MIN_STACKSPACE 1024*SIZEOF_INT_P)
set(MIN_HEAPSPACE 32*1024*SIZEOF_INT_P)
set(MIN_TRAILSPACE 512*SIZEOF_INT_P)
set(DEF_STACKSPACE 0)
set(DEF_HEAPSPACE 0)
set(DEF_TRAILSPACE 0)
2017-10-11 02:24:15 +01:00
# dd_definitions (-D)
## don't touch these opts
2017-11-11 22:48:09 +00:00
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS DEPTH_LIMIT=1;COROUTINING=1;RATIONAL_TREES=1)
2017-10-11 02:24:15 +01:00
# inform we are compiling YAP
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "_YAP_NOT_INSTALLED_=1;HAVE_CONFIG_H=1;_GNU_SOURCE=1")
2017-10-11 02:24:15 +01:00
# Compilation model
# target_compile_definitions(libYap PUBLIC _XOPEN_SOURCE=700 )
#add_definitions( -Wall -Wstrict-prototypes -Wmissing-prototypes)
# Model Specific
2017-11-11 22:48:09 +00:00
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:DEBUG=1>)
2017-10-11 02:24:15 +01:00
2019-02-01 13:14:33 +00:00
# debug across macros
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS $<$<CONFIG:Debug>:-g3>)
2017-10-11 02:24:15 +01:00
#ensure cells are properly aligned in code
2017-11-11 22:48:09 +00:00
set(ALIGN_LONGS 1)
2017-10-11 02:24:15 +01:00
#ensure best access to slots in environments
2017-11-11 22:48:09 +00:00
set(MSHIFTOFFS 1)
2017-10-11 02:24:15 +01:00
2017-11-11 22:48:09 +00:00
set(C_COMPILER CMAKE_C_COMPILER_ID)
2017-10-11 02:24:15 +01:00
2017-11-11 22:48:09 +00:00
if (${C_COMPILER} MATCHES "GNU")
set(HAVE_GCC 1)
2017-11-11 22:48:09 +00:00
endif ()
2017-10-11 02:24:15 +01:00
# compatible compilers
2017-11-11 22:48:09 +00:00
if (${C_COMPILER} MATCHES "Clang")
set(HAVE_GCC 1)
2017-11-11 22:48:09 +00:00
endif ()
2017-10-11 02:24:15 +01:00
2017-11-11 22:48:09 +00:00
if (${C_COMPILER} MATCHES "Intel")
set(HAVE_GCC 1)
2017-11-11 22:48:09 +00:00
endif ()
2017-10-11 02:24:15 +01:00
2017-12-11 03:36:21 +00:00
# rpath stuff, hopefully it works
# use, i.e. don't skip the full RPATH for the build tree
2018-01-05 16:57:38 +00:00
#SET(CMAKE_SKIP_BUILD_RPATH TRUE)
2017-12-11 03:36:21 +00:00
# when building, don't use the install RPATH already
2018-01-05 16:57:38 +00:00
## (but later on when installing)
#SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
#
2019-01-18 03:49:42 +00:00
## SET(CMAKE_INSTALL_FULL_RPATH ${CMAKE_BINARY_DIR})
2018-01-05 16:57:38 +00:00
#
## add the automatically determined parts of the RPATH
## which point to directories outside the build tree to the install RPATH
#SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FAlSE)
#
#
## the RPATH to be used when installing, but only if it's not a system directory
2018-11-16 14:02:56 +00:00
#LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${YAP_INSTALL_LIBDIR}" isSystemDir)
2018-01-05 16:57:38 +00:00
# IF("${isSystemDir}" STREQUAL "-1")
2018-11-16 14:02:56 +00:00
# SET(CMAKE_INSTALL_RPATH ${YAP_INSTALL_LIBDIR})
2018-01-05 16:57:38 +00:00
#ENDIF("${isSystemDir}" STREQUAL "-1")
#
2017-12-11 03:36:21 +00:00
IF(NOT WIN32 AND NOT APPLE)
LIST(APPEND CMAKE_INSTALL_RPATH \\$ORIGIN/../lib/Yap)
LIST(APPEND CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR})
LIST(APPEND CMAKE_INSTALL_RPATH \\$ORIGIN/../lib)
LIST(APPEND CMAKE_INSTALL_RPATH \\$ORIGIN/../../../lib)
2018-01-05 16:57:38 +00:00
ELSE()
LIST(APPEND CMAKE_INSTALL_RPATH @loader_path/../lib/Yap)
LIST(APPEND CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR})
LIST(APPEND CMAKE_INSTALL_RPATH @loader_path/../lib)
LIST(APPEND CMAKE_INSTALL_RPATH @loader_path/../../../lib)
2017-12-11 03:36:21 +00:00
ENDIF()
2019-01-18 03:49:42 +00:00
set(YAP_STARTUP startup.yss)
set(YAP_SOURCEBOOT boot.yap )
2017-10-11 02:24:15 +01:00
# Model Specific
if (HAVE_GCC)
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS -Wall)
if (${C_COMPILER} MATCHES "GNU")
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS $<$<CONFIG:Release>:-O3;-fomit-frame-pointer;-fstrict-aliasing;-freorder-blocks;-fsched-interblock>)
else ()
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS $<$<CONFIG:Release>:-O3;-fstrict-aliasing;-freorder-blocks;-fsched-interblock>)
endif ()
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS -fexceptions)
2017-11-11 22:48:09 +00:00
endif ()
2017-10-11 02:24:15 +01:00
# set_property( DIRECTORY APPEND_STRING PROPERTY -fsanitize=memory;-fsanitize-memory-track-origins=2)
if (HAVE_GCC)
# replace instructions codes by the address of their code
if (WITH_THREADED_CODE)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS THREADED_CODE=1)
endif (WITH_THREADED_CODE)
2017-10-11 02:24:15 +01:00
endif (HAVE_GCC)
#
#option (YAP_SWI_IO ON)
2019-01-09 13:59:58 +00:00
#TODO:
2017-10-11 02:24:15 +01:00
#TODO:
if (WITH_CALL_TRACER)
list(APPEND YAP_SYSTEM_OPTIONS "call_tracer " ${YAP_SYSTEM_OPTIONS})
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:LOW_LEVEL_TRACER=1>)
2017-10-11 02:24:15 +01:00
endif (WITH_CALL_TRACER)
2017-11-11 22:48:09 +00:00
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS UTF8PROC=1)
2017-06-13 13:34:17 +01:00
2018-02-15 00:02:44 +00:00
set_property(SOURCE ${LIBYAP_SOURCES} APPEND PROPERTY COMPILE_DEFINITIONS YAP_KERNEL=1)
2017-06-13 13:34:17 +01:00
IF (WITH_PYTHON)
include(python )
2017-06-13 13:34:17 +01:00
ENDIF (WITH_PYTHON)
2018-12-07 16:22:17 +00:00
2016-05-30 11:23:36 +01:00
2018-05-20 18:40:56 +01:00
IF (WITH_R)
find_host_package(LibR)
add_subDIRECTORY(packages/real)
2019-03-18 14:47:29 +00:00
ENDIF (WITH_R)
2018-05-20 18:40:56 +01:00
2017-06-13 13:34:17 +01:00
2017-11-11 22:48:09 +00:00
include(Sources)
2016-12-03 16:38:07 +00:00
2019-01-09 13:59:58 +00:00
ADD_SUBDIRECTORY(OPTYap)
ADD_SUBDIRECTORY(os)
ADD_SUBDIRECTORY(library/dialect/swi/fli)
ADD_SUBDIRECTORY(CXX)
2019-01-18 03:49:42 +00:00
ADD_SUBDIRECTORY(pl)
ADD_SUBDIRECTORY(library)
2019-01-21 01:11:42 +00:00
ADD_SUBDIRECTORY(swi/library)
2019-01-09 13:59:58 +00:00
add_subDIRECTORY(utf8proc )
2019-01-21 01:11:42 +00:00
2019-01-09 09:32:09 +00:00
if(ANDROID)
set(CXX_SWIG_OUTDIR ${CMAKE_BINARY_DIR}/packages/swig/android)
add_subdirectory(packages/swig/android)
add_definitions(-DMYDDAS=1 -DEMBEDDED_MYDDAS=1 -DMYDDAS_SQLITE3=1 -DEMBEDDED_SQLITE3=1)
2019-01-09 13:59:58 +00:00
link_directories(${CMAKE_SOURCE_DIR}/../sqlite-android/jni/${CMAKE_ANDROID_ARCH_ABI})
2019-01-09 09:32:09 +00:00
else()
add_definitions(-DMYDDAS=1 -DEMBEDDED_MYDDAS=1 -DMYDDAS_SQLITE3=1 )
2015-06-19 01:30:13 +01:00
2019-01-09 09:32:09 +00:00
endif()
if (MYSQL_FOUND)
2019-01-09 09:32:09 +00:00
add_definitions( -DMYDDAS_MYSQL=1)
endif ()
if (ODBC_FOUND)
2019-01-09 09:32:09 +00:00
add_definitions( -DMYDDAS_ODBC=1)
endif ()
2019-01-09 13:59:58 +00:00
if (POSTGRES_FOUND)
2019-01-09 09:32:09 +00:00
add_definitions( -DMYDDAS_POSTGRES=1)
endif()
#utf-8 is not aPconn option
# we use the nice UTF-8 package
#available at the Julia project
2017-06-13 13:34:17 +01:00
2018-05-20 18:40:56 +01:00
2019-01-09 09:32:09 +00:00
add_subDIRECTORY( packages/myddas )
2019-01-21 01:11:42 +00:00
add_subDIRECTORY( packages/clpqr )
2018-05-20 18:40:56 +01:00
2017-06-13 13:34:17 +01:00
2017-11-11 22:48:09 +00:00
List(APPEND YLIBS $<TARGET_OBJECTS:libOPTYap>)
List(APPEND YLIBS $<TARGET_OBJECTS:libYAPOs>)
List(APPEND YLIBS $<TARGET_OBJECTS:utf8proc>)
List(APPEND YLIBS $<TARGET_OBJECTS:myddas>)
List(APPEND YLIBS $<TARGET_OBJECTS:libswi>)
2018-01-18 14:47:27 +00:00
if (WIN32 OR ANDROID)
List(APPEND YLIBS $<TARGET_OBJECTS:YAP++>)
if (WIN32 AND WITH_PYTHON)
List(APPEND YLIBS $<TARGET_OBJECTS:Py4YAP>)
2019-01-18 03:49:42 +00:00
list (APPEND WINDLLS ${PYTHON_LIBRARIES})
endif ()
if (ANDROID)
List(APPEND YLIBS $<TARGET_OBJECTS:YAPsqlite3>)
2019-01-09 13:59:58 +00:00
List(APPEND YLIBS $<TARGET_OBJECTS:DROID>)
2019-01-18 03:49:42 +00:00
set(ANDROID_LIBRARIES sqliteX android log)
2019-01-09 13:59:58 +00:00
endif ()
2017-11-11 22:48:09 +00:00
endif ()
2017-06-13 13:34:17 +01:00
2016-12-03 16:38:07 +00:00
2019-01-09 09:32:09 +00:00
add_library( # Sets the name of the library.
libYap
2016-07-31 10:56:54 +01:00
# Sets the library as a shared library.
SHARED
${ENGINE_SOURCES}
${C_INTERFACE_SOURCES}
2019-01-09 09:32:09 +00:00
${STATIC_SOURCES}
# cmake object libraries
${YLIBS}
)
2016-04-08 09:13:45 +01:00
2019-01-18 03:49:42 +00:00
target_link_libraries(libYap
m
${GMP_LIBRARIES}
${READLINE_LIBRARIES}
${ANDROID_LIBRARIES}
${WINDLLS}
${PYTHON_LIBRARIES}
)
2019-01-09 09:32:09 +00:00
set_target_properties(libYap
PROPERTIES OUTPUT_NAME Yap
)
2017-10-11 02:24:15 +01:00
## define system
2017-10-17 00:13:09 +01:00
# Optional libraries that affect compilation
#
2017-10-11 02:24:15 +01:00
set(CMAKE_TOP_BINARY_DIR ${CMAKE_BINARY_DIR})
set(YAP_PL_SRCDIR ${CMAKE_SOURCE_DIR}/pl)
set(YAP_YAPLIB libYap${CMAKE_SHARED_LIBRARY_SUFFIX})
string(TIMESTAMP YAP_TIMESTAMP)
2017-11-11 22:48:09 +00:00
string(SUBSTRING ${CMAKE_SHARED_LIBRARY_SUFFIX} 1 -1 SO_EXT)
2017-10-11 02:24:15 +01:00
set_property(DIRECTORY PROPERTY CXX_STANDARD 11)
if (ANDROID)
2019-01-18 03:49:42 +00:00
include_directories(CXX ${CMAKE_SOURCE_DIR}/../yaplib/generated/src/jni)
2017-11-11 22:48:09 +00:00
endif ()
include(Threads)
2017-10-11 02:24:15 +01:00
#
# include OS and I/o stuff
#
# convenience libraries
# OPTYap exports important flags
#
list(APPEND YAP_SYSTEM_OPTIONS "thread support")
2017-10-17 00:13:09 +01:00
set_target_properties(libYap
PROPERTIES OUTPUT_NAME Yap
)
2017-10-17 00:13:09 +01:00
MY_set_target_properties(libYap
PROPERTIES VERSION ${YAP_FULL_VERSION}
SOVERSION ${YAP_MAJOR_VERSION}.${YAP_MINOR_VERSION}
)
2017-10-17 00:13:09 +01:00
2017-11-10 23:08:35 +00:00
2016-08-01 12:54:28 +01:00
2017-11-10 23:08:35 +00:00
# file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/packages/python/swig/yap4py)
2017-10-27 23:06:23 +01:00
2018-09-26 01:14:14 +01:00
if (WITH_PYTHON AND PYTHONLIBS_FOUND AND SWIG_FOUND)
set( ENV{PYTHONPATH} ${CMAKE_BINARY_DIR}/packages/python/swig:${CMAKE_BINARY_DIR}/packages/python/yap_kernel:. )
add_subdirectory(packages/python/swig)
2017-06-13 13:34:17 +01:00
include(FindPythonModule)
2017-06-13 13:34:17 +01:00
find_python_module(jupyter)
find_python_module(wheel)
find_python_module(setuptools)
if (PY_JUPYTER AND PY_WHEEL AND PY_SETUPTOOLS)
add_subdirectory(packages/python/yap_kernel)
else()
message("will not compile yap_kernel, as jupyter=${PY_JUPYTER};wheel=${PY_WHEEL};setuptools=${PY_SETUPTOOLS}")
ENDIF ()
2018-03-12 15:11:59 +00:00
2017-11-11 22:48:09 +00:00
endif ()
2017-06-13 13:34:17 +01:00
2017-07-25 01:10:44 +01:00
2017-10-11 02:24:15 +01:00
message(STATUS "Building YAP packages version ${YAP_VERSION}")
if (NOT WIN32)
set(BUILD_SHARED_LIBS ON)
2017-11-11 22:48:09 +00:00
endif ()
2017-10-11 02:24:15 +01:00
if (WITH_JIT)
add_subDIRECTORY(JIT)
2017-10-11 02:24:15 +01:00
endif (WITH_JIT)
if (WITH_XML2 OR WITH_RAPTOR)
2017-10-11 02:24:15 +01:00
add_subDIRECTORY(packages/raptor)
2017-10-11 02:24:15 +01:00
endif()
2017-10-11 02:24:15 +01:00
if (WITH_XML)
2017-10-11 02:24:15 +01:00
add_subDIRECTORY(packages/xml)
endif ()
2018-02-21 13:17:35 +00:00
2017-10-11 02:24:15 +01:00
IF (WITH_CLPBN)
add_subDIRECTORY(packages/CLPBN)
2017-11-11 22:48:09 +00:00
ENDIF (WITH_CLPBN)
2017-10-11 02:24:15 +01:00
IF (WITH_CPLINT)
add_subDIRECTORY(packages/cplint)
2017-11-11 22:48:09 +00:00
ENDIF (WITH_CPLINT)
2017-10-17 00:13:09 +01:00
IF (WITH_DOCS)
get_target_property(YAP_SOURCES libYap SOURCES)
add_subDIRECTORY(docs)
find_host_package(Doxygen)
2018-10-12 14:57:05 +01:00
2017-10-17 00:13:09 +01:00
ENDIF (WITH_DOCS)
2017-10-11 02:24:15 +01:00
# add_subDIRECTORY (packages/cuda)
if (WITH_GECODE)
add_subDIRECTORY(packages/gecode)
2017-11-11 22:48:09 +00:00
endif ()
2017-10-11 02:24:15 +01:00
2018-08-21 03:01:03 +01:00
if (WITH_LBFGS)
add_subDIRECTORY(packages/yap-lbfgs)
2018-08-21 03:01:03 +01:00
endif ()
2017-10-11 02:24:15 +01:00
2018-06-18 10:25:17 +01:00
if (WITH_JAVA)
#detect java setup, as it is shared between different installations.
2018-06-18 10:25:17 +01:00
2019-03-18 14:47:29 +00:00
find_package(Java COMPONENTS Development Runtime)
# find_package(Java COMPONENTS Development)
# find_package(Java COMPONENTS Runtime)
#find_package(JavaLibs)
2018-06-18 10:25:17 +01:00
if (Java_Development_FOUND)
2018-06-18 10:25:17 +01:00
set (STD_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
set (CMAKE_FIND_FRAMEWORK LAST) # CMake will find the Java returned by /usr/libexec/java_home.
2018-10-24 13:15:19 +01:00
macro_optional_find_package(JNI ON)
2018-10-24 13:15:19 +01:00
2018-06-18 10:25:17 +01:00
set (CMAKE_FIND_FRAMEWORK ${STD_CMAKE_FIND_FRAMEWORK})
2018-06-18 10:25:17 +01:00
if (JNI_FOUND)
2018-06-18 10:25:17 +01:00
get_filename_component(JAVA_HOME ${JAVA_INCLUDE_PATH} DIRECTORY)
2018-07-15 13:43:29 +01:00
include(UseJava)
2018-06-18 10:25:17 +01:00
#
# Java_JAVA_EXECUTABLE = the full path to the Java runtime
# Java_JAVAC_EXECUTABLE = the full path to the Java compiler
# Java_JAVAH_EXECUTABLE = the full path to the Java header generator
# Java_JAVADOC_EXECUTABLE = the full path to the Java documention generator
# Java_IDLJ_EXECUTABLE = the full path to the Java idl compiler
# Java_JAR_EXECUTABLE = the full path to the Java archiver
# Java_JARSIGNER_EXECUTABLE = the full path to the Java jar signer
# Java_VERSION_STRING = Version of java found, eg. 1.6.0_12
# Java_VERSION_MAJOR = The major version of the package found.
# Java_VERSION_MINOR = The minor version of the package found.
# Java_VERSION_PATCH = The patch version of the package found.
# Java_VERSION_TWEAK = The tweak version of the package found (after '_')
# Java_VERSION = This is set to: $major.$minor.$patch(.$tweak)
#
# The Java_ADDITIONAL_VERSIONS variable can be used to specify a list
# of version numbers that should be taken into account when searching
# for Java. You need to set this variable before calling
2018-07-15 13:43:29 +01:00
#
#macro_optional_find_package(JNI ON)
# JNI_INCLUDE_DIRS = the include dirs to use
# JNI_LIBRARIES = the libraries to use
# JNI_FOUND = TRUE if JNI headers and libraries were found.
# JAVA_AWT_LIBRARY = the path to the jawt library
# JAVA_JVM_LIBRARY = the path to the jvm library
# JAVA_INCLUDE_PATH = the include path to jni.h
# JAVA_INCLUDE_PATH2 = the include path to jni_md.h
# JAVA_AWT_INCLUDE_PATH = the include path to jawt.h
2018-06-18 10:25:17 +01:00
2018-11-16 14:02:56 +00:00
get_filename_component ( JAVA_AWT_DIR ${JAVA_AWT_LIBRARY} DIRECTORY)
get_filename_component ( JAVA_JNI_DIR ${JAVA_JVM_LIBRARY} DIRECTORY)
list(APPEND CMAKE_INSTALL_RPATH ${JAVA_AWT_DIR};${JAVA_JNI_DIR})
if (APPLE)
set(CMAKE_MACOSX_RPATH 1)
find_library (JLI jli ${JAVA_AWT_DIR}/jli)
2018-12-28 17:44:28 +00:00
#find_library (JAL JavaApplicationLauncher FRAMEWORK ONLY PATH /System/Library/PrivateFrameworks)
#find_library (JL JavaLaunching FRAMEWORK ONLY PATH /System/Library/PrivateFrameworks)
2018-11-16 14:02:56 +00:00
list(APPEND CMAKE_INSTALL_RPATH ${JAVA_AWT_DIR}/jli)
list(APPEND JNI_LIBRARIES ${JLI};${JAL};${JL})
endif()
endif (JNI_FOUND)
2018-07-15 13:43:29 +01:00
2018-06-18 10:25:17 +01:00
endif (Java_Development_FOUND)
add_subDIRECTORY(packages/jpl)
2018-06-18 10:25:17 +01:00
endif(WITH_JAVA)
if (WITH_CUDD)
2017-10-11 02:24:15 +01:00
add_subDIRECTORY(packages/bdd)
2017-10-11 02:24:15 +01:00
endif()
2017-10-11 02:24:15 +01:00
if (WITH_PROBLOG)
2017-10-11 02:24:15 +01:00
add_subDIRECTORY(packages/ProbLog)
endif()
if (WITH_MINISAT)
add_subDIRECTORY(packages/swi-minisat2)
endif()
if (WITH_CLPQR)
add_subDIRECTORY(packages/clpqr)
endif()
2017-10-11 02:24:15 +01:00
#todo: use cmake target builds
# option (USE_MAXPERFORMANCE
2019-01-09 09:32:09 +00:00
# "try using the best flags for specific architecture" ON)
2017-10-11 02:24:15 +01:00
# option (USE_MAXMEMORY
# "try using the best flags for using the memory to the most" ON)
#TODO: check MAXMEMORY
#TODO: use cmake target builds
# option (USE_DEBUGYAP
2019-01-09 09:32:09 +00:00
# "enable C-debugging for YAP" ON)
2017-10-11 02:24:15 +01:00
#TODO: use cmake arch/compiler
# option (USE_CYGWIN
2019-01-09 09:32:09 +00:00
# "use cygwin library in WIN32" ON)
2017-10-11 02:24:15 +01:00
#TODO:
#TODO: detect arch before allow this option
# OPTION(WIN64
# "compile YAP for win64" OFF)
# option (APRIL
# "compile Yap to support April ILP system" OFF)
# option (DLCOMPAT
# "use dlcompat library for dynamic loading on Mac OS X" OFF)
# SHARED PACKAGES with SWI
# swi packages have both Makefile.in which we will use and
# Makefile.mak, we will use the later to identify this packages
# while we keep both autotools amd cmake working side by side
# Search for available packages which all have a Makefile.mak
#file (GLOB PACKAGES packages/*/Makefile.mak)
# needed by this packages
2017-11-11 22:48:09 +00:00
if (WIN32)
2017-10-11 02:24:15 +01:00
if (MSVC)
set(MSVC_RUNTIME "dynamic")
ENDIF (MSVC)
2017-10-11 02:24:15 +01:00
target_link_libraries(libYap wsock32 ws2_32 shlwapi)
2017-10-11 02:24:15 +01:00
2017-11-11 22:48:09 +00:00
endif (WIN32)
2017-10-11 02:24:15 +01:00
2017-11-11 22:48:09 +00:00
add_executable(yap-bin ${CONSOLE_SOURCES})
2017-10-11 02:24:15 +01:00
2017-11-11 22:48:09 +00:00
set_target_properties(yap-bin PROPERTIES OUTPUT_NAME yap)
2017-10-11 02:24:15 +01:00
2017-11-11 22:48:09 +00:00
target_link_libraries(yap-bin libYap)
2017-10-11 02:24:15 +01:00
2017-11-11 22:48:09 +00:00
install(TARGETS libYap yap-bin
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
2018-11-22 13:48:21 +00:00
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
2017-10-11 02:24:15 +01:00
if (WITH_MPI)
2017-11-21 15:44:43 +00:00
add_subDIRECTORY(library/lammpi)
2017-10-11 02:24:15 +01:00
if (MPI_C_FOUND)
2017-10-11 02:24:15 +01:00
2017-11-11 22:48:09 +00:00
macro_optional_add_subDIRECTORY(library/mpi)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_C_COMPILE_FLAGS} ")
include_directories(${MPI_C_INCLUDE_PATH})
target_link_libraries(yap-bin ${MPI_C_LIBRARIES})
if (MPI_C_COMPILE_FLAGS)
set_target_properties(yap-bin PROPERTIES
COMPILE_FLAGS "${MPI_C_COMPILE_FLAGS}")
2017-11-11 22:48:09 +00:00
endif (MPI_C_COMPILE_FLAGS)
if (MPI_C_LINK_FLAGS)
set_target_properties(yap-bin PROPERTIES
LINK_FLAGS "${MPI_C_LINK_FLAGS}")
2017-11-11 22:48:09 +00:00
endif ()
endif (MPI_C_FOUND)
2017-10-11 02:24:15 +01:00
endif(WITH_MPI)
2017-11-21 15:44:43 +00:00
2017-10-11 02:24:15 +01:00
## add_subDIRECTORY(utils)
#
2018-11-16 14:02:56 +00:00
install(FILES ${INCLUDE_HEADERS} ${CONFIGURATION_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Yap )
2017-12-05 15:14:57 +00:00
2017-10-11 02:24:15 +01:00
macro_display_feature_log()
2017-11-11 22:48:09 +00:00
if (POLICY CMP0058)
cmake_policy(SET CMP0058 NEW)
2017-11-11 22:48:09 +00:00
endif (POLICY CMP0058)
2017-10-11 02:24:15 +01:00
2017-12-05 15:14:57 +00:00
include(Config )
2017-07-30 22:24:00 +01:00
2017-10-11 02:24:15 +01:00
2018-04-10 00:54:01 +01:00
feature_summary(DESCRIPTION "Packages found:"
WHAT PACKAGES_FOUND
)
2018-04-10 00:54:01 +01:00
feature_summary(DESCRIPTION "Packages not found:"
WHAT PACKAGES_NOT_FOUND
)