/
External_python-wheel.cmake
49 lines (42 loc) · 1.23 KB
/
External_python-wheel.cmake
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
set(proj python-wheel)
# Set dependency list
set(${proj}_DEPENDENCIES
python
python-pip
python-setuptools
)
if(NOT DEFINED Slicer_USE_SYSTEM_${proj})
set(Slicer_USE_SYSTEM_${proj} ${Slicer_USE_SYSTEM_python})
endif()
# Include dependent projects if any
ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)
if(Slicer_USE_SYSTEM_${proj})
foreach(module_name IN ITEMS wheel)
ExternalProject_FindPythonPackage(
MODULE_NAME "${module_name}"
REQUIRED
)
endforeach()
endif()
if(NOT Slicer_USE_SYSTEM_${proj})
set(requirements_file ${CMAKE_BINARY_DIR}/${proj}-requirements.txt)
file(WRITE ${requirements_file} [===[
# [wheel]
wheel==0.42.0 --hash=sha256:177f9c9b0d45c47873b619f5b650346d632cdc35fb5e4d25058e09c9e581433d
# [/wheel]
]===])
ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
DOWNLOAD_COMMAND ""
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${PYTHON_EXECUTABLE} -m pip install --require-hashes -r ${requirements_file}
LOG_INSTALL 1
DEPENDS
${${proj}_DEPENDENCIES}
)
else()
ExternalProject_Add_Empty(${proj} DEPENDS ${${proj}_DEPENDENCIES})
endif()