X_API
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
|
||||
# This is a CMake example for Python
|
||||
|
||||
INCLUDE(NewUseSWIG)
|
||||
#INCLUDE(NewUseSWIG)
|
||||
|
||||
include(FindPythonModule)
|
||||
|
||||
@@ -23,22 +23,6 @@ SET_SOURCE_FILES_PROPERTIES(../../swig/yap.i PROPERTIES SWIG_FLAGS "-O;-py3")
|
||||
SET_SOURCE_FILES_PROPERTIES(../../swiyap.i PROPERTIES SWIG_MODULE_NAME yap)
|
||||
#SET_SOURCE_FILES_PROPERTIES(../../swi/yap.i PROPERTIES OUTPUT_NAME yap)
|
||||
|
||||
SWIG_ADD_LIBRARY(Py2YAP LANGUAGE python SHARED SOURCES ../../swig/yap.i )
|
||||
if (WIN32)
|
||||
SWIG_LINK_LIBRARIES(Py2YAP YAPPython libYap ${PYTHON_LIBRARIES} )
|
||||
else()
|
||||
SWIG_LINK_LIBRARIES( Py2YAP libYap YAP++ YAPPython ${PYTHON_LIBRARIES} )
|
||||
endif()
|
||||
set_target_properties ( ${SWIG_MODULE_Py2YAP_REAL_NAME}
|
||||
PROPERTIES
|
||||
NO_SONAME ON
|
||||
CXXFLAGS "-include cmath "
|
||||
OUTPUT_NAME _yap
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
DEPENDS YAPPython YAPPython YAP++
|
||||
)
|
||||
|
||||
SET( CMAKE_CXX_FLAGS " -include cmath ${CMAKE_CXX_FLAGS} " )
|
||||
|
||||
# inform we are compiling YAP
|
||||
# s used in MSYS
|
||||
@@ -65,9 +49,12 @@ endif()
|
||||
|
||||
set (PL ${pl_library} ${PROLOG_SOURCES} )
|
||||
|
||||
add_custom_target( YAP4PY_SETUP
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${dlls} ${CMAKE_BINARY_DIR}/libYap${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_BINARY_DIR}/${YAP_STARTUP} ${PYTHON_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/yap4py
|
||||
add_custom_target( YAP4PY_SETUP
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/yap.py
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/packages/swig/yap.i ${CMAKE_CURRENT_BINARY_DIR}/yap.i
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${dlls} ${CMAKE_BINARY_DIR}/libYap${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_BINARY_DIR}/${YAP_STARTUP} ${PYTHON_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/yap4py
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${PL} ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/yap4py/prolog/pl
|
||||
|
@@ -1,3 +0,0 @@
|
||||
|
||||
// make Python happy...
|
||||
|
@@ -6,7 +6,7 @@
|
||||
from __future__ import print_function
|
||||
|
||||
from setuptools import setup
|
||||
from setuptools.extension import Extension
|
||||
from setuptools.extension import Extension
|
||||
from codecs import open
|
||||
from os import path, makedirs, walk
|
||||
from shutil import copytree, rmtree, copy2, move
|
||||
@@ -18,23 +18,23 @@ import os.path
|
||||
# the name of the package
|
||||
name = 'YAP4PY'
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------------------
|
||||
# Minimal Python version sanity check
|
||||
#-----------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
import sys
|
||||
|
||||
v = sys.version_info
|
||||
if v[:2] < (2,7) or (v[0] >= 3 and v[:2] < (3,3)):
|
||||
if v[:2] < (2, 7) or (v[0] >= 3 and v[:2] < (3, 3)):
|
||||
error = "ERROR: %s requires Python version 2.7 or 3.3 or above." % name
|
||||
print(error, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
PY3 = (sys.version_info[0] >= 3)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------------------
|
||||
# get on with it
|
||||
#-----------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------------------
|
||||
from codecs import open
|
||||
from os import path, makedirs, walk
|
||||
from shutil import copytree, rmtree, copy2, move
|
||||
@@ -53,85 +53,86 @@ pkg_root = pjoin(here, name)
|
||||
|
||||
my_extra_link_args = []
|
||||
if platform.system() == 'Darwin':
|
||||
my_extra_link_args = ['-Wl,-rpath','-Wl,${_ABS_PYTHON_MODULE_PATH}']
|
||||
so = 'dylib'
|
||||
#or dll in glob('yap/dlls/*'):
|
||||
my_extra_link_args = ['-Wl,-rpath', '-Wl,${_ABS_PYTHON_MODULE_PATH}']
|
||||
# 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']
|
||||
|
||||
cplus = ['']
|
||||
bpy2yap = ['${CMAKE_SOURCE_DIR}/packages/python/python.c',
|
||||
'${CMAKE_SOURCE_DIR}/packages/python/pl2py.c',
|
||||
'${CMAKE_SOURCE_DIR}/packages/python/pybips.c',
|
||||
'${CMAKE_SOURCE_DIR}/packages/python/py2pl.c',
|
||||
'${CMAKE_SOURCE_DIR}/packages/python/pl2pl.c',
|
||||
'${CMAKE_SOURCE_DIR}/packages/python/pypreds.c'
|
||||
]
|
||||
|
||||
cplus=['${RELATIVE_SOURCE}CXX/yapi.cpp']
|
||||
|
||||
py2yap=['${RELATIVE_SOURCE}packages/python/python.c',
|
||||
'${RELATIVE_SOURCE}packages/python/pl2py.c',
|
||||
'${RELATIVE_SOURCE}packages/python/pybips.c',
|
||||
'${RELATIVE_SOURCE}packages/python/py2pl.c',
|
||||
'${RELATIVE_SOURCE}packages/python/pl2pl.c',
|
||||
'${RELATIVE_SOURCE}packages/python/pypreds.c'
|
||||
]
|
||||
|
||||
native_sources = ['yapPYTHON_wrap.cxx']+py2yap+cplus
|
||||
native_sources = ['yap.i']
|
||||
here = path.abspath(path.dirname(__file__))
|
||||
|
||||
# Get the long description from the README file
|
||||
|
||||
extensions=[Extension('_yap', native_sources,
|
||||
define_macros = [('MAJOR_VERSION', '1'),
|
||||
extensions = [Extension('_yap', native_sources,
|
||||
define_macros=[('MAJOR_VERSION', '1'),
|
||||
('MINOR_VERSION', '0'),
|
||||
('_YAP_NOT_INSTALLED_', '1'),
|
||||
('_GNU_SOURCE', '1'),
|
||||
('YAP_PYTHON', '1')],
|
||||
runtime_library_dirs=['yap4py','${libdir}','${bindir}'],
|
||||
swig_opts=['-modern', '-c++', '-py3','-I${RELATIVE_SOURCE}/CXX'],
|
||||
library_dirs=['../../..','../../../CXX','../../packages/python',"${dlls}","${bindir}", '.'],
|
||||
extra_link_args=my_extra_link_args,
|
||||
extra_compile_args=['-std=c++11','-g3','-O0'],
|
||||
libraries=['Yap','${GMP_LIBRARIES}'],
|
||||
include_dirs=['../../..',
|
||||
'${GMP_INCLUDE_DIRS}',
|
||||
'${RELATIVE_SOURCE}H',
|
||||
'${RELATIVE_SOURCE}H/generated',
|
||||
'${RELATIVE_SOURCE}OPTYap',
|
||||
'${RELATIVE_SOURCE}os',
|
||||
'${RELATIVE_SOURCE}include',
|
||||
'${RELATIVE_SOURCE}CXX', '.']
|
||||
)]
|
||||
runtime_library_dirs=['yap4py', '${libdir}', '${bindir}'],
|
||||
swig_opts=['-modern', '-c++', '-py3', '-I${CMAKE_SOURCE_DIR}/CXX', '-I${CMAKE_SOURCE_DIR}/include',
|
||||
'-I${CMAKE_SOURCE_DIR}/H', '-I${CMAKE_SOURCE_DIR}/H/generated',
|
||||
'-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}'],
|
||||
include_dirs=['../../..',
|
||||
'${GMP_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', '.']
|
||||
)]
|
||||
|
||||
packages = ['yap4py']
|
||||
|
||||
|
||||
def visit(d0, pls):
|
||||
for (r,ds,fs) in walk('.'):
|
||||
for (r, ds, fs) in walk('.'):
|
||||
for f in fs:
|
||||
f0,ext = os.path.splitext(f)
|
||||
f0, ext = os.path.splitext(f)
|
||||
if (ext == 'yap' or ext == 'pl' or ext == 'so' or ext == 'dll' or ext == 'yss'):
|
||||
pls += [os.path.join(r, f)]
|
||||
for i in ds:
|
||||
pls = visit(os.path.join(d0, i), pls)
|
||||
return pls
|
||||
|
||||
|
||||
package_data = {
|
||||
'': visit('.',[])
|
||||
'': visit('.', [])
|
||||
}
|
||||
|
||||
version_ns = {'__version__':'6.3.5','minor-version':'6','minor-version':'3','patch':'5'}
|
||||
|
||||
version_ns = {'__version__': '6.3.5', 'minor-version': '6', 'minor-version': '3', 'patch': '5'}
|
||||
|
||||
setup_args = dict(
|
||||
name = name,
|
||||
version = version_ns['__version__'],
|
||||
scripts = glob(pjoin('scripts', '*')),
|
||||
packages = packages,
|
||||
py_modules = ['yap'],
|
||||
package_data = package_data,
|
||||
include_package_data = True,
|
||||
description = "YAP in Python",
|
||||
author = 'YAP Development Team',
|
||||
author_email = 'ipython-dev@scipy.org',
|
||||
url = 'http://ipython.org',
|
||||
license = 'BSD',
|
||||
ext_modules = extensions,
|
||||
platforms = "Linux, Mac OS X, Windows",
|
||||
keywords = ['Interactive', 'Interpreter', 'Shell', 'Web'],
|
||||
classifiers = [
|
||||
name=name,
|
||||
version=version_ns['__version__'],
|
||||
scripts=glob(pjoin('scripts', '*')),
|
||||
packages=packages,
|
||||
py_modules=['yap'],
|
||||
package_data=package_data,
|
||||
include_package_data=True,
|
||||
description="YAP in Python",
|
||||
author='YAP Development Team',
|
||||
author_email='ipython-dev@scipy.org',
|
||||
url='http://ipython.org',
|
||||
license='BSD',
|
||||
ext_modules=extensions,
|
||||
platforms="Linux, Mac OS X, Windows",
|
||||
keywords=['Interactive', 'Interpreter', 'Shell', 'Web'],
|
||||
classifiers=[
|
||||
'Intended Audience :: Developers',
|
||||
'Intended Audience :: System Administrators',
|
||||
'Intended Audience :: Science/Research',
|
||||
|
Reference in New Issue
Block a user