python
This commit is contained in:
parent
f78ddb6724
commit
c4544f042d
@ -16,6 +16,8 @@ foreach (i 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
|||||||
break()
|
break()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
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()
|
endif()
|
||||||
|
|
||||||
find_package(PythonInterp)
|
find_package(PythonInterp)
|
||||||
|
@ -8,14 +8,12 @@ include(FindPythonModule)
|
|||||||
set (PYTHON_SOURCES
|
set (PYTHON_SOURCES
|
||||||
python.c pl2py.c pybips.c py2pl.c pl2pl.c pypreds.c )
|
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
|
set (PYTHON_HEADERS
|
||||||
python.h)
|
python.h)
|
||||||
|
|
||||||
configure_file ("setup.py.cmake" "setup.py" )
|
target_link_libraries(YAPPython libYap ${PYTHON_LIBRARIES})
|
||||||
|
|
||||||
target_link_libraries(libpython libYap ${PYTHON_LIBRARIES})
|
|
||||||
|
|
||||||
set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/setup.py")
|
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
|
COMMAND ${PYTHON_EXECUTABLE} setup.py build -f
|
||||||
DEPENDS yapex.py )
|
DEPENDS yapex.py )
|
||||||
|
|
||||||
set_target_properties (libpython PROPERTIES PREFIX "")
|
# set_target_properties (YAPPython PROPERTIES PREFIX "")
|
||||||
|
|
||||||
include_directories (${PYTHON_INCLUDE_DIRS})
|
include_directories (${PYTHON_INCLUDE_DIRS})
|
||||||
|
|
||||||
install(TARGETS libpython
|
install(TARGETS YAPPython
|
||||||
LIBRARY DESTINATION ${dlls}
|
LIBRARY DESTINATION ${dlls}
|
||||||
ARCHIVE DESTINATION ${dlls}
|
ARCHIVE DESTINATION ${dlls}
|
||||||
)
|
)
|
||||||
@ -36,6 +34,8 @@ add_custom_target ( YAPex ALL
|
|||||||
DESTINATION ${libpl}
|
DESTINATION ${libpl}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
configure_file ("setup.py.cmake" "setup.py" )
|
||||||
|
|
||||||
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install -f
|
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install -f
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
|
||||||
|
|
||||||
|
@ -429,4 +429,4 @@ python_assign_field(C1.E, Obj) :-
|
|||||||
python_eval_term(C1, O1),
|
python_eval_term(C1, O1),
|
||||||
python_assign_field(O1, E, Obj ).
|
python_assign_field(O1, E, Obj ).
|
||||||
|
|
||||||
:- initialization( use_foreign_library(foreign(libpython), init_python), now ).
|
:- initialization( use_foreign_library(foreign(libpYAPPython), init_python), now ).
|
||||||
|
@ -16,6 +16,7 @@ if (PYTHONLIBS_FOUND)
|
|||||||
|
|
||||||
SET_SOURCE_FILES_PROPERTIES(../yap.i PROPERTIES CPLUSPLUS ON)
|
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 PROPERTIES SWIG_FLAGS "-includeall")
|
||||||
|
SET_SOURCE_FILES_PROPERTIES(../yap.i PROPERTY SWIG_MODULE_NAME libPy2YAP )
|
||||||
|
|
||||||
configure_file ("setup.py.cmake" "setup.py" )
|
configure_file ("setup.py.cmake" "setup.py" )
|
||||||
|
|
||||||
@ -23,9 +24,11 @@ if (PYTHONLIBS_FOUND)
|
|||||||
#SET( CMAKE_SWIG_OUTDIR "yap" )
|
#SET( CMAKE_SWIG_OUTDIR "yap" )
|
||||||
|
|
||||||
|
|
||||||
SWIG_ADD_MODULE(yap python ../yap.i)
|
SWIG_ADD_MODULE(Py2YAP python ../yap.i )
|
||||||
SWIG_LINK_LIBRARIES(yap ${PYTHON_LIBRARIES} Yap++ libYap libpython)
|
SWIG_LINK_LIBRARIES(Py2YAP ${PYTHON_LIBRARIES} Yap++ libYap YAPPython)
|
||||||
set_target_properties ( ${SWIG_MODULE_yap_REAL_NAME} PROPERTIES NO_SONAME ON )
|
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}' ) )"
|
# 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
|
# OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH
|
||||||
@ -41,7 +44,7 @@ if (PYTHONLIBS_FOUND)
|
|||||||
|
|
||||||
add_custom_target ( py2yap ALL
|
add_custom_target ( py2yap ALL
|
||||||
COMMAND ${PYTHON_EXECUTABLE} setup.py bdist
|
COMMAND ${PYTHON_EXECUTABLE} setup.py bdist
|
||||||
DEPENDS yap.py )
|
DEPENDS yap.py ${SWIG_MODULE_Py2YAP_REAL_NAME} )
|
||||||
|
|
||||||
|
|
||||||
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install
|
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY} install
|
||||||
@ -77,6 +80,11 @@ if (PYTHONLIBS_FOUND)
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
|
install(TARGETS ${SWIG_MODULE_Py2YAP_REAL_NAME}
|
||||||
|
LIBRARY DESTINATION ${dlls}
|
||||||
|
ARCHIVE DESTINATION ${dlls}
|
||||||
|
)
|
||||||
|
|
||||||
# add_subdirectory ( examples )
|
# add_subdirectory ( examples )
|
||||||
else ()
|
else ()
|
||||||
message(STATUS "Not building python bindings")
|
message(STATUS "Not building python bindings")
|
||||||
|
@ -3,27 +3,23 @@ from distutils.core import setup, Extension
|
|||||||
setup(
|
setup(
|
||||||
name = "yap",
|
name = "yap",
|
||||||
version = "0.1",
|
version = "0.1",
|
||||||
ext_modules=[Extension('_yap', [ 'yapPYTHON_wrap.cxx',
|
ext_modules=[Extension('_yap', ['${CMAKE_SOURCE_DIR}/packages/swig/python/_yap.c'],
|
||||||
'${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'],
|
|
||||||
define_macros = [('MAJOR_VERSION', '1'),
|
define_macros = [('MAJOR_VERSION', '1'),
|
||||||
('MINOR_VERSION', '0'),
|
('MINOR_VERSION', '0'),
|
||||||
('_YAP_NOT_INSTALLED_', '1')],
|
('_YAP_NOT_INSTALLED_', '1')],
|
||||||
swig_opts=['-py3', '-c++','-I${CMAKE_SOURCE_DIR}/CXX'],
|
runtime_library_dirs=['${dlls}'],
|
||||||
runtime_library_dirs=['/usr/local/lib'],
|
library_dirs=['../../..','../../../CXX',
|
||||||
library_dirs=['../../..','../../../CXX'],
|
'../../python',
|
||||||
libraries=['Yap++','Yap'],
|
'.'],
|
||||||
|
libraries=['Yap++','Yap','YAPPython'],
|
||||||
include_dirs=['../../..',
|
include_dirs=['../../..',
|
||||||
'${CMAKE_SOURCE_DIR}/H',
|
'${CMAKE_SOURCE_DIR}/H',
|
||||||
'${CMAKE_SOURCE_DIR}/H/generated',
|
'${CMAKE_SOURCE_DIR}/H/generated',
|
||||||
'${CMAKE_SOURCE_DIR}/OPTYap',
|
'${CMAKE_SOURCE_DIR}/OPTYap',
|
||||||
'${CMAKE_SOURCE_DIR}/os',
|
'${CMAKE_SOURCE_DIR}/os',
|
||||||
'${CMAKE_SOURCE_DIR}/include',
|
'${CMAKE_SOURCE_DIR}/include',
|
||||||
'${CMAKE_SOURCE_DIR}/CXX', '.']
|
'${CMAKE_SOURCE_DIR}/CXX', '.'],
|
||||||
|
extra_objects = ['${CMAKE_CURRENT_BINARY_DIR}/_Py2YAP${CMAKE_SHARED_MODULE_SUFFIX}' ]
|
||||||
)],
|
)],
|
||||||
py_modules = ['yap']
|
py_modules = ['yap']
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user