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

View File

@ -23,7 +23,7 @@ target_link_libraries(regexp libYap)
set_target_properties (regexp PROPERTIES PREFIX "") set_target_properties (regexp PROPERTIES PREFIX "")
TARGET_INCLUDE_DIRECTORIES (regexp PUBLIC BEFORE 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 install(TARGETS regexp
LIBRARY DESTINATION ${YAP_INSTALL_LIBDIR} LIBRARY DESTINATION ${YAP_INSTALL_LIBDIR}

View File

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