|
@ -1,32 +1,30 @@ |
|
|
#!/usr/bin/env python |
|
|
#!/usr/bin/env python |
|
|
import os |
|
|
import os |
|
|
import re |
|
|
|
|
|
import sys |
|
|
import sys |
|
|
import platform |
|
|
|
|
|
import subprocess |
|
|
import subprocess |
|
|
|
|
|
|
|
|
from setuptools import setup, Extension |
|
|
from setuptools import setup, Extension |
|
|
from setuptools.command.build_ext import build_ext |
|
|
from setuptools.command.build_ext import build_ext |
|
|
from distutils.version import LooseVersion |
|
|
|
|
|
|
|
|
|
|
|
if sys.version_info[0] == 2: |
|
|
if sys.version_info[0] == 2: |
|
|
sys.exit('Sorry, Python 2.x is not supported') |
|
|
sys.exit('Sorry, Python 2.x is not supported') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CMakeExtension(Extension): |
|
|
class CMakeExtension(Extension): |
|
|
def __init__(self, name, sourcedir='', subdir=''): |
|
|
def __init__(self, name, sourcedir='', subdir=''): |
|
|
Extension.__init__(self, name, sources=[]) |
|
|
Extension.__init__(self, name, sources=[]) |
|
|
self.sourcedir = os.path.abspath(sourcedir) |
|
|
self.sourcedir = os.path.abspath(sourcedir) |
|
|
self.subdir = subdir |
|
|
self.subdir = subdir |
|
|
|
|
|
|
|
|
class CMakeBuild(build_ext): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CMakeBuild(build_ext): |
|
|
user_options = build_ext.user_options + [ |
|
|
user_options = build_ext.user_options + [ |
|
|
('storm-dir=', None, 'Path to storm root (binary) location') |
|
|
('storm-dir=', None, 'Path to storm root (binary) location') |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
def run(self): |
|
|
def run(self): |
|
|
try: |
|
|
try: |
|
|
out = subprocess.check_output(['cmake', '--version']) |
|
|
|
|
|
|
|
|
_ = subprocess.check_output(['cmake', '--version']) |
|
|
except OSError: |
|
|
except OSError: |
|
|
raise RuntimeError("CMake must be installed to build the following extensions: " + |
|
|
raise RuntimeError("CMake must be installed to build the following extensions: " + |
|
|
", ".join(e.name for e in self.extensions)) |
|
|
", ".join(e.name for e in self.extensions)) |
|
@ -34,17 +32,14 @@ class CMakeBuild(build_ext): |
|
|
for ext in self.extensions: |
|
|
for ext in self.extensions: |
|
|
self.build_extension(ext) |
|
|
self.build_extension(ext) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def initialize_options(self): |
|
|
def initialize_options(self): |
|
|
build_ext.initialize_options(self) |
|
|
build_ext.initialize_options(self) |
|
|
self.storm_dir = None |
|
|
|
|
|
|
|
|
|
|
|
def finalize_options(self): |
|
|
def finalize_options(self): |
|
|
if self.storm_dir: |
|
|
|
|
|
|
|
|
if hasattr(self, 'storm_dir'): |
|
|
print('The custom storm directory', self.storm_dir) |
|
|
print('The custom storm directory', self.storm_dir) |
|
|
build_ext.finalize_options(self) |
|
|
build_ext.finalize_options(self) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def build_extension(self, ext): |
|
|
def build_extension(self, ext): |
|
|
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name))) |
|
|
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name))) |
|
|
cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + os.path.join(extdir, ext.subdir), |
|
|
cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + os.path.join(extdir, ext.subdir), |
|
@ -53,10 +48,9 @@ class CMakeBuild(build_ext): |
|
|
cfg = 'Release' # if self.debug else 'Release' |
|
|
cfg = 'Release' # if self.debug else 'Release' |
|
|
build_args = ['--config', cfg] |
|
|
build_args = ['--config', cfg] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg] |
|
|
cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg] |
|
|
build_args += ['--', '-j2'] |
|
|
build_args += ['--', '-j2'] |
|
|
if self.storm_dir: |
|
|
|
|
|
|
|
|
if hasattr(self, 'storm_dir'): |
|
|
cmake_args += ['-Dstorm_DIR=' + self.storm_dir] |
|
|
cmake_args += ['-Dstorm_DIR=' + self.storm_dir] |
|
|
|
|
|
|
|
|
env = os.environ.copy() |
|
|
env = os.environ.copy() |
|
@ -67,6 +61,7 @@ class CMakeBuild(build_ext): |
|
|
subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env) |
|
|
subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env) |
|
|
subprocess.check_call(['cmake', '--build', '.', '--target', ext.name] + build_args, cwd=self.build_temp) |
|
|
subprocess.check_call(['cmake', '--build', '.', '--target', ext.name] + build_args, cwd=self.build_temp) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setup( |
|
|
setup( |
|
|
name="stormpy", |
|
|
name="stormpy", |
|
|
version="0.9", |
|
|
version="0.9", |
|
@ -79,7 +74,13 @@ setup( |
|
|
packages=['stormpy', 'stormpy.info', 'stormpy.expressions', 'stormpy.logic', 'stormpy.storage', 'stormpy.utility'], |
|
|
packages=['stormpy', 'stormpy.info', 'stormpy.expressions', 'stormpy.logic', 'stormpy.storage', 'stormpy.utility'], |
|
|
package_dir={'': 'lib'}, |
|
|
package_dir={'': 'lib'}, |
|
|
ext_package='stormpy', |
|
|
ext_package='stormpy', |
|
|
ext_modules=[CMakeExtension('core', subdir=''), CMakeExtension('info', subdir='info'), CMakeExtension('expressions', subdir='expressions'), CMakeExtension('logic', subdir='logic'), CMakeExtension('storage', subdir='storage'), CMakeExtension('utility', subdir='utility')], |
|
|
|
|
|
|
|
|
ext_modules=[CMakeExtension('core', subdir=''), |
|
|
|
|
|
CMakeExtension('info', subdir='info'), |
|
|
|
|
|
CMakeExtension('expressions', subdir='expressions'), |
|
|
|
|
|
CMakeExtension('logic', subdir='logic'), |
|
|
|
|
|
CMakeExtension('storage', subdir='storage'), |
|
|
|
|
|
CMakeExtension('utility', subdir='utility') |
|
|
|
|
|
], |
|
|
cmdclass=dict(build_ext=CMakeBuild), |
|
|
cmdclass=dict(build_ext=CMakeBuild), |
|
|
zip_safe=False, |
|
|
zip_safe=False, |
|
|
install_requires=['pytest'], |
|
|
install_requires=['pytest'], |
|
|