Fork me on GitHub

Tools for building MAME on Windows

MAME Build Tools


Introduction

The MAME development environment for Windows consists of the GCC compiler (by way of MinGW), and the MSYS2 (POSIX/Unix compatability layer), plus various utilities such as Python and Git. It is available as a prepackaged installer, or can be assembled from upstream components.

Source control is handled by github (https://github.com/mamedev/mame.git), so you'll need to check out a copy. Various modules are disabled by default, such as the MAME interactive debugger, but can be enabled through arguments when building and may require additional MSYS2 packages to be installed.

Installation and building

Downloads

Installation

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

To open a non-posix shell there are two batch files: win32env.bat for regular windows console, and win32con.bat for fancy looking conemu console.

Important thing is to setup your git environment first

git config --global core.autocrlf true

Since it can be that some of configuration file have altered, first pull latest from root of your tools:

git pull

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 under your Msys2 user's homedir:

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:

pacman -Su

Alternative Shells for advanced usage

For a simple MSYS32 terminal use buildtools.bat to start.

For a fancier looking one use conemu.bat.

There are also buildtools_32.bat and conemu_32.bat enforcing mingw32 on 64-bit tools (makes sense if you use combined distribution).

For more information about Msys2, see MSYS2 Introduction.

Optional additional packages

SDL

If you wish to build with the SDL renderer:

For x64

   pacman -S mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_ttf

For x86

   pacman -S 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

Doxygen

To be able to generate the documentation from the source:

   pacman -S doxygen 

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

Manual steps

  1. Download MSYS2. You can do that by downloading from http://msys2.github.io/ or from our mirror for 64-bit Windows or for 32-bit Windows

  2. Run the installer (location can be changed to suite) and let it complete and it will launch an Msys shell

  3. Update initial installation

    pacman --needed -Sy bash pacman pacman-mirrors msys2-runtime
  4. Type exit to close current window and start "MSYS2 Shell" again

  5. Now upgrade already installed packages to current

    pacman -Su
  6. Install ConEmu console, make, wget and git tools

    pacman -S conemu-git make wget git
  7. Install mingw and gdb including python

    For x64

    pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-gdb

    For x86

    pacman -S mingw-w64-i686-gcc mingw-w64-i686-gdb
  8. Go to root folder and download MAME development environment shell scripts

    For x86

    cd /
    git clone https://github.com/mamedev/buildtools_x86.git build
    cd build
    mv * ..
    cd ..
    rm -r -f build
    exit

    For x64

    cd /
    git clone https://github.com/mamedev/buildtools_x64.git build
    cd build
    mv * ..
    cd ..
    rm -r -f build
    exit
  9. Finally, start buildtools.bat from installed folder (by default it is C:\msys64 or c:\msys32)



Previous version is still available