From 64f7f9f8ad242ea0fa05bba8fdc3c05649d4a2d8 Mon Sep 17 00:00:00 2001 From: Mavo Date: Thu, 11 Feb 2016 17:16:55 +0100 Subject: [PATCH] Arguments for cmake and make in setup.py possible now Former-commit-id: a3ab0f7a6a72267159fafa964fa95564f1d58503 --- install.sh | 2 ++ setup.py | 77 ++++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 59 insertions(+), 20 deletions(-) create mode 100755 install.sh diff --git a/install.sh b/install.sh new file mode 100755 index 000000000..86e8ffcb0 --- /dev/null +++ b/install.sh @@ -0,0 +1,2 @@ +#!/bin/bash +pip install -ve . --install-option="--cmake=" --install-option="--make=" diff --git a/setup.py b/setup.py index 67e1ea4b0..f2d70890d 100644 --- a/setup.py +++ b/setup.py @@ -51,35 +51,72 @@ class MyEggInfo(egg_info): class MyInstall(install): + user_options = install.user_options + [ + ('cmake=', None, 'Additional cmake arguments'), + ('make=', None, 'Additional make arguments'), + ] + + def initialize_options(self): + install.initialize_options(self) + self.cmake = "" + self.make = "" + def run(self): - ret = call(["cmake", "-DSTORM_PYTHON=ON", "-DUSE_BOOST_STATIC_LIBRARIES=OFF", "-DPYTHON_LIBRARY="+PYTHONLIB, "-DPYTHON_INCLUDE_DIR="+PYTHONINC, os.path.abspath(os.path.dirname(os.path.realpath(__file__)))], cwd=d) + # Call cmake + cmake_args = ["cmake", "-DSTORM_PYTHON=ON", "-DUSE_BOOST_STATIC_LIBRARIES=OFF", "-DPYTHON_LIBRARY="+PYTHONLIB, "-DPYTHON_INCLUDE_DIR="+PYTHONINC] + cmake_args.extend(self.cmake.split()) + cmake_args.append(os.path.abspath(os.path.dirname(os.path.realpath(__file__)))) + ret = call(cmake_args, cwd=d) if ret != 0: raise RuntimeError("Cmake exited with return code {}".format(ret)) - ret = call(["make", "stormpy", "-j"+str(NO_COMPILE_CORES)], cwd=d) + + # Call make + make_args = ["make", "stormpy", "-j"+str(NO_COMPILE_CORES)] + make_args.extend(self.make.split()) + ret = call(make_args, cwd=d) if ret != 0: raise RuntimeError("Make exited with return code {}".format(ret)) install.run(self) + class MyDevelop(develop): + user_options = develop.user_options + [ + ('cmake=', None, 'Additional cmake arguments'), + ('make=', None, 'Additional make arguments'), + ] + + def initialize_options(self): + develop.initialize_options(self) + self.cmake = "" + self.make = "" + def run(self): - ret = call(["cmake", "-DSTORM_PYTHON=ON","-DUSE_BOOST_STATIC_LIBRARIES=OFF", "-DPYTHON_LIBRARY="+PYTHONLIB, "-DPYTHON_INCLUDE_DIR="+PYTHONINC, os.path.abspath(os.path.dirname(os.path.realpath(__file__)))], cwd=d) - if ret != 0: - raise RuntimeError("Cmake exited with return code {}".format(ret)) - ret = call(["make", "stormpy", "-j"+str(NO_COMPILE_CORES)], cwd=d) - if ret != 0: - raise RuntimeError("Make exited with return code {}".format(ret)) - develop.run(self) + # Call cmake + cmake_args = ["cmake", "-DSTORM_PYTHON=ON", "-DUSE_BOOST_STATIC_LIBRARIES=OFF", "-DPYTHON_LIBRARY="+PYTHONLIB, "-DPYTHON_INCLUDE_DIR="+PYTHONINC] + cmake_args.extend(self.cmake.split()) + cmake_args.append(os.path.abspath(os.path.dirname(os.path.realpath(__file__)))) + ret = call(cmake_args, cwd=d) + if ret != 0: + raise RuntimeError("Cmake exited with return code {}".format(ret)) + + # Call make + make_args = ["make", "stormpy", "-j"+str(NO_COMPILE_CORES)] + make_args.extend(self.make.split()) + ret = call(make_args, cwd=d) + if ret != 0: + raise RuntimeError("Make exited with return code {}".format(ret)) + develop.run(self) setup(cmdclass={'install': MyInstall, 'develop': MyDevelop, 'egg_info': MyEggInfo}, - name="stormpy", - version="0.2", - description="Stormpy - Python Bindings for Storm", - package_dir={'':d}, - packages=['stormpy', 'stormpy.core', 'stormpy.info', 'stormpy.logic', 'stormpy.expressions'], - package_data={'stormpy.core': ['_core.so'], - 'stormpy.logic': ['_logic.so'], - 'stormpy.info' : ['_info.so'] , - 'stormpy.expressions' : ['_expressions.so'], - 'stormpy': ['*.so', '*.dylib', '*.a']}, + name="stormpy", + version="0.2", + description="Stormpy - Python Bindings for Storm", + package_dir={'':d}, + packages=['stormpy', 'stormpy.core', 'stormpy.info', 'stormpy.logic', 'stormpy.expressions'], + package_data={'stormpy.core': ['_core.so'], + 'stormpy.logic': ['_logic.so'], + 'stormpy.info' : ['_info.so'] , + 'stormpy.expressions' : ['_expressions.so'], + 'stormpy': ['*.so', '*.dylib', '*.a']}, - include_package_data=True) + include_package_data=True)