configuration
This commit is contained in:
parent
3bb4570c55
commit
5c199984ed
@ -544,7 +544,7 @@ set_property(DIRECTORY PROPERTY CXX_STANDARD 11)
|
||||
|
||||
# the RPATH to be used when installing, but only if it's not a system directory#LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${libdir}" isSystemDir)
|
||||
# IF("${isSystemDir}" STREQUAL "-1")
|
||||
# SET(CMAKE_INSTALL_RPATH "${libdir}")
|
||||
SET(CMAKE_INSTALL_RPATH "${libdir}")
|
||||
# ENDIF("${isSystemDir}" STREQUAL "-1")
|
||||
|
||||
include_directories (H
|
||||
|
@ -66,13 +66,10 @@ if(R_COMMAND)
|
||||
find_library(R_LIBRARY_READLINE readline
|
||||
DOC "(Optional) system readline library. Only required if the R libraries were built with readline support.")
|
||||
|
||||
else()
|
||||
message(SEND_ERROR "FindR.cmake requires the following variables to be set: R_COMMAND")
|
||||
endif()
|
||||
|
||||
# Note: R_LIBRARY_BASE is added to R_LIBRARIES twice; this may be due to circular linking dependencies; needs further investigation
|
||||
set(R_LIBRARIES ${R_LIBRARY_BASE} ${R_LIBRARY_BLAS} ${R_LIBRARY_LAPACK} ${R_LIBRARY_BASE})
|
||||
if(R_LIBRARY_READLINE)
|
||||
set(R_LIBRARIES ${R_LIBRARIES} ${R_LIBRARY_READLINE})
|
||||
# Note: R_LIBRARY_BASE is added to R_LIBRARIES twice; this may be due to circular linking dependencies; needs further investigation
|
||||
set(R_LIBRARIES ${R_LIBRARY_BASE} ${R_LIBRARY_BLAS} ${R_LIBRARY_LAPACK} ${R_LIBRARY_BASE})
|
||||
if(R_LIBRARY_READLINE)
|
||||
set(R_LIBRARIES ${R_LIBRARIES} ${R_LIBRARY_READLINE})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -8,6 +8,7 @@ include(FindPythonModule)
|
||||
list (APPEND pl_library ${CMAKE_CURRENT_SOURCE_DIR}/prolog/jupyter.yap ${CMAKE_CURRENT_SOURCE_DIR}/prolog/yapi.yap )
|
||||
set (PYTHON_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/yap4py/yapi.py ${CMAKE_CURRENT_SOURCE_DIR}/yap4py/__init__.py ${CMAKE_CURRENT_SOURCE_DIR}/yap4py/__main__.py)
|
||||
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES(../../swig/yap.i PROPERTIES CPLUSPLUS ON)
|
||||
SET_SOURCE_FILES_PROPERTIES(../../swig/yap.i PROPERTIES SWIG_FLAGS "-O;-py3")
|
||||
SET_SOURCE_FILES_PROPERTIES(../../swiyap.i PROPERTIES SWIG_MODULE_NAME yap4py.yap)
|
||||
@ -15,13 +16,13 @@ SET_SOURCE_FILES_PROPERTIES(../../swiyap.i PROPERTIES SWIG_MODULE_NAME yap4py.ya
|
||||
|
||||
|
||||
set(YAP4PY_PL prolog/jupyter.yap prolog/yapi.yap)
|
||||
set(YAP4PY_PY yap4py/__init__.py yap4py/__main__.py yap4py/yapi.py)
|
||||
|
||||
configure_file("setup.py.in" ${CMAKE_CURRENT_BINARY_DIR}/setup.py)
|
||||
configure_file("MANIFEST.in" ${CMAKE_CURRENT_BINARY_DIR}/MANIFEST.in)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/YAP4PY.md" ${CMAKE_CURRENT_BINARY_DIR}/README)
|
||||
configure_file("YAP4PY.md" README.md)
|
||||
|
||||
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH} ${CMAKE_CURRENT_BINARY_DIR}/yap4py/include
|
||||
|
||||
DEPENDS ${SWIG_SOURCES} YAP++
|
||||
)
|
||||
|
||||
@ -50,18 +51,26 @@ else()
|
||||
set(bdist bdist_wheel)
|
||||
endif()
|
||||
|
||||
|
||||
add_custom_target( YAP4PY ALL
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory yap4py
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/yap4py yap4py
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/CXX/yapi.cpp yap4py
|
||||
COMMAND ${SWIG_EXECUTABLE} -c++ -python -O -py3 -module "yap" -addextern -I${CMAKE_SOURCE_DIR}/H -I${CMAKE_SOURCE_DIR}/H/generated -I${CMAKE_SOURCE_DIR}/include -I${CMAKE_SOURCE_DIR}/OPTYap -I${CMAKE_SOURCE_DIR}/os -I${CMAKE_SOURCE_DIR}/utf8proc -I.././.. -I${CMAKE_SOURCE_DIR}/CXX -I${CMAKE_SOURCE_DIR}/packages/python -outdir ${CMAKE_CURRENT_BINARY_DIR}/yap4py -I${GMP_INCLUDE_DIRS} -DX_API="" -o yap4py/yap_wrap.cxx -oh yap4py/yap_wrap.hh ${SWIG_SOURCES}
|
||||
COMMAND ${SWIG_EXECUTABLE} -c++ -python -O -py3 -module "yap" -addextern -I${CMAKE_SOURCE_DIR}/H -I${CMAKE_SOURCE_DIR}/H/generated -I${CMAKE_SOURCE_DIR}/include
|
||||
-I${CMAKE_SOURCE_DIR}/OPTYap -I${CMAKE_SOURCE_DIR}/os -I${CMAKE_SOURCE_DIR}/utf8proc -I.././.. -I${CMAKE_SOURCE_DIR}/CXX -I${CMAKE_SOURCE_DIR}/packages/python
|
||||
-outdir ${CMAKE_CURRENT_BINARY_DIR}/yap4py -I${GMP_INCLUDE_DIRS} -DX_API="" -o ${CMAKE_CURRENT_BINARY_DIR}/yap4py/yap_wrap.cxx -oh ${CMAKE_CURRENT_BINARY_DIR}/yap4py/yap_wrap.hh ${SWIG_SOURCES}
|
||||
COMMAND ${PYTHON_EXECUTABLE} setup.py sdist ${bdist}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
DEPENDS ${SWIG_SOURCES} Py4YAP YAP++
|
||||
DEPENDS ${SWIG_SOURCES} Py4YAP YAP++ yap4py/yapi.cpp YAP4PY_PY
|
||||
)
|
||||
|
||||
|
||||
add_custom_command( OUTPUT yap4py/yapi.cpp
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/CXX/yapi.cpp ${CMAKE_CURRENT_BINARY_DIR}/yap4py
|
||||
DEPENDS ${CMAKE_SOURCE_DIR}/CXX/yapi.cpp
|
||||
)
|
||||
|
||||
add_custom_command( OUTPUT YAP4PY_PY
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/yap4py
|
||||
DEPENDS ${PYTHON_SOURCES}
|
||||
)
|
||||
|
||||
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install --ignore-installed .
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"
|
||||
DEPENDS Py4YAP ${CMAKE_BINARY_DIR}/${YAP_STARTUP} ${dlls} )
|
||||
|
@ -51,7 +51,7 @@ from distutils.core import setup
|
||||
|
||||
here = abspath(dirname(__file__))
|
||||
libpydir = abspath(sysconfig.get_path('platlib'))
|
||||
libpyauxdir = abspath(os.path.dirname('std lib'))
|
||||
libpyauxdir = abspath(os.path.dirname('stdlib'))
|
||||
#pkg_root = join(here, name)
|
||||
|
||||
here = path.abspath(path.dirname(__file__))
|
||||
@ -64,10 +64,10 @@ if platform.system() == 'Windows':
|
||||
win_libs = ['wsock32','ws2_32']
|
||||
my_extra_link_args = ['-Wl,-export-all-symbols']
|
||||
else:
|
||||
#if platform.system() == 'Darwin':
|
||||
my_extra_link_args = ['-Wl,-rpath','-Wl,@loader_path']
|
||||
my_extra_link_args = ['-Wl,-rpath','-Wl,${libdir}']
|
||||
win_libs = []
|
||||
local_libs = ['Py4YAP']
|
||||
|
||||
# or dll in glob('yap/dlls/*'):
|
||||
# move( dll ,'lib' )
|
||||
|
||||
|
@ -9,16 +9,17 @@ import sys
|
||||
# global yap_lib_path
|
||||
#yap_lib_path = os.path.dirname(__file__)
|
||||
|
||||
if platform.system() == 'Windows':
|
||||
def load( dll ):
|
||||
dll = glob.glob(os.path.join(yap_lib_path,dll))[0]
|
||||
dll = os.path.abspath(dll)
|
||||
ctypes.WinDLL(dll)
|
||||
load('libYap*')
|
||||
# else:
|
||||
# def load( dll ):
|
||||
# dll = glob.glob(os.path.join(yap_lib_path,dll))[0]
|
||||
# dll = os.path.abspath(dll)
|
||||
# ctypes.CDLL(dll, mode=ctypes.RTLD_GLOBAL)
|
||||
# load('libYap*')
|
||||
# load('libPy4YAP*')
|
||||
# if platform.system() == 'Windows':
|
||||
# def load( dll ):
|
||||
# dll = glob.glob(os.path.join(yap_lib_path,dll))[0]
|
||||
# dll = os.path.abspath(dll)
|
||||
# ctypes.WinDLL(dll)
|
||||
# else:
|
||||
# def load( l0 ):
|
||||
# for i in ["@libdir@",""]:
|
||||
# dll = os.path.concat(i,l0)
|
||||
# dll = glob.glob(os.path.join(yap_lib_path,dll))[0]
|
||||
# dll = os.path.abspath(dll)
|
||||
# ctypes.CDLL(dll)
|
||||
# # load('libYap*')
|
||||
# # load('libPy4YAP*')
|
||||
|
@ -10,6 +10,7 @@ from .yap import *
|
||||
|
||||
|
||||
class Engine( YAPEngine ):
|
||||
|
||||
def __init__(self, args=None,**kwargs):
|
||||
# type: (object) -> object
|
||||
self.contained = False
|
||||
@ -17,14 +18,13 @@ class Engine( YAPEngine ):
|
||||
args = EngineArgs(**kwargs)
|
||||
if self.contained:
|
||||
yap_lib_path = os.path.dirname(__file__)
|
||||
args.setYapShareDir(os.path.join(yap_lib_path,"prolog"))
|
||||
args.setYapShareDir(os.path.join(yap_lib_path, "prolog"))
|
||||
args.setYapLibDir(yap_lib_path)
|
||||
args.setSavedState(os.path.join(yap_lib_path,"startup.yss"))
|
||||
YAPEngine.__init__(self,args)
|
||||
self.goal( set_prolog_flag('verbose', 'silent' ) )
|
||||
self.goal( use_module(library('yapi') ) )
|
||||
self.goal( set_prolog_flag('verbose', 'normal' ) )
|
||||
|
||||
args.setSavedState(os.path.join(yap_lib_path, "startup.yss"))
|
||||
YAPEngine.__init__(self, args)
|
||||
self.goal(set_prolog_flag('verbose', 'silent'))
|
||||
self.goal(use_module(library('yapi')))
|
||||
self.goal(set_prolog_flag('verbose', 'normal'))
|
||||
|
||||
def run(self, g, m=None):
|
||||
if m:
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
macro_optional_find_package (R ON)
|
||||
|
||||
if (R_HOME)
|
||||
if (R_LIBRARIES AND R_INCLUDE_DIR)
|
||||
|
||||
set (REAL_SOURCES
|
||||
real.c
|
||||
|
Reference in New Issue
Block a user