|
@ -11,11 +11,11 @@ from distutils.version import LooseVersion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CMakeExtension(Extension): |
|
|
class CMakeExtension(Extension): |
|
|
def __init__(self, name, sourcedir=''): |
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
class CMakeBuild(build_ext): |
|
|
class CMakeBuild(build_ext): |
|
|
|
|
|
|
|
|
user_options = build_ext.user_options + [ |
|
|
user_options = build_ext.user_options + [ |
|
@ -43,10 +43,10 @@ class CMakeBuild(build_ext): |
|
|
|
|
|
|
|
|
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=' + extdir, |
|
|
|
|
|
|
|
|
cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + os.path.join(extdir, ext.subdir), |
|
|
'-DPYTHON_EXECUTABLE=' + sys.executable] |
|
|
'-DPYTHON_EXECUTABLE=' + sys.executable] |
|
|
|
|
|
|
|
|
cfg = 'Debug' if self.debug else 'Release' |
|
|
|
|
|
|
|
|
cfg = 'Release'# if self.debug else 'Release' |
|
|
build_args = ['--config', cfg] |
|
|
build_args = ['--config', cfg] |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -60,15 +60,9 @@ class CMakeBuild(build_ext): |
|
|
self.distribution.get_version()) |
|
|
self.distribution.get_version()) |
|
|
if not os.path.exists(self.build_temp): |
|
|
if not os.path.exists(self.build_temp): |
|
|
os.makedirs(self.build_temp) |
|
|
os.makedirs(self.build_temp) |
|
|
subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env) |
|
|
|
|
|
try: |
|
|
|
|
|
subprocess.check_call(['cmake', '--build', '.', '--target', ext.name] + build_args, cwd=self.build_temp) |
|
|
|
|
|
except subprocess.CalledProcessError as e: |
|
|
|
|
|
if e.output: |
|
|
|
|
|
raise RuntimeError("CMake build returned with an error: " + e.output) |
|
|
|
|
|
|
|
|
|
|
|
print(e.stdout) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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) |
|
|
|
|
|
|
|
|
setup( |
|
|
setup( |
|
|
name="stormpy", |
|
|
name="stormpy", |
|
|
version="0.9", |
|
|
version="0.9", |
|
@ -81,7 +75,7 @@ setup( |
|
|
packages=['stormpy', 'stormpy.info', 'stormpy.expressions', 'stormpy.logic', 'stormpy.storage'], |
|
|
packages=['stormpy', 'stormpy.info', 'stormpy.expressions', 'stormpy.logic', 'stormpy.storage'], |
|
|
package_dir={'':'lib'}, |
|
|
package_dir={'':'lib'}, |
|
|
ext_package='stormpy', |
|
|
ext_package='stormpy', |
|
|
ext_modules=[CMakeExtension('stormpy.core'), CMakeExtension('stormpy.info'),CMakeExtension('stormpy.expressions'), CMakeExtension('stormpy.logic'), CMakeExtension('stormpy.storage')], |
|
|
|
|
|
|
|
|
ext_modules=[CMakeExtension('core', subdir=''), CMakeExtension('info', subdir='info'),CMakeExtension('expressions', subdir='expressions'), CMakeExtension('logic', subdir='logic'), CMakeExtension('storage', subdir='storage')], |
|
|
cmdclass=dict(build_ext=CMakeBuild), |
|
|
cmdclass=dict(build_ext=CMakeBuild), |
|
|
zip_safe=False |
|
|
zip_safe=False |
|
|
) |
|
|
) |