|
|
@ -1,7 +1,7 @@ |
|
|
|
#!/usr/bin/env python |
|
|
|
from setuptools import setup |
|
|
|
from distutils.core import Extension |
|
|
|
from distutils.command.build_ext import build_ext |
|
|
|
from distutils.command.build_ext import build_ext as orig_build_ext |
|
|
|
import os.path |
|
|
|
import platform |
|
|
|
from glob import glob |
|
|
@ -15,36 +15,13 @@ logic_sources = glob(os.path.join('src', 'logic', '*.cpp')) |
|
|
|
storage_sources = glob(os.path.join('src', 'storage', '*.cpp')) |
|
|
|
|
|
|
|
# Configuration shared between external modules follows |
|
|
|
|
|
|
|
# To help along, if storm and/or pybind is not system installed, retrieve from storm distribution |
|
|
|
include_dirs = ['.', 'src', 'resources/pybind11/include/'] |
|
|
|
# Add more include dirs |
|
|
|
# TODO handle by cmake |
|
|
|
include_dirs.extend(['../build/include/', '../resources/3rdparty/sylvan/src/', '../resources/3rdparty/exprtk/', '../resources/3rdparty/gmm-5.0/include/']) |
|
|
|
boost_dir = '/usr/local/include/' |
|
|
|
include_dirs.append(boost_dir) |
|
|
|
cudd_dirs = ['../resources/3rdparty/cudd-3.0.0/cplusplus/', '../resources/3rdparty/cudd-3.0.0/mtr/', '../resources/3rdparty/cudd-3.0.0/cudd/'] |
|
|
|
include_dirs.extend(cudd_dirs) |
|
|
|
log4cplus_dirs = ['../resources/3rdparty/log4cplus-1.1.3-rc1/include/', '../build/resources/3rdparty/log4cplus-1.1.3-rc1/include/'] |
|
|
|
include_dirs.extend(log4cplus_dirs) |
|
|
|
|
|
|
|
local_storm_path = os.path.join(PROJECT_DIR, '..') |
|
|
|
if os.path.exists(local_storm_path): |
|
|
|
include_dirs.append(local_storm_path) |
|
|
|
|
|
|
|
# Like includes, also add local path for library, assuming made in 'build' |
|
|
|
include_dirs = [PROJECT_DIR, os.path.join(PROJECT_DIR, 'src'), |
|
|
|
os.path.join(PROJECT_DIR, 'resources', 'pybind11', 'include')] |
|
|
|
library_dirs = [] |
|
|
|
local_storm_lib_path = os.path.join(PROJECT_DIR, '..', 'build/src') |
|
|
|
if os.path.exists(local_storm_lib_path): |
|
|
|
library_dirs.append(local_storm_lib_path) |
|
|
|
|
|
|
|
libraries = ['storm'] |
|
|
|
extra_compile_args = ['-std=c++11'] |
|
|
|
define_macros = [] |
|
|
|
|
|
|
|
extra_link_args = [] |
|
|
|
if platform.system() == 'Darwin': |
|
|
|
extra_link_args.append('-Wl,-rpath,'+library_dirs[0]) |
|
|
|
|
|
|
|
ext_core = Extension( |
|
|
|
name='core', |
|
|
@ -101,27 +78,22 @@ ext_storage = Extension( |
|
|
|
extra_link_args=extra_link_args |
|
|
|
) |
|
|
|
|
|
|
|
class stormpy_build_ext(build_ext): |
|
|
|
class build_ext(orig_build_ext): |
|
|
|
"""Extend build_ext to provide CLN toggle option |
|
|
|
""" |
|
|
|
user_options = build_ext.user_options + [ |
|
|
|
user_options = orig_build_ext.user_options + [ |
|
|
|
('use-cln', None, |
|
|
|
"use cln numbers instead of gmpxx"), |
|
|
|
('carl_src', None, |
|
|
|
"path to src directory of CaRL"), |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs): |
|
|
|
build_ext.__init__(self, *args, **kwargs) |
|
|
|
boolean_options = orig_build_ext.boolean_options + ['use-cln'] |
|
|
|
|
|
|
|
def initialize_options (self): |
|
|
|
build_ext.initialize_options(self) |
|
|
|
super(build_ext, self).initialize_options() |
|
|
|
self.use_cln = None |
|
|
|
self.carl_src = None |
|
|
|
|
|
|
|
def finalize_options(self): |
|
|
|
build_ext.finalize_options(self) |
|
|
|
super(build_ext, self).finalize_options() |
|
|
|
|
|
|
|
if self.use_cln: |
|
|
|
self.libraries += ['cln'] |
|
|
@ -136,12 +108,14 @@ class stormpy_build_ext(build_ext): |
|
|
|
self.undef = [] |
|
|
|
self.undef += ['STORMPY_USE_CLN'] |
|
|
|
|
|
|
|
if library_dirs: |
|
|
|
if self.library_dirs: |
|
|
|
# Makes local storm library lookup that much easier |
|
|
|
self.rpath += library_dirs |
|
|
|
self.rpath += self.library_dirs |
|
|
|
|
|
|
|
print("Add carl_src: {}".format(self.carl_src)) |
|
|
|
include_dirs.append(self.carl_src) |
|
|
|
if platform.system() == 'Darwin' and len(self.rpath) > 0: |
|
|
|
for e in self.extensions: |
|
|
|
# If rpath is used on OS X, set this option |
|
|
|
e.extra_link_args.append('-Wl,-rpath,'+self.rpath[0]) |
|
|
|
|
|
|
|
setup(name="stormpy", |
|
|
|
version="0.9", |
|
|
@ -157,6 +131,6 @@ setup(name="stormpy", |
|
|
|
ext_modules=[ext_core, ext_info, ext_expressions, ext_logic, ext_storage |
|
|
|
], |
|
|
|
cmdclass={ |
|
|
|
'build_ext': stormpy_build_ext, |
|
|
|
'build_ext': build_ext, |
|
|
|
} |
|
|
|
) |