-
Notifications
You must be signed in to change notification settings - Fork 75
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.
This method is easier to set up, but you're expected to be somewhat familiar with the command line.
- Clone the repository, including submodules (see Get the code)
- Install MSYS2, and open its terminal (MSYS2 MINGW32)
- 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
cd path/to/your/supermariowar; mkdir build; cd build
cmake .. -G 'Unix Makefiles' -DUSE_SDL2_LIBS=1
make smw
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.
- 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
- Install the latest CodeBlocks + MinGW (
codeblocks-16.01mingw-setup.exe
at the time of writing) - Install the latest CMake
- 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
- 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 recommendi686
, thex86_64
version may need additional tweaking). - Press Ok, Ok, Ok
- 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
tomingw32/bin
- Create a build directory somewhere
- 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.
- Open the build directory, open the CodeBlocks project file. Select
smw
as build target, then start the build. - 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'sbin
folder (eg.i686-w64-mingw32\bin
), the DLL file in the zlib directory, and of course the data directory of the game.