Skip to content

feat: drop vendored libiimod, consume from libcvc-deps - #63

Merged
transfix merged 15 commits into
masterfrom
feat/use-libcvc-deps-libiimod
May 18, 2026
Merged

transfix merged 15 commits into
masterfrom
feat/use-libcvc-deps-libiimod

Conversation

@transfix

Copy link
Copy Markdown
Owner

What

Drops the in-tree copy of libiimod under src/cvc/libiimod/ and consumes it from the libcvc-deps distribution instead.

For years libcvc has vendored a curated subset of IMOD's image I/O library (libiimod/ + a few libcfshr/ files). That copy:

  • duplicates ~11.5 k lines of upstream C inside our repository,
  • sits at 0 % coverage (3,864 uncovered lines, ~10 pp of our headline coverage number),
  • can't be patched without diverging from upstream, and
  • never gets updated.

libcvc-deps PR #6 promotes libiimod into the dependency bundle, built from the upstream LabShare-Archive/IMOD repo (archived/read-only) at a pinned SHA. The bundle now ships libiimod.a / iimod.lib plus headers under include/libiimod/, and exports a libiimod::iimod imported target whose PUBLIC properties carry the include directory and the NOTIFFLIBS compile definition.

Changes

  • Deletes src/cvc/libiimod/ entirely (27 files, −11,516 LoC).

  • Replaces the inline source/include lists in src/cvc/CMakeLists.txt with:

    if(CVC_USING_IMOD_MRC)
      find_package(libiimod CONFIG REQUIRED)
      add_compile_definitions(CVC_USING_IMOD_MRC)
      list(APPEND CVC_LINK_LIBS libiimod::iimod)
    endif()

    CVC_USING_IMOD_MRC is still emitted because mrc_io.cpp guards its libiimod code paths on it. NOTIFFLIBS and the include/libiimod/ include dir come from the imported target.

  • Updates README.md to drop the libiimod/ entry from the src/cvc/ tree diagram.

  • Adds a status note to docs/roadmap/COVERAGE_IMPROVEMENT_PLAN.md explaining that Phase-3 libiimod scope-out is now mechanically achieved by removing the directory.

Local validation

  • Built libcvc-deps's third-party/libiimod standalone into /tmp/libiimod-prefix.
  • Configured this branch with -DCMAKE_PREFIX_PATH=/tmp/libiimod-prefix -DCVC_USING_IMOD_MRC=ON. find_package(libiimod CONFIG REQUIRED) succeeds, mrc_io.cpp's compile command picks up -DCVC_USING_IMOD_MRC, -DNOTIFFLIBS, and -I/tmp/libiimod-prefix/include/libiimod from the imported target.
  • Full libcvc.so.3.0 build succeeds with no libiimod-related warnings or errors. libiimod is statically linked into the shared library; no new runtime NEEDED entries are introduced.

Dependencies / ordering

This PR depends on libcvc-deps shipping a release that includes libiimod (libcvc-deps PR #6). Do not merge until that release is tagged and the libcvc-deps fetch action is pointed at it; otherwise the CI configure step will fail with find_package(libiimod CONFIG REQUIRED).

Diff size

 31 files changed, 17 insertions(+), 11533 deletions(-)

transfix added 4 commits May 13, 2026 01:28
libcvc has carried a curated subset of IMOD's image I/O library
(libiimod + a few libcfshr files) directly under src/cvc/libiimod/
for years. That copy

  * duplicates ~11.5k lines of upstream C in our source tree,
  * is included in our code-coverage stats (it sat at 0 %, 3,864
    uncovered lines, dragging the headline number down by ~10pp),
  * cannot be patched without diverging from upstream,
  * never gets updated.

libcvc-deps PR transfix/libcvc-deps#6 promotes libiimod into the
dependency bundle, built from the upstream LabShare-Archive/IMOD
repository at a pinned commit
(8c592ce4cfae5e0748314da56d73334de7465776). The bundle now ships
libiimod.a (or iimod.lib) plus headers under include/libiimod/ and
exports a libiimod::iimod CMake imported target whose PUBLIC
properties carry both the include directory and the NOTIFFLIBS
compile definition.

This change:

  * Deletes src/cvc/libiimod/ entirely (27 files, ~11.5k LoC).
  * Replaces the inline source/include lists in
    src/cvc/CMakeLists.txt with
        find_package(libiimod CONFIG REQUIRED)
        list(APPEND CVC_LINK_LIBS libiimod::iimod)
    when CVC_USING_IMOD_MRC is ON. The CVC_USING_IMOD_MRC
    compile definition is still emitted because mrc_io.cpp guards
    its libiimod code paths on it.
  * Updates README.md to drop the libiimod/ entry from the
    src/cvc/ tree diagram.
  * Adds a status note to
    docs/roadmap/COVERAGE_IMPROVEMENT_PLAN.md explaining the
    Phase-3 libiimod scope-out is now mechanically achieved by
    removal from this repository.

Locally validated: libcvc-deps third-party/libiimod installed to
/tmp/libiimod-prefix, then libcvc configured with
  -DCMAKE_PREFIX_PATH=/tmp/libiimod-prefix -DCVC_USING_IMOD_MRC=ON
and built clean to libcvc.so.3.0. The compile command for
mrc_io.cpp picks up -DCVC_USING_IMOD_MRC, -DNOTIFFLIBS, and
-I.../include/libiimod from the imported target with no further
configuration on the libcvc side.

This PR depends on libcvc-deps shipping a release that includes
libiimod (libcvc-deps PR #6). It should not be merged until that
release is available.
…s-libiimod

# Conflicts:
#	.github/workflows/ci.yml
@transfix transfix closed this May 14, 2026
@transfix transfix reopened this May 14, 2026
transfix added 11 commits May 14, 2026 14:47
…eftover)

Resolving the merge conflict between feat/use-libcvc-deps-libiimod and
master left two steps with id: libcvc-deps-windows in the Windows job:
the early one ('Windows speedup', uses matrix.build_type) and a later
duplicate from HEAD (uses Release). GitHub rejected this as an invalid
workflow file (duplicate step id), causing every push-event run to
fail with 0 jobs and no pull_request:synchronize run to fire at all.

Drop the late duplicate; the early step already runs before vcpkg
cache restore and gates all downstream fallback steps via
steps.libcvc-deps-windows.outputs.path.
v1.0.1 macOS bundles shipped a broken VTKPython-targets.cmake that
referenced .cpython-*-darwin.so files not included in the bundle,
causing consumer configure-time failure:

  CMake Error at .../VTKPython-targets.cmake:464:
    The imported target 'VTK::vtkCommonCorePython' references the file
    '.../lib/python3.14/site-packages/vtkmodules/vtkCommonCore.cpython-314-darwin.so'
    but this file does not exist.

v1.0.2 builds VTK with -DVTK_WRAP_PYTHON=OFF (we don't consume VTK's
Python bindings anyway). Linux and Windows bundles were also rebuilt
identically.
…r gtest discovery and ctest

gtest_discover_tests' default POST_BUILD mode runs each test executable at build time to enumerate test names. On Windows the consumed DLLs (libcvc-deps' Boost/HDF5/FFTW/Qt6/VTK plus libcvc itself) are not on PATH during 'cmake --build', so MSBuild's spawned discovery process exits with STATUS_DLL_NOT_FOUND (0xc0000135), and CMake aborts the build with 'GoogleTestAddTests.cmake:132: Error running test executable. Result: Exit code 0xc0000135'.

Fix by prepending the deps bin dir, the aqt Qt6 bin dir, and the per-config build/bin output dir to PATH in both the Build and Run tests steps (the latter so the tests themselves can launch). Switch Run tests on Windows from bash to pwsh so PATH plumbing is consistent with the rest of the windows packaging job.
vcpkg ships Debug DLLs at debug/bin/ with the same filename as their Release counterparts at bin/ (e.g. both contain hdf5.dll, boost_thread-*-mt-*.dll). When PATH lists bin/ first, a Debug build loads Release DLLs against a Debug import lib, producing CRT/iterator-debug-level mismatches that surface as SEH access violations (0xc0000005) inside libcvc::volume::write (CvcRawRoundTrip) and 'unknown C++ exception' failures inside H5::H5File constructor calls (13 HDF5Test failures).

For Debug builds prepend $depsPath\\debug\\bin; for Release builds prepend $depsPath\\bin. Never mix.
@transfix
transfix merged commit a9ee141 into master May 18, 2026
13 checks passed
@transfix
transfix deleted the feat/use-libcvc-deps-libiimod branch May 18, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant