Skip to content

Instantly share code, notes, and snippets.

@reeFridge
Last active March 5, 2024 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reeFridge/e338f798f09e2730e760cef4b7489032 to your computer and use it in GitHub Desktop.
Save reeFridge/e338f798f09e2730e760cef4b7489032 to your computer and use it in GitHub Desktop.
Compiling RBDoom3BFG with Zig

Compiling RBDoom3BFG with Zig

Install Zig from your package manager (I use Arch btw.)

sudo pacman -S zig

Create shortcuts for zig cc and zig c++

#!/bin/bash
zig cc "$@"
#!/bin/bash
zig c++ "$@"

Do not forget chmod it.

chmod +x zigcc
chmod +x zigc++

Create new build recipe in neo/ folder.

neo/cmake-zig-linux-release.sh

cd ..
rm -rf build-zig
mkdir build-zig
cd build-zig
cmake -G "Unix Makefiles" -DUSE_PRECOMPILED_HEADERS=OFF -DCMAKE_BUILD_TYPE=Release -DONATIVE=ON -DFFMPEG=OFF -DBINKDEC=ON ../neo

Do not forget chmod it.

chmod +x cmake-zig-linux-release.sh

Run cmake with overridden CC and CXX env variables

cd neo
CC=/home/fridge/thirdparty/zigtoolchain/zigcc CXX=/h
ome/fridge/thirdparty/zigtoolchain/zigc++ ./cmake-zig-linux-release.sh

And finally make it!

cd ../build-zig
make -j8

Notes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment