TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 229 subscribers
Post #24117 18
Cross-Platform & Cross-Compile C++ action workflow build

Just sharing a practical GitHub Actions workflow for testing cross-platform and cross-compilation builds - something many (if not the most) C++ projects eventually need.

👉 View the full YAML workflow here

It’s part of a small demo project that integrates another open-source project -- Areg SDK.

A quick note about Areg SDK for context:
it provides its own internal CMake variables (AREG_*) to detect and configure target platforms, and these can be combined with standard CMake toolchain files for flexible cross-builds.

The YAML demonstrates both methods:

Example 1: Using a Toolchain File for ARM32

Install the compiler first (!!!):

- name: Install GNU 32-bit ARM compilers
run: sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf

Configure and build using a predefined toolchain file:

- name: Configure (ARM32 toolchain)
run: |
cmake -B ./product/cache/gnu-linux-arm32 \
-DCMAKETOOLCHAINFILE=${{github.workspace}}/toolchains/gnu-linux-arm32.cmake \
-DAREGEXTENDED:BOOL=OFF

- name: Build (ARM32)
run: cmake --build ./product/cache/gnu-linux-arm32 -j20

In this example, the project is configured in `./product/cache/gnu-linux-arm32`.
The build artifacts are generated in `./product/build/gnu-g++/linux-32-arm32-release-shared`, which follows Areg SDK’s *custom directory structure*. Your project may use a different layout.

**Example 2:** Using Areg SDK *Custom CMake Variables*

Same cross-build, but without a toolchain file:

- name: Configure (GNU on ARM32, shared)
run: cmake -B ./product/cache/gnu-arm-so \
-DAREG
COMPILERFAMILY=gnu \
-DAREG
PROCESSOR=arm

- name: Build (GNU on ARM32, shared)
run: cmake --build ./product/cache/gnu-arm-so -j20

The workflow also includes additional configurations (x86, x86_64, ARM64). Sharing it as a ready-to-use reference for anyone building portable C++ projects that need to run across multiple architectures.

P.S. If this isn’t the right sub, feel free to point me to a better one.

https://redd.it/1ogm11y
@r_cpp
GitHub areg-sdk-demo/.github/workflows/cmake-linux-cc.yml at main · aregtech/areg-sdk-demo This repository demonstrates the integration of AREG framework in the projects. - aregtech/areg-sdk-demo
More from @r_cpp
  1. Oct 14, 2026I tested whether a coding agent would use C++23 ranges without being told Blog post: https…
  2. Oct 14, 2026C++ futures part 1: The mental model https://devblogs.microsoft.com/oldnewthing/20261012-0…
  3. Oct 14, 2026C++ futures part 2: The mental model for std::promise, std::packaged_task https://devblogs…
  4. Oct 12, 2026[Release] slick-logger v2.2.0 — Lock-free asynchronous C++20 logging with multi-process sh…
  5. Oct 12, 2026Cheap alternative to reboot parameters (nohz, rcu, isolcpus) for stable benchmarks When no…
  6. Oct 12, 2026This C++ drama is crazy - Adobe votes no https://www.youtube.com/watch?v=DEqx_NMMH9Q https…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →