R
This commit is contained in:
parent
2905688c0f
commit
aed15571ff
@ -554,7 +554,7 @@ IF (WITH_PYTHON)
|
|||||||
ENDIF (WITH_PYTHON)
|
ENDIF (WITH_PYTHON)
|
||||||
|
|
||||||
option(WITH_R
|
option(WITH_R
|
||||||
"Allow YAP->R" ON)
|
"Use R Interface" ON)
|
||||||
|
|
||||||
IF (WITH_R)
|
IF (WITH_R)
|
||||||
include_directories(packages/real )
|
include_directories(packages/real )
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# FindLibR.cmake
|
# FindLibR.cmake
|
||||||
#
|
#
|
||||||
# Copyright (C) 2009-11 by RStudio, Inc.
|
# Copyright (C) 2009-18 by RStudio, Inc.
|
||||||
#
|
#
|
||||||
# This program is licensed to you under the terms of version 3 of the
|
# This program is licensed to you under the terms of version 3 of the
|
||||||
# GNU Affero General Public License. This program is distributed WITHOUT
|
# GNU Affero General Public License. This program is distributed WITHOUT
|
||||||
@ -21,11 +21,24 @@
|
|||||||
if(APPLE)
|
if(APPLE)
|
||||||
|
|
||||||
find_library(LIBR_LIBRARIES R)
|
find_library(LIBR_LIBRARIES R)
|
||||||
if(LIBR_LIBRARIES)
|
|
||||||
|
if(LIBR_LIBRARIES MATCHES ".*\\.framework")
|
||||||
set(LIBR_HOME "${LIBR_LIBRARIES}/Resources" CACHE PATH "R home directory")
|
set(LIBR_HOME "${LIBR_LIBRARIES}/Resources" CACHE PATH "R home directory")
|
||||||
set(LIBR_INCLUDE_DIRS "${LIBR_HOME}/include" CACHE PATH "R include directory")
|
set(LIBR_INCLUDE_DIRS "${LIBR_HOME}/include" CACHE PATH "R include directory")
|
||||||
set(LIBR_DOC_DIR "${LIBR_HOME}/doc" CACHE PATH "R doc directory")
|
set(LIBR_DOC_DIR "${LIBR_HOME}/doc" CACHE PATH "R doc directory")
|
||||||
set(LIBR_EXECUTABLE "${LIBR_HOME}/R" CACHE PATH "R executable")
|
set(LIBR_EXECUTABLE "${LIBR_HOME}/R" CACHE PATH "R executable")
|
||||||
|
else()
|
||||||
|
get_filename_component(_LIBR_LIBRARIES "${LIBR_LIBRARIES}" REALPATH)
|
||||||
|
get_filename_component(_LIBR_LIBRARIES_DIR "${_LIBR_LIBRARIES}" PATH)
|
||||||
|
set(LIBR_EXECUTABLE "${_LIBR_LIBRARIES_DIR}/../bin/R")
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${LIBR_EXECUTABLE} "--slave" "--vanilla" "-e" "cat(R.home())"
|
||||||
|
OUTPUT_VARIABLE LIBR_HOME
|
||||||
|
)
|
||||||
|
set(LIBR_HOME ${LIBR_HOME} CACHE PATH "R home directory")
|
||||||
|
set(LIBR_INCLUDE_DIRS "${LIBR_HOME}/include" CACHE PATH "R include directory")
|
||||||
|
set(LIBR_DOC_DIR "${LIBR_HOME}/doc" CACHE PATH "R doc directory")
|
||||||
|
set(LIBR_LIB_DIR "${LIBR_HOME}/lib" CACHE PATH "R lib directory")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# detection for UNIX & Win32
|
# detection for UNIX & Win32
|
||||||
@ -103,12 +116,15 @@ else()
|
|||||||
set(LIBR_INCLUDE_DIRS "${LIBR_HOME}/include" CACHE PATH "R include directory")
|
set(LIBR_INCLUDE_DIRS "${LIBR_HOME}/include" CACHE PATH "R include directory")
|
||||||
set(LIBR_DOC_DIR "${LIBR_HOME}/doc" CACHE PATH "R doc directory")
|
set(LIBR_DOC_DIR "${LIBR_HOME}/doc" CACHE PATH "R doc directory")
|
||||||
|
|
||||||
# set library hint path based on whether we are doing a special session 64 build
|
# set library hint path for 64-bit build
|
||||||
if(LIBR_FIND_WINDOWS_64BIT)
|
set(LIBR_ARCH "x64")
|
||||||
set(LIBRARY_ARCH_HINT_PATH "${LIBR_HOME}/bin/x64")
|
set(LIBRARY_ARCH_HINT_PATH "${LIBR_HOME}/bin/x64")
|
||||||
else()
|
|
||||||
set(LIBRARY_ARCH_HINT_PATH "${LIBR_HOME}/bin/i386")
|
# call dll2lib.R to ensure export files are generated
|
||||||
endif()
|
execute_process(
|
||||||
|
COMMAND "${LIBR_HOME}/bin/${LIBR_ARCH}/Rscript.exe" "dll2lib.R"
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/tools"
|
||||||
|
RESULT_VARIABLE LIBR_DLL2LIB_RESULT)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -173,6 +189,7 @@ find_package_handle_standard_args(LibR DEFAULT_MSG
|
|||||||
|
|
||||||
if(LIBR_FOUND)
|
if(LIBR_FOUND)
|
||||||
message(STATUS "Found R: ${LIBR_HOME}")
|
message(STATUS "Found R: ${LIBR_HOME}")
|
||||||
|
get_filename_component(LIBR_BIN_DIR "${LIBR_EXECUTABLE}" PATH CACHE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# mark low-level variables from FIND_* calls as advanced
|
# mark low-level variables from FIND_* calls as advanced
|
||||||
|
@ -326,6 +326,8 @@ add_custom_target(YAP_KERNEL ALL
|
|||||||
COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} build sdist bdist
|
COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} build sdist bdist
|
||||||
COMMAND ${PYTHON_EXECUTABLE} -m pip install ${PYTHON_USER_INSTALL} --ignore-installed --no-deps .
|
COMMAND ${PYTHON_EXECUTABLE} -m pip install ${PYTHON_USER_INSTALL} --ignore-installed --no-deps .
|
||||||
COMMAND ${PYTHON_EXECUTABLE} -m yap_kernel.kernelspec
|
COMMAND ${PYTHON_EXECUTABLE} -m yap_kernel.kernelspec
|
||||||
|
ERROR_VARIABLE setupErr
|
||||||
|
OUTPUT_VARIABLE setupOut
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
|
||||||
|
|
||||||
install(FILES ${PL_SOURCES} DESTINATION ${libpl} )
|
install(FILES ${PL_SOURCES} DESTINATION ${libpl} )
|
||||||
|
@ -56,7 +56,8 @@ jupyter_consult(Cell) :-
|
|||||||
% stream_property(Stream, file_name(Name) ),
|
% stream_property(Stream, file_name(Name) ),
|
||||||
% setup_call_cleanup(
|
% setup_call_cleanup(
|
||||||
open_mem_read_stream( Cell, Stream),
|
open_mem_read_stream( Cell, Stream),
|
||||||
load_files(user:'jupyter cell',[stream(Stream)]).
|
load_files(user:'jupyter cell',[stream(Stream)]),
|
||||||
|
close(Stream).
|
||||||
|
|
||||||
blank(Text) :-
|
blank(Text) :-
|
||||||
atom_codes(Text, L),
|
atom_codes(Text, L),
|
||||||
@ -206,4 +207,5 @@ plot_inline :-
|
|||||||
|
|
||||||
:- endif.
|
:- endif.
|
||||||
|
|
||||||
%:- ( start_low_level_trace ).
|
:- ( start_low_level_trace ).
|
||||||
|
|
||||||
|
@ -2,30 +2,12 @@
|
|||||||
# PROJECT ( YAP_REAL C )
|
# PROJECT ( YAP_REAL C )
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# - This module locates an installed R distribution.
|
# LIBR_FOUND
|
||||||
#
|
# LIBR_HOME
|
||||||
# Defines the following:
|
# LIBR_INCLUDE_DIRS
|
||||||
# R_COMMAND - Path to R command
|
# LIBR_DOC_DIR
|
||||||
# R_HOME - Path to 'R home', as reported by R
|
# LIBR_LIBRARIES
|
||||||
# R_INCLUDE_DIR - Path to R include directory
|
|
||||||
# R_LIBRARY_BASE - Path to R library
|
|
||||||
# R_LIBRARY_BLAS - Path to Rblas / blas library
|
|
||||||
# R_LIBRARY_LAPACK - Path to Rlapack / lapack library
|
|
||||||
# R_LIBRARY_READLINE - Path to readline library
|
|
||||||
# R_LIBRARIES - Array of: R_LIBRARY_BASE, R_LIBRARY_BLAS, R_LIBRARY_LAPACK, R_LIBRARY_BASE [, R_LIBRARY_READLINE]
|
|
||||||
#
|
|
||||||
# VTK_R_HOME - (deprecated, use R_HOME instead) Path to 'R home', as reported by R
|
|
||||||
#
|
|
||||||
# Variable search order:
|
|
||||||
# 1. Attempt to locate and set R_COMMAND
|
|
||||||
# If unsuccessful, generate error and prompt user to manually set R_COMMAND
|
|
||||||
# 2. Use R_COMMAND to set R_HOME
|
|
||||||
# 3. Locate other libraries in the priority:
|
|
||||||
# 1. Within a user-built instance of R at R_HOME
|
|
||||||
# 2. Within an installed instance of R
|
|
||||||
# 3. Within external system libraries
|
|
||||||
#
|
|
||||||
|
|
||||||
if (R_LIBRARIES AND R_INCLUDE_DIR)
|
if (R_LIBRARIES AND R_INCLUDE_DIR)
|
||||||
set_package_properties(R PROPERTIES
|
set_package_properties(R PROPERTIES
|
||||||
|
@ -9,6 +9,11 @@
|
|||||||
/**
|
/**
|
||||||
* @ingroup ModuleBuiltins
|
* @ingroup ModuleBuiltins
|
||||||
* @{
|
* @{
|
||||||
|
*
|
||||||
|
* YAP follows the following protovol:
|
||||||
|
* - predicate is in current module;
|
||||||
|
* - predicate is in user
|
||||||
|
* - predicate will be autoloaded, SWI style.
|
||||||
*/
|
*/
|
||||||
:- '$mk_dynamic'('$parent_module'(_,_),prolog).
|
:- '$mk_dynamic'('$parent_module'(_,_),prolog).
|
||||||
|
|
||||||
@ -38,7 +43,7 @@
|
|||||||
'$get_undefined_predicates'(G, ImportingMod, G0, ExportingMod) :-
|
'$get_undefined_predicates'(G, ImportingMod, G0, ExportingMod) :-
|
||||||
'$parent_module'(ImportingMod,ExportingModI),
|
'$parent_module'(ImportingMod,ExportingModI),
|
||||||
'$continue_imported'(ExportingMod, ExportingModI, G0, G).
|
'$continue_imported'(ExportingMod, ExportingModI, G0, G).
|
||||||
'$get_undefined_predicates'(G, ImportingMod, G0, ExportingMod) :-
|
'$get_undefined_predicates'(G, _ImportingMod, G0, ExportingMod) :-
|
||||||
yap_flag(default_parent_module,ExportingModI),
|
yap_flag(default_parent_module,ExportingModI),
|
||||||
'$continue_imported'(ExportingMod, ExportingModI, G0, G).
|
'$continue_imported'(ExportingMod, ExportingModI, G0, G).
|
||||||
|
|
||||||
@ -62,3 +67,4 @@
|
|||||||
*
|
*
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user