Merge branch 'master' of https://github.com/vscosta/yap-6.3
This commit is contained in:
commit
cbafd93b03
@ -123,13 +123,7 @@ void *Yap_LoadForeignFile(char *file, int flags) {
|
||||
else
|
||||
dlflag |= RTLD_LOCAL;
|
||||
#endif
|
||||
if (!Yap_findFile(file, NULL, NULL, LOCAL_FileNameBuf, true, YAP_OBJ, true, true)) {
|
||||
/* use LD_LIBRARY_PATH */
|
||||
strncpy(LOCAL_FileNameBuf, file, YAP_FILENAME_MAX - 1);
|
||||
strncat(LOCAL_FileNameBuf, ".", YAP_FILENAME_MAX - 1);
|
||||
strncat(LOCAL_FileNameBuf, "SO_EXT", YAP_FILENAME_MAX - 1);
|
||||
}
|
||||
out = (void *)dlopen(LOCAL_FileNameBuf, flags);
|
||||
out = (void *)dlopen(file, dlflag);
|
||||
if (out == NULL) {
|
||||
const char *m_os = dlerror();
|
||||
if (m_os) {
|
||||
|
@ -209,12 +209,6 @@ X_API int PL_get_nchars(term_t l, size_t *lengthp, char **s, unsigned flags) {
|
||||
} else {
|
||||
out.enc = ENC_ISO_LATIN1;
|
||||
}
|
||||
if (flags & BUF_MALLOC) {
|
||||
out.type |= YAP_STRING_MALLOC;
|
||||
out.val.c = *s;
|
||||
} else {
|
||||
out.val.c = NULL;
|
||||
}
|
||||
if (lengthp) {
|
||||
out.type |= YAP_STRING_NCHARS;
|
||||
out.max = *lengthp;
|
||||
|
@ -73,7 +73,7 @@ PyObject *term_to_python(term_t t, bool eval) {
|
||||
return o;
|
||||
} break;
|
||||
case PL_STRING: {
|
||||
char *s;
|
||||
char *s = NULL;
|
||||
if (!PL_get_chars(t, &s,
|
||||
REP_UTF8 | CVT_ATOM | CVT_STRING | BUF_DISCARDABLE)) {
|
||||
return NULL;
|
||||
|
@ -633,6 +633,7 @@ static int python_import(term_t mname, term_t mod) {
|
||||
return false;
|
||||
s = stpcpy(s, sa);
|
||||
*s++ = '.';
|
||||
s[0] = '\0';
|
||||
} else if (!PL_get_nchars(mname, &len, &s,
|
||||
CVT_ALL | CVT_EXCEPTION | REP_UTF8)) {
|
||||
return false;
|
||||
|
@ -429,4 +429,6 @@ python_assign_field(C1.E, Obj) :-
|
||||
python_eval_term(C1, O1),
|
||||
python_assign_field(O1, E, Obj ).
|
||||
|
||||
:- initialization( use_foreign_library(foreign(libpYAPPython), init_python), now ).
|
||||
%:- initialization( load_foreign_files([libYAPPython], [], init_python), now ).
|
||||
|
||||
:- initialization( load_foreign_library(foreign(libYAPPython), init_python), now ).
|
||||
|
@ -24,10 +24,10 @@ if (PYTHONLIBS_FOUND)
|
||||
#SET( CMAKE_SWIG_OUTDIR "yap" )
|
||||
|
||||
|
||||
SWIG_ADD_MODULE(Py2YAP python ../yap.i )
|
||||
SWIG_LINK_LIBRARIES(Py2YAP ${PYTHON_LIBRARIES} Yap++ libYap YAPPython)
|
||||
set_target_properties ( ${SWIG_MODULE_Py2YAP_REAL_NAME} PROPERTIES
|
||||
NO_SONAME ON )
|
||||
# SWIG_ADD_MODULE(Py2YAP python ../yap.i )
|
||||
# SWIG_LINK_LIBRARIES(Py2YAP ${PYTHON_LIBRARIES} Yap++ libYap YAPPython)
|
||||
# set_target_properties ( ${SWIG_MODULE_Py2YAP_REAL_NAME} PROPERTIES
|
||||
# NO_SONAME ON )
|
||||
|
||||
|
||||
# execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print( sysconfig.get_python_lib( plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}' ) )"
|
||||
@ -36,15 +36,15 @@ if (PYTHONLIBS_FOUND)
|
||||
# get_filename_component ( _ABS_PYTHON_MODULE_PATH ${_ABS_PYTHON_MODULE_PATH} ABSOLUTE )
|
||||
# file ( RELATIVE_PATH _REL_PYTHON_MOULE_PATH ${CMAKE_INSTALL_PREFIX} ${_ABS_PYTHON_MODULE_PATH} )
|
||||
|
||||
set ( PYTHON_MODULE_PATH
|
||||
${_REL_PYTHON_MODULE_PATH}
|
||||
)
|
||||
# set ( PYTHON_MODULE_PATH
|
||||
# ${_REL_PYTHON_MODULE_PATH}
|
||||
# )
|
||||
|
||||
set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
|
||||
|
||||
add_custom_target ( py2yap ALL
|
||||
COMMAND ${PYTHON_EXECUTABLE} setup.py bdist
|
||||
DEPENDS yap.py ${SWIG_MODULE_Py2YAP_REAL_NAME} )
|
||||
DEPENDS ../yap.i YAPPython )
|
||||
|
||||
|
||||
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install
|
||||
|
@ -1,25 +1,34 @@
|
||||
from distutils.core import setup, Extension
|
||||
import sys
|
||||
import os
|
||||
import platform
|
||||
|
||||
if platform.system() == 'Darwin':
|
||||
my_extra_link_args = ['-Wl,-rpath','${dlls}']
|
||||
else:
|
||||
my_extra_link_args = []
|
||||
|
||||
setup(
|
||||
name = "yap",
|
||||
version = "0.1",
|
||||
ext_modules=[Extension('_yap', ['${CMAKE_SOURCE_DIR}/packages/swig/python/_yap.c'],
|
||||
ext_modules=[Extension('_yap', ['${CMAKE_SOURCE_DIR}/packages/swig/yap.i'],
|
||||
define_macros = [('MAJOR_VERSION', '1'),
|
||||
('MINOR_VERSION', '0'),
|
||||
('_YAP_NOT_INSTALLED_', '1')],
|
||||
runtime_library_dirs=['${dlls}'],
|
||||
runtime_library_dirs=['${dlls}'],
|
||||
swig_opts=['-modern', '-c++', '-py3','-I${CMAKE_SOURCE_DIR}/CXX'],
|
||||
library_dirs=['../../..','../../../CXX',
|
||||
'../../python',
|
||||
'.'],
|
||||
libraries=['Yap++','Yap','YAPPython'],
|
||||
extra_link_args=my_extra_link_args,
|
||||
libraries=['Yap++','Yap','YAPPython'],
|
||||
include_dirs=['../../..',
|
||||
'${CMAKE_SOURCE_DIR}/H',
|
||||
'${CMAKE_SOURCE_DIR}/H/generated',
|
||||
'${CMAKE_SOURCE_DIR}/OPTYap',
|
||||
'${CMAKE_SOURCE_DIR}/os',
|
||||
'${CMAKE_SOURCE_DIR}/include',
|
||||
'${CMAKE_SOURCE_DIR}/CXX', '.'],
|
||||
extra_objects = ['${CMAKE_CURRENT_BINARY_DIR}/_Py2YAP${CMAKE_SHARED_MODULE_SUFFIX}' ]
|
||||
'${CMAKE_SOURCE_DIR}/CXX', '.']
|
||||
)],
|
||||
py_modules = ['yap']
|
||||
)
|
||||
|
Reference in New Issue
Block a user