- CMakePresets.json: add 'fast' preset (clang+lld+ccache) - .gitignore: generalize build/ to build*/, add CMakeUserPresets.json - CMakeUserPresets.json: untrack (conan-generated, now gitignored) - src/Core/Archives.h: remove redundant 'using basic_xml_iarchive::load_override' in xml_iarchive; caused ambiguous overload with clang (diamond inheritance) - src/Core/Object.cpp: remove invalid explicit instantiations of non-template virtual Object::serialize (GCC extension, clang rejects) - README.md, CLAUDE.md: document GCC and LLVM/clang build workflows Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
5.3 KiB
5.3 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Build Commands
# Activate the conda environment (required before any build/run)
export MAMBA_EXE="/home/share/micromamba/bin/micromamba"
export MAMBA_ROOT_PREFIX="/home/share/micromamba"
eval "$(/home/share/micromamba/bin/micromamba shell hook --shell bash)"
micromamba activate mutom
# Configure (from repo root, using Conan preset — uses Ninja + ccache)
cmake --preset conan-release
# Build everything
cmake --build build -j$(nproc)
# Build a specific target
cmake --build build --target gcompose -j$(nproc)
# Run tests
cmake --build build --target test
# or
ctest --test-dir build
# Run a single test binary (example)
./build/src/Core/testing/CoreTest
# Run the gcompose GUI app
./build/app/gcompose/gcompose
First-time setup (if build/ does not exist):
conan profile detect
conan install . --output-folder=build --build=missing
cmake --preset conan-release
Build acceleration (already configured)
- Ninja generator — used automatically via the conan default profile (
~/.conan2/profiles/default) - ccache — enabled via
CMAKE_CXX_COMPILER_LAUNCHER=ccache; cached rebuilds are nearly instant (~0.3s vs ~25s cold) - Clang 22 + lld profile available (
~/.conan2/profiles/fast) but blocked by template overload ambiguities insrc/Core/Archives.hthat need fixing for full compatibility
To reconfigure with the fast profile once Archives.h is fixed:
conan install . --output-folder=build --build=missing --profile=fast
cmake -B build -G Ninja -DCMAKE_TOOLCHAIN_FILE=build/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
Architecture
uLib is a C++ framework for Cosmic Muon Tomography (CMT), structured as layered shared libraries:
mutomCore → mutomMath → mutomDetectors → mutomGeant
↘
mutomVtk → gcompose (Qt6 GUI app)
mutomRoot
Core Object Model (src/Core/)
- All framework objects inherit from
uLib::Object - Property system:
Property<T>wraps member pointers with change notification viaPropertyChangedsignal - Signal/slot:
uLib::Object::connect(sender, &Sender::Signal, callback)— resembles Qt but works for non-QObject classes - Serialization: Boost archives (
xml_oarchive,text_oarchive,hrt_oarchive);hrp<T>marks fields as "human-readable properties" ObjectsContextis a container owning a list ofObject*pointers; signalsObjectAdded/ObjectRemoved
VTK Layer (src/Vtk/)
Puppet(inheritsuLib::Object): wraps a VTKvtkPropfor rendering. HasGetContent()returning the underlying domain object. Display-only properties are registered viaULIB_ACTIVATE_DISPLAY_PROPERTIESmacro.Viewport: base class managing the VTK renderer, picking, selection logic. Maintainsm_Puppetsvector andm_ObjectToPuppetmap.QViewport(inheritsQWidget+Viewport): Qt-embedded VTK widget. Emits Qt signalpuppetSelected(Puppet*)on click-selection viaOnSelectionChanged.vtkObjectsContext: wrapsObjectsContext, creating/destroyingPuppets as objects come/go. EmitsPuppetAdded/PuppetRemoved.- Display properties:
serialize_display()+display_properties_archiveregisters selectedhrp<T>fields asPropertyBase*in the puppet'sm_DisplayProperties.PropertyEditor::setObject(obj, displayOnly=true)shows only those.
gcompose GUI App (app/gcompose/src/)
MainPanel: top-level widget. OwnsContextPanel(left) andViewportPane(right). Wires together viewport↔context selection via signals.ContextPanel: tree view ofObjectsContext. EmitsobjectSelected(Object*). Contains an embeddedPropertiesPanel.PropertiesPanel: showsuLib::Objectproperties viaPropertyEditor.ViewportPane: embedsQViewport+ a slide-out "Display Properties" panel (PropertyEditorin display-only mode).PropertyEditor: populates widgets fromObject::GetProperties()(all) orPuppet::GetDisplayProperties()(display-only mode).
Selection Sync Flow
Viewport click → Viewport::SelectPuppet() → QViewport::OnSelectionChanged()
→ emit puppetSelected(p)
→ MainPanel: contextPanel->selectObject(p->GetContent()) [updates tree + PropertiesPanel]
→ MainPanel: firstPane->setObject(p) [updates Display Properties panel]
ContextPanel tree click → emit objectSelected(obj)
→ MainPanel: viewport->SelectPuppet(puppet) [visual selection in VTK]
→ MainPanel: firstPane->setObject(puppet) [updates Display Properties panel]
Key Patterns
- Two signal systems coexist: Qt signals (
Q_OBJECT,connect(...)) for GUI;uLib::Object::connect(...)for domain signals. - Display properties flow:
Puppet::serialize_display()→display_properties_archive→RegisterDisplayProperty()→PropertyEditor(displayOnly=true). Must callULIB_ACTIVATE_DISPLAY_PROPERTIESin the puppet constructor. - Puppet ↔ Object map:
Viewport::m_ObjectToPuppetallows lookup by domain object;vtkObjectsContext::GetPuppet(obj)does the same.