Skip to content

Commit c5987c6

Browse files
authored
Merge pull request #32 from thewtex/module-resources
ENH: Export ITK build trees on Linux
2 parents 4b888f3 + c45c57c commit c5987c6

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ standalone-x64-build
88
downloads
99
venvs
1010
venv-*
11+
ITK-*
1112

1213
# Python
1314
*.py[cod]

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ if(ITKPythonPackage_SUPERBUILD)
150150
#-----------------------------------------------------------------------------
151151
# ITK: This project builds ITK and associated Python modules
152152

153-
set(ITK_BINARY_DIR ${CMAKE_BINARY_DIR}/ITK-build)
153+
set(ITK_BINARY_DIR "${CMAKE_BINARY_DIR}/ITK-build" CACHE PATH "ITK build directory")
154154

155155
message(STATUS "SuperBuild - ITK => Requires ITK-source-download")
156156
message(STATUS "SuperBuild - ITK_BINARY_DIR: ${ITK_BINARY_DIR}")
@@ -185,7 +185,7 @@ if(ITKPythonPackage_SUPERBUILD)
185185
)
186186
ExternalProject_Add_StepDependencies(ITK download ITK-source-download)
187187

188-
set(ITK_DIR ${CMAKE_BINARY_DIR}/ITK-build)
188+
set(ITK_DIR "${ITK_BINARY_DIR}")
189189

190190
message(STATUS "SuperBuild - ITK_DIR: ${ITK_DIR}")
191191
message(STATUS "SuperBuild - ITK[OK]")

scripts/internal/manylinux-build-wheels.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,20 @@ for PYBIN in "${PYBINARIES[@]}"; do
6767
echo "PYTHON_LIBRARY:${PYTHON_LIBRARY}"
6868

6969
${PYBIN}/pip install -r /work/requirements-dev.txt
70+
build_path=/work/ITK-$(basename $(dirname ${PYBIN}))-manylinux1_${arch}
71+
# Clean up previous invocations
72+
rm -rf $build_path
7073
${PYBIN}/python setup.py bdist_wheel --build-type MinSizeRel -G Ninja -- \
7174
-DITK_SOURCE_DIR:PATH=/work/standalone-${arch}-build/ITK-source \
75+
-DITK_BINARY_DIR:PATH=${build_path} \
7276
-DPYTHON_EXECUTABLE:FILEPATH=${PYTHON_EXECUTABLE} \
7377
-DPYTHON_INCLUDE_DIR:PATH=${PYTHON_INCLUDE_DIR} \
7478
-DPYTHON_LIBRARY:FILEPATH=${PYTHON_LIBRARY}
7579
${PYBIN}/python setup.py clean
80+
# Remove unecessary files for building against ITK
81+
find $build_path -name '*.cpp' -delete -o -name '*.xml' -delete
82+
rm -rf $build_path/Wrapping/Generators/castxml*
83+
find $build_path -name '*.o' -delete
7684
done
7785

7886
# Since there are no external shared libraries to bundle into the wheels
@@ -88,8 +96,8 @@ for PYBIN in "${PYBINARIES[@]}"; do
8896
echo "Skipping ${PYBIN}"
8997
continue
9098
fi
91-
${PYBIN}/pip install itk --user --no-cache-dir --no-index -f /work/dist
92-
${PYBIN}/pip install --user numpy
99+
sudo ${PYBIN}/pip install itk --no-cache-dir --no-index -f /work/dist
100+
sudo ${PYBIN}/pip install numpy
93101
(cd $HOME; ${PYBIN}/python -c 'from itk import ITKCommon;')
94102
(cd $HOME; ${PYBIN}/python -c 'import itk; image = itk.Image[itk.UC, 2].New()')
95103
(cd $HOME; ${PYBIN}/python -c 'import itkConfig; itkConfig.LazyLoading = False; import itk;')

0 commit comments

Comments
 (0)