Skip to content

Fix standalone build and add examples to GitHub Actions CI - #10

Merged
eyck merged 5 commits into
Minres:mainfrom
ripopov:fix/stanalone-examples-build
Jun 11, 2026
Merged

Fix standalone build and add examples to GitHub Actions CI#10
eyck merged 5 commits into
Minres:mainfrom
ripopov:fix/stanalone-examples-build

Conversation

@ripopov

@ripopov ripopov commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Examples did not work out-of-the box of freshly installed Ubuntu 26.
Add examples build & run to CI.
Since this repo sees only occasional activity, the extra compute is unlikely to meaningfully accelerate climate change.

ripopov added 5 commits June 10, 2026 23:35
The top-level fetch builds fmt with FMT_INSTALL off, leaving fmt and
fmt-header-only out of any export set. Because lwtr (and the scp reporting
target) are static libraries, exporting them wraps their fmt dependency in
$<LINK_ONLY:>, which requires fmt to be in an export set. install(EXPORT)
then fails:

  install(EXPORT ...) includes target "lwtr" which requires target
  "fmt-header-only" that is not in any export set.

This configures cleanly in environments where fmt is already installed
system-wide: find_package() yields an imported target, which is excluded
from the export-set check. Where fmt is absent it is fetched and built from
source as a normal (non-exported) target, triggering the error.

Force FMT_INSTALL ON so a from-source fmt is exportable, and add
FIND_PACKAGE_ARGS to prefer an installed fmt when present.
The binary FTR backend (lwtr_ftr.cpp, lz4_streambuf.cpp) and thus
tx_ftr_init are only compiled when a lz4::lz4 target exists. Relying on a
system lz4 is unreliable across environments: Ubuntu's liblz4-dev ships no
CMake config, and upstream/other distributions export the target as
LZ4::lz4 (capital), so the project's find_package(lz4)/lz4::lz4 check fails
and the examples fail to link with undefined reference to tx_ftr_init.

Fetch lz4 (v1.10.0) from source like the other dependencies so the FTR
backend builds everywhere with nothing preinstalled. lz4 builds a static
library as a subproject, so force PIC for linking into the shared lwtr
library, disable its CLI, and alias the unified target to lz4::lz4.
The bundled SystemC (3.0.2) defines no _ns user-defined literal, so 10_ns
fails with 'unable to find numeric literal operator'. Use an explicit
sc_core::sc_time(10, SC_NS) instead.
- replace unavailable 10_ns literal with sc_time(10, SC_NS)
- declare issue_time from sc_time_stamp() after wait()
- use record_event_at_time for timestamped events
- use end_tx_delayed for delayed memory tx end
- enable events on tx_generators (with_events=true)
- add enable_testing() so the existing add_test() entries in
  example/CMakeLists.txt are registered with CTest
- add ci-examples.yml workflow (C++17/20 matrix) that builds the
  three example targets and runs ctest scoped to build/example
  (unscoped ctest would also run failing tests from the fetched
  SystemC-CCI dependency)

@eyck eyck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eyck
eyck merged commit 7861a98 into Minres:main Jun 11, 2026
4 checks passed
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.

2 participants