Skip to content

Building PCem on Windows

Michael Manley edited this page Nov 16, 2022 · 5 revisions

This guide will walk you through setting up a build environment for PCem. PCem uses the MSYS environment and MinGW-w64 for the compiler.

You can download MSYS from the following link, https://www.msys2.org/

First steps

You will need to install MSYS, this is very easy and the link above documents the initial setup very well. Once MSYS is installed, go ahead and open up an "MSYS MSYS2" command prompt. We will now install the required packages to compile PCem.

The command to do this is as follows

pacman -Sy mingw-w64-{i686,x86_64}-ntldd-git mingw-w64-{i686,x86_64}-toolchain mingw-w64-{i686,x86_64}-SDL2 mingw-w64-{i686,x86_64}-openal mingw-w64-{i686,x86_64}-wxWidgets mingw-w64-{i686,x86_64}-libpcap mingw-w64-{i686,x86_64}-cmake mingw-w64-{i686,x86_64}-ninja

After this we can check out and build the code.

Compile PCem

You can do in source or out of source builds. Personally I do my build in a build or build-<buildtype> but regardless it can be done in source as well.

We use CMake to generate the makefiles for PCem. Here is an example command to build a Release build, with networking. This is ran in the source directory

mkdir build && cd build
cmake -G Ninja -DUSE_NETWORKING=ON -DCMAKE_BUILD_TYPE=Release ..
ninja

This will find all the dependencies and link accordingly. If you are not using MSYS's bash prompts, you need to add the compiler bin directory and msys's in the PATH, so wxWidgets can be found. for example on a GCC 64-bit toolchain:

set PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin;%PATH%

Once the build is complete, the binary is in output/bin/pcem. Any plugins that are not embedded into PCem will be in output/lib/pcem.

Clone this wiki locally