The project is written in C and supports 64bits platforms only. It is tested on Linux and Windows.
To build on Linux, you need at least to have the following packages installed:
- GCC or Clang which support C20 features
- X11 development libraries
- OpenGL development libraries (GLU and GL)
- Python 3.6 or later
- GNU Make
The following packages are optional:
- UPX (for size optimized builds)
On Ubuntu-based systems, you can install them with the following command:
$ apt-get install -y python3 make build-essential mesa-common-dev \
libgl1-mesa-dev libglu1-mesa-dev libasound2-dev
On Fedora:
$ dnf install -y python3 make gcc mesa-libGLU-devel mesa-libGL-devel \
alsa-lib-devel
On Alpine:
$ apk add python3 make gcc mesa-dev musl-dev freeglut-dev alsa-lib-dev
On Void Linux:
$ xbps-install -Su
$ xbps-install python3 make clang libX11-devel MesaLib-devel glu-devel \
alsa-lib-devel
After that, you can build the project with the following commands:
$ git clone https://github.com/SheatNoisette/potetre2d.git --recursive
$ cd potetre2d
$ make -j
# try it out!
$ ./build/potetre2d.elf examples/fractal.wren
If clang and upx is installed, you can also build a agressive size optimized version:
$ CC=clang CLANG=1 make compress
PLEASE NOTE that the size optimized version MAY BE DETECTED AS A VIRUS by some antivirus software. This is a false positive. If you don't trust me, you can build the project yourself and check the source code. IT IS RECOMMENDED TO AVOID USING THE SIZE OPTIMIZED VERSION FOR PRODUCTION PURPOSES.
As a convenience, you can also use Dockerfile to build the project:
$ docker build -t potetre2d-dev .
$ docker run -it --rm -v $(pwd):/potetre2d potetre2d-dev
(docker) $ (do the same as above)
You can also generate an AppImage with the following commands:
$ docker run -it --rm --volume=$(pwd):/work/ --workdir=/work/ \
appimagecrafters/appimage-builder:latest
(docker):/work# apt-get update
(docker):/work# apt-get install -y python3 make build-essential \
mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libasound2-dev git
(docker):/work# INSTALL_DIR="AppDir/usr/bin" PYTHON=python3 make install
(docker):/work# appimage-builder --recipe AppImageBuilder.yml --skip-tests
If you are using Nix/NixOS, you can also use the provided flake.nix
file to
build the project:
$ nix run
The macOS building has not been tested. Please report any issue you may encounter.
To build for Windows, you need to have the following packages installed:
- MinGW-w64 GCC
- Upx
On Fedora 37:
$ dnf install mingw64-gcc
Then, you can build the project with the following commands:
$ CC=x86_64-w64-mingw32-gcc CLANG=0 OS=windows make compress
Please note that you need a Macintosh with XCode command line tools installed to build this:
$ PYTHON=python3 make
Please note that you may need to install a compatible Python version (3.6 or later) with Homebrew or MacPorts.
$ brew install python3
If you get an error about python3
not found, you can try to set the PYTHON
make variable to the path of the Python 3 executable.