build.py
can produce a game executable from a fresh clone of the repo in a single command. It will work on macOS, Windows and Linux, provided that your system has Python 3, CMake, and an adequate C++ compiler.
git clone --recurse-submodules https://github.com/jorio/Nanosaur
cd Nanosaur
python3 build.py
If you want to build the game manually instead, the rest of this document describes how to do just that on each of the big 3 desktop OSes.
- Install the prerequisites:
- Xcode 12+
- CMake 3.16+ (installing via Homebrew is recommended)
- Clone the repo recursively:
git clone --recurse-submodules https://github.com/jorio/Nanosaur cd Nanosaur
- Download SDL2-2.30.2.dmg, open it, and copy SDL2.framework to the extern folder
- Prep the Xcode project:
cmake -G Xcode -S . -B build
- Now you can open
build/Nanosaur.xcodeproj
in Xcode, or you can just go ahead and build the game:cmake --build build --config RelWithDebInfo
- The game gets built in
build/RelWithDebInfo/Nanosaur.app
. Enjoy!
- Install the prerequisites:
- Visual Studio 2022 with the C++ toolchain
- CMake 3.16+
- Clone the repo recursively:
git clone --recurse-submodules https://github.com/jorio/Nanosaur cd Nanosaur
- Download SDL2-devel-2.30.2-VC.zip, extract it, and copy SDL2-2.30.2 to the extern folder
- Prep the Visual Studio solution:
cmake -G "Visual Studio 17 2022" -A x64 -S . -B build
- Now you can open
build/Nanosaur.sln
in Visual Studio, or you can just go ahead and build the game:cmake --build build --config Release
- The game gets built in
build/Release/Nanosaur.exe
. Enjoy!
- Install the prerequisites from your package manager:
- Any C++20 compiler
- CMake 3.16+
- SDL2 development library (e.g. "libsdl2-dev" on Ubuntu, "sdl2" on Arch, "SDL-devel" on Fedora)
- OpenGL development libraries (e.g. "libgl1-mesa-dev" on Ubuntu)
- Clone the repo recursively:
git clone --recurse-submodules https://github.com/jorio/Nanosaur cd Nanosaur
- Build the game:
If you'd like to enable runtime sanitizers, append
cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo cmake --build build
-DSANITIZE=1
to the firstcmake
call above. - The game gets built in
build/Nanosaur
. Enjoy!