Skip to content

Commit

Permalink
add command-line overwrite capability to setup.py
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
  • Loading branch information
NikolajBjorner committed Jul 20, 2022
1 parent 2c8df54 commit 2e52029
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/api/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 2e52029

Please sign in to comment.