Skip to content

Building From Source

Y-Less edited this page Sep 19, 2020 · 2 revisions

In general you will need CMake and a C compiller to build Pawn from source code.

Building on Windows

If you have VS 2017 or later:

  • Clone this repo: git clone https://github.com/Zeex/pawn.git
  • In VS 2017: File > Open > CMake > Select the CMakeLists.txt file in the root of the compiler repository.

Otherwise:

  • Install Visual Studio Community

  • Clone this repo: git clone https://github.com/Zeex/pawn.git

  • Install CMake. When installing make sure to check "Add CMake to system PATH" to make your life easier.

  • Generate a Visual Studio project. In Command Prompt or Powershell execute the following (which will auto-detect your compiler and set to build for 32-bit):

    cd C:\Pawn
    mkdir build && cd build
    cmake ..\source\compiler -A Win32
  • From the same directory as in the previous step run:

    cmake --build . --config Release

    or open the pawnc.sln in Visual Studio and build from there (but make sure to choose the "Release" configuration).

    This will create pawnc.dll and pawncc.exe in the Release folder. You can now copy these files to your pawno folder for convenience or put them in a separate folder and configure your code editor accordingly.

Building on Linux

Use your distribution's package manager to install the required dependencies. For example, in Ubuntu you would do:

sudo apt install gcc gcc-multilib make cmake

gcc-multilib is needed for compiling a 32-bit binary (64-bit is not supported).

Now you can clone this repo and build the compiler:

git clone https://github.com/Zeex/pawn.git ~/pawn
cd ~/pawn
mkdir build && cd build
cmake ../source/compiler -DCMAKE_C_FLAGS=-m32 -DCMAKE_BUILD_TYPE=Release
make

Replace "Release" with "Debug" if you want to build a debug executable for development or submitting bugs.

Building on macOS

xcode-select --install
  • Install CMake:
brew install cmake
  • Now you can clone this repo and build the compiler:
git clone https://github.com/Zeex/pawn.git ~/pawn
cd ~/pawn
mkdir build && cd build
cmake ../source/compiler -DCMAKE_C_FLAGS=-m32 -DCMAKE_BUILD_TYPE=Release
make