Skip to content

Building on Windows

Mátyás Mustoha edited this page Mar 30, 2016 · 14 revisions

Using any IDE + SDL2 graphics

In this example, I'll use CodeBlocks, but the steps are mostly the same for eg. Visual Studio too.

  1. Clone the repository, including submodules (see Get the code)
  2. Install the latest CodeBlocks + MinGW (codeblocks-16.01mingw-setup.exe at the time of writing)
  3. Install the latest CMake
  4. Get the dependencies:
  • Download the SDL2 dev files for MinGW (SDL2-devel-2.x.x-mingw.tar.gz), and extract it somewhere
  • Download SDL2 image for MinGW (SDL2_image-devel-2.x.x-mingw.tar.gz), and etract it to the same place as SDL2
  • Download SDL2 mixer for MinGW (SDL2_mixer-devel-2.x.x-mingw.tar.gz), and etract it to the same place as SDL2
  • Download zlib (compiled DLL, version 1.2.8, zipfile format), and extract it somewhere
  1. Set the SDL2DIR environment variable:
  • on Windows 7: Control Panel -> System -> Advanced System Settings -> Environment Variables
  • Click New
  • Set SDL2DIR as name, then type in the full path to one one of the architecture inside the directory where you've extracted SDL2. For example, C:\SDL2-2.0.4\i686-w64-mingw32 (note: I recommend i686, the x86_64 version may need additional tweaking).
  • Press Ok, Ok, Ok
  1. Create a build directory somewhere
  2. Open CMake,
  • Where is the source code: open the directory of supermariowar
  • Where to build: open the build directory you've just created
  • Click Add entry, set ZLIB_ROOT as name, PATH as type, then set the directory to where you've extracted zlib
  • Click Configure. Select CodeBlock - MinGW.
  • Turn on Use SDL2 libs
  • Click Configure again.
  • If everything works, click Generate.
  1. Open the build directory, open the CodeBlocks project file. Select smw as build target, then start the build.

Using MSYS2

  1. Clone the repository, including submodules (see Get the code)
  2. Install MSYS2, and open its terminal
  3. Install the required packages: pacman --noconfirm --needed -Sy pkg-config mingw-w64-i686-toolchain mingw-w64-i686-cmake mingw-w64-i686-zlib mingw-w64-i686-SDL2 mingw-w64-i686-SDL2_image mingw-w64-i686-SDL2_mixer
  4. cd path/to/your/supermariowar; mkdir build; cd build
  5. cmake .. -G 'Unix Makefiles' -DUSE_SDL2_LIBS=1
  6. make smw
Clone this wiki locally