|
1 | 1 | from subprocess import check_call |
2 | 2 | import os |
3 | 3 | import sys |
| 4 | +import argparse |
4 | 5 |
|
5 | 6 | SCRIPT_DIR = os.path.dirname(__file__) |
6 | 7 | ROOT_DIR = os.path.abspath(os.getcwd()) |
|
14 | 15 | from wheel_builder_utils import push_dir, push_env |
15 | 16 | from windows_build_common import DEFAULT_PY_ENVS, venv_paths |
16 | 17 |
|
17 | | -def build_wheels(py_envs=DEFAULT_PY_ENVS): |
| 18 | +def build_wheels(py_envs=DEFAULT_PY_ENVS, cleanup=True, cmake_options=[]): |
18 | 19 | for py_env in py_envs: |
19 | 20 | python_executable, \ |
20 | 21 | python_include_dir, \ |
@@ -53,9 +54,17 @@ def build_wheels(py_envs=DEFAULT_PY_ENVS): |
53 | 54 | "-DPython3_INCLUDE_DIR:PATH=%s" % python_include_dir, |
54 | 55 | "-DPython3_INCLUDE_DIRS:PATH=%s" % python_include_dir, |
55 | 56 | "-DPython3_LIBRARY:FILEPATH=%s" % python_library |
56 | | - ]) |
| 57 | + ] + cmake_options) |
57 | 58 | # Cleanup |
58 | | - check_call([python_executable, "setup.py", "clean"]) |
| 59 | + if cleanup: |
| 60 | + check_call([python_executable, "setup.py", "clean"]) |
59 | 61 |
|
60 | 62 | if __name__ == '__main__': |
61 | | - build_wheels() |
| 63 | + parser = argparse.ArgumentParser(description='Driver script to build ITK Python module wheels.') |
| 64 | + parser.add_argument('--py-envs', nargs='+', default=DEFAULT_PY_ENVS, |
| 65 | + help='Target Python environment versions, e.g. "37-x64".') |
| 66 | + parser.add_argument('--no-cleanup', dest='cleanup', action='store_false', help='Do not clean up temporary build files.') |
| 67 | + parser.add_argument('cmake_options', nargs='*', help='Extra options to pass to CMake, e.g. -DBUILD_SHARED_LIBS:BOOL=OFF') |
| 68 | + args = parser.parse_args() |
| 69 | + |
| 70 | + build_wheels(cleanup=args.cleanup, py_envs=args.py_envs, cmake_options=args.cmake_options) |
0 commit comments