This commit is contained in:
Vitor Santos Costa 2016-08-23 15:14:19 -05:00
commit 227c75a213
27 changed files with 225 additions and 176 deletions

View File

@ -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) {

View File

@ -338,6 +338,11 @@ unsigned char *Yap_readText(seq_tv_t *inp, size_t *lengp) {
return latin2utf8(inp, lengp);
}
}
if (IsStringTerm(inp->val.t) && inp->type & YAP_STRING_STRING) {
// this is a term, extract to a buffer, and representation is wide
//Yap_DebugPlWriteln(inp->val.t);
return UStringOfTerm(inp->val.t);
}
if (((inp->type & (YAP_STRING_CODES | YAP_STRING_ATOMS)) ==
(YAP_STRING_CODES | YAP_STRING_ATOMS)) && IsPairTerm(inp->val.t)) {
//Yap_DebugPlWriteln(inp->val.t);

View File

@ -10,19 +10,10 @@
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (NOT DEFINED CUDD_ROOT)
set(CUDD_ROOT $ENV{CUDD_ROOT})
endif()
SET( CUDD_FOUND "NO" )
# Check if we have cached results in case the last round was successful.
find_package(PkgConfig)
find_path(CUDD_INCLUDE_DIR
NAMES cudd.h cudd/cudd.h
$ENV{CUDD_ROOT}/include
$ENV{CUDD_ROOT}
set (CUDD_INCLUDE_SEARCH_PATH
${CMAKE_INSTALL_PREFIX}/include
/usr/local/yap/include
/usr/local/Yap/include
/usr/local/cudd/include
@ -36,41 +27,50 @@ endif()
/opt/csw/include # Blastwave
/opt/include
/usr/freeware/include
NO_DEFAULT_PATHS
)
mark_as_advanced(CUDD_INCLUDE_DIR)
if (${CUDD_ROOT})
set (CUDD_LIB_SEARCH_PATH
$ENV{CUDD_ROOT}/lib
$ENV{CUDD_ROOT}/lib64
$ENV{CUDD_ROOT}/lib-dbg
$ENV{CUDD_ROOT}
${CUDD_ROOT}/cudd
/usr/lib
${CUDD_ROOT}/lib
${CUDD_ROOT}/lib64
${CUDD_ROOT}/lib-dbg
${CUDD_ROOT}
${CUDD_ROOT}/cudd
)
endif()
mark_as_advanced(CUDD_LIB_SEARCH_PATH on)
set (CUDD_LIB_SEARCH_PATH
${CUDD_LIB_SEARCH_PATH}
/usr/lib64
${CMAKE_INSTALL_PREFIX}/lib
/usr/lib
/usr/local/lib/cudd
/usr/local/cudd/lib
/usr/lib/cudd
/usr/lib/cudd/lib
/usr/lib64/cudds
/usr/freeware/lib64 )
/usr/freeware/lib )
if ($ENV{CUDD_ROOT})
list (APPEND CUDD_LIB_SEARCH_PATH
$ENV{CUDD_ROOT}/lib
$ENV{CUDD_ROOT}/lib-dbg
$ENV{CUDD_ROOT} )
list (APPEND CUDD_INCLUDE_SEARCH_PATH
$ENV{CUDD_ROOT}/include )
endif()
if (${CUDD_ROOT})
list (APPEND CUDD_LIB_SEARCH_PATH
${CUDD_ROOT}/lib
${CUDD_ROOT}/lib-dbg
${CUDD_ROOT} )
list (APPEND CUDD_INCLUDE_SEARCH_PATH
${CUDD_ROOT}/include )
endif()
# Check if we have cached results in case the last round was successful.
find_package(PkgConfig)
find_path(CUDD_INCLUDE_DIR
NAMES cudd.h cudd/cudd.h
${CUDD_INCLUDE_SEARCH_PATH}
)
mark_as_advanced(CUDD_INCLUDE_DIR)
if (CUDD_INCLUDE_DIR)
find_library(CUDD_LIBRARIES
NAMES cudd
@ -78,7 +78,9 @@ set (CUDD_LIB_SEARCH_PATH
${CUDD_LIB_SEARCH_PATH}
)
IF (NOT EXISTS ${CUDD_INCLUDE_DIR}/epdInt.h )
if (CUDD_LIBRARIES)
SET( CUDD_FOUND "YES" )
find_library(CUDD_DDDMP_LIBRARY
NAMES dddmp
@ -86,50 +88,63 @@ find_library(CUDD_DDDMP_LIBRARY
${CUDD_LIB_SEARCH_PATH}
)
if (CUDD_DDMP_LIBRARY)
list( APPEND CUDD_LIBRARIES ${CUDD_DDMP_LIBRARY} )
endif()
find_library(CUDD_EPD_LIBRARY
NAMES epd
PATHS
${CUDD_LIB_SEARCH_PATH}
)
if (CUDD_EPD_LIBRARY)
list( APPEND CUDD_LIBRARIES ${CUDD_EPD_LIBRARY} )
endif()
find_library(CUDD_ST_LIBRARY
NAMES cuddst st
NAMES cuddst
PATHS
${CUDD_LIB_SEARCH_PATH}
)
if (CUDD_ST_LIBRARY)
list( APPEND CUDD_LIBRARIES ${CUDD_ST_LIBRARY} )
endif()
find_library(CUDD_UTIL_LIBRARY
NAMES cuddutil util
NAMES cuddutil
PATHS
${CUDD_LIB_SEARCH_PATH}
NO_DEFAULT_PATHS
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH
)
if (CUDD_UTIL_LIBRARY)
list( APPEND CUDD_LIBRARIES ${CUDD_ST_LIBRARY} )
endif()
find_library(CUDD_MTR_LIBRARY
NAMES mtr
PATHS
${CUDD_LIB_SEARCH_PATH}
)
if (CUDD_MTR_LIBRARY)
list( APPEND CUDD_LIBRARIES ${CUDD_MTR_LIBRARY} )
endif()
set(CUDD_LIBRARIES
${CUDD_LIBRARIES} ${CUDD_ST_LIBRARY} ${CUDD_UTIL_LIBRARY}
${CUDD_MTR_LIBRARY} ${CUDD_EPD_LIBRARY} ${CUDD_DDDMP_LIBRARY} )
endif()
endif () # Check for cudd 2.
endif()
mark_as_advanced(CUDD_LIBRARIES)
SET( CUDD_FOUND "NO" )
IF(CUDD_INCLUDE_DIR AND CUDD_LIBRARIES)
SET( CUDD_FOUND "YES" )
ENDIF()
mark_as_advanced (CUDD_FOUND)
find_package_handle_standard_args(R DEFAULT_MSG CUDD_LIBRARIES CUDD_INCLUDE_DIR )
find_package_handle_standard_args(CUDD DEFAULT_MSG CUDD_LIBRARIES CUDD_INCLUDE_DIR )

View File

@ -2,11 +2,11 @@
#Works under the assumption than when gecode is installed at least the kernel component exists
# Look for the header file
find_path(GECODE_INCLUDE_DIR NAMES gecode/kernel.hh )
find_file(GECODE_CONFIG gecode/support/config.hpp)
find_path(GECODE_INCLUDE_DIR NAMES gecode/kernel.hh PATHS ${CMAKE_INSTALL_PREFIX}/include)
find_file(GECODE_CONFIG gecode/support/config.hpp PATHS ${CMAKE_INSTALL_PREFIX}/include)
# Look for the library
find_library(GECODE_LIBRARY NAMES gecodekernel)
find_library(GECODE_SUPPORT_LIBRARY NAMES gecodesupport)
find_library(GECODE_LIBRARY NAMES gecodekernel PATHS ${CMAKE_INSTALL_PREFIX}/lib)
find_library(GECODE_SUPPORT_LIBRARY NAMES gecodesupportl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
if(GECODE_CONFIG)
file(STRINGS ${GECODE_CONFIG} GECODE_LINE_VERSION REGEX "^#define GECODE_VERSION .*")
@ -20,39 +20,39 @@ endif()
if(GECODE_FOUND)
set(GECODE_LIBRARIES ${GECODE_LIBRARY} ${GECODE_SUPPORT_LIBRARY})
set(GECODE_INCLUDE_DIRS ${GECODE_INCLUDE_DIR})
find_library(GECODE_DRIVER_LIBRARY gecodedriver)
find_library(GECODE_DRIVER_LIBRARY gecodedriverl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
if(GECODE_FZ_LIBRARY)
list(APPEND GECODE_LIBRARIES ${GECODE_FZ_LIBRARY})
endif()
find_library(GECODE_GIST_LIBRARY gecodegist)
find_library(GECODE_GIST_LIBRARY gecodegistl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
if(GECODE_GIST_LIBRARY)
list(APPEND GECODE_LIBRARIES ${GECODE_GIST_LIBRARY})
endif()
find_library(GECODE_GRAPH_LIBRARY gecodegraph)
find_library(GECODE_GRAPH_LIBRARY gecodegraphl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
if(GECODE_GRAPH_LIBRARY)
list(APPEND GECODE_LIBRARIES ${GECODE_GRAPH_LIBRARY})
endif()
find_library(GECODE_INT_LIBRARY gecodeint)
find_library(GECODE_INT_LIBRARY gecodeintl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
if(GECODE_INT_LIBRARY)
list(APPEND GECODE_LIBRARIES ${GECODE_INT_LIBRARY})
endif()
find_library(GECODE_FLOAT_LIBRARY gecodefloat)
find_library(GECODE_FLOAT_LIBRARY gecodefloatl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
if(GECODE_FLOAT_LIBRARY)
list(APPEND GECODE_LIBRARIES ${GECODE_FLOAT_LIBRARY})
endif()
find_library(GECODE_MM_LIBRARY gecodeminimodel)
find_library(GECODE_MM_LIBRARY gecodeminimodell PATHS ${CMAKE_INSTALL_PREFIX}/lib)
if(GECODE_MM_LIBRARY)
list(APPEND GECODE_LIBRARIES ${GECODE_MM_LIBRARY})
endif()
find_library(GECODE_SCHEDULING_LIBRARY gecodescheduling)
find_library(GECODE_SCHEDULING_LIBRARY gecodeschedulingl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
if(GECODE_SCHEDULING_LIBRARY)
list(APPEND GECODE_LIBRARIES ${GECODE_SCHEDULING_LIBRARY})
endif()
find_library(GECODE_SEARCH_LIBRARY gecodesearch)
find_library(GECODE_SEARCH_LIBRARY gecodesearchl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
if(GECODE_SEARCH_LIBRARY)
list(APPEND GECODE_LIBRARIES ${GECODE_SEARCH_LIBRARY})
endif()
find_library(GECODE_SET_LIBRARY gecodeset)
find_library(GECODE_SET_LIBRARY gecodesetl PATHS ${CMAKE_INSTALL_PREFIX}/lib)
if(GECODE_SET_LIBRARY)
list(APPEND GECODE_LIBRARIES ${GECODE_SET_LIBRARY})
endif()

View File

@ -1,6 +1,7 @@
option (WITH_CUDD "BDD CUDD package" ON)
if (WITH_CUDD)
#detect cudd setup, as it is shared between different installations.
@ -9,13 +10,18 @@ find_package(CUDD)
# CUDD_LIBRARIES - Link these to use CUDD
# CUDD_INCLUDE_DIR - Include directory for using CUDD
#
macro_log_feature (CUDD_FOUND "CUDD"
"Use CUDD BDD library"
"http://vlsi.colorado.edu/~fabio/CUDD/" FALSE)
if (CUDD_FOUND)
set( CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${CUDD_INCLUDE_DIR} )
check_include_files( cudd.h HAVE_CUDD_H )
check_include_files( "stdio.h;cudd.h" HAVE_CUDD_H )
check_include_files( "stdio.h;cudd/cudd.h" HAVE_CUDD_CUDD_H )
check_include_files( cuddInt.h HAVE_CUDDINT_H )
check_include_files( "stdio.h;cudd/cudd.h;cudd/cuddInt.h" HAVE_CUDD_CUDDINT_H )
check_include_files( "cuddInt.h" HAVE_CUDDINT_H )
check_include_files( "cudd/cuddInt.h" HAVE_CUDD_CUDDINT_H )
endif (CUDD_FOUND)
endif(WITH_CUDD)

View File

@ -16,6 +16,8 @@ foreach (i 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
break()
endif()
endforeach()
else()
set (Python_ADDITIONAL_VERSIONS 3.6 3.5 3.4 3.3 3.2 3.1 3.0 2.8 2.6 2.5)
endif()
find_package(PythonInterp)

View File

@ -1 +0,0 @@
Debug/compile_commands.json

0
hh
View File

View File

@ -209,8 +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;
if (lengthp) {
out.type |= YAP_STRING_NCHARS;
out.max = *lengthp;
@ -232,8 +230,12 @@ int PL_get_wchars(term_t l, size_t *lengthp, wchar_t **s, unsigned flags) {
inp.val.t = Yap_GetFromSlot(l);
inp.type = cvtFlags(flags);
out.type = YAP_STRING_WCHARS;
if (flags & BUF_MALLOC)
if (flags & BUF_MALLOC) {
out.type |= YAP_STRING_MALLOC;
out.val.w = *s;
} else {
out.val.w = NULL;
}
if (lengthp) {
out.type |= YAP_STRING_NCHARS;
out.max = *lengthp;

View File

@ -45,6 +45,7 @@
mktemp/2,
make_directory/1,
popen/3,
read_link/3,
rename_file/2,
shell/0,
shell/1,
@ -318,6 +319,14 @@ Create file _OldFile_ to _NewFile_. This predicate uses the
`C` built-in function `rename`.
*/
/** @pred read_link(+ SymbolicLink, -Link, -NewPath)
Follow a _SymbolicLink_, and obtain the actual _Link_ and the target _newPath_). This predicate uses the
`C` built-in function `readlink` and is not yet operational in WIN32.
*/
/** @pred shell
@ -797,3 +806,8 @@ tmpdir(TmpDir):-
path_separator('\\'):-
win, !.
path_separator('/').
read_link(P,D,F) :-
read_link(P, D),
absolute_file_name(D, [], F).

View File

@ -312,6 +312,27 @@ static YAP_Bool rename_file(void) {
return (TRUE);
}
static YAP_Bool read_link(void) {
char *s1 = (char *)YAP_AtomName(YAP_AtomOfTerm(YAP_ARG1));
#if HAVE_READLINK
char buf[PATH_MAX + 1];
if (readlink(s1, buf, PATH_MAX) < 0)
return false;
/* return an error number */
if (!YAP_Unify(YAP_ARG2, YAP_MkAtomTerm(YAP_LookupAtom(buf)))) {
return false;
}
#endif
# if _WIN32
return false;
#endif
return true;
}
static YAP_Bool dir_separator(void) {
return (YAP_Unify(YAP_ARG1, YAP_MkAtomTerm(YAP_LookupAtom("/"))));
}
@ -1038,6 +1059,7 @@ void init_sys(void) {
YAP_UserCPredicate("tmpdir", p_tmpdir, 2);
YAP_UserCPredicate("rename_file", rename_file, 3);
YAP_UserCPredicate("sleep", p_sleep, 2);
YAP_UserCPredicate("read_link", read_link, 2);
YAP_UserCPredicate("error_message", error_message, 2);
YAP_UserCPredicate("win", win, 0);
YAP_UserCPredicate("md5", md5, 3);

View File

@ -1,5 +1,15 @@
// cmake template file
/* Define to 1 if you have the <cuddInt.h> header file. */
#ifndef HAVE_CUDD_H
#cmakedefine HAVE_CUDD_H ${HAVE_CUDD_H}
#endif
/* Define to 1 if you have the <cudd/cuddInt.h> header file. */
#ifndef HAVE_CUDD_CUDD_H
#cmakedefine HAVE_CUDD_CUDD_H ${HAVE_CUDD_CUDD_H}
#endif
/* Define to 1 if you have the <cuddInt.h> header file. */
#ifndef HAVE_CUDDINT_H
#cmakedefine HAVE_CUDDINT_H ${HAVE_CUDDINT_H}

View File

@ -12,7 +12,7 @@ for the relative license.
#include "cudd_config.h"
#if HAVE_CUDD_CUDDINT_H
#include "cudd/cuddInt.h"
#else
#elif HAVE_CUDDINT_H
#include "cuddInt.h"
#endif
#include "YapInterface.h"

View File

@ -15,10 +15,10 @@ for the relative license.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if HAVE_CUDD_CUDDINT_H
#include <cudd/cuddInt.h>
#elif HAVE_CUDDINT_H
#include "cuddInt.h"
#if HAVE_CUDD_CUDD_H
#include <cudd/cudd.h>
#elif HAVE_CUDD_H
#include "cudd.h"
#endif
#include "YapInterface.h"
#define LOGZERO log(0.000001)

View File

@ -8,14 +8,12 @@ include(FindPythonModule)
set (PYTHON_SOURCES
python.c pl2py.c pybips.c py2pl.c pl2pl.c pypreds.c )
add_library (libpython SHARED ${PYTHON_SOURCES})
add_library (YAPPython SHARED ${PYTHON_SOURCES})
set (PYTHON_HEADERS
python.h)
configure_file ("setup.py.cmake" "setup.py" )
target_link_libraries(libpython libYap ${PYTHON_LIBRARIES})
target_link_libraries(YAPPython libYap ${PYTHON_LIBRARIES})
set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
@ -23,11 +21,11 @@ add_custom_target ( YAPex ALL
COMMAND ${PYTHON_EXECUTABLE} setup.py build -f
DEPENDS yapex.py )
set_target_properties (libpython PROPERTIES PREFIX "")
# set_target_properties (YAPPython PROPERTIES PREFIX "")
include_directories (${PYTHON_INCLUDE_DIRS})
install(TARGETS libpython
install(TARGETS YAPPython
LIBRARY DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls}
)
@ -36,6 +34,8 @@ add_custom_target ( YAPex ALL
DESTINATION ${libpl}
)
configure_file ("setup.py.cmake" "setup.py" )
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install -f
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")

View File

@ -0,0 +1,12 @@
:- [library(python)].
main :-
Plt = matplotlib.pyplot,
:= import( Plt ),
:= (
Plt.plot([1,2,3,4]),
Plt.ylabel(`some numbers`),
Plt.show()
).

View File

@ -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;

View File

@ -633,8 +633,9 @@ 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 | ENC_ISO_UTF8)) {
CVT_ALL | CVT_EXCEPTION | REP_UTF8)) {
return false;
} else {
break;

View File

@ -110,7 +110,10 @@ Data types are
:- use_module(library(charsio)).
:- dynamic python_mref_cache/2, python_obj_cache/2.
:= import( F ) :- python_import(F).
:= (P1,P2) :- !,
:= P1,
:= P2.
:= import( F ) :- !, python_import(F).
:= F :- python(F,_).
V := F :- var(V), !, python(F,V0),
@ -426,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(libpython), init_python), now ).
%:- initialization( load_foreign_files([libYAPPython], [], init_python), now ).
:- initialization( load_foreign_library(foreign(libYAPPython), init_python), now ).

View File

@ -1,58 +0,0 @@
from distutils.command.install import install
from distutils.core import setup
from distutils import log
import json
import sys
import os
PY3 = sys.version_info[0] >= 3
kernel_json = {
"argv": [sys.executable,
"-m", "yap_kernel",
"-f", "{connection_file}"],
"display_name": " YAP-6.3" ,
"language": "prolog",
"name": "yap_kernel",
}
class install_with_kernelspec(install):
def run(self):
install.run(self)
from jupyter_client.kernelspec import install_kernel_spec
from IPython.utils.tempdir import TemporaryDirectory
with TemporaryDirectory() as td:
os.chmod(td, 0o755) # Starts off as 700, not user readable
with open(os.path.join(td, 'kernel.json'), 'w') as f:
json.dump(kernel_json, f, sort_keys=True)
log.info('Installing kernel spec')
try:
install_kernel_spec(td, 'yap_kernel', user=self.user,
replace=True)
except:
install_kernel_spec(td, 'yap_kernel', user=not self.user,
replace=True)
svem_flag = '--single-version-externally-managed'
if svem_flag in sys.argv:
# Die, setuptools, die.
sys.argv.remove(svem_flag)
setup(name='yap_kernel',
version='0.0.1',
description='A simple YAP kernel for Jupyter/IPython',
long_description="A simple YAP kernel for Jupyter/IPython, based on MetaKernel",
url="https://github.com/vscosta/yap-6.3",
author='Vitor Santos Costa, based on the metakernel from Douglas Blank',
author_email='vsc@dcc.fc.up.pt',
py_modules=['yap_kernel'],
install_requires=["metakernel","yap"],
cmdclass={'install': install_with_kernelspec},
classifiers = [
'Framework :: IPython',
'License :: OSI Approved :: BSD License',
'Programming Language :: YAP :: 6.3',
'Programming Language :: Python :: 3',
'Topic :: System :: Shells',
]
)

View File

@ -15,9 +15,9 @@ IF (NOT YAP_FOUND)
ENDIF (NOT YAP_FOUND)
macro_optional_find_package (LibXml2 ON)
macro_log_feature (LIBXML2_FOUND "RAPTOR"
macro_log_feature (LIBXML2_FOUND "LIBXML2"
"Use XML2 Library"
"http://www.r.org" FALSE)
"http://www.xmlsoft.org" FALSE)
IF (LIBXML2_FOUND)
# LIBXML2_FOUND - System has LibXml2
# LIBXML2_INCLUDE_DIR - The LibXml2 include directory
@ -76,7 +76,7 @@ ENDIF (LIBXML2_FOUND)
macro_optional_find_package (RAPTOR ON)
macro_log_feature (RAPTOR_FOUND "RAPTOR"
"Use RAPTOR Library"
"http://www.r.org" FALSE)
"http://www.librdf.org" FALSE)
IF (RAPTOR_FOUND)
# RAPTOR_FOUND - system has Raptor
# RAPTOR_LIBRARIES - Link these to use Raptor

View File

@ -45,6 +45,7 @@ if ( NOT( RAPTOR_INCLUDE_DIR AND RAPTOR_LIBRARIES ) OR NOT RAPTOR_FOUND )
NAMES raptor2.h raptor2/raptor2.h raptor.h raptor/raptor.h
PATHS $ENV{RAPTOR_DIR}/include
$ENV{RAPTOR_DIR}
${CMAKE_INSTALL_PREFIX}/include
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
@ -64,6 +65,7 @@ if ( NOT( RAPTOR_INCLUDE_DIR AND RAPTOR_LIBRARIES ) OR NOT RAPTOR_FOUND )
PATHS $ENV{RAPTOR_DIR}/lib
$ENV{RAPTOR_DIR}/lib-dbg
$ENV{RAPTOR_DIR}
${CMAKE_INSTALL_PREFIX}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib

View File

@ -66,6 +66,7 @@
:- use_module(library(charsio)).
:- use_module(library(readutil)).
:- use_module(library(debug)).
:- use_module(library(system)).
:- dynamic( real:r_started/1 ).

Binary file not shown.

Before

Width:  |  Height:  |  Size: 755 B

View File

@ -12,10 +12,11 @@ if (PYTHONLIBS_FOUND)
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/CXX)
SET(CMAKE_SWIG_FLAGS "")
SET(CMAKE_SWIG_FLAGS "-py3")
SET_SOURCE_FILES_PROPERTIES(../yap.i PROPERTIES CPLUSPLUS ON)
SET_SOURCE_FILES_PROPERTIES(../yap.i PROPERTIES SWIG_FLAGS "-includeall")
SET_SOURCE_FILES_PROPERTIES(../yap.i PROPERTY SWIG_MODULE_NAME libPy2YAP )
configure_file ("setup.py.cmake" "setup.py" )
@ -23,9 +24,11 @@ if (PYTHONLIBS_FOUND)
#SET( CMAKE_SWIG_OUTDIR "yap" )
SWIG_ADD_MODULE(yap python ../yap.i)
SWIG_LINK_LIBRARIES(yap ${PYTHON_LIBRARIES} Yap++ libYap libpython)
set_target_properties ( ${SWIG_MODULE_yap_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}' ) )"
# OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH
@ -33,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 )
DEPENDS ../yap.i YAPPython )
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install
@ -77,6 +80,11 @@ if (PYTHONLIBS_FOUND)
endif ()
install(TARGETS ${SWIG_MODULE_Py2YAP_REAL_NAME}
LIBRARY DESTINATION ${dlls}
ARCHIVE DESTINATION ${dlls}
)
# add_subdirectory ( examples )
else ()
message(STATUS "Not building python bindings")

View File

@ -0,0 +1,3 @@
// make Python happy...

View File

@ -1,23 +1,29 @@
from distutils.core import setup, Extension
import sys
import os
import platform
if platform.system() == 'Darwin':
my_extra_link_args = ['-Wl,-rpath','-Wl,${dlls}']
else:
my_extra_link_args = []
setup(
name = "yap",
version = "0.1",
ext_modules=[Extension('_yap', [ 'yapPYTHON_wrap.cxx',
'${CMAKE_SOURCE_DIR}/packages/python/pl2py.c',
'${CMAKE_SOURCE_DIR}/packages/python/python.c',
'${CMAKE_SOURCE_DIR}/packages/python/py2pl.c',
'${CMAKE_SOURCE_DIR}/packages/python/pl2pl.c',
'${CMAKE_SOURCE_DIR}/packages/python/pypreds.c',
'${CMAKE_SOURCE_DIR}/packages/python/pybips.c'],
ext_modules=[Extension('_yap', ['${CMAKE_SOURCE_DIR}/packages/swig/yap.i'],
define_macros = [('MAJOR_VERSION', '1'),
('MINOR_VERSION', '0'),
('_YAP_NOT_INSTALLED_', '1')],
swig_opts=['-py3', '-c++','-I${CMAKE_SOURCE_DIR}/CXX'],
runtime_library_dirs=['/usr/local/lib'],
library_dirs=['../../..','../../../CXX'],
libraries=['Yap++','Yap'],
runtime_library_dirs=['${dlls}'],
swig_opts=['-modern', '-c++', '-py3','-I${CMAKE_SOURCE_DIR}/CXX'],
library_dirs=['../../..','../../../CXX',
'../../python',
'.'],
extra_link_args=my_extra_link_args,
libraries=['Yap++','Yap','YAPPython'],
include_dirs=['../../..',
'${GMP_INCLUDE_DIRS}',
'${CMAKE_SOURCE_DIR}/H',
'${CMAKE_SOURCE_DIR}/H/generated',
'${CMAKE_SOURCE_DIR}/OPTYap',