Skip to content

build+core: move onto core-cpp v0.2.1 -- CPM, timers, base64, wakeup, and coroutines on core::async #805

Description

@christianparpart

Tracking issue for moving morph onto core-cpp v0.2.1, the shared C++23 foundation of the Contour Terminal projects. Everything lands as one branch, build/core-cpp, and one pull request, in this commit order. Each commit is green on its own.

  1. build: fetch dependencies with CPM instead of FetchContent
    • glaze, Catch2, doxygen-awesome-css and both Lightweight sites go through CPMAddPackage, using core-cpp's pinned cmake/CPM.cmake (0.40.8 plus its SHA-256).
    • cmake/DepCache.cmake is replaced by CPM's CPM_SOURCE_CACHE, which defaults to .cache/cpm.
    • ci.yml, wasm-ladder.yml and wasm-demo.yml cache that directory.
  2. core: TimeoutScheduler is one implementation over core-cpp's event-loop timers
    • core-cpp v0.2.1 comes in through CPM, linking core::base, core::async and core::net, plus core::platform natively.
    • TimeoutScheduler becomes one class:
      • natively, a thread running a core::net::PlatformLoop;
      • under single-threaded WebAssembly, a host-driven PlatformLoop with no thread.
    • The public API is unchanged. cancel() still releases the callback's captures immediately, and in the browser it now also retires the timer.
  3. net: base64 and the wakeup pipe come from core-cpp
    • morph/net/detail/base64.hpp is replaced by core::base64.
    • SocketServer's nested WakeupPipe is replaced by core::platform::Wakeup.
  4. Coroutine support on core::async, spec first (docs/spec/core/coroutines.md):
    • Completion<T> is awaitable, via operator co_await() &&;
    • morph::async::spawn and morph::async::delay;
    • Task-returning model handlers are driven on the model's strand through StrandCoroExecutor;
    • then tests, the implementation, and one bank or ladder action plus one GUI flow converted as a demonstration.

Constraints

  • morph's public surface stays header-only. Its consumers now also build core-cpp's static libraries, which the README and docs/ARCHITECTURE.md will say.
  • Single-threaded WebAssembly (Qt wasm_singlethread, emsdk 3.1.56) must keep working. wasm-ladder and wasm-demo then compile core-cpp's WebAssembly subset.
  • The wire protocol and the remote backends are unchanged.

Verification status. Nothing is measured yet; this issue is filed before the work starts. The pull request will carry a gate table covering:

  • Windows MSVC (vcpkg preset);
  • WSL GCC 15 and Clang;
  • the CI legs, including wasm-ladder and wasm-demo.

What would change this plan: a gap in core-cpp's API, or in its WebAssembly subset, that morph would have to work around. Any such gap is reported to core-cpp and fixed there, not patched here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions