This repository was archived by the owner on Sep 10, 2024. It is now read-only.
forked from InsightSoftwareConsortium/ITKPythonPackage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwindows_build_module_wheels.py
More file actions
60 lines (49 loc) · 2.24 KB
/
Copy pathwindows_build_module_wheels.py
File metadata and controls
60 lines (49 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from subprocess import check_call
import os
import sys
SCRIPT_DIR = os.path.dirname(__file__)
ROOT_DIR = os.path.abspath(os.getcwd())
print("SCRIPT_DIR: %s" % SCRIPT_DIR)
print("ROOT_DIR: %s" % ROOT_DIR)
sys.path.insert(0, os.path.join(SCRIPT_DIR, "internal"))
from wheel_builder_utils import push_dir, push_env
from windows_build_common import DEFAULT_PY_ENVS, venv_paths
def build_wheels(py_envs=DEFAULT_PY_ENVS):
for py_env in py_envs:
python_executable, \
python_include_dir, \
python_library, \
pip, \
ninja_executable, \
path = venv_paths(py_env)
with push_env(PATH="%s%s%s" % (path, os.pathsep, os.environ["PATH"])):
# Install dependencies
requirements_file = os.path.join(ROOT_DIR, "requirements-dev.txt")
if os.path.exists(requirements_file):
check_call([pip, "install", "--upgrade", "-r", requirements_file])
check_call([pip, "install", "cmake"])
check_call([pip, "install", "scikit_build"])
check_call([pip, "install", "ninja"])
build_type = "Release"
source_path = ROOT_DIR
itk_build_path = os.path.abspath("%s/ITK-win_%s" % (os.path.join(SCRIPT_DIR, '..'), py_env))
print('ITKDIR: %s' % itk_build_path)
# Generate wheel
check_call([
python_executable,
"setup.py", "bdist_wheel",
"--build-type", build_type, "-G", "Ninja",
"--",
"-DCMAKE_MAKE_PROGRAM:FILEPATH=%s" % ninja_executable,
"-DITK_DIR:PATH=%s" % itk_build_path,
"-DWRAP_ITK_INSTALL_COMPONENT_IDENTIFIER:STRING=PythonWheel",
"-DSWIG_EXECUTABLE:FILEPATH=%s/Wrapping/Generators/SwigInterface/swig/bin/swig.exe" % itk_build_path,
"-DBUILD_TESTING:BOOL=OFF",
"-DPYTHON_EXECUTABLE:FILEPATH=%s" % python_executable,
"-DPYTHON_INCLUDE_DIR:PATH=%s" % python_include_dir,
"-DPYTHON_LIBRARY:FILEPATH=%s" % python_library
])
# Cleanup
check_call([python_executable, "setup.py", "clean"])
if __name__ == '__main__':
build_wheels()