Skip to content

Commit 79695e7

Browse files
hjmjohnsonclaude
andcommitted
DOC: Add conda-forge staged-recipes submission for libitk-wrapping
Add conda-forge-ready recipe files (meta.yaml, build.sh, bld.bat) for the libitk-wrapping package. These are prepared for submission to conda-forge/staged-recipes once the ITK install rule changes are merged upstream and an ITK 6 release is tagged. The recipe builds ITK C++ with Python wrapping using conda-forge system libraries and includes the CMAKE_FIND_ROOT_PATH settings required by conda-build cross-compilation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e6cadad commit 79695e7

4 files changed

Lines changed: 255 additions & 0 deletions

File tree

conda-forge/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# conda-forge Submission
2+
3+
This directory contains recipe files for submitting ITK packages to conda-forge
4+
via [staged-recipes](https://github.com/conda-forge/staged-recipes).
5+
6+
## Packages
7+
8+
### libitk-wrapping
9+
10+
A conda package containing ITK C++ libraries with full Python wrapping
11+
artifacts (SWIG interfaces, CastXML outputs, compiled Python modules).
12+
This package enables building ITK Python wheels and remote module wheels
13+
without recompiling ITK from source.
14+
15+
### Submission Process
16+
17+
1. Fork [conda-forge/staged-recipes](https://github.com/conda-forge/staged-recipes)
18+
2. Copy `libitk-wrapping/` into `recipes/libitk-wrapping/`
19+
3. Open a PR against staged-recipes
20+
4. Address conda-forge review feedback
21+
5. Once merged, a feedstock will be created automatically
22+
23+
### Updating the existing libitk feedstock
24+
25+
The existing [libitk-feedstock](https://github.com/conda-forge/libitk-feedstock)
26+
(currently at v5.4.5) should be updated to ITK 6 separately. The `libitk-wrapping`
27+
package will depend on `libitk-devel` once both are at ITK 6.
28+
29+
## Environment Variables for Custom Builds
30+
31+
When building from a non-default ITK branch (e.g., for PR testing):
32+
33+
```bash
34+
export ITK_GIT_URL="https://github.com/BRAINSia/ITK.git"
35+
export ITK_GIT_TAG="itk-conda-pythonpackage-support"
36+
```
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
@echo off
2+
setlocal enabledelayedexpansion
3+
4+
set BUILD_DIR=%SRC_DIR%\..\build
5+
mkdir %BUILD_DIR%
6+
cd %BUILD_DIR%
7+
8+
cmake ^
9+
-G "Ninja" ^
10+
%CMAKE_ARGS% ^
11+
-D BUILD_SHARED_LIBS:BOOL=ON ^
12+
-D BUILD_TESTING:BOOL=OFF ^
13+
-D BUILD_EXAMPLES:BOOL=OFF ^
14+
-D CMAKE_BUILD_TYPE:STRING=Release ^
15+
-D "CMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX%" ^
16+
^
17+
-D ITK_WRAP_PYTHON:BOOL=ON ^
18+
-D ITK_WRAP_DOC:BOOL=ON ^
19+
-D ITK_LEGACY_SILENT:BOOL=ON ^
20+
-D CMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON ^
21+
^
22+
-D ITK_WRAP_unsigned_short:BOOL=ON ^
23+
-D ITK_WRAP_double:BOOL=ON ^
24+
-D ITK_WRAP_complex_double:BOOL=ON ^
25+
-D "ITK_WRAP_IMAGE_DIMS:STRING=2;3;4" ^
26+
^
27+
-D WRAP_ITK_INSTALL_COMPONENT_IDENTIFIER:STRING=PythonWheel ^
28+
-D WRAP_ITK_INSTALL_COMPONENT_PER_MODULE:BOOL=ON ^
29+
^
30+
-D ITK_USE_SYSTEM_EXPAT:BOOL=ON ^
31+
-D ITK_USE_SYSTEM_HDF5:BOOL=ON ^
32+
-D ITK_USE_SYSTEM_JPEG:BOOL=ON ^
33+
-D ITK_USE_SYSTEM_PNG:BOOL=ON ^
34+
-D ITK_USE_SYSTEM_TIFF:BOOL=ON ^
35+
-D ITK_USE_SYSTEM_ZLIB:BOOL=ON ^
36+
-D ITK_USE_SYSTEM_FFTW:BOOL=ON ^
37+
-D ITK_USE_SYSTEM_EIGEN:BOOL=ON ^
38+
-D ITK_USE_FFTWD:BOOL=ON ^
39+
-D ITK_USE_FFTWF:BOOL=ON ^
40+
^
41+
-D ITK_BUILD_DEFAULT_MODULES:BOOL=ON ^
42+
-D Module_ITKReview:BOOL=ON ^
43+
-D Module_ITKTBB:BOOL=ON ^
44+
-D Module_MGHIO:BOOL=ON ^
45+
-D Module_ITKIOTransformMINC:BOOL=ON ^
46+
-D Module_GenericLabelInterpolator:BOOL=ON ^
47+
-D Module_AdaptiveDenoising:BOOL=ON ^
48+
^
49+
-D ITK_USE_KWSTYLE:BOOL=OFF ^
50+
-D "ITK_DEFAULT_THREADER:STRING=Pool" ^
51+
^
52+
"%SRC_DIR%"
53+
54+
if errorlevel 1 exit /b 1
55+
56+
cmake --build . --config Release
57+
if errorlevel 1 exit /b 1
58+
59+
cmake --install . --config Release
60+
if errorlevel 1 exit /b 1
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
# Build ITK C++ with Python wrapping for conda-forge.
5+
# Produces headers, shared libraries, CMake config, and all wrapping
6+
# metadata (SWIG .i/.idx/.mdx, Python stubs) needed by downstream
7+
# ITK remote modules.
8+
9+
BUILD_DIR="${SRC_DIR}/../build"
10+
mkdir -p "${BUILD_DIR}"
11+
cd "${BUILD_DIR}"
12+
13+
# TBB: enabled on Linux, disabled on macOS (conda TBB issues)
14+
use_tbb=ON
15+
if [ "$(uname)" = "Darwin" ]; then
16+
use_tbb=OFF
17+
fi
18+
19+
# Cross-compilation support
20+
if [[ "${CONDA_BUILD_CROSS_COMPILATION:-0}" == "1" ]]; then
21+
try_run_results="${RECIPE_DIR}/TryRunResults-${target_platform}.cmake"
22+
if [[ -f "${try_run_results}" ]]; then
23+
CMAKE_ARGS="${CMAKE_ARGS} -C ${try_run_results}"
24+
fi
25+
fi
26+
27+
cmake \
28+
-G "Ninja" \
29+
${CMAKE_ARGS} \
30+
-D BUILD_SHARED_LIBS:BOOL=ON \
31+
-D BUILD_TESTING:BOOL=OFF \
32+
-D BUILD_EXAMPLES:BOOL=OFF \
33+
-D CMAKE_BUILD_TYPE:STRING=Release \
34+
-D "CMAKE_INSTALL_PREFIX=${PREFIX}" \
35+
\
36+
-D ITK_WRAP_PYTHON:BOOL=ON \
37+
-D ITK_WRAP_DOC:BOOL=ON \
38+
-D ITK_LEGACY_SILENT:BOOL=ON \
39+
-D CMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON \
40+
\
41+
-D ITK_WRAP_unsigned_short:BOOL=ON \
42+
-D ITK_WRAP_double:BOOL=ON \
43+
-D ITK_WRAP_complex_double:BOOL=ON \
44+
-D "ITK_WRAP_IMAGE_DIMS:STRING=2;3;4" \
45+
\
46+
-D WRAP_ITK_INSTALL_COMPONENT_IDENTIFIER:STRING=PythonWheel \
47+
-D WRAP_ITK_INSTALL_COMPONENT_PER_MODULE:BOOL=ON \
48+
\
49+
-D ITK_USE_SYSTEM_EXPAT:BOOL=ON \
50+
-D ITK_USE_SYSTEM_HDF5:BOOL=ON \
51+
-D ITK_USE_SYSTEM_JPEG:BOOL=ON \
52+
-D ITK_USE_SYSTEM_PNG:BOOL=ON \
53+
-D ITK_USE_SYSTEM_TIFF:BOOL=ON \
54+
-D ITK_USE_SYSTEM_ZLIB:BOOL=ON \
55+
-D ITK_USE_SYSTEM_FFTW:BOOL=ON \
56+
-D ITK_USE_SYSTEM_EIGEN:BOOL=ON \
57+
-D ITK_USE_FFTWD:BOOL=ON \
58+
-D ITK_USE_FFTWF:BOOL=ON \
59+
\
60+
-D ITK_BUILD_DEFAULT_MODULES:BOOL=ON \
61+
-D Module_ITKReview:BOOL=ON \
62+
-D Module_ITKTBB:BOOL=${use_tbb} \
63+
-D Module_MGHIO:BOOL=ON \
64+
-D Module_ITKIOTransformMINC:BOOL=ON \
65+
-D Module_GenericLabelInterpolator:BOOL=ON \
66+
-D Module_AdaptiveDenoising:BOOL=ON \
67+
\
68+
-D ITK_USE_KWSTYLE:BOOL=OFF \
69+
-D NIFTI_SYSTEM_MATH_LIB= \
70+
-D GDCM_USE_COREFOUNDATION_LIBRARY:BOOL=OFF \
71+
-D "ITK_DEFAULT_THREADER:STRING=Pool" \
72+
\
73+
-D "CMAKE_FIND_ROOT_PATH:PATH=${PREFIX}" \
74+
-D "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE:STRING=ONLY" \
75+
-D "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY:STRING=ONLY" \
76+
-D "CMAKE_FIND_ROOT_PATH_MODE_PROGRAM:STRING=NEVER" \
77+
-D "CMAKE_FIND_ROOT_PATH_MODE_PACKAGE:STRING=ONLY" \
78+
-D "CMAKE_FIND_FRAMEWORK:STRING=NEVER" \
79+
-D "CMAKE_FIND_APPBUNDLE:STRING=NEVER" \
80+
-D "CMAKE_PROGRAM_PATH=${BUILD_PREFIX}" \
81+
\
82+
"${SRC_DIR}"
83+
84+
cmake --build . --config Release
85+
86+
cmake --install . --config Release
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{% set version = "6.0.0" %}
2+
{% set itk_tag = "v" + version %}
3+
4+
package:
5+
name: libitk-wrapping
6+
version: {{ version }}
7+
8+
source:
9+
url: https://github.com/InsightSoftwareConsortium/ITK/archive/{{ itk_tag }}.tar.gz
10+
# sha256: UPDATE_WITH_ACTUAL_HASH
11+
12+
build:
13+
number: 0
14+
skip: true # [win and vc<14]
15+
16+
requirements:
17+
build:
18+
- cmake >=3.26
19+
- ninja
20+
- {{ compiler('c') }}
21+
- {{ stdlib("c") }}
22+
- {{ compiler('cxx') }}
23+
host:
24+
- python
25+
- swig >=4.1
26+
- castxml
27+
- expat # [not win]
28+
- hdf5
29+
- libjpeg-turbo
30+
- libtiff
31+
- libpng # [not win]
32+
- eigen
33+
- zlib # [not win]
34+
- fftw
35+
- tbb-devel
36+
- doxygen
37+
run:
38+
- python
39+
- tbb
40+
- hdf5
41+
- fftw
42+
- libjpeg-turbo
43+
- libtiff
44+
- libpng # [not win]
45+
- expat # [not win]
46+
- zlib # [not win]
47+
48+
test:
49+
commands:
50+
# Verify CMake config is installed and discoverable
51+
- test -d $PREFIX/lib/cmake/ITK* # [not win]
52+
- if not exist %LIBRARY_LIB%\\cmake\\ITK* exit 1 # [win]
53+
# Verify Python wrapping modules are installed
54+
- test -f $PREFIX/lib/python*/site-packages/itk/__init__.py # [not win]
55+
# Verify wrapping metadata is installed
56+
- test -d $PREFIX/lib/cmake/ITK*/WrapITK/Typedefs # [not win]
57+
58+
about:
59+
home: https://itk.org
60+
license: Apache-2.0
61+
license_file:
62+
- LICENSE
63+
- NOTICE
64+
summary: >
65+
ITK C++ libraries with Python wrapping artifacts for building
66+
ITK Python wheels and remote module packages.
67+
dev_url: https://github.com/InsightSoftwareConsortium/ITK
68+
69+
extra:
70+
recipe-maintainers:
71+
- hjmjohnson
72+
- thewtex
73+
- blowekamp

0 commit comments

Comments
 (0)