2015-10-13 08:25:49 +01:00
|
|
|
|
2016-08-20 03:40:01 +01:00
|
|
|
# PROJECT ( YAP_REAL C )
|
2015-10-13 08:25:49 +01:00
|
|
|
|
|
|
|
macro_optional_find_package (R ON)
|
|
|
|
|
2016-01-20 22:36:52 +00:00
|
|
|
macro_log_feature (R_FOUND "R"
|
2015-10-13 08:25:49 +01:00
|
|
|
"Use R Environment"
|
|
|
|
"http://www.r.org" FALSE)
|
|
|
|
|
2016-01-20 22:36:52 +00:00
|
|
|
if (R_FOUND)
|
2015-10-13 08:25:49 +01:00
|
|
|
|
|
|
|
set (REAL_SOURCES
|
|
|
|
real.c
|
|
|
|
real.pl
|
|
|
|
)
|
|
|
|
|
|
|
|
include_directories (
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
2016-08-20 03:40:01 +01:00
|
|
|
${R_INCLUDE_DIR}
|
2015-10-13 08:25:49 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
set (CMAKE_REQUIRED_INCLUDES
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
2016-08-20 03:40:01 +01:00
|
|
|
${R_INCLUDE_DIR}
|
2015-10-13 08:25:49 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2016-01-20 22:36:52 +00:00
|
|
|
# The module defines the following variables:
|
|
|
|
# R_FOUND - System has R
|
|
|
|
# R_EXECUTABLE - The R interpreter
|
|
|
|
# R_INCLUDE_DIR - the R include directory
|
|
|
|
# R_LIBRARIES - The libraries needed to use R
|
|
|
|
# R_VERSION_STRING - R version
|
2015-10-13 08:25:49 +01:00
|
|
|
|
|
|
|
add_library (real SHARED ${REAL_SOURCES})
|
|
|
|
|
2016-02-11 15:32:42 +00:00
|
|
|
target_link_libraries (real ${R_LIBRARIES} ${CMAKE_DL_LIBS} libYap)
|
2015-10-13 08:25:49 +01:00
|
|
|
|
|
|
|
set_target_properties (real PROPERTIES PREFIX "")
|
|
|
|
|
|
|
|
check_include_files( R.h HAVE_R_H )
|
|
|
|
check_include_files ( "R.h;Rembedded.h" HAVE_R_EMBEDDED_H )
|
|
|
|
check_include_files( "Rembedded.h;Rinterface.h" HAVE_R_INTERFACE_H )
|
|
|
|
|
|
|
|
configure_file ("rconfig.h.cmake" "rconfig.h" )
|
|
|
|
|
|
|
|
install(TARGETS real
|
|
|
|
LIBRARY DESTINATION ${dlls}
|
2016-01-20 22:36:52 +00:00
|
|
|
ARCHIVE DESTINATION ${dlls}
|
2015-10-13 08:25:49 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
install(FILES real.pl
|
|
|
|
DESTINATION ${libpl}
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2016-01-20 22:36:52 +00:00
|
|
|
endif (R_FOUND)
|