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

672 lines
17 KiB
CMake
Raw Normal View History

2014-12-14 12:05:43 +00:00
# organised as follows:
# main variables
# sources
# system core
# libraries
cmake_minimum_required(VERSION 2.8)
2015-02-03 02:40:41 +00:00
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
cmake_policy( SET CMP0042 NEW)
cmake_policy( NO_POLICY_SCOPE )
endif()
cmake_policy(SET CMP0043 NEW)
2014-12-14 12:05:43 +00:00
project(YAP C CXX)
set(YAP_FOUND ON)
set(YAP_MAJOR_VERSION 6)
set(YAP_MINOR_VERSION 3)
set(YAP_PATCH_VERSION 4)
2014-12-14 12:05:43 +00:00
if (WIN32)
set (YAP_ARCH $ENV{PROCESSOR_ARCHITECTURE})
endif()
if (UNIX)
find_program (UNAME uname)
execute_process (
COMMAND ${UNAME} -m
OUTPUT_VARIABLE YAP_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE )
endif()
set(YAP_FULL_VERSION
${YAP_MAJOR_VERSION}.${YAP_MINOR_VERSION}.${YAP_PATCH_VERSION})
2014-12-14 12:05:43 +00:00
set(YAP_FVERSION
${YAP_MAJOR_VERSION}.${YAP_MINOR_VERSION}.${YAP_PATCH_VERSION})
set(YAP_NUMERIC_VERSION
2014-12-14 12:05:43 +00:00
${YAP_MAJOR_VERSION}*10000+${YAP_MINOR_VERSION}*100+${YAP_PATCH_VERSION})
set(MYDDAS_VERSION MYDDAS-0.9.1)
2014-12-14 12:05:43 +00:00
site_name( YAP_SITE )
message(STATUS "Building YAP version ${YAP_VERSION}")
# set path to additional CMake modules
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
2014-12-14 12:05:43 +00:00
set(CMAKE_TOP_BINARY_DIR ${CMAKE_BINARY_DIR})
set(YAP_PL_SRCDIR ${CMAKE_SOURCE_DIR}/pl)
# Compatibility vars with autotols
set ( prefix "${CMAKE_INSTALL_PREFIX}")
set ( exec_prefix "${prefix}")
set ( libdir "${exec_prefix}/lib")
set ( dlls "${exec_prefix}/lib/Yap")
set ( includedir "${prefix}/include")
set ( datarootdir "${prefix}/share")
2014-12-14 12:05:43 +00:00
set ( libpl "${prefix}/share/Yap")
set ( datadir "${datarootdir}")
set ( mandir "${datarootdir}/man")
set ( bindir "${exec_prefix}/bin")
2014-12-14 12:05:43 +00:00
set ( docdir "${exec_prefix}/share/doc/Yap")
set(YAP_ROOTDIR ${prefix})
# erootdir -> rootdir
# bindir defined above
# libdir defined above
2015-02-17 20:26:46 +00:00
set(YAP_LIB_DIR "${dlls}")
set(YAP_SHARE_DIR "${datarootdir}")
set(YAP_BIN_DIR "${bindir}")
set(YAP_INCLUDE_DIR "${includedir}")
2015-01-26 04:02:46 +00:00
set(YAP_ROOTDIR "${prefix}")
2014-12-14 12:05:43 +00:00
set(YAP_YAPLIB libYap${CMAKE_SHARED_LIBRARY_SUFFIX})
set(YAP_STARTUP startup.yss)
2014-12-14 12:05:43 +00:00
string(TIMESTAMP YAP_TIMESTAMP)
2014-12-15 14:32:35 +00:00
string( SUBSTRING ${CMAKE_SHARED_LIBRARY_SUFFIX} 1 -1 SO_EXT )
#
2015-02-03 02:40:41 +00:00
include_directories (H include os)
include_directories (BEFORE ${CMAKE_BINARY_DIR})
2014-12-15 23:05:05 +00:00
# Optional libraries that affect compilation
#
include (ConfigureChecks)
include (MacroOptionalAddSubdirectory)
include (MacroOptionalFindPackage)
include (MacroLogFeature)
#
# Optional Components
#
include (CMakeDependentOption)
include (CheckSymbolExists)
2015-02-03 02:40:41 +00:00
set ( YAP_MALLOC_T void *)
set ( MIN_STACKSPACE 1024*SIZEOF_INT_P )
set ( MIN_HEAPSPACE 2*1024*SIZEOF_INT_P )
set ( MIN_TRAILSPACE 512*SIZEOF_INT_P )
2014-12-14 12:05:43 +00:00
set ( DEF_STACKSPACE 0 )
set ( DEF_HEAPSPACE 0 )
set ( DEF_TRAILSPACE 0 )
2015-01-26 04:02:46 +00:00
# option (RATIONAL_TREES "support infinite rational trees" ON)
2015-02-03 02:40:41 +00:00
# dd_definitions (-D)
## don't touch these opts
set_property( DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS DEPTH_LIMIT=1;COROUTINING=1;RATIONAL_TREES=1 )
# inform we are compiling YAP
set_property( DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS _YAP_NOT_INSTALLED_=1;HAVE_CONFIG_H )
2015-02-03 02:40:41 +00:00
# Compilation model
set_property( DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS GNU_SOURCE=1;_XOPEN_SOURCE=700 )
2014-12-14 12:05:43 +00:00
2015-02-03 02:40:41 +00:00
#add_definitions( -Wall -Wstrict-prototypes -Wmissing-prototypes)
2015-02-03 02:40:41 +00:00
# Model Specific
set_property( DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:DEBUG=1;LOW_LEVEL_TRACER=1> )
2014-12-14 12:05:43 +00:00
#ensure cells are properly aligned in code
set (ALIGN_LONGS 1)
#ensure best access to slots in environments
set (MSHIFTOFFS 1)
set (C_COMPILER CMAKE_C_COMPILER_ID)
if ( ${C_COMPILER} MATCHES "GNU")
set (HAVE_GCC 1)
endif()
# compatible compilers
if ( ${C_COMPILER} MATCHES "Clang")
set (HAVE_GCC 1)
endif()
if ( ${C_COMPILER} MATCHES "Intel")
set (HAVE_GCC 1)
endif()
2015-02-03 02:40:41 +00:00
# Model Specific
if (HAVE_GCC)
set_property( DIRECTORY APPEND_STRING PROPERTY COMPILE_OPTIONS -Wall;-Wstrict-prototypes;-Wmissing-prototypes )
set_property( DIRECTORY APPEND_STRING PROPERTY COMPILE_OPTIONS -fexceptions )
2015-02-03 02:40:41 +00:00
endif()
2015-01-26 04:02:46 +00:00
message(STATUS "Original CMAKE_C_FLAGS ${CMAKE_C_FLAGS}")
# Compilation Flags
if (CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3 -fomit-frame-pointer -fstrict-aliasing -freorder-blocks -fsched-interblock")
endif()
message(STATUS "Running with CMAKE_C_FLAGS ${CMAKE_C_FLAGS}")
2014-12-15 14:32:35 +00:00
if (HAVE_GCC)
# replace instructions codes by the address of their code
2015-02-03 02:40:41 +00:00
option (YAP_THREADED_CODE "threaded code" ON)
if (YAP_THREADED_CODE)
2014-12-15 14:32:35 +00:00
set (USE_THREADED_CODE 1)
2015-01-26 04:02:46 +00:00
add_definitions(-DTHREADEAD_CODE=1)
2015-02-03 02:40:41 +00:00
endif (YAP_THREADED_CODE)
2014-12-15 14:32:35 +00:00
endif (HAVE_GCC)
2015-01-26 04:02:46 +00:00
#
2014-12-15 14:32:35 +00:00
set (BUILD_SHARED_LIBS ON)
2014-12-14 12:05:43 +00:00
#
# include libtai package as an independent library
#
add_subdirectory (os/libtai)
2015-02-03 02:40:41 +00:00
option (YAP_TABLING "Support tabling" ON)
if (YAP_TABLING)
#this depends on DEPTH_LIMIT define it after
#this macro should realy be in config.h or other like it
#and it is used across several files outside OPTYap
2015-01-26 04:02:46 +00:00
add_definitions (-DTABLING=1)
include_directories (OPTYap)
add_subdirectory (OPTYap)
2015-02-03 02:40:41 +00:00
endif(YAP_TABLING)
2015-02-03 02:40:41 +00:00
option (YAP_EAM "enable EAM (Extended Andorra Model)" OFF)
if (YAP_EAM)
#this macro should realy be in config.h or other like it
add_definitions (-DBEAM=1)
include_directories (BEAM)
add_subdirectory (BEAM)
set (EXTRALIBS ${EXTRALIBS} beam)
2015-02-03 02:40:41 +00:00
endif (YAP_EAM)
#TODO: option (or-parallelism)
2015-01-26 04:02:46 +00:00
# option (WAM_Profile
# "support low level profiling of abstract machine" OFF)
2015-02-03 02:40:41 +00:00
option (YAP_CALL_TRACER
"support for procedure-call tracing" ON)
#TODO:
2015-02-03 02:40:41 +00:00
if (YAP_CALL_TRACER)
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS_DEBUG LOW_LEVEL_TRACER=1)
endif (YAP_CALL_TRACER)
2015-02-03 02:40:41 +00:00
option (YAP_THREADS
"support system threads" OFF)
#TODO:
2014-12-14 12:05:43 +00:00
#
# Sources Section
#
set(IOLIB_SOURCES
2015-01-26 04:02:46 +00:00
os/pl-buffer.c
os/pl-codelist.c
os/pl-ctype.c
os/pl-dtoa.c
os/pl-error.c
os/pl-file.c
os/pl-files.c
os/pl-fmt.c
os/pl-glob.c
os/pl-option.c
2014-12-14 12:05:43 +00:00
os/pl-nt.c
2015-01-26 04:02:46 +00:00
os/pl-os.c
os/pl-privitf.c
os/pl-prologflag.c
os/pl-read.c
os/pl-rl.c
2014-12-14 12:05:43 +00:00
os/pl-stream.c
2015-01-26 04:02:46 +00:00
os/pl-string.c
os/pl-table.c
os/pl-tai.c
os/pl-text.c
2014-12-14 12:05:43 +00:00
os/pl-utf8.c
2015-01-26 04:02:46 +00:00
os/pl-write.c
2014-12-14 12:05:43 +00:00
C/pl-yap.c
)
if (WIN32)
set(IOLIBS_SOURCES
${IOLIBS_SOURCES}
os/windows/uxnt.c
)
endif (WIN32)
2015-01-20 03:00:42 +00:00
set (ABSMI_SOURCES
2014-12-14 12:05:43 +00:00
C/absmi.c
2015-01-20 03:00:42 +00:00
C/absmi_insts.h
C/fli_absmi_insts.h
C/or_absmi_insts.h
C/control_absmi_insts.h
C/index_absmi_insts.h
C/prim_absmi_insts.h
C/cp_absmi_insts.h
C/lu_absmi_insts.h
C/unify_absmi_insts.h
C/fail_absmi_insts.h
C/meta_absmi_insts.h
)
set (ENGINE_SOURCES
${ABSMI_SOURCES}
2015-01-26 04:02:46 +00:00
C/agc.c
C/adtdefs.c
C/alloc.c
2014-12-14 12:05:43 +00:00
C/amasm.c
2015-01-26 04:02:46 +00:00
C/analyst.c
C/arrays.c
2014-12-14 12:05:43 +00:00
C/arith0.c
C/arith1.c
C/arith2.c
C/atomic.c
C/attvar.c
2015-01-26 04:02:46 +00:00
C/bignum.c
2014-12-14 12:05:43 +00:00
C/bb.c
C/cdmgr.c
C/cmppreds.c
C/compiler.c
2015-01-26 04:02:46 +00:00
C/computils.c
C/corout.c
C/cut_c.c
2014-12-14 12:05:43 +00:00
C/dbase.c
2015-01-26 04:02:46 +00:00
C/dlmalloc.c
C/errors.c
2014-12-14 12:05:43 +00:00
C/eval.c
C/exec.c
2015-01-26 04:02:46 +00:00
C/exo.c
C/exo_udi.c
2014-12-14 12:05:43 +00:00
C/globals.c
2015-01-26 04:02:46 +00:00
C/gmp_support.c
2014-12-14 12:05:43 +00:00
C/gprof.c
2015-01-26 04:02:46 +00:00
C/grow.c
2014-12-14 12:05:43 +00:00
C/heapgc.c
2015-01-26 04:02:46 +00:00
C/index.c
2014-12-14 12:05:43 +00:00
C/init.c
2015-01-26 04:02:46 +00:00
C/inlines.c
2014-12-14 12:05:43 +00:00
C/iopreds.c
2015-01-26 04:02:46 +00:00
C/depth_bound.c
2014-12-14 12:05:43 +00:00
C/mavar.c
C/modules.c
2015-01-26 04:02:46 +00:00
C/other.c
C/parser.c
C/qlyr.c
2014-12-14 12:05:43 +00:00
C/qlyw.c
C/range.c
C/save.c
C/scanner.c
C/signals.c
C/sort.c
C/stdpreds.c
C/sysbits.c
C/text.c
2015-01-26 04:02:46 +00:00
C/threads.c
C/tracer.c
2014-12-14 12:05:43 +00:00
C/unify.c
2015-01-26 04:02:46 +00:00
C/userpreds.c
2014-12-14 12:05:43 +00:00
C/utilpreds.c
2015-01-26 04:02:46 +00:00
C/yap-args.c
C/write.c
C/ypstdio.c
library/dialect/swi/fli/swi.c
2014-12-14 12:05:43 +00:00
library/dialect/swi/fli/blobs.c
2015-01-26 04:02:46 +00:00
C/udi.c
#packages/udi/rtree.c
#packages/udi/rtree_udi.c
2014-12-14 12:05:43 +00:00
# ${IOLIB_SOURCES}
# MPI_SOURCES
)
set(C_INTERFACE_SOURCES
2015-01-26 04:02:46 +00:00
C/load_foreign.c
2014-12-14 12:05:43 +00:00
C/load_dl.c
2015-01-26 04:02:46 +00:00
C/load_dld.c
2014-12-14 12:05:43 +00:00
C/load_dyld.c
2015-01-26 04:02:46 +00:00
C/load_none.c
2014-12-14 12:05:43 +00:00
C/load_aout.c
C/load_aix.c
2015-01-26 04:02:46 +00:00
C/load_dll.c
C/load_shl.c
C/c_interface.c
C/clause_list.c
2014-12-14 12:05:43 +00:00
)
SET(OPTYAP_SOURCES
OPTYap/or.memory.c
2015-01-26 04:02:46 +00:00
OPTYap/opt.init.c
2014-12-14 12:05:43 +00:00
OPTYap/opt.preds.c
2015-01-26 04:02:46 +00:00
OPTYap/or.copy_engine.c
2014-12-14 12:05:43 +00:00
OPTYap/or.cow_engine.c
2015-01-26 04:02:46 +00:00
OPTYap/or.sba_engine.c
OPTYap/or.thread_engine.c
2014-12-14 12:05:43 +00:00
OPTYap/or.scheduler.c
2015-01-26 04:02:46 +00:00
OPTYap/or.cut.c
2014-12-14 12:05:43 +00:00
OPTYap/tab.tries.c
OPTYap/tab.completion.c
)
2015-01-20 03:00:42 +00:00
2014-12-14 12:05:43 +00:00
set(STATIC_SOURCES
#NOT INCLUDED FOR NOW
)
2015-01-26 04:02:46 +00:00
set(CONSOLE_SOURCES console/yap.c)
2014-12-14 12:05:43 +00:00
#MPI STUFF
2015-01-26 04:02:46 +00:00
# library/mpi/mpi.c library/mpi/mpe.c
# library/lammpi/yap_mpi.c library/lammpi/hash.c library/lammpi/prologterms2c.c
2014-12-14 12:05:43 +00:00
# )
#WIN STUFF
# SET(PLCONS_SOURCES
2015-01-26 04:02:46 +00:00
# console/LGPL/pl-nt.c
# console/LGPL/pl-ntcon.c
# console/LGPL/pl-ntconsole.c
2014-12-14 12:05:43 +00:00
# console/LGPL/pl-ntmain.c
# )
## define system
add_library(libYap SHARED
2015-01-26 04:02:46 +00:00
${ENGINE_SOURCES}
2014-12-14 12:05:43 +00:00
${IOLIB_SOURCES}
2015-01-26 04:02:46 +00:00
${C_INTERFACE_SOURCES}
${STATIC_SOURCES}
2014-12-14 12:05:43 +00:00
${OPTYAP_SOURCES}
2015-01-20 03:00:42 +00:00
$<TARGET_OBJECTS:libyaptai>
)
2014-12-14 12:05:43 +00:00
target_link_libraries(libYap
m resolv stdc++ )
set_target_properties(libYap
PROPERTIES VERSION ${YAP_FULL_VERSION}
SOVERSION ${YAP_MAJOR_VERSION}.${YAP_MINOR_VERSION}
OUTPUT_NAME Yap
)
#TODO:
#TODO:
#
# Arch checks
#
#include(ConfigureChecks)
include (Config)
macro_optional_find_package (GMP ON)
2015-01-26 04:02:46 +00:00
macro_log_feature (GMP_FOUND "libgmp"
"GNU Multiple Precision"
"http://gmplib.org")
if (GMP_FOUND)
include_directories (${GMP_INCLUDE_DIR})
2015-01-26 04:02:46 +00:00
target_link_libraries(libYap ${GMP_LIBRARIES})
#config.h needs this (TODO: change in code latter)
set (USE_GMP 1)
2015-02-03 02:40:41 +00:00
set( CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${GMP_INCLUDE_DIR} )
set( CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${GMP_LIBRARIES} )
endif (GMP_FOUND)
2014-12-14 12:05:43 +00:00
macro_optional_find_package (Readline ON)
2015-01-26 04:02:46 +00:00
macro_log_feature (READLINE_FOUND "libreadline"
"GNU Readline Library (or similar)"
"http://www.gnu.org/software/readline")
if (READLINE_FOUND)
include_directories (${READLINE_INCLUDE_DIR})
2015-01-26 04:02:46 +00:00
target_link_libraries(libYap ${READLINE_LIBRARIES})
2015-02-03 02:40:41 +00:00
set( CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${READLINE_INCLUDE_DIR} )
set( CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${READLINE_LIBRARIES} )
2015-01-26 04:02:46 +00:00
2015-02-03 02:40:41 +00:00
check_include_file( readline/readline.h HAVE_READLINE_READLINE_H )
check_function_exists( add_history HAVE_ADD_HISTORY )
2015-01-26 04:02:46 +00:00
check_function_exists( rl_begin_undo_group HAVE_RL_BEGIN_UNDO_GROUP)
check_function_exists( rl_clear_pending_input HAVE_RL_CLEAR_PENDING_INPUT)
check_function_exists( rl_discard_argument HAVE_RL_DISCARD_ARGUMENT)
2015-01-26 04:02:46 +00:00
check_function_exists( rl_filename_completion_function HAVE_RL_FILENAME_COMPLETION_FUNCTION)
check_function_exists( rl_free_line_state HAVE_RL_FREE_LINE_STATE )
check_function_exists( rl_insert_close HAVE_RL_INSERT_CLOSE )
check_function_exists( rl_reset_after_signal HAVE_RL_RESET_AFTER_SIGNAL )
2015-01-26 04:02:46 +00:00
check_function_exists( rl_set_keyboard_input_timeout HAVE_RL_SET_KEYBOARD_INPUT_TIMEOUT )
check_function_exists( rl_set_prompt HAVE_RL_SET_PROMPT)
2015-01-26 04:02:46 +00:00
check_symbol_exists( rl_catch_signals stdio.h;readline/readline.h HAVE_DECL_RL_CATCH_SIGNALS )
check_symbol_exists( rl_completion_func_t stdio.h;readline/readline.h HAVE_DECL_RL_COMPLETION_FUNC_T )
2014-12-14 12:05:43 +00:00
check_symbol_exists( rl_done stdio.h;readline/readline.h HAVE_DECL_RL_DONE )
2015-01-26 04:02:46 +00:00
check_symbol_exists( rl_hook_func_t stdio.h;readline/readline.h HAVE_DECL_RL_HOOK_FUNC_T )
2014-12-14 12:05:43 +00:00
check_symbol_exists( rl_event_hook stdio.h;readline/readline.h HAVE_DECL_RL_EVENT_HOOK )
check_symbol_exists( rl_readline_state stdio.h;readline/readline.h HAVE_DECL_RL_READLINE_STATE )
endif (READLINE_FOUND)
2015-02-03 02:40:41 +00:00
option (YAP_THREADS OFF)
macro_optional_find_package (Threads ON)
2015-01-26 04:02:46 +00:00
macro_log_feature (THREADS_FOUND "Threads Support"
"GNU Threads Library (or similar)"
"http://www.gnu.org/software/threads")
2015-02-03 02:40:41 +00:00
if (YAP_THREADS AND THREADS_FOUND)
#
# CMAKE_THREAD_LIBS_INIT - the thread library
# CMAKE_USE_SPROC_INIT - are we using sproc?
# CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads?
# CMAKE_USE_PTHREADS_INIT - are we using pthreads
# CMAKE_HP_PTHREADS_INIT - are we using hp pthreads
#
# The following import target is created
#
# ::
#
# Threads::Threads
#
# For systems with multiple thread libraries, caller can set
#
# ::
#
# CMAKE_THREAD_PREFER_PTHREAD
#
# If the use of the -pthread compiler and linker flag is prefered then the
# caller can set
#
# ::
#
2014-12-14 12:05:43 +00:00
set( THREADS_PREFER_PTHREAD_FLAG ON)
2015-01-26 04:02:46 +00:00
2014-12-14 12:05:43 +00:00
if (CMAKE_USE_PTHREADS_INIT)
2015-01-26 04:02:46 +00:00
target_link_libraries(libYap pthread)
2014-12-14 12:05:43 +00:00
set (HAVE_READLINE_READLINE_H 1)
set( CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
check_function_exists( pthread_mutexattr_setkind_np HAVE_PTHREAD_MUTEXATTR_SETKIND_NP )
check_function_exists( pthread_mutexattr_settype HAVE_PTHREAD_MUTEXATTR_SETTYPE )
2015-01-26 04:02:46 +00:00
check_function_exists( pthread_setconcurrency HAVE_PTHREAD_SETCONCURRENCY )
2014-12-14 12:05:43 +00:00
endif (CMAKE_USE_PTHREADS_INIT)
#
# Please note that the compiler flag can only be used with the imported
# target. Use of both the imported target as well as this switch is highly
# recommended for new code.
2015-02-03 02:40:41 +00:00
endif (YAP_THREADS AND THREADS_FOUND)
2015-02-03 02:40:41 +00:00
cmake_dependent_option (YAP_PTHREADLOCKING
2014-12-14 12:05:43 +00:00
"use pthread locking primitives for internal locking" ON
2015-02-03 02:40:41 +00:00
"NOT YAP_THREADS; NOT THREADS_FOUND" OFF)
2015-02-03 02:40:41 +00:00
add_subdirectory (pl)
add_subdirectory (CXX)
2014-12-15 23:05:05 +00:00
ADD_SUBDIRECTORY(library)
ADD_SUBDIRECTORY(swi/library)
# ADD_SUBDIRECTORY(os)
# ADD_SUBDIRECTORY(packages)
2015-01-26 04:02:46 +00:00
2015-02-10 00:03:02 +00:00
macro_optional_find_package (LLVM ON)
macro_log_feature (LLVM_FOUND "LLVM JIT generator"
"The LLVM Compiler Infrastructure" "http://www.llvm.org")
if (LLVM_FOUND)
add_definitions (-DYAP_JIT=1)
INCLUDE_DIRECTORIES(JIT JIT/HPP)
macro_optional_add_subdirectory(JIT)
endif()
2015-02-03 02:40:41 +00:00
macro_optional_add_subdirectory(library/mpi)
2015-02-10 00:03:02 +00:00
2015-02-03 02:40:41 +00:00
macro_optional_add_subdirectory(library/lammpi)
2015-01-26 04:02:46 +00:00
macro_optional_add_subdirectory (packages/gecode)
2015-01-26 04:02:46 +00:00
macro_optional_add_subdirectory (packages/cuda)
2014-12-15 23:05:05 +00:00
2015-02-03 02:40:41 +00:00
macro_optional_add_subdirectory (packages/myddas)
2015-01-26 04:02:46 +00:00
macro_optional_add_subdirectory (packages/real)
2014-12-15 23:05:05 +00:00
2015-01-26 04:02:46 +00:00
macro_optional_add_subdirectory (packages/python)
macro_optional_add_subdirectory (packages/raptor)
2015-02-03 02:40:41 +00:00
#add_subdirectory (packages/archive)
2015-01-26 04:02:46 +00:00
macro_optional_add_subdirectory (packages/jpl)
2015-02-03 02:40:41 +00:00
#add_subdirectory (packages/prosqlite)
2015-02-03 02:40:41 +00:00
#add_subdirectory (packages/zlib)
#todo: use cmake target builds
# option (MAXPERFORMANCE
# "try using the best flags for specific architecture" OFF)
# option (MAXMEMORY
# "try using the best flags for using the memory to the most" ON)
#TODO: check MAXMEMORY
#TODO: use cmake target builds
# option (DEBUGYAP
# "enable C-debugging for YAP" OFF)
#TODO: use cmake arch/compiler
# option (CYGWIN
# "use cygwin library in WIN32" OFF)
2015-02-03 02:40:41 +00:00
option (YAP_PRISM
"use PRISM system in YAP" ON)
#TODO:
2015-02-03 02:40:41 +00:00
option (YAP_DLL
"compile YAP as a DLL" ON)
#TODO:
2015-02-03 02:40:41 +00:00
option (YAP_STATIC
"compile YAP statically" OFF)
#TODO:
2015-02-03 02:40:41 +00:00
option (YAP_MALLOC
"use malloc to allocate memory" ON)
2015-02-03 02:40:41 +00:00
if (YAP_MALLOC)
2014-12-14 12:05:43 +00:00
# use default allocator
set ( USE_SYSTEM_MALLOC 1 )
endif()
2015-02-03 02:40:41 +00:00
option(YAP_CONDOR
"allow YAP to be used from condor" OFF)
2015-02-03 02:40:41 +00:00
if (YAP_MALLOC)
# use default allocator
set ( YAP_STATIC ON )
set ( YAP_DLL OFF )
endif()
#TODO: detect arch before allow this option
# OPTION(WIN64
# "compile YAP for win64" OFF)
2015-01-26 04:02:46 +00:00
# option (APRIL
# "compile Yap to support April ILP system" OFF)
# option (DLCOMPAT
# "use dlcompat library for dynamic loading on Mac OS X" OFF)
# find_package(R)
# if (R_FOUND)
# MESSAGE(STATUS "RFOUND ${R_LIBRARIES} ${R_DEFINITIONS} ${R_EXECUTABLE}")
# endif (R_FOUND)
2015-01-26 04:02:46 +00:00
#TODO: check REAL_TARGET REAL#TODO: Switch to feature detection
# OPTION(CHR
# "install chr library" ON)
# OPTION(CLPQR
# "install clpqr library" ON)
# OPTION(CPLINT
# "enable the cplint library using the CUDD library in DIR/lib" OFF)
# OPTION(yap_cv_clpbn_bp
# "enable belief propagation solver in CLPBN." OFF)
2015-01-26 04:02:46 +00:00
# OPTION(
# 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
#configure_file(packages/Makefile.defs.cmake packages/Makefile.defs)
#configure_file(packages/Dialect.defs.cmake packages/Dialect.defs)
#
2014-12-14 12:05:43 +00:00
# include subdirectories configuration
## after we have all functionality in
#
2014-12-14 12:05:43 +00:00
configure_file ("${PROJECT_SOURCE_DIR}/config.h.cmake"
"${PROJECT_BINARY_DIR}/config.h" )
2015-02-14 17:09:43 +00:00
configure_file ("${PROJECT_SOURCE_DIR}/config.h.cmake"
"${PROJECT_BINARY_DIR}/YapConfig.h" )
configure_file ("${PROJECT_SOURCE_DIR}/YapTermConfig.h.cmake"
"${PROJECT_BINARY_DIR}/YapTermConfig.h" )
add_executable (yap-bin ${CONSOLE_SOURCES})
2014-12-14 12:05:43 +00:00
set_target_properties (yap-bin PROPERTIES OUTPUT_NAME yap)
2014-12-14 12:05:43 +00:00
target_link_libraries(yap-bin libYap )
2015-01-26 04:02:46 +00:00
if (MPI_C_FOUND)
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}")
endif()
if(MPI_C_LINK_FLAGS)
set_target_properties(yap-bin PROPERTIES
LINK_FLAGS "${MPI_C_LINK_FLAGS}")
endif()
endif (MPI_C_FOUND)
2014-12-14 12:05:43 +00:00
add_custom_target (main ALL DEPENDS ${YAP_STARTUP} ) # WORKING_DIRECTORY ${CMAKE_BINARY_DIR} )
install (
2014-12-14 12:05:43 +00:00
TARGETS yap-bin libYap
RUNTIME DESTINATION ${bindir}
ARCHIVE DESTINATION ${libdir}
LIBRARY DESTINATION ${libdir}
)
macro_display_feature_log()