I couldn't find a simple C++ CMake/Conan build setup with continuous integration that uses the latest compilers and builds a shippable application on mobile and desktop platforms so I made one! And in the process, I also made StackBlox. I even did a CppCon lightning talk.
Get StackBlox now (it's free and ad-free)
If you want to build from source, download the latest versions of the following tools:
- CMake
- Conan (Run
pip install conan --upgrade
) - Ninja (for Linux and Android builds)
- Android NDK
- Android SDK tools (install Android Studio for the full IDE experience)
- On Windows: Visual Studio
- On Linux: gcc
- On macOS: Xcode
Then, Clone this repo
The whole development workflow is driven by CMake presets to make it easy to select all the supported configurations! Presets are defined in CMakePresets.json. In the preset names, you'll see references to the platform name, build configuration, and Iwyu
, which runs the Include What You Use check.
- Open the CMake GUI
- Click Browse Source... and navigate to the repo
- Click the Preset dropdown and select the platform you want to build
- Click Generate
- For Visual Studio and Xcode, click Open Project to launch the project in the IDE. For Android, the button is grayed out, but you can open Android Studio and select the project in AndroidStudio/StackBlox from the CMake binary folder.
- Build from the IDE as you normally would
- At the command line,
cd
to the repo - Run
cmake --workflow --list-presets
to see available presets - Run
cmake --workflow --preset=<preset-name>
to run the full CMake workflow for that build (example: macOS build/test/packaging with release build config would becmake --workflow --preset=macosRelease
).
The build process is automated through GitHub Actions, defined in the main.yml file. Nothing fancy here, it runs CMake's configure, build, test, and package commands and archives the results.
All the builds run on the Windows, Linux, and macOS build environments provided by GitHub. More information at https://github.com/actions/runner-images.
The Conan packages used in StackBlox are listed in conanfile.py and originate from ConanCenter. For more details, check out https://github.com/conan-io/conan-center-index.