real
This commit is contained in:
parent
2a1ec9c36b
commit
94621bf8f2
@ -557,7 +557,8 @@ option(WITH_R
|
|||||||
"Use R Interface" ON)
|
"Use R Interface" ON)
|
||||||
|
|
||||||
IF (WITH_R)
|
IF (WITH_R)
|
||||||
include_directories(packages/real )
|
find_host_package(LibR)
|
||||||
|
add_subDIRECTORY(packages/real)
|
||||||
ENDIF (WITH_R)
|
ENDIF (WITH_R)
|
||||||
|
|
||||||
|
|
||||||
@ -776,7 +777,6 @@ if (WITH_GECODE)
|
|||||||
add_subDIRECTORY(packages/gecode)
|
add_subDIRECTORY(packages/gecode)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_subDIRECTORY(packages/real)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -795,17 +795,16 @@ if (Java_Development_FOUND)
|
|||||||
|
|
||||||
set (STD_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
|
set (STD_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
|
||||||
set (CMAKE_FIND_FRAMEWORK LAST) # CMake will find the Java returned by /usr/libexec/java_home.
|
set (CMAKE_FIND_FRAMEWORK LAST) # CMake will find the Java returned by /usr/libexec/java_home.
|
||||||
find_package(JNI)
|
|
||||||
|
macro_optional_find_package(JNI ON)
|
||||||
|
|
||||||
|
|
||||||
set (CMAKE_FIND_FRAMEWORK ${STD_CMAKE_FIND_FRAMEWORK})
|
set (CMAKE_FIND_FRAMEWORK ${STD_CMAKE_FIND_FRAMEWORK})
|
||||||
|
|
||||||
if (NOT JNI_FOUND)
|
|
||||||
|
|
||||||
set (JAVA_HOME ${JAVA_INCLUDE_PATH}/..)
|
|
||||||
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (JNI_FOUND)
|
if (JNI_FOUND)
|
||||||
|
|
||||||
|
get_filename_component(JAVA_HOME ${JAVA_INCLUDE_PATH} DIRECTORY)
|
||||||
|
|
||||||
include(UseJava)
|
include(UseJava)
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -826,7 +825,8 @@ endif()
|
|||||||
# The Java_ADDITIONAL_VERSIONS variable can be used to specify a list
|
# The Java_ADDITIONAL_VERSIONS variable can be used to specify a list
|
||||||
# of version numbers that should be taken into account when searching
|
# of version numbers that should be taken into account when searching
|
||||||
# for Java. You need to set this variable before calling
|
# for Java. You need to set this variable before calling
|
||||||
# find_package(JavaLibs).
|
|
||||||
|
|
||||||
#
|
#
|
||||||
#macro_optional_find_package(JNI ON)
|
#macro_optional_find_package(JNI ON)
|
||||||
# JNI_INCLUDE_DIRS = the include dirs to use
|
# JNI_INCLUDE_DIRS = the include dirs to use
|
||||||
@ -838,6 +838,7 @@ endif()
|
|||||||
# JAVA_INCLUDE_PATH2 = the include path to jni_md.h
|
# JAVA_INCLUDE_PATH2 = the include path to jni_md.h
|
||||||
# JAVA_AWT_INCLUDE_PATH = the include path to jawt.h
|
# JAVA_AWT_INCLUDE_PATH = the include path to jawt.h
|
||||||
|
|
||||||
|
|
||||||
endif (JNI_FOUND)
|
endif (JNI_FOUND)
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,31 +3,36 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
set(REAL_SOURCES real.c)
|
||||||
|
|
||||||
# LIBR_FOUND
|
# LIBR_FOUND
|
||||||
# LIBR_HOME
|
# LIBR_HOME
|
||||||
# LIBR_INCLUDE_DIRS
|
# LIBLIBR_INCLUDE_DIRSS
|
||||||
# LIBR_DOC_DIR
|
# LIBR_DOC_DIR
|
||||||
# LIBR_LIBRARIES
|
# LIBR_LIBRARIES
|
||||||
|
|
||||||
if (R_LIBRARIES AND R_INCLUDE_DIR)
|
if (LIBR_LIBRARIES AND LIBR_INCLUDE_DIRS)
|
||||||
set_package_properties(R PROPERTIES
|
set_package_properties(R PROPERTIES
|
||||||
DESCRIPTION "The R Project for Statistical Computing."
|
DESCRIPTION "The R Project for Statistical Computing."
|
||||||
|
|
||||||
URL "https://www.r-project.org/")
|
URL "https://www.r-project.org/")
|
||||||
add_lib(real ${REAL_SOURCES})
|
add_lib(real ${REAL_SOURCES})
|
||||||
target_link_libraries (real ${R_LIBRARIES} libYap)
|
target_link_libraries (real ${LIBR_LIBRARIES} libYap)
|
||||||
include_directories (
|
include_directories (
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
${R_INCLUDE_DIR}
|
${CMAKE_BINARY_DIR}
|
||||||
|
${CMAKE_SOURCE_DIR}/include
|
||||||
|
${LIBR_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
list (APPEND CMAKE_REQUIRED_INCLUDES
|
list (APPEND CMAKE_REQUIRED_INCLUDES
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
${R_INCLUDE_DIR}
|
${CMAKE_SOURCE_DIR}/include
|
||||||
|
${LIBR_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
check_include_files( "stdio.h;R.h" HAVE_R_H )
|
check_include_files( "stdio.h;R.h" HAVE_R_H )
|
||||||
check_include_files( "R.h,;Rembedded.h" HAVE_R_EMBEDDED_H )
|
check_include_files( "R.h,;Rembeddred.h" HAVE_R_EMBEDDED_H )
|
||||||
check_include_files( "Rembedded.h;Rinterface.h" HAVE_R_INTERFACE_H )
|
check_include_files( "Rembedded.h;Rinterface.h" HAVE_R_INTERFACE_H )
|
||||||
|
|
||||||
configure_file ("rconfig.h.cmake" "rconfig.h" )
|
configure_file ("rconfig.h.cmake" "rconfig.h" )
|
||||||
|
@ -66,6 +66,7 @@
|
|||||||
:- use_module(library(readutil)).
|
:- use_module(library(readutil)).
|
||||||
:- use_module(library(debug)).
|
:- use_module(library(debug)).
|
||||||
:- use_module(library(system)).
|
:- use_module(library(system)).
|
||||||
|
:- use_module(library(readutil)).
|
||||||
|
|
||||||
:- dynamic( real:r_started/1 ).
|
:- dynamic( real:r_started/1 ).
|
||||||
|
|
||||||
@ -111,6 +112,15 @@ init_r_env :-
|
|||||||
install_in_ms_windows(ToR).
|
install_in_ms_windows(ToR).
|
||||||
:- endif.
|
:- endif.
|
||||||
|
|
||||||
|
init_r_env :-
|
||||||
|
current_prolog_flag(unix, true),
|
||||||
|
open(popen('R RHOME'),read,S),
|
||||||
|
read_line_to_codes(S,Lc),
|
||||||
|
close(S),
|
||||||
|
Lc \= end_of_file,
|
||||||
|
!,
|
||||||
|
atom_codes(RH,Lc),
|
||||||
|
setenv('R_HOME',RH).
|
||||||
init_r_env :-
|
init_r_env :-
|
||||||
current_prolog_flag(unix, true),
|
current_prolog_flag(unix, true),
|
||||||
% typical Linux 64 bit setup (fedora)
|
% typical Linux 64 bit setup (fedora)
|
||||||
|
Reference in New Issue
Block a user