Skip to content

Building From Source

grunt-lucas edited this page Mar 14, 2025 · 11 revisions

Table Of Contents

Linux And WSL2

Run the following commands in sequence:

sudo apt-get update
sudo apt-get install zlib1g-dev
sudo apt-get install libpng-dev
sudo apt-get install cmake
sudo apt-get install g++
CXX=g++ cmake -B build -DCMAKE_BUILD_TYPE=Release
cd build
cmake --build .
cd ..
./build/Porytiles/tests/Porytiles0xTestSuite
# if those tests pass, you're all set, then just do
sudo cp build/Porytiles/cli/porytiles /usr/local/bin

MacOS Arm64

Run the following commands in sequence:

brew install llvm
brew install libpng
brew install cmake
git clone [email protected]:grunt-lucas/porytiles.git
cd porytiles
CXX=/opt/homebrew/opt/llvm/bin/clang++ cmake -B build -DCMAKE_BUILD_TYPE=Release
cd build
cmake --build .
cd ..
./build/Porytiles/tests/Porytiles0xTestSuite
# if those tests pass, you're all set, then just do
sudo cp build/Porytiles/cli/porytiles /usr/local/bin

MacOS Amd64

Run the following commands in sequence:

brew install llvm
brew install libpng
brew install cmake
git clone [email protected]:grunt-lucas/porytiles.git
cd porytiles
CXX=/usr/local/opt/llvm/bin/clang++ cmake -B build -DCMAKE_BUILD_TYPE=Release
cd build
cmake --build .
cd ..
./build/Porytiles/tests/Porytiles0xTestSuite
# if those tests pass, you're all set, then just do
sudo cp build/Porytiles/cli/porytiles /usr/local/bin

A note on building with GNU GCC on MacOS:

CXX=g++-14 cmake -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-stdlib=libstdc++ -I/opt/homebrew/opt/gcc/include/c++/14 -L/opt/homebrew/opt/gcc/lib/gcc/14" -DCMAKE_OSX_SYSROOT=""

Need to set the CMake OSX sysroot to blank. Otherwise it pulls in MacOS framework include dirs which break compilation, since the system includes within GCC's headers pull in MacOS framework headers incorrectly. May also need:

# In your CMakeLists.txt
set(CMAKE_OSX_SYSROOT "" CACHE PATH "")
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES})
string(REPLACE "-isysroot;" "" CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES "${CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES}")

Windows

Unfortunately, Porytiles does not support pure Windows at this time. If you are on a Windows machine, I recommend setting up WSL2 to run Porytiles. Once you have WSL2 set up, you can follow the Linux And WSL2 instructions above. Alternatively, you could try MSVC or MinGW. I have heard that MinGW can compile Porytiles with a little massaging, but I have not tried MSVC. I don't have plans to support Porytiles compilation on pure Windows, since Porytiles 1.x in Go should work on Windows out of the box.

Clone this wiki locally