Skip to content

Building on Windows

Mátyás Mustoha edited this page Mar 9, 2023 · 14 revisions

NOTE: You do not need to build the game manually if you just want to play. You can find the releases here. This section is for source code developers.

Using MSYS2

This method is easier to set up, but you're expected to be somewhat familiar with the command line.

  1. Clone the repository, including submodules (see Get the code)
  2. Install MSYS2, and open its terminal (MSYS2 MINGW32)
  3. Install the required packages: pacman --noconfirm --needed -Sy pkg-config make 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

Using any IDE + SDL2 graphics

This method manually sets up the dependencies, but uses graphical applications. 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)
  • a) use any GUI to do a recursive clone (that is, clone the submodules too)
  • b) using the command line, git clone --recursive https://github.com/mmatyas/supermariowar.git
  1. Install the latest CodeBlocks + MinGW (codeblocks-16.01mingw-setup.exe at the time of writing)
  2. Install the latest CMake
  3. Get the dependencies:
  • Note: To extract tar.gz files, you can use eg. 7z, WinRAR, Total Commander, ...
  • 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 extract its contents to the same place as SDL2 (= copy i686-w64-mingw32 and x86_64-w64-mingw32 dirs from this archive to SDL2-2.0.something, click yes when Windows asks for merging)
  • Download SDL2 mixer for MinGW (SDL2_mixer-devel-2.x.x-mingw.tar.gz), and extract it similarly
  • 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. There's a CMake/MinGW bug (as.exe error), to fix it:
  • open the install location of CodeBlocks, and enter the MinGW dir
  • copy all the DLLs from bin to mingw32/bin
  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 Add entry, set USE_SDL2_LIBS as name, BOOL as type, and tick in the checkbox (Value)
  • Click Configure. Select CodeBlock - MinGW.
  • If everything works, click Generate.
  1. Open the build directory, open the CodeBlocks project file. Select smw as build target, then start the build.
  2. You'll now have the smw.exe. To run the game on its own, you will also need the DLLs located in the SDL directory's bin folder (eg. i686-w64-mingw32\bin), the DLL file in the zlib directory, and of course the data directory of the game.
Clone this wiki locally