|
|
@ -11,11 +11,11 @@ from distutils.version import LooseVersion |
|
|
|
|
|
|
|
|
|
|
|
class CMakeExtension(Extension): |
|
|
|
def __init__(self, name, sourcedir=''): |
|
|
|
def __init__(self, name, sourcedir='', subdir=''): |
|
|
|
Extension.__init__(self, name, sources=[]) |
|
|
|
self.sourcedir = os.path.abspath(sourcedir) |
|
|
|
|
|
|
|
|
|
|
|
self.subdir = subdir |
|
|
|
|
|
|
|
class CMakeBuild(build_ext): |
|
|
|
|
|
|
|
user_options = build_ext.user_options + [ |
|
|
@ -43,10 +43,10 @@ class CMakeBuild(build_ext): |
|
|
|
|
|
|
|
def build_extension(self, ext): |
|
|
|
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] |
|
|
|
|
|
|
|
cfg = 'Debug' if self.debug else 'Release' |
|
|
|
cfg = 'Release'# if self.debug else 'Release' |
|
|
|
build_args = ['--config', cfg] |
|
|
|
|
|
|
|
|
|
|
@ -60,15 +60,9 @@ class CMakeBuild(build_ext): |
|
|
|
self.distribution.get_version()) |
|
|
|
if not os.path.exists(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( |
|
|
|
name="stormpy", |
|
|
|
version="0.9", |
|
|
@ -81,7 +75,7 @@ setup( |
|
|
|
packages=['stormpy', 'stormpy.info', 'stormpy.expressions', 'stormpy.logic', 'stormpy.storage'], |
|
|
|
package_dir={'':'lib'}, |
|
|
|
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), |
|
|
|
zip_safe=False |
|
|
|
) |