From ae18ef8003bc9621f9666c7809cbf83acfa8cbb7 Mon Sep 17 00:00:00 2001 From: sjunges Date: Tue, 19 Jan 2016 17:49:54 +0100 Subject: [PATCH] refactored construction of python modules Former-commit-id: 779fdf6e4c494d982cdfcefa161a46f681fc73d9 --- src/python/CMakeLists.txt | 50 ++++++++++++++++++++++++++------------ src/python/storm-logic.cpp | 0 stormpy/logic/__init__.py | 0 3 files changed, 34 insertions(+), 16 deletions(-) create mode 100644 src/python/storm-logic.cpp create mode 100644 stormpy/logic/__init__.py diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 0ec2c2e08..63a1bb278 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -3,23 +3,41 @@ ## STORM PYTHON ## ############################################################# + +function (add_python_module _libname _modulename, _sources) + add_library(${_libname} SHARED ${_sources}) + target_link_libraries(${_libname} storm ${BOOST_PYTHON_LIB} ${PYTHON_LIBRARIES}) + set_target_properties(${_libname} PROPERTIES + OUTPUT_NAME "_${_modulename}" + LIBRARY_OUTPUT_DIRECTORY ${STORMPY_OUTPUT_DIR}/${_modulename} + PREFIX "" + SUFFIX ".so" + ) +endfunction() + + + if(STORM_PYTHON) - add_library(stormpy-info SHARED ${CMAKE_CURRENT_SOURCE_DIR}/storm-info.cpp) - target_link_libraries(stormpy-info storm ${BOOST_PYTHON_LIB} ${PYTHON_LIBRARIES}) - set_target_properties(stormpy-info PROPERTIES - OUTPUT_NAME _info - LIBRARY_OUTPUT_DIRECTORY ${STORMPY_OUTPUT_DIR}/info - PREFIX "" - SUFFIX ".so" - ) - add_library(stormpy-core SHARED ${CMAKE_CURRENT_SOURCE_DIR}/storm-core.cpp) - target_link_libraries(stormpy-core storm ${BOOST_PYTHON_LIB} ${PYTHON_LIBRARIES}) - set_target_properties(stormpy-core PROPERTIES - OUTPUT_NAME _core - LIBRARY_OUTPUT_DIRECTORY ${STORMPY_OUTPUT_DIR}/core - PREFIX "" - SUFFIX ".so" - ) + add_python_module(stormpy-info info ${CMAKE_CURRENT_SOURCE_DIR}/storm-info.cpp) + add_python_module(stormpy-core core ${CMAKE_CURRENT_SOURCE_DIR}/storm-core.cpp) + + # add_library(stormpy-info SHARED ${CMAKE_CURRENT_SOURCE_DIR}/storm-info.cpp) +# target_link_libraries(stormpy-info storm ${BOOST_PYTHON_LIB} ${PYTHON_LIBRARIES}) +# set_target_properties(stormpy-info PROPERTIES +# OUTPUT_NAME _info +# LIBRARY_OUTPUT_DIRECTORY ${STORMPY_OUTPUT_DIR}/info +# PREFIX "" +# SUFFIX ".so" +# ) +# add_library(stormpy-core SHARED ${CMAKE_CURRENT_SOURCE_DIR}/storm-core.cpp) +# target_link_libraries(stormpy-core storm ${BOOST_PYTHON_LIB} ${PYTHON_LIBRARIES}) +# set_target_properties(stormpy-core PROPERTIES +# OUTPUT_NAME _core +# LIBRARY_OUTPUT_DIRECTORY ${STORMPY_OUTPUT_DIR}/core +# PREFIX "" +# SUFFIX ".so" +# ) + add_custom_target(stormpy DEPENDS stormpy-info stormpy-core) diff --git a/src/python/storm-logic.cpp b/src/python/storm-logic.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/stormpy/logic/__init__.py b/stormpy/logic/__init__.py new file mode 100644 index 000000000..e69de29bb