This commit is contained in:
Vitor Santos Costa 2019-01-18 03:49:42 +00:00
parent 29c004d62a
commit 670bfd421d
3 changed files with 46 additions and 53 deletions

View File

@ -65,6 +65,9 @@ if (POLICY CMP0003)
endif ()
if (POLICY CMP0068)
cmake_policy(SET CMP0068 NEW)
endif()
if (POLICY CMP0075)
cmake_policy(SET CMP0075 NEW)
endif ()
## options: compilation flags
@ -169,7 +172,7 @@ 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})
option(WITH_JAVA "Try to use Java (currently Java 6,7,8)" ${WITH_PACKAGES})
option(WITH_JAVA "Try to use Java (currently Java )" ${WITH_PACKAGES})
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
@ -312,16 +315,17 @@ disallow_intree_builds()
set(CMAKE_PREFIX_PATH $ENV{PREFIX})
set( R_COMMAND "$ENV{R}")
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS CONDA_BUILD=1)
list (APPEND CMAKE_REQUIRED_INCLUDES
${PREFIX}/include
${SYS_PREFIX}/include
)
set(YAP_IS_MOVABLE 1)
endif()
ADD_CUSTOM_TARGET(run_install COMMAND ${CMAKE_MAKE_PROGRAM} install)
list (APPEND CMAKE_REQUIRED_INCLUDES
${PREFIX}/include
${SYS_PREFIX}/include
)
set(prefix ${CMAKE_INSTALL_PREFIX}) #BINDIR})
@ -365,13 +369,6 @@ find_package(GMP)
list(APPEND YAP_SYSTEM_OPTIONS big_numbers)
include_directories(H
H/generated
include os OPTYap utf8proc JIT/HPP)
include_directories(BEFORE ${CMAKE_BINARY_DIR} ${CMAKE_TOP_BINARY_DIR})
add_subdirectory( H )
if (GMP_INCLUDE_DIRS)
#config.h needs this (TODO: change in code latter)
include_directories(${GMP_INCLUDE_DIRS})
@ -388,13 +385,20 @@ if (WITH_READLINE)
# ADD_SUBDIRECTORY(console/terminal)
if (READLINE_FOUND)
include_directories(${READLINE_INCLUDE_DIR})
# required for configure
list(APPEND CMAKE_REQUIRED_LIBRARIES ${READLINE_LIBRARIES})
list(APPEND CMAKE_REQUIRED_INCLUDES ${READLINE_INCLUDE_DIR})
list(APPEND CMAKE_REQUIRED_INCLUDES ${READLINE_INCLUDE_DIR}
${READLINE_INCLUDE_DIR}/readline
)
endif ()
endif()
include_directories(H
H/generated
include os OPTYap utf8proc JIT/HPP)
include_directories(BEFORE ${CMAKE_BINARY_DIR})
add_subdirectory( H )
#MPI STUFF
# library/mpi/mpi.c library/mpi/mpe.c
# library/lammpi/yap_mpi.c library/lammpi/hash.c library/lammpi/prologterms2c.c
@ -493,7 +497,7 @@ endif ()
## (but later on when installing)
#SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
#
## SET(CMAKE_INSTALL_FULL_RPATH ${CMAKE_TOP_BINARY_DIR})
## SET(CMAKE_INSTALL_FULL_RPATH ${CMAKE_BINARY_DIR})
#
## add the automatically determined parts of the RPATH
## which point to directories outside the build tree to the install RPATH
@ -518,6 +522,9 @@ ELSE()
LIST(APPEND CMAKE_INSTALL_RPATH @loader_path/../../../lib)
ENDIF()
set(YAP_STARTUP startup.yss)
set(YAP_SOURCEBOOT boot.yap )
# Model Specific
if (HAVE_GCC)
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS -Wall)
@ -571,6 +578,10 @@ ADD_SUBDIRECTORY(os)
ADD_SUBDIRECTORY(library/dialect/swi/fli)
ADD_SUBDIRECTORY(CXX)
ADD_SUBDIRECTORY(pl)
ADD_SUBDIRECTORY(library)
add_subDIRECTORY(utf8proc )
if(ANDROID)
@ -612,10 +623,12 @@ if (WIN32 OR ANDROID)
List(APPEND YLIBS $<TARGET_OBJECTS:YAP++>)
if (WIN32 AND WITH_PYTHON)
List(APPEND YLIBS $<TARGET_OBJECTS:Py4YAP>)
list (APPEND WINDLLS ${PYTHON_LIBRARIES})
endif ()
if (ANDROID)
List(APPEND YLIBS $<TARGET_OBJECTS:YAPsqlite3>)
List(APPEND YLIBS $<TARGET_OBJECTS:DROID>)
set(ANDROID_LIBRARIES sqliteX android log)
endif ()
endif ()
@ -633,40 +646,20 @@ add_library( # Sets the name of the library.
${YLIBS}
)
if (GMP_FOUND)
target_link_libraries(libYap ${GMP_LIBRARIES})
endif (GMP_FOUND)
if (READLINE_FOUND)
target_link_libraries(libYap ${READLINE_LIBRARIES})
# required for configure
endif ()
if (ANDROID)
target_link_libraries(libYap sqliteX android log)
endif()
if (WIN32)
target_link_libraries(libYap ${WINDLLS})
if (WITH_PYTHON AND PYTHON_INCLUDE_DIRS AND PYTHON_LIBRARIES)
target_link_libraries(libYap ${PYTHON_LIBRARIES})
endif ()
if (WITH_PYTHON AND PYTHON_INCLUDE_DIRS AND PYTHON_LIBRARIES)
target_link_libraries(libYap ${PYTHON_LIBRARIES})
endif ()
endif (WIN32)
target_link_libraries(libYap m)
target_link_libraries(libYap
m
${GMP_LIBRARIES}
${READLINE_LIBRARIES}
${ANDROID_LIBRARIES}
${WINDLLS}
${PYTHON_LIBRARIES}
)
set_target_properties(libYap
PROPERTIES OUTPUT_NAME Yap
)
set(YAP_STARTUP startup.yss)
set(YAP_SOURCEBOOT boot.yap )
## define system
# Optional libraries that affect compilation
@ -686,7 +679,7 @@ set_property(DIRECTORY PROPERTY CXX_STANDARD 11)
if (ANDROID)
include_directories(CXX ${CMAKE_SOURCE_DIR}/yaplib/../generated/src/jni)
include_directories(CXX ${CMAKE_SOURCE_DIR}/../yaplib/generated/src/jni)
endif ()
include(Threads)
#

View File

@ -23,7 +23,7 @@ target_link_libraries(regexp libYap)
set_target_properties (regexp PROPERTIES PREFIX "")
TARGET_INCLUDE_DIRECTORIES (regexp PUBLIC BEFORE
${CMAKE_TOP_SOURCE_DIR}/include;${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR} )
${CMAKE_SOURCE_DIR}/include;${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR} )
install(TARGETS regexp
LIBRARY DESTINATION ${YAP_INSTALL_LIBDIR}

View File

@ -1,4 +1,4 @@
set(PL_BOOT_SOURCES
set(11PL_BOOT_SOURCES
absf.yap
android.yap
arith.yap
@ -76,21 +76,21 @@ elseif(CMAKE_CROSSCOMPILING)
)
else ()
add_custom_target(STARTUP ALL
DEPENDS ${CMAKE_TOP_BINARY_DIR}/${YAP_STARTUP}
DEPENDS ${CMAKE_BINARY_DIR}/${YAP_STARTUP}
)
add_custom_command(OUTPUT ${CMAKE_TOP_BINARY_DIR}/${YAP_STARTUP}
COMMAND yap-bin -b
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${YAP_STARTUP}
COMMAND yap-bin -B ${CMAKE_SOURCE_DIR}/pl/boot.yap
VERBATIM
DEPENDS ${PL_BOOT_SOURCES} yap-bin
)
# install(CODE "execute_process(COMMAND ./yap -B
# WORKING_DIRECTORY ${CMAKE_TOP_BINARY_DIR})"
# WORKING_DIRECTORY ${CMAKE_BINARY_DIR})"
# DEPENDS Py4YAP ${PL_BOOT_SOURCES} yap-bin )
install(FILES ${CMAKE_TOP_BINARY_DIR}/${YAP_STARTUP}
DESTINATION ${YAP_INSTALL_DATADIR}/pl)
install(FILES ${CMAKE_BINARY_DIR}/${YAP_STARTUP}
DESTINATION ${YAP_INSTALL_LIBDIR})
endif()