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)
|
# 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")
|
# IF("${isSystemDir}" STREQUAL "-1")
|
||||||
# SET(CMAKE_INSTALL_RPATH "${libdir}")
|
SET(CMAKE_INSTALL_RPATH "${libdir}")
|
||||||
# ENDIF("${isSystemDir}" STREQUAL "-1")
|
# ENDIF("${isSystemDir}" STREQUAL "-1")
|
||||||
|
|
||||||
include_directories (H
|
include_directories (H
|
||||||
|
@ -66,13 +66,10 @@ if(R_COMMAND)
|
|||||||
find_library(R_LIBRARY_READLINE readline
|
find_library(R_LIBRARY_READLINE readline
|
||||||
DOC "(Optional) system readline library. Only required if the R libraries were built with readline support.")
|
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
|
# 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})
|
set(R_LIBRARIES ${R_LIBRARY_BASE} ${R_LIBRARY_BLAS} ${R_LIBRARY_LAPACK} ${R_LIBRARY_BASE})
|
||||||
if(R_LIBRARY_READLINE)
|
if(R_LIBRARY_READLINE)
|
||||||
set(R_LIBRARIES ${R_LIBRARIES} ${R_LIBRARY_READLINE})
|
set(R_LIBRARIES ${R_LIBRARIES} ${R_LIBRARY_READLINE})
|
||||||
|
endif()
|
||||||
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 )
|
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 (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 CPLUSPLUS ON)
|
||||||
SET_SOURCE_FILES_PROPERTIES(../../swig/yap.i PROPERTIES SWIG_FLAGS "-O;-py3")
|
SET_SOURCE_FILES_PROPERTIES(../../swig/yap.i PROPERTIES SWIG_FLAGS "-O;-py3")
|
||||||
SET_SOURCE_FILES_PROPERTIES(../../swiyap.i PROPERTIES SWIG_MODULE_NAME yap4py.yap)
|
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_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("setup.py.in" ${CMAKE_CURRENT_BINARY_DIR}/setup.py)
|
||||||
configure_file("MANIFEST.in" ${CMAKE_CURRENT_BINARY_DIR}/MANIFEST.in)
|
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
|
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH} ${CMAKE_CURRENT_BINARY_DIR}/yap4py/include
|
||||||
|
|
||||||
DEPENDS ${SWIG_SOURCES} YAP++
|
DEPENDS ${SWIG_SOURCES} YAP++
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -50,18 +51,26 @@ else()
|
|||||||
set(bdist bdist_wheel)
|
set(bdist bdist_wheel)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
add_custom_target( YAP4PY ALL
|
add_custom_target( YAP4PY ALL
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove_directory 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
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/yap4py yap4py
|
-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
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/CXX/yapi.cpp yap4py
|
-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 ${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 ${PYTHON_EXECUTABLE} setup.py sdist ${bdist}
|
COMMAND ${PYTHON_EXECUTABLE} setup.py sdist ${bdist}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
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 .
|
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install --ignore-installed .
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"
|
||||||
DEPENDS Py4YAP ${CMAKE_BINARY_DIR}/${YAP_STARTUP} ${dlls} )
|
DEPENDS Py4YAP ${CMAKE_BINARY_DIR}/${YAP_STARTUP} ${dlls} )
|
||||||
|
@ -51,7 +51,7 @@ from distutils.core import setup
|
|||||||
|
|
||||||
here = abspath(dirname(__file__))
|
here = abspath(dirname(__file__))
|
||||||
libpydir = abspath(sysconfig.get_path('platlib'))
|
libpydir = abspath(sysconfig.get_path('platlib'))
|
||||||
libpyauxdir = abspath(os.path.dirname('std lib'))
|
libpyauxdir = abspath(os.path.dirname('stdlib'))
|
||||||
#pkg_root = join(here, name)
|
#pkg_root = join(here, name)
|
||||||
|
|
||||||
here = path.abspath(path.dirname(__file__))
|
here = path.abspath(path.dirname(__file__))
|
||||||
@ -64,10 +64,10 @@ if platform.system() == 'Windows':
|
|||||||
win_libs = ['wsock32','ws2_32']
|
win_libs = ['wsock32','ws2_32']
|
||||||
my_extra_link_args = ['-Wl,-export-all-symbols']
|
my_extra_link_args = ['-Wl,-export-all-symbols']
|
||||||
else:
|
else:
|
||||||
#if platform.system() == 'Darwin':
|
my_extra_link_args = ['-Wl,-rpath','-Wl,${libdir}']
|
||||||
my_extra_link_args = ['-Wl,-rpath','-Wl,@loader_path']
|
|
||||||
win_libs = []
|
win_libs = []
|
||||||
local_libs = ['Py4YAP']
|
local_libs = ['Py4YAP']
|
||||||
|
|
||||||
# or dll in glob('yap/dlls/*'):
|
# or dll in glob('yap/dlls/*'):
|
||||||
# move( dll ,'lib' )
|
# move( dll ,'lib' )
|
||||||
|
|
||||||
|
@ -9,16 +9,17 @@ import sys
|
|||||||
# global yap_lib_path
|
# global yap_lib_path
|
||||||
#yap_lib_path = os.path.dirname(__file__)
|
#yap_lib_path = os.path.dirname(__file__)
|
||||||
|
|
||||||
if platform.system() == 'Windows':
|
# if platform.system() == 'Windows':
|
||||||
def load( dll ):
|
# def load( dll ):
|
||||||
dll = glob.glob(os.path.join(yap_lib_path,dll))[0]
|
# dll = glob.glob(os.path.join(yap_lib_path,dll))[0]
|
||||||
dll = os.path.abspath(dll)
|
# dll = os.path.abspath(dll)
|
||||||
ctypes.WinDLL(dll)
|
# ctypes.WinDLL(dll)
|
||||||
load('libYap*')
|
# else:
|
||||||
# else:
|
# def load( l0 ):
|
||||||
# def load( dll ):
|
# for i in ["@libdir@",""]:
|
||||||
# dll = glob.glob(os.path.join(yap_lib_path,dll))[0]
|
# dll = os.path.concat(i,l0)
|
||||||
# dll = os.path.abspath(dll)
|
# dll = glob.glob(os.path.join(yap_lib_path,dll))[0]
|
||||||
# ctypes.CDLL(dll, mode=ctypes.RTLD_GLOBAL)
|
# dll = os.path.abspath(dll)
|
||||||
# load('libYap*')
|
# ctypes.CDLL(dll)
|
||||||
# load('libPy4YAP*')
|
# # load('libYap*')
|
||||||
|
# # load('libPy4YAP*')
|
||||||
|
@ -10,6 +10,7 @@ from .yap import *
|
|||||||
|
|
||||||
|
|
||||||
class Engine( YAPEngine ):
|
class Engine( YAPEngine ):
|
||||||
|
|
||||||
def __init__(self, args=None,**kwargs):
|
def __init__(self, args=None,**kwargs):
|
||||||
# type: (object) -> object
|
# type: (object) -> object
|
||||||
self.contained = False
|
self.contained = False
|
||||||
@ -17,14 +18,13 @@ class Engine( YAPEngine ):
|
|||||||
args = EngineArgs(**kwargs)
|
args = EngineArgs(**kwargs)
|
||||||
if self.contained:
|
if self.contained:
|
||||||
yap_lib_path = os.path.dirname(__file__)
|
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.setYapLibDir(yap_lib_path)
|
||||||
args.setSavedState(os.path.join(yap_lib_path,"startup.yss"))
|
args.setSavedState(os.path.join(yap_lib_path, "startup.yss"))
|
||||||
YAPEngine.__init__(self,args)
|
YAPEngine.__init__(self, args)
|
||||||
self.goal( set_prolog_flag('verbose', 'silent' ) )
|
self.goal(set_prolog_flag('verbose', 'silent'))
|
||||||
self.goal( use_module(library('yapi') ) )
|
self.goal(use_module(library('yapi')))
|
||||||
self.goal( set_prolog_flag('verbose', 'normal' ) )
|
self.goal(set_prolog_flag('verbose', 'normal'))
|
||||||
|
|
||||||
|
|
||||||
def run(self, g, m=None):
|
def run(self, g, m=None):
|
||||||
if m:
|
if m:
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
macro_optional_find_package (R ON)
|
macro_optional_find_package (R ON)
|
||||||
|
|
||||||
if (R_HOME)
|
if (R_LIBRARIES AND R_INCLUDE_DIR)
|
||||||
|
|
||||||
set (REAL_SOURCES
|
set (REAL_SOURCES
|
||||||
real.c
|
real.c
|
||||||
|
Reference in New Issue
Block a user