Skip to content

Ship the cvcgl-examples demos with their UI (imgui in the closure) - #313

Merged
transfix merged 2 commits into
masterfrom
fix/cvcgl-examples-imgui-ui
Sep 3, 2026
Merged

transfix merged 2 commits into
masterfrom
fix/cvcgl-examples-imgui-ui

Conversation

@transfix

@transfix transfix commented Sep 2, 2026

Copy link
Copy Markdown
Owner

The problem

The published cvcgl-examples binaries ship with no UI at all.

imgui is simply absent from the recipe's closure, and cvcGL's imgui block
degrades silently: when find_library misses, ImGuiOverlay compiles to
inert stubs. The demos then build, run, pass the ABI smoke test and publish —
with every control panel they define compiled out, and nothing in the log
saying so.

The fix

recipe.yaml declare imgui (linux) as a build and runtime dep; cvc_revision 1 → 2
build.sh hard-fail when cvcGL configures without imgui
workflow install imgui from cvcpkg into its own prefix, joined to the examples step only
src/cvcGL/CMakeLists.txt make the imgui export relocatable

Why imgui is a runtime dep too

It is published shared-only, so libimgui.so is a load-time dep of the demo
binaries even though cvcGL itself is linked static into them. The demos'
INSTALL_RPATH of $ORIGIN/../lib resolves it out of a consumer's prefix —
the same path VTK/Boost already take.

Why a loud gate

This silent degradation is the whole reason UI-less demos shipped. imgui is
a declared dependency on linux, so a miss is a broken closure, not a soft
option — build.sh now reads CVC_IMGUI_LIBRARY back out of CMakeCache.txt
and fails the build rather than quietly publishing a UI-less demo. The wasm
column links its own static closure and is not covered.

Why a separate imgui prefix

cvcGL locates imgui with find_library, so putting imgui on the earlier
cvcgl SDK step's
prefix would bake this builder's absolute path into the
published cvcGLTargets.cmake. The prefixes stay separate so the SDK bundle
cannot regress.

Why the export split

cvcGL is a static archive, so an unguarded find_library result propagates
verbatim into the exported targets and breaks consumers on another machine with
"missing and no known rule to make it" — the exact trap the X11 comment
directly below already documents, and sidesteps by linking that one by name:

target_link_libraries(cvcGL PUBLIC
  "$<BUILD_INTERFACE:${CVC_IMGUI_LIBRARY}>"
  "$<INSTALL_INTERFACE:imgui>")

The export now carries a relocatable -limgui plus include/imgui, matching
the bundle's real layout. (Note the include dir was already
BUILD_INTERFACE-wrapped while the library was not — an inconsistency this
settles.)

Verification

Confirmed against the real imgui 1.92.9+cvc.1 linux bundle that the block's
three gates are all satisfiable — this is what makes the UI actually appear
rather than the gate merely turning red:

include/imgui/imgui.h                        <- find_path PATH_SUFFIXES imgui
include/imgui/backends/imgui_impl_opengl3.cpp <- the EXISTS() gate
lib/libimgui.so                              <- find_library NAMES imgui

cvcpkg validate cvcpkg/recipes/cvcgl-examples passes; bash -n and workflow
YAML parse clean.

The published cvcgl-examples binaries have no UI at all. imgui is absent
from the recipe's closure, and cvcGL's imgui block degrades silently: when
find_library misses, ImGuiOverlay compiles to inert stubs, so the demos
build, run, pass the ABI smoke test and publish -- with every control panel
the demos define compiled out, and nothing in the log saying so.

Four changes:

- recipe: declare imgui (linux) as both a build and a runtime dependency.
  It is published shared-only, so libimgui.so is a load-time dep of the
  demo binaries even though cvcGL itself is linked static into them; the
  demos' INSTALL_RPATH of $ORIGIN/../lib resolves it out of a consumer's
  prefix, the same path VTK/Boost already take. cvc_revision 1 -> 2, since
  a recipe change without a bump no-ops on published catalogs.

- build.sh: fail loudly when cvcGL configures without imgui, reading
  CVC_IMGUI_LIBRARY back out of CMakeCache.txt. imgui is a declared
  dependency on linux, so a miss is a broken closure rather than a soft
  option -- this is the gate whose absence let UI-less demos ship. The
  wasm column links its own static closure and is not covered.

- workflow: install imgui from cvcpkg (never apt) into its OWN prefix and
  join it to CVC_DEPS_PREFIX for the examples step only. The separation is
  deliberate: cvcGL locates imgui with find_library, so an imgui on the
  earlier "cvcgl" SDK step's prefix would bake this builder's absolute
  path into the published cvcGLTargets.cmake.

- src/cvcGL/CMakeLists.txt: split the imgui link and include into
  BUILD_INTERFACE/INSTALL_INTERFACE. cvcGL is a static archive, so an
  unguarded find_library result propagates verbatim into the exported
  targets and breaks consumers on another machine with "missing and no
  known rule to make it" -- the trap the X11 comment directly below
  already documents and sidesteps by linking that one by name. The export
  now carries a relocatable -limgui plus include/imgui, matching the
  bundle's real layout. Keeping the prefixes separate above means the SDK
  cannot regress even if this guard is later lost.
@transfix
transfix merged commit 0be06dd into master Sep 3, 2026
13 checks passed
@transfix
transfix deleted the fix/cvcgl-examples-imgui-ui branch October 29, 2026 20:53
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