Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,40 @@ API surface).

### Fixed

- **`bank_gui_qml_tests` did not compile.** The target compiles
`examples/common/testkit/testkit_main.cpp`, whose `#include
<testkit/log_level.hpp>` resolves only against the repository's `tests/`
directory, and it reached that directory through nothing: it links
`Catch2::Catch2` directly, where its sibling `bank_gui_tests` links
`morph_test_main` (which carries the include path publicly, via
`morph_test_log_level`). Reproduced on `26bfdb8f` with the `linux-everything`
preset, the only configuration that switches `MORPH_BUILD_BANK_GUI` on:
`fatal error: 'testkit/log_level.hpp' file not found`. The target now also
links `morph_test_log_level` — the same split, for the same reason, that
`morph_qt_tests` already uses for a suite that owns its own `main`. It
builds, its 32 assertions pass offscreen, and `--log-level` (the helper that
header declares) is live on it. No CI job configures
`MORPH_BUILD_BANK_GUI`, so this fix is not yet gated by anything; morph#605
covers that separately. morph#604.

- **The compiler-cache module told you to throw away your build directory, and
for a preset it did not even work.** When a launcher is already pinned in the
CMake cache, `cmake/CompileCache.cmake` advised "reconfigure with `--fresh`
to let this module choose instead". Reconfiguring the *same* directory with
`-UCMAKE_C_COMPILER_LAUNCHER -UCMAKE_CXX_COMPILER_LAUNCHER` removes exactly
the two entries the module's guard reads, reaches the same selection, and
leaves the build directory standing; `--fresh` deletes `CMakeFiles/` and,
unless the generator is re-passed, drops `CMAKE_GENERATOR` back to the
platform default (measured: a `-G Ninja` tree came back `Unix Makefiles`
with a stale `build.ninja` beside the new `Makefile`). And where the pin
comes from a **preset** — one of the three sources the message itself
names — `--fresh` clears nothing at all, because the preset re-applies its
`cacheVariables` on the very reconfigure `--fresh` triggers: the tree is
gone and the launcher is still pinned. The message now names `-U` first and
keeps `--fresh` with its actual cost and its actual limits. Behaviour is
unchanged; only the advice is. Measured on an isolated harness that does
nothing but `include()` the module. morph#592.

- **`equation()` no longer walks a shared derivation once per path.**
`EquationRenderer::assignLabels` was the one traversal without a visited set,
so a node reachable by *k* displayed paths was walked *k* times. Since the
Expand Down
29 changes: 28 additions & 1 deletion cmake/CompileCache.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,36 @@ if(DEFINED CMAKE_CXX_COMPILER_LAUNCHER OR DEFINED CMAKE_C_COMPILER_LAUNCHER)
# A build tree configured before this module existed carries the launcher of
# the day in its cache, and would keep it forever without a word about why
# the selection below never runs.
#
# -U before --fresh, because the guard above reads exactly two cache entries
# and -U deletes exactly those two: the reconfigure then falls through to
# the selection below without discarding the build directory. --fresh
# reaches the same place for a -D or an older configure, but it deletes
# CMakeFiles/ and, unless the generator is re-passed, drops CMAKE_GENERATOR
# back to the platform default on the way -- a `cmake -S . -B build --fresh`
# on a tree configured `-G Ninja` comes back a Makefile tree with a stale
# build.ninja still sitting in it.
#
# What -U saves is the configure state -- the populated _deps tree, the
# generator, generated sources, cached find_ results -- and not, note, the
# compiling: a launcher is part of every C/C++ compile command, so the next
# build recompiles those TUs whichever route got here. That is the honest
# size of it.
#
# The case that makes the ordering matter rather than merely cheaper is the
# "a preset" one this very message names, where --fresh does not work at
# all: the preset re-applies its cacheVariables on the reconfigure that
# --fresh triggers, so the launcher comes back pinned and the tree is gone
# for nothing. -U clears it there too, until the preset is next run.
# All of the above measured on an isolated harness, morph#592.
if(DEFINED CACHE{CMAKE_CXX_COMPILER_LAUNCHER} OR DEFINED CACHE{CMAKE_C_COMPILER_LAUNCHER})
message(STATUS "[cache] That value comes from the CMake cache (a -D, a preset, or an older configure); "
"reconfigure with --fresh to let this module choose instead.")
"to let this module choose instead, reconfigure the same build directory with "
"-UCMAKE_C_COMPILER_LAUNCHER -UCMAKE_CXX_COMPILER_LAUNCHER, which clears exactly those "
"two entries and leaves the build directory standing. (--fresh clears them too when they "
"came from a -D or an older configure, at the price of the whole build directory; when "
"they come from a preset it clears nothing, because the preset re-applies them on the "
"same reconfigure.)")
endif()
return()
endif()
Expand Down
8 changes: 8 additions & 0 deletions examples/bank/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,14 @@ if(MORPH_BUILD_TESTS)
${PROJECT_SOURCE_DIR}/examples/common)
target_link_libraries(bank_gui_qml_tests PRIVATE
bank_gui_lib Catch2::Catch2
# Our own main() owns the QGuiApplication, so this cannot link
# morph_test_main the way bank_gui_tests above does -- that
# library carries a `main` of its own. morph_test_log_level is
# the half of it that is wanted here: the --log-level helper
# testkit_main.cpp calls, and the tests/ include directory that
# puts <testkit/log_level.hpp> on the path. Same split, for the
# same reason, as morph_qt_tests (tests/qt/CMakeLists.txt).
morph_test_log_level
Qt6::Gui Qt6::Qml Qt6::Quick Qt6::QuickControls2)
target_compile_features(bank_gui_qml_tests PRIVATE cxx_std_23)
target_compile_definitions(bank_gui_qml_tests PRIVATE
Expand Down
Loading