windows trouble

This commit is contained in:
vsc 2017-06-08 22:16:52 +01:00
parent f1ddb5822e
commit ebd6f0a0c2
9 changed files with 29 additions and 12 deletions

View File

@ -60,7 +60,6 @@ option(BUILD_SHARED_LIBS "Build shared library" ON)
set (CMAKE_POSITION_INDEPENDENT_CODE TRUE) set (CMAKE_POSITION_INDEPENDENT_CODE TRUE)
set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
include(Prelims NO_POLICY_SCOPE) include(Prelims NO_POLICY_SCOPE)
include(Sources NO_POLICY_SCOPE) include(Sources NO_POLICY_SCOPE)

View File

@ -188,7 +188,7 @@ bool Yap_set_stream_to_buf(StreamDesc *st, const char *buf, size_t nchars) {
flags = Input_Stream_f | InMemory_Stream_f; flags = Input_Stream_f | InMemory_Stream_f;
st->vfs = NULL; st->vfs = NULL;
Yap_initStream(st - GLOBAL_Stream, f, NULL, TermNil, LOCAL_encoding, flags, Yap_initStream(st - GLOBAL_Stream, f, NULL, TermNil, LOCAL_encoding, flags,
AtomRead); AtomRead, NULL);
// like any file stream. // like any file stream.
/* currently these streams are not seekable */ /* currently these streams are not seekable */
st->status = Input_Stream_f | InMemory_Stream_f; st->status = Input_Stream_f | InMemory_Stream_f;
@ -222,7 +222,7 @@ int Yap_open_buf_read_stream(const char *buf, size_t nchars, encoding_t *encp,
st->file = f = NULL; st->file = f = NULL;
flags = Input_Stream_f | InMemory_Stream_f; flags = Input_Stream_f | InMemory_Stream_f;
st->vfs = NULL; st->vfs = NULL;
Yap_initStream(sno, f, NULL, TermNil, encoding, flags, AtomRead); Yap_initStream(sno, f, NULL, TermNil, encoding, flags, AtomRead, NULL);
// like any file stream. // like any file stream.
/* currently these streams are not seekable */ /* currently these streams are not seekable */
st->status = Input_Stream_f | InMemory_Stream_f; st->status = Input_Stream_f | InMemory_Stream_f;

View File

@ -9,9 +9,13 @@ set (CMAKE_POSITION_INDEPENDENT_CODE TRUE)
add_library (YAPPython SHARED ${PYTHON_SOURCES}) add_library (YAPPython SHARED ${PYTHON_SOURCES})
# arithmetic hassle.
set_property(TARGET YAPPython PROPERTY CXX_STANDARD 11)
set_property(TARGET YAPPython PROPERTY CXX_STANDARD_REQUIRED ON)
target_link_libraries(YAPPython libYap ${PYTHON_LIBRARY}) target_link_libraries(YAPPython libYap ${PYTHON_LIBRARY})
set_property( SOURCE ${PYTHON_SOURCES} APPEND PROPERTY COMPILE_DEFINITIONS YAP_KERNEL=1) set_property( SOURCE ${PYTHON_SOURCES} APPEND PROPERTY COMPILE_DEFINITIONS YAP_KERNEL=1 _GNU-SOURCE=1)
set (PYTHON_PL python.pl) set (PYTHON_PL python.pl)

View File

@ -25,8 +25,13 @@ VFS_t pystream;
static void * static void *
py_open( const char *name, const char *io_mode) { py_open( const char *name, const char *io_mode) {
#if HAVE_STRCASESTR
if (strcasestr(name,"//python/")== name) if (strcasestr(name,"//python/")== name)
name += strlen("//python/"); name += strlen("//python/");
#else
if (strstr(name,"//python/")== name)
name += strlen("//python/");
#endif
// we assume object is already open, so there is no need to open it. // we assume object is already open, so there is no need to open it.
PyObject *stream = string_to_python( name, true, NULL); PyObject *stream = string_to_python( name, true, NULL);
if (stream == Py_None) if (stream == Py_None)

View File

@ -13,6 +13,7 @@
#endif #endif
#include <Python.h> #include <Python.h>
#include <SWI-Prolog.h> #include <SWI-Prolog.h>
#ifdef HAVE_STAT #ifdef HAVE_STAT
#undef HAVE_STATa #undef HAVE_STATa

View File

@ -32,10 +32,14 @@ else()
set_target_properties ( ${SWIG_MODULE_Py2YAP_REAL_NAME} set_target_properties ( ${SWIG_MODULE_Py2YAP_REAL_NAME}
PROPERTIES PROPERTIES
NO_SONAME ON NO_SONAME ON
CXXFLAGS "-include cmath "
OUTPUT_NAME _yap OUTPUT_NAME _yap
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
DEPENDS YAPPython YAPPython YAP++ DEPENDS YAPPython YAPPython YAP++
) )
SET( CMAKE_CXX_FLAGS " -include cmath ${CMAKE_CXX_FLAGS} " )
# inform we are compiling YAP # inform we are compiling YAP
# s used in MSYS # s used in MSYS
# #
@ -44,7 +48,7 @@ else()
# RUNTIME DESTINATION ${PYTHON_MODULE_PATH} # RUNTIME DESTINATION ${PYTHON_MODULE_PATH}
# ARCHIVE DESTINATION ${PYTHON_MODULE_PATH} # ARCHIVE DESTINATION ${PYTHON_MODULE_PATH}
# LIBRARY DESTINATION ${PYTHON_MODULE_PATH} # LIBRARY DESTINATION ${PYTHON_MODULE_PATH}
# ) # )x
set (dlls $<TARGET_FILE:matrix> set (dlls $<TARGET_FILE:matrix>

View File

@ -78,12 +78,13 @@ extensions=[Extension('_yap', native_sources,
define_macros = [('MAJOR_VERSION', '1'), define_macros = [('MAJOR_VERSION', '1'),
('MINOR_VERSION', '0'), ('MINOR_VERSION', '0'),
('_YAP_NOT_INSTALLED_', '1'), ('_YAP_NOT_INSTALLED_', '1'),
('_GNU_SOURCE', '1'),
('YAP_PYTHON', '1')], ('YAP_PYTHON', '1')],
runtime_library_dirs=['yap4py','${libdir}','${bindir}'], runtime_library_dirs=['yap4py','${libdir}','${bindir}'],
swig_opts=['-modern', '-c++', '-py3','-I${RELATIVE_SOURCE}/CXX'], swig_opts=['-modern', '-c++', '-py3','-I${RELATIVE_SOURCE}/CXX'],
library_dirs=['../../..','../../../CXX','../../packages/python',"${dlls}","${bindir}", '.'], library_dirs=['../../..','../../../CXX','../../packages/python',"${dlls}","${bindir}", '.'],
extra_link_args=my_extra_link_args, extra_link_args=my_extra_link_args,
extra_compile_args=['-g3','-O0'], extra_compile_args=['-std=c++11','-g3','-O0'],
libraries=['Yap','${GMP_LIBRARIES}'], libraries=['Yap','${GMP_LIBRARIES}'],
include_dirs=['../../..', include_dirs=['../../..',
'${GMP_INCLUDE_DIRS}', '${GMP_INCLUDE_DIRS}',

View File

@ -3,6 +3,7 @@
#include "rconfig.h" #include "rconfig.h"
#if HAVE_R_H || !defined(_YAP_NOT_INSTALLED_) #if HAVE_R_H || !defined(_YAP_NOT_INSTALLED_)
#include <SWI-Prolog.h> #include <SWI-Prolog.h>
#undef ERROR
#if HAVE_R_EMBEDDED_H #if HAVE_R_EMBEDDED_H
#include <Rembedded.h> #include <Rembedded.h>
#endif #endif
@ -1873,7 +1874,9 @@ static foreign_t init_R(void) {
R_SignalHandlers = 0; R_SignalHandlers = 0;
#endif #endif
Rf_initEmbeddedR(argc, argv); Rf_initEmbeddedR(argc, argv);
#ifndef WIN32
R_CStackLimit = -1; R_CStackLimit = -1;
#endif
return TRUE; return TRUE;
} }

View File

@ -1,13 +1,13 @@
#ifdef SWIGPYTHON
%{
#include <Python.h>
%}
#endif
%{ %{
#include <cmath>
#include <gmpxx.h> #include <gmpxx.h>
extern "C"{ extern "C"{
#include "Yap.h" #ifdef SWIGPYTHON
#include <Python.h>
#endif
#include "Yap.h"
} }
%} %}