@@ -34,7 +34,7 @@ usage()
3434 echo " Usage:
3535 manylinux-build-module-wheels
3636 [ -h | --help ] show usage
37- [ -c | --cmake_options ] space-separated string of CMake options to forward to the module (e.g. \" -DBUILD_TESTING =OFF\" )
37+ [ -c | --cmake_options ] space-separated string of CMake options to forward to the module (e.g. \" --config-setting=cmake.define.BUILD_TESTING =OFF\" )
3838 [ -x | --exclude_libs ] semicolon-separated library names to exclude when repairing wheel (e.g. \" libcuda.so\" )
3939 [ python_version ] build wheel for a specific python version. (e.g. cp39)"
4040 exit 2
@@ -73,8 +73,11 @@ source "${script_dir}/manylinux-build-common.sh"
7373sudo ldconfig
7474export LD_LIBRARY_PATH=${LD_LIBRARY_PATH} :/work/oneTBB-prefix/lib:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64
7575
76- # Swig pre-built version from ITK build in ITKPythonPackage
77- SWIG_VERSION=4.0.2
76+ if test -e setup.py; then
77+ use_skbuild_classic=true
78+ else
79+ use_skbuild_classic=false
80+ fi
7881
7982# Compile wheels re-using standalone project and archive cache
8083for PYBIN in " ${PYBINARIES[@]} " ; do
@@ -85,6 +88,11 @@ for PYBIN in "${PYBINARIES[@]}"; do
8588 echo " Python3_EXECUTABLE:${Python3_EXECUTABLE} "
8689 echo " Python3_INCLUDE_DIR:${Python3_INCLUDE_DIR} "
8790
91+ if $use_skbuild_classic ; then
92+ # So older remote modules with setup.py continue to work
93+ ${Python3_EXECUTABLE} -m pip install --upgrade scikit-build
94+ fi
95+
8896 if [[ -e /work/requirements-dev.txt ]]; then
8997 ${PYBIN} /pip install --upgrade -r /work/requirements-dev.txt
9098 elif [[ -e /ITKPythonPackage/requirements-dev.txt ]]; then
@@ -105,21 +113,42 @@ for PYBIN in "${PYBINARIES[@]}"; do
105113 echo ' ITK source tree not available!' 1>&2
106114 exit 1
107115 fi
108- swig_args=" "
109- if [[ " ${ARCH} " = " x64" ]]; then
110- swig_args=" -DITK_USE_SYSTEM_SWIG:BOOL=ON -DSWIG_VERSION:STRING=${SWIG_VERSION} -DSWIG_EXECUTABLE:FILEPATH=${itk_build_dir} /Wrapping/Generators/SwigInterface/swiglinux-${SWIG_VERSION} /bin/swig -DSWIG_DIR:FILEPATH=${itk_build_dir} /Wrapping/Generators/SwigInterface/swiglinux-${SWIG_VERSION} /share/swig/${SWIG_VERSION} "
116+ if $use_skbuild_classic ; then
117+ ${PYBIN} /python setup.py clean
118+ ${PYBIN} /python setup.py bdist_wheel --build-type Release -G Ninja -- \
119+ -DITK_DIR:PATH=${itk_build_dir} \
120+ -DWRAP_ITK_INSTALL_COMPONENT_IDENTIFIER:STRING=PythonWheel \
121+ -DCMAKE_CXX_COMPILER_TARGET:STRING=$( uname -m) -linux-gnu \
122+ -DCMAKE_INSTALL_LIBDIR:STRING=lib \
123+ -DBUILD_TESTING:BOOL=OFF \
124+ -DPython3_EXECUTABLE:FILEPATH=${Python3_EXECUTABLE} \
125+ -DPython3_INCLUDE_DIR:PATH=${Python3_INCLUDE_DIR} \
126+ ${CMAKE_OPTIONS} \
127+ || exit 1
128+ else
129+ py_minor=$( echo $version | cut -d ' -' -f 1 | cut -d ' 3' -f 2)
130+ wheel_py_api=" "
131+ if test $py_minor -ge 11; then
132+ wheel_py_api=cp3$py_minor
133+ fi
134+ ${PYBIN} /python -m build \
135+ --verbose \
136+ --wheel \
137+ --outdir dist \
138+ --no-isolation \
139+ --skip-dependency-check \
140+ --config-setting=cmake.define.ITK_DIR:PATH=${itk_build_dir} \
141+ --config-setting=cmake.define.WRAP_ITK_INSTALL_COMPONENT_IDENTIFIER:STRING=PythonWheel \
142+ --config-setting=cmake.define.CMAKE_CXX_COMPILER_TARGET:STRING=$( uname -m) -linux-gnu \
143+ --config-setting=cmake.define.CMAKE_INSTALL_LIBDIR:STRING=lib \
144+ --config-setting=cmake.define.PY_SITE_PACKAGES_PATH:PATH=" ." \
145+ --config-setting=wheel.py-api=$wheel_py_api \
146+ --config-setting=cmake.define.BUILD_TESTING:BOOL=OFF \
147+ --config-setting=cmake.define.Python3_EXECUTABLE:FILEPATH=${Python3_EXECUTABLE} \
148+ --config-setting=cmake.define.Python3_INCLUDE_DIR:PATH=${Python3_INCLUDE_DIR} \
149+ ${CMAKE_OPTIONS} \
150+ || exit 1
111151 fi
112- ${PYBIN} /python setup.py clean
113- ${PYBIN} /python setup.py bdist_wheel --build-type Release -G Ninja -- \
114- -DITK_DIR:PATH=${itk_build_dir} \
115- -DWRAP_ITK_INSTALL_COMPONENT_IDENTIFIER:STRING=PythonWheel \
116- -DCMAKE_CXX_COMPILER_TARGET:STRING=$( uname -m) -linux-gnu \
117- -DCMAKE_INSTALL_LIBDIR:STRING=lib \
118- -DBUILD_TESTING:BOOL=OFF \
119- -DPython3_EXECUTABLE:FILEPATH=${Python3_EXECUTABLE} \
120- -DPython3_INCLUDE_DIR:PATH=${Python3_INCLUDE_DIR} \
121- ${swig_args} ${CMAKE_OPTIONS} \
122- || exit 1
123152done
124153
125154# Convert list of excluded libs in --exclude_libs to auditwheel --exclude options
130159sudo ${Python3_EXECUTABLE} -m pip install auditwheel
131160for whl in dist/* linux* $( uname -m) .whl; do
132161 auditwheel repair ${whl} -w /work/dist/ ${AUDITWHEEL_EXCLUDE_ARGS}
133- rm ${whl}
162+ if $use_skbuild_classic ; then
163+ rm ${whl}
164+ fi
134165done
135166
136167if compgen -G " dist/itk*-linux*.whl" > /dev/null; then
0 commit comments