win python support
This commit is contained in:
parent
e68630cd8a
commit
3a06d4fecb
@ -34,15 +34,8 @@ add_to_group( pl_library PYTHON_PL )
|
||||
|
||||
#set_target_properties (YAPPython PROPERTIES PREFIX "")
|
||||
|
||||
IF(WIN32)
|
||||
install(TARGETS YAPPython
|
||||
LIBRARY DESTINATION ${libdir}
|
||||
RUNTIME DESTINATION ${bindir}
|
||||
ARCHIVE DESTINATION ${libdir} )
|
||||
else()
|
||||
install(TARGETS YAPPython
|
||||
LIBRARY DESTINATION ${dlls}
|
||||
RUNTIME DESTINATION ${dlls}
|
||||
ARCHIVE DESTINATION ${dlls} )
|
||||
endif()
|
||||
|
||||
|
@ -188,6 +188,7 @@ extern install_t install_pypreds(void);
|
||||
extern install_t install_pl2pl(void);
|
||||
|
||||
X_API extern bool init_python(void);
|
||||
X_API extern bool loadt_python(void);
|
||||
X_API extern bool do_init_python(void);
|
||||
|
||||
extern PyObject PyInit_yap(void);
|
||||
|
@ -1,10 +1,16 @@
|
||||
|
||||
#include "py4yap.h"
|
||||
|
||||
X_API bool init_python(void) {
|
||||
return true;
|
||||
}
|
||||
|
||||
X_API bool init_python_dll(void);
|
||||
|
||||
|
||||
X_API bool init_python_dll(void)
|
||||
{
|
||||
do_init_python();
|
||||
|
||||
return 1;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h>
|
||||
|
@ -151,4 +151,4 @@ add_cwd_to_python :-
|
||||
python_command("sys.argv = [\"yap\"]").
|
||||
% done
|
||||
|
||||
:- initialization( load_foreign_files([libYAPPython], [], init_python), now ).
|
||||
:- initialization( load_foreign_files([libYAPPython], [], init_python_dll), now ).
|
||||
|
@ -25,12 +25,10 @@ SET_SOURCE_FILES_PROPERTIES(../../swig/yap.i PROPERTIES SWIG_MODULE_NAME yap)
|
||||
if (WIN32)
|
||||
|
||||
set (SYS_DLLS ${GMP_LIBRARIES})
|
||||
find_library( stdc+++ tmp $ENV{PATH})
|
||||
list (APPEND SYS_DLLS ${tmp})
|
||||
find_library( winpthread tmp $ENV{PATH})
|
||||
list (APPEND SYS_DLLS ${tmp})
|
||||
find_library( gcc_s_seh tmp $ENV{PATH})
|
||||
list (APPEND SYS_DLLS ${tmp})
|
||||
|
||||
message(STATUS "SYS_ = ${tmp}")
|
||||
|
||||
set (SYS_DLLS c:/msys64/mingw64/bin/libgmp-10.dll)
|
||||
|
||||
endif()
|
||||
|
||||
@ -42,7 +40,7 @@ endif()
|
||||
# RUNTIME DESTINATION ${PYTHON_MODULE_PATH}
|
||||
# ARCHIVE DESTINATION ${PYTHON_MODULE_PATH}
|
||||
# LIBRARY DESTINATION ${PYTHON_MODULE_PATH}
|
||||
# )x
|
||||
# )
|
||||
|
||||
|
||||
set (python_dlls $<TARGET_FILE:matrix>
|
||||
@ -52,11 +50,13 @@ endif()
|
||||
$<TARGET_FILE:itries>
|
||||
$<TARGET_FILE:sys>
|
||||
$<TARGET_FILE:yap_random>
|
||||
)
|
||||
$<TARGET_FILE:YAPPython>
|
||||
)
|
||||
if (TARGET real)
|
||||
list( python_dlls $<TARGET_FILE:real>
|
||||
)
|
||||
endif()
|
||||
list(APPEND python_dlls $<TARGET_FILE:real>
|
||||
)
|
||||
message(STATUS "${python_dlls}")
|
||||
endif()
|
||||
|
||||
set (PL ${pl_library} ${PROLOG_SOURCES} )
|
||||
|
||||
@ -70,23 +70,23 @@ add_custom_target( YAP4PY_SETUP
|
||||
DEPENDS YAP4PY_SETUP_DIRS STARTUP ${python_dlls} ${PYTHON_SOURCES} ${PROLOG_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/setup.py ${SWIG_MODULE_Py2YAP_REAL_NAME} )
|
||||
|
||||
add_custom_target( YAP4PY_SETUP_DIRS
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/yap.py
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/pl
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/os
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/pl
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/os
|
||||
)
|
||||
|
||||
add_custom_target( YAP4PY ALL
|
||||
COMMAND ${PYTHON_EXECUTABLE} setup.py sdist bdist_wheel
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMAND ${PYTHON_EXECUTABLE} setup.py sdist bdist_wheel
|
||||
COMMAND ${PYTHON_EXECUTABLE} setup.py sdist bdist_wheel
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
DEPENDS YAP4PY_SETUP)
|
||||
|
||||
|
||||
|
||||
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install --force --no-index -f dist yap4py
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"
|
||||
DEPENDS Py4YAP ${CMAKE_BINARY_DIR}/${YAP_STARTUP} ${dlls} )
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})"
|
||||
DEPENDS Py4YAP ${CMAKE_BINARY_DIR}/${YAP_STARTUP} ${dlls} )
|
||||
|
||||
install(FILES ${PROLOG_SOURCES} DESTINATION ${libpl})
|
||||
|
||||
|
@ -20,7 +20,5 @@ else:
|
||||
dll = os.path.abspath(dll)
|
||||
ctypes.CDLL(dll, mode=ctypes.RTLD_GLOBAL)
|
||||
|
||||
load('libgcc*')
|
||||
load('libstdc*')
|
||||
load('libsinpt*')
|
||||
load('libgmp*')
|
||||
|
||||
load('libYap*')
|
||||
|
@ -57,7 +57,7 @@ if platform.system() == 'Darwin':
|
||||
# or dll in glob('yap/dlls/*'):
|
||||
# move( dll ,'lib' )
|
||||
elif platform.system() == 'Windows':
|
||||
my_extra_link_args = ['-Wl,-export-all-symbols','-Wl,-enable-auto-import','-Wl,-enable-runtime-pseudo-relocs']
|
||||
my_extra_link_args = ['-Wl,-export-all-symbols']
|
||||
|
||||
cplus = ['']
|
||||
bpy2yap = \
|
||||
@ -70,8 +70,7 @@ extensions = [Extension('_yap', native_sources,
|
||||
define_macros=[('MAJOR_VERSION', '1'),
|
||||
('MINOR_VERSION', '0'),
|
||||
('_YAP_NOT_INSTALLED_', '1'),
|
||||
('_GNU_SOURCE', '1'),
|
||||
('YAP_PYTHON', '1')],
|
||||
('_GNU_SOURCE', '1')],
|
||||
runtime_library_dirs=['yap4py', '${libdir}', '${bindir}'],
|
||||
swig_opts=['-modern', '-c++', '-py3',
|
||||
'-DX_API', '-I${CMAKE_SOURCE_DIR}/CXX', '-I${CMAKE_SOURCE_DIR}/include',
|
||||
@ -79,7 +78,7 @@ extensions = [Extension('_yap', native_sources,
|
||||
'-I${CMAKE_SOURCE_DIR}/os', '-I${CMAKE_SOURCE_DIR}/OPTYap', '-I../../..'],
|
||||
library_dirs=['../../..', '../../../CXX', '../../packages/python', "${dlls}", "${bindir}", '.'],
|
||||
extra_link_args=my_extra_link_args,
|
||||
libraries=['Yap', '${GMP_LIBRARIES}'],
|
||||
libraries=['Yap','${PYTHON_LIBRARIES}','${GMP_LIBRARIES}','wsock32','ws2_32'],
|
||||
include_dirs=['../../..',
|
||||
'${GMP_INCLUDE_DIRS}',
|
||||
'${CMAKE_SOURCE_DIR}/H',
|
||||
|
@ -1,5 +1,6 @@
|
||||
|
||||
|
||||
|
||||
%{
|
||||
|
||||
#include <cmath>
|
||||
|
Reference in New Issue
Block a user