Quick links:
Setup Your Environment
Build & Install Required Libraries
Windows
install Visual Studio or Visual Studio: Build Tools.
whichever version of Visual Studio you install make sure the following components are selected to installed, everything else can be completely disabled to save bandwidth:
- Desktop development with C++
- C++ AddressSanitizer
- Clang Compiler For Windows
- One Of These SDKs:
- Windows 10 SDK (XX.X.XXXXX.X)
- Windows 11 SDK (XX.X.XXXXX.X)
- Desktop development with C++
install python since few scripts depend on them.
install git to clone repositories.
Linux
install any compiler toolchain:
GCC: GNU Compiler Collection
- Debian & Children:
apt install gcc
(g++ should be automatically installed by installing gcc) - Arch & Children:
pacman -S gcc
(g++ comes with gcc)
- Debian & Children:
Clang: C language family frontend for LLVM
- Debian & Children:
apt install clang
(clang++ comes with clang) - Arch & Children:
pacman -S clang
(clang++ comes with clang)
- Debian & Children:
install any build system:
Ninja Build
- Debian & Children:
apt install ninja-build
- Arch & Children:
pacman -S ninja
- Debian & Children:
GNU Make
- Debian & Children:
apt install make
- Arch & Children:
pacman -S make
- Debian & Children:
install Other Dependencies:
- Arch & Children:
pacman -S git cmake sdl2 python3
- Debian & Children:
apt install git cmake libsdl2-2.0-0 libsdl2-dev python3 python3-pip
- SDL2 on Debian & Children's Repository are very old and csprite requires SDL2 v2.0.17 or greater, so you will need to build & install it yourself from source
- Arch & Children:
macOS
install a compiler toolchain:
- Xcode: https://developer.apple.com/xcode/
- GCC: GNU Compiler Toolchain:
brew install gcc
- Clang: C language family frontend for LLVM: as far as i know clang is pre-installed on MacOS
install other deps with homebrew:
brew install git cmake sdl2 python@3.9
Build & Install SDL2
this step is required on Window or Debian & Debian based linux distributions since the package is either too old or isn't available at all (like on windows).
- Get SDL2 v2.26.5 Source Code:
git clone https://github.com/libsdl-org/SDL/ -b release-2.26.5
- Move into newly cloned directory & Generate Build Files:
cd SDL/
- Build & Install using these Build & Install Instructions
Install Numpy & Pillow
- Python Package
Pillow
&numpy
can be installed using various methods:- Python PIP:
python -m pip install --upgrade Pillow numpy
(Works where-ever pip is installed, which comes installed with python on Arch, Homebrew & Windows on Debian & Children you will need to installpython3-pip
(already done in setup). - Homebrew:
homebrew install pillow numpy
- Arch & Children:
pacman -S python-numpy python-pillow
- Python PIP:
Build & Install Instructions
these instructions are used for build SDL2 & Csprite.
Generate Build Files:
cmake -S ./ -B ./build/ <other-options>
-DCMAKE_BUILD_TYPE=Release
this option enables all sorts of optimizations & stuff is recommended if you're building for daily use, other possible values are:RelWithDebInfo
&Debug
.-G
option specifies the generator to use.- On Linux, you can use
-G "Ninja"
(recomendded) or-G "Unix Makefiles"
. - On MacOS, you can use:
-G "Xcode"
(recomendded) or-G "Unix Makefiles"
. - On Windows, since you install Visual Studio you can use the following generators:
- you can specify any of the follow Visual Studio generators, depending on the version of Visual Studio you installed:
Visual Studio 17 2022
,Visual Studio 16 2019
,Visual Studio 15 2017
&Visual Studio 14 2015
- you can specify any of the follow Visual Studio generators, depending on the version of Visual Studio you installed:
- On Linux, you can use
-T "ClangCL"
flag specifies the toolset to use, this is meant for Windows & is used to Compile using Clang since it doesn't have weird rules & regulations like MSVC.-A
flag specifies the platform you are building the library for & this flag is only used on Window.- use
-A "x64"
for x64 or x86_64 platform. - use
-A "Win32"
for x86 or i686 platform.
- use
-DCMAKE_OSX_ARCHITECTURES=x86_64
flag specifies the Mac CPU Architecture to build for.- use
arm64
for Apple Silicon M1 or M2 (or new CPUs apple might introduce with arm64 architecture). - use
x86_64
for Apple CPUs with x64 or x86_64 architecture, this can be used with Apple's M1 & M2 chips since they can run x64 binaries too.
- use
-DBUILD_APPLE_BUNDLE=ON
flag specifies wether to build a Apple's.app
bundle or not, by default the value isOFF
.
Build The Code With Generated Build Files:
cmake --build ./build/ <other-options>
--config Release
flag specifies the build configuration to build for, the value should be same as the value of-DCMAKE_BUILD_TYPE
flag above.--parallel 4
flag specifies the number of jobs while building, the value should be set to your number of CPU Cores & if it causes it to lag set the value to something smaller.
Install:
sudo cmake --install ./build/ --strip
--config Release
flag is same as the flag in step 2.- this step should be only used when building a library and will require administrative permissions, so on linux you might need to use
sudo
and on windows you will need to run your terminal "Run as administrator".
Build Csprite
- Clone Csprite Repository:
git clone https://github.com/pegvin/csprite --recursive
- Move Into Cloned Repository Folder:
cd csprite
- Generate Icons & Assets:
- Icons:
python tools/create_icons.py
- Assets:
python tools/create_assets.py
- Icons:
- Build Csprite using Build & Install Instructions & you should have your final binary/package in a folder name on of the following:
Release
,RelWithDebInfo
orDebug
.