Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

MIT License Platform C++ CMake Toolchain vcpkg

Degoras HelloWorlds

Minimal C++ projects, one per third-party library, that prove a Degoras development drive actually works.


About The Project

Each project links one library, loads it, uses it for something real and prints what it found.

They are not tutorials and they are not a test suite. They exist because "the port installed successfully" and "the library works" are different claims, and on a MinGW/UCRT64 toolchain the gap between them is where the time goes. A library can build clean, install clean, link clean and still fail at load time with an error that names nothing useful. These are the smallest programs that tell the two apart.

Built With

  • C++17, one CMakeLists.txt per project
  • CMake presets, shared once in dp-presets-common.json and inherited by every project
  • vcpkg for every dependency
  • MSYS2 UCRT64 for the toolchain

Getting Started

Prerequisites

A development drive generated by DrivEnv-Win, and a shell opened through that drive's own launcher.

This is not a formality. The shared presets refuse to configure unless five environment variables are set, and the launcher is what sets them:

Variable What it points at
MINGW_ROOT the UCRT64 toolchain, which supplies cmake, ninja, g++ and gdb
VCPKG_ROOT the vcpkg checkout whose toolchain file is used
VCPKG_DEFAULT_TRIPLET the target triplet, also used as the install subdirectory
DEVSYSTEM_BUILDTREES where builds go, outside the source tree
DEVSYSTEM_DEPLOYS where installs go, in the vcpkg prefix shape

⚠️ Running these from an ordinary shell is worse than failing. The build may succeed and pick up another environment's DLLs, and the result shows up much later as 0xC0000139, "entry point not found", which reads like a broken build rather than a mixed one.

Installation

Clone into the drive's workspace directory:

cd $DEVSYSTEM_WORKSPACE
git clone https://github.com/DegorasProjectTeam/DegorasHelloWorlds.git

Usage

From any project's own directory:

cmake --preset dp-ucrt64-deb
cmake --build $DEVSYSTEM_BUILDTREES/HelloWorldMongoC/dp-ucrt64-deb

Or in one step, since every project also defines workflow presets:

cmake --workflow --preset dp-ucrt64-deb
Preset Purpose
dp-ucrt64-deb Debug
dp-ucrt64-rel Release
qtcreator-dp-ucrt64-deb Debug, with the Qt Creator kit and debugger wired up
qtcreator-dp-ucrt64-rel Release, same

CMakeUserPresets.json is deliberately not committed. It hard-codes a drive letter and a triplet, so a shared one is wrong for everybody except whoever committed it.

Verifying all of them at once

./verify_all.sh

Configures, builds and runs every project in both Debug and Release, then prints one table: which failed at cmake, which at build, which at execution. The Qt Creator presets are skipped -- they configure the same targets and exist only to hand Qt Creator a kit.

Three of these open a window and never exit, so every binary gets a deadline (RUN_TIMEOUT, 20 s by default): exiting before it means the exit code decides, still running at it counts as a pass recorded as gui, because reaching a live event loop is what we wanted to prove. A crash before the deadline is still a failure.

Per-step logs land under $DEVSYSTEM_BUILDTREES/_verify_helloworlds. The script exits non-zero if anything failed.

A run on a drive without unofficial-qwt installed looks like this, and is correct:

  passed                 20 of 22
    of those, gui        2
  failed at cmake        2
  failed at build        0
  failed at run          0

CMAKE:
  HelloWorldQwt [deb]
  HelloWorldQwt [rel]

The projects

Project Links What it demonstrates
HelloWorldC++ nothing The toolchain itself, with no dependency at all
HelloWorldVcpkg fmt That the vcpkg toolchain file is wired up and a port resolves
HelloWorldSpdlog spdlog, nlohmann_json Logging, and two header-mostly libraries coexisting
HelloWorldMongoC mongoc, nlohmann_json The MongoDB C driver: BSON, Extended JSON, and CRUD
HelloWorldMongoCxx mongocxx, bsoncxx, nlohmann_json The same ground through the C++ driver
HelloWorldFlatbuffers flatbuffers Schema compilation, in-place reads, verification, JSON
HelloWorldProtobuf protobuf Code generation, serialisation, round-trip and reflection
HelloWorldOpenCV OpenCV, Qt6 OpenCV on UCRT64, and the cv::Mat to QImage bridge
HelloWorldQtMV Qt6 Qt's model/view separation, with a .ui file
HelloWorldQwt Qt6, unofficial-qwt Static and animated Qwt plots
HelloWorldDDS fastdds eProsima Fast DDS participant lifecycle. Read its header first

Two that need reading before running

The MongoDB examples run without a database, on purpose. Each splits into an offline phase that always runs and checks its own results — document build and iteration, BSON to Extended JSON in every mode and back, malformed input rejected, ObjectId, URI parsing — and an online phase, every CRUD operation, that is skipped when no server answers. The probe uses a short server-selection timeout, so a missing mongod costs under a second rather than the default thirty seconds per operation.

The exit code means something: zero only if every check that ran passed. A skipped online phase is not a failure; a failed offline check is. There is no in-process substitute for a real server, so if you want the online phase, start a mongod on 27017. The embedded library was discontinued and libmongoc's mock server lives in the driver's own test suite and is never installed.

The Fast DDS example does not build out of the box today. Its overlay port was retired from DrivEnv-Win because DDS is not currently in use, and the baseline vcpkg port does not compile on MinGW at all — it redefines clock_gettime, which mingw-w64 already declares. The example's header explains how to restore the overlay from git history and what the five local deltas were for. It also corrects an earlier conclusion in this repository's own history: Fast DDS pub/sub does work on this toolchain, when the library is built statically.

Portability

Windows and MinGW/UCRT64 today, and only that. The C++ itself is ordinary and portable, but the build is not: the presets pin a UCRT64 toolchain, a vcpkg triplet and a Windows-shaped set of environment variables, and nothing here has been configured or run anywhere else.

Unix and ARM are intended, not claimed. They will most likely arrive through a container image rather than through more presets, which should simplify the whole arrangement rather than complicate it.

Layout

DegorasHelloWorlds/
    dp-presets-common.json     shared presets, included by every project
    dp-qt-deploy.cmake         Qt deployment helper for the Qt-based projects
    HelloWorld<Library>/       one directory per project

The nesting is deliberate: the repository root holds only the README, the licence and the ignore rules, and everything buildable sits one level down.

License

Distributed under the MIT License. See LICENSE for more information.

Author / Contact

Degoras Project Team

Ángel Vera Herrera — Real Instituto y Observatorio de la Armada (ROA) — avera@roa.es

Project link: https://github.com/DegorasProjectTeam/DegorasHelloWorlds

Acknowledgments

(back to top)

About

Minimal C++ projects, one per third-party library, that prove a Degoras development drive actually works.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages