Building CherryGrove
This tutorial will help you build CherryGrove on your own machine. This is also a very good starting point for developing CherryGrove.
CherryGrove is still in a very early stage of development. Please check CherryGrove's currently supported platforms before you move on.
Introduction
CherryGrove currently only uses CMake as the build system. We use the following dependency management strategies:
- For header-only libraries, we use Git submodules and CMake's
target_include_directoriesto include them automatically. - For CMake compatible libraries, we use Git submodules and CMake's
add_subdirectorycommand to import it. - For some libraries, we download the source code, commit them into our repository, and build them together with our code. Get more information at Local Libraries Documentation.
- For the rest of the libraries, we use GitHub Actions to build them in advance and they need to be downloaded for CherryGrove to build.
Prerequisites
Git
Since CherryGrove uses Git submodules, it's recommended to clone the repository using Git, rather than downloading zip from GitHub webpage.
- Windows
- Linux
- macOS
Download and install Git at https://git-scm.org.
Install Git from your distro's package manager, for example in Ubuntu:
sudo apt install git
Download and install Git at https://git-scm.org, or install it from Homebrew:
brew install git
Check if Git is installed using:
git --version
Build Toolchain
Compiler
Clang/LLVM-build is the default toolchain. It's recommended on all platforms for better dead code eliminating and unified modern C++ support.
Linker
We use lld-link that comes with LLVM on Linux and macOS, and MSVC LINK.EXE on Windows because weird ABI incompatibility issues. If you found a way to make lld-link work on Windows, please let us know.
Standard Library
Prebuilt dependencies assume linkage against the platform's default C++ Standard Library: Microsoft STL for Windows, libstdc++ for Linux, and libc++ for macOS.
Building CherryGrove using incorrect C++ Standard Library will result in an ABI conflict while linking. Please build the prebuilt dependencies manually if you really need another standard library.
Installing Build Tools
- Windows
- Linux
- macOS
- Download and open the Microsoft Visual Studio installer from https://visualstudio.microsoft.com.
- Check
Desktop development with C++workload. - Switch to
Individual Componentstab, and check the following components for the Clang/LLVM toolchain:C++ Clang Compiler for Windows (xx.x.x)MSBuild Support for LLVM (clang-cl) Toolset
If you need to cross compile (e.g. arm64 Windows on x64 Windows), you should also switch to Individual Components and check the MSVC component for the other architecture (e.g. MSVC v1xx - VS 20xx C++ ARM64/ARM64EC build tools (latest)).
Install clang and lld from LLVM's official APT repository for latest support for C++23.
- Add the repository's GPG key and source list:
sudo apt install ca-certificates gpg wget
sudo mkdir -p /etc/apt/keyrings
wget -O- https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/llvm.gpg >/dev/null
sudo nano /etc/apt/sources.list.d/llvm.sources
For Ubuntu 24.04, put this in llvm.sources:
Types: deb
URIs: http://apt.llvm.org/noble/
Suites: llvm-toolchain-noble
Components: main
Signed-By: /etc/apt/keyrings/llvm.gpg
- Install the latest floating packages:
sudo apt update
sudo apt install clang clangd lld libc++-dev libc++abi-dev
clang++ --version
You should see clang 22.x.x or later in the output.
- For STL compatibility with prebuilt dependencies, you also need to install the latest
libstdc++:
sudo apt install g++-14 libstdc++-14-dev
MacOS uses clang and clang++ as the default C and C++ compilers, so you don't need to do anything to set up the toolchain. Rare macOS W.
CMake
- Windows
- Linux
- macOS
Download and install CMake at https://cmake.org.
CherryGrove uses CMake 4.x, which is not present in most of the registries. Therefore, we recommend installing from Kitware's APT repository.
- Install the repository's GPG key:
sudo apt install ca-certificates gpg wget
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \
gpg --dearmor | \
sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
- Add the repository to your APT sources:
sudo nano /etc/apt/sources.list.d/kitware.list
And put this line in the file. Make sure to replace <your-codename> with your Ubuntu release codename, for example jammy for Ubuntu 22.04 and noble for Ubuntu 24.04:
deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ <your-codename> main
- Update APT and install CMake:
sudo apt update
sudo apt install kitware-archive-keyring
sudo apt install cmake
cmake --version
If you're not seeing CMake 4.x, use this to check if the correct repository is selected:
apt-cache policy cmake
Download and install CMake at https://cmake.org, or install it from Homebrew:
brew install cmake
Check if CMake is installed using:
cmake --version
Ninja
CherryGrove uses Ninja as low level build system on all platforms by default because of its compatibility and versability. If you don't want to use Ninja, don't be worry. C++ toolchain is a wonderful place and many IDEs come with Ninja / can add Ninja as a workload such as Microsoft Visual Studio and CLion.
- Windows
- Linux
- macOS
Download Ninja at https://github.com/ninja-build/ninja/releases, and put it somewhere. Then set up system PATH variable to include Ninja's directory.
Download and install Ninja at https://github.com/ninja-build/ninja/releases, or use your package manager, for example in Ubuntu:
sudo apt install ninja-build
Download and install Ninja at https://github.com/ninja-build/ninja/releases, or install it from Homebrew:
brew install ninja
Check if Ninja is installed using:
ninja --version
7-zip
You will need 7z-compatible compression software to decompress downloaded prebuilt dependencies.
- Windows
- Linux
- macOS
Download and install 7-zip at https://7-zip.org. Then, set up system PATH variable to include 7-zip's installation directory (e.g. C:\Program Files\7-Zip) if you want to use the prebuilt dependency fetching scripts.
If you're using Windows 11 22H2 or later versions of Windows and you don't want to use the fetch scripts, you don't need to install anything. Doubleclicking the downloaded .7z files and extracting using File Explorer should just work.
Install 7zip from your distro's package manager, for example in Ubuntu:
sudo apt install 7zip
If that package name is not available on your system, try using 7zip-standalone. Check if 7z is installed using:
7z
Install sevenzip from Homebrew:
brew install sevenzip
Check if 7z is installed using:
7z
gperf
CherryGrove uses gperf to generate perfect hash functions for some of the internal data structures.
- Windows
- Linux
- macOS
Download and install gperf at https://ftp.gnu.org/pub/gnu/gperf/. Then set up system PATH variable to include gperf's installation directory.
Install gperf from your distro's package manager, for example in Ubuntu:
sudo apt install gperf
Install gperf from Homebrew:
brew install gperf
Check if gperf is installed using:
gperf --version
Clone Repository
Remember to use the --recursive argument. Cloning might take several minutes to complete because of the large submodule tree.
git clone --recursive https://github.com/cherryridge/cherrygrove.git
Grab Prebuilt Dependencies
Currently we have five prebuilt dependencies that need to be downloaded separately from GitHub Action's release. All of the archives from these releases are compressed using 7-Zip. You can download them all from running this script in cherrygrove/libs folder:
- Windows
- Linux
- macOS
cd libs
./fetch_prebuilt_libs.ps1
cd libs
./fetch_prebuilt_libs.sh
cd libs
./fetch_prebuilt_libs.sh
You will need 7z in your PATH for the scripts to work.
You will probably need to download both debug and release builds if you want to set up a development environment. If you only want to build CherryGrove and use it, only download release builds.
Tips about bgfx's shaderc
- The bgfx dependency has a shader compiler (
shaderc) in it, which will be invoked post-build. If you see some errors about execution permission, you might need to runchmod +x lib/bgfx/<debug|release>/bin/shaderc. - On Windows arm64,
shaderc.exeis actually an x64 build because of some weird incompatibility errors building it targetting arm64 Windows. It should work fine unless you're using an older version of arm64 Windows 10, which is really rare.
Links, in case you need to download these dependencies manually:
bgfx: https://github.com/cherryridge/dep_bgfx/releases/latestSoLoud: https://github.com/cherryridge/dep_soloud/releases/latestV8: https://github.com/cherryridge/dep_v8/releases/latestWasmtime: https://github.com/cherryridge/dep_wasmtime/releases/latest
If you're downloading them manually, upon decompressing, put all of the files and folders into libs/<dependency_name>/<debug|release>. You should see a .gitignore file inside each destination folder before putting files in, which stops Git from tracking these files. The inner structure of the destination folder should look like this:
├───📁 include/
│ ├───📁 <dependency_name>/ (optional)
│ │ └───...
│ ├───📁 <dependency_name2>/ (optional)
│ │ └───...
│ └───📄 (...).<h|hpp|hh> (optional)
├───📁 ... (optional)
├───📄 <library_name>.<lib|a>
├───📄 <library_name>.pdb (optional)
├───📄 <library_name2>.<lib|a> (optional)
└───📄 VERSION.txt
Platform-Specific Dependencies
Wine
For Linux and macOS, you need to have wine64 installed to compile DX11 shaders using shaderc. For Linux, you can install it from your distro's package manager, for example in Ubuntu:
sudo apt install wine64
Linux-Only Dependencies
For Linux, there are some additional dependencies for SDL3 (which also covers SoLoud and bgfx's dependencies) you need to install. Check out https://wiki.libsdl.org/SDL3/README-linux#build-dependencies for more details. For Ubuntu, run:
sudo apt install build-essential pkg-config libasound2-dev libpulse-dev libaudio-dev libfribidi-dev libjack-dev libsndio-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxtst-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev libthai-dev libpipewire-0.3-dev libwayland-dev libdecor-0-dev liburing-dev
Build
- Visual Studio
- Visual Studio Code
- CLion
- XCode
- Command Line
It's recommended to use CMake support for Visual Studio instead of generating .sln files. Open the cherrygrove folder in Visual Studio, and it will probably prompt you to install the CMake workload, or you can also install it manually from the Visual Studio Installer. After that, Visual Studio will automatically generate build files for you.
If you don't have Ninja installed, you might also need to set the CMake generator to "Visual Studio 17 2022" in CMakePresets.json or just delete the file. It's not that difficult to set up Ninja on Windows, please.
Ensure the configuration is correctly generated, then switch build target to CherryGrove.exe and choose Build > Build CherryGrove.exe.
Install the "CMake Tools" extension. Open the cherrygrove folder in Visual Studio Code, and it will probably prompt you to install the CMake Tools extension, or you can also install it manually from the Extensions Marketplace.
After that, press Ctrl+Shift+P and select "CMake: Configure". Choose your desired build configuration and generator (Ninja is recommended). Wait for CMake to generate build files.
Then, press Ctrl+Shift+P again and select "CMake: Build". Choose the CherryGrove target if prompted.
Open the cherrygrove folder in CLion. Enable <os>-<architecture>-<mode> profiles in Open Project Wizard, and press OK. Wait for CLion to generate build files. CLion comes with Ninja, so you even don't need to set up Ninja manually.
Ensure the configuration is correct, then choose your desired profile and choose Build 'CherryGrove'.
If you're using XCode IDE, open the generated .xcworkspace or .xcodeproj in Xcode. Adjust Scheme in the top toolbar, select the desired build mode configuration, and select the CherryGrove target. Then, you can build the project by selecting Product > Build from the menu.
Browse CMakePresets.json and find the preset that matches your desired build configuration. Then, generate build system files using this command:
cd cherrygrove
mkdir out
cd out
cmake -S .. --preset <preset>
Then build using this command:
cmake --build <preset>
Product Explanation
For default CMake presets, the products are located in out/<os>-<architecture>-<mode>. CherryGrove is monolithic, i.e. all of the code is located in the CherryGrove executable.
Copying assets and CherryGrove executable to another place and they should just work.
For packing CherryGrove to ship to end user, visit the next document about packing.
Troubleshooting
Cloning
-
It takes forever to clone CherryGrove
- Unfortunately there is no way to fix this because CherryGrove simply uses a lot of Git submodules and they also have many submodules inside of them. Under a typical network environment, cloning CherryGrove would take 1-5mins.
-
Server timeout/unexpected EOF/other network issues while cloning
- Simply retry using a better network. It's recommended to remove any downloaded files before retrying.
- Consider using a proxy for Git. Git in command prompt/bash won't automatically pick up system proxy, so you might need to configure it using:
git config --global http.proxy <proxy_host>git config --global https.proxy <proxy_host>
- If you're still not able to clone CherryGrove using command line, you are in really bad luck: You need to manually download code from GitHub.com webpage recursively for every Git submodule dependencies, as well as the dependencies of these dependencies. You are a legend if you managed to do so.
Building
- CMake failed to generate project files
- If you're using Linux, and the error message contains
not found, check if you had installed the Linux-only dependencies.
- If you're using Linux, and the error message contains
Testing
-
CherryGrove won't start
- Try to locate and inspect log files like
CherryGrove-<timestamp>.loginlogsfolder near the executable. If you believe that a bug had occured, consider reporting to us. - You can also try to debug using your IDE.
- Try to locate and inspect log files like
-
The GUI is in a bad shape / is flickering / is wrongly scaled / won't respond to resizing
- CherryGrove is still in a very early stage of development. For now, that's pretty normal. At least you saw something happening :).