From 2e5202911427061541de9c9fae7d7627e2f49512 Mon Sep 17 00:00:00 2001 From: Nikolaj Bjorner Date: Tue, 19 Jul 2022 22:52:57 -0700 Subject: [PATCH] add command-line overwrite capability to setup.py Signed-off-by: Nikolaj Bjorner --- src/api/python/setup.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/api/python/setup.py b/src/api/python/setup.py index 572b0a7a7..56f310fff 100644 --- a/src/api/python/setup.py +++ b/src/api/python/setup.py @@ -129,6 +129,17 @@ def _configure_z3(): for key, val in cmake_options.items(): if type(val) is bool: cmake_options[key] = str(val).upper() + + # Allow command-line arguments to add and override Z3_ options + for i in range(len(sys.argv) - 1): + key = sys.argv[i] + if key.starts_with("Z3_"): + val = sys.argv[i + 1] + if val.lower() == "true": + cmake_options[key] = "TRUE" + elif val.lower() == "false": + cmake_options[key] = "FALSE" + cmake_args = [ '-D' + key + '=' + value for key,value in cmake_options.items() ] args = [ 'cmake', *cmake_args, SRC_DIR ] if subprocess.call(args, env=build_env, cwd=BUILD_DIR) != 0: