Fork me on GitHub

Tools for building MAME on Windows

MAME Build Tools


Introduction

The MAME development environment for Windows consists of the MinGW GCC compiler, MSYS2 environment (POSIX/Unix compatibility layer), plus various utilities such as Python and Git. It is available pre-packaged, or can be assembled by installing MSYS2 with the necessary packages.

Our main source code repository is hosted on GitHub (https://github.com/mamedev/mame.git), so you’ll need to check out a copy. Various features are disabled by default, but can be enabled through arguments when building, and may require additional MSYS2 packages to be installed. For more information on compiling MAME, see the relevant page on our documentation site.

Installation and building

Downloads

Installation

If you are installing it in a location other than the default (C:\Users\Public\msys64), after you unpack, double-click: autorebase.bat

To open a Windows cmd.exe shell, there is a batch file win32env.bat – this works better with interactive MinGW tools.

Important thing is to setup your git environment first

git config --global core.autocrlf true

And if you are contributor

git config --global user.email youremail@something.com
git config --global user.name "Firstname Lastname"

Building

Then, to download the MAME source inside your MSYS2 home directory:

git clone https://github.com/mamedev/mame.git

Alternatively, locate your existing source tree (drives are mapped to hidden dirs /c etc. under the virtual root):

cd /c/Projects/mame

And finally to build:

make

Updating build tools

Similar to package managers on Linux like apt-get, yum etc. MSYS2 can automatically update packages for fixes, security updates etc. To update all installed packages to current, from a regular Windows console run the following:

pacman -Sy
pacman -S bash pacman msys2-runtime --noconfirm --needed

Next, exit the console and restart Msys2.

Finally, once back at the console, execute:

pacman -Su --noconfirm

Alternative Shells for advanced usage

For a simple MSYS2 terminal use mingw64.exe to start.

For more information about MSYS2, see MSYS2 Introduction.

Optional additional packages

SDL

If you wish to build 32-bit binaries:

pacman -S mingw-w64-i686-gcc mingw-w64-i686-libc++ mingw-w64-i686-lld mingw-w64-i686-python mingw-w64-i686-SDL2 mingw-w64-i686-SDL2_ttf

QT5

If you wish to build with the QT5 debugger:

For x64

pacman -S mingw-w64-x86_64-qt5

For x86

pacman -S mingw-w64-i686-qt5

QT4

If you with to build the QMC2 frontend or similar:

For x64

pacman -S mingw-w64-x86_64-qt4

For x86

pacman -S mingw-w64-i686-qt4

CCache

To be able to use ccache to speed-up (re)compilation

For x64

pacman -S mingw-w64-x86_64-ccache 

For x86

pacman -S mingw-w64-i686-ccache 

CMake

Used as build system for some other project that can be handy

For x64

pacman -S mingw-w64-x86_64-cmake 

For x86

pacman -S mingw-w64-i686-cmake 

To build in Windows environment use from build folder:

   cmake -G "MinGW Makefiles" .. -DCMAKE_MAKE_PROGRAM=c:\msys64\win32\make.exe

To build in MSYS environment use from build folder:

   cmake -G "MSYS Makefiles" ..

Clang

If you wish to compile/link with the alternative Clang, go ahead and download STILL EXPERIMENTAL:

For x64

   pacman -S mingw-w64-x86_64-clang mingw-w64-x86_64-clang-analyzer mingw-w64-x86_64-clang-tools-extra 

For x86

   pacman -S mingw-w64-i686-clang mingw-w64-i686-clang-analyzer mingw-w64-i686-clang-tools-extra


Previous version is still available