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.
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
And if you are contributor
git config --global user.email firstname.lastname@example.org
git config --global user.name "Firstname Lastname"
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):
And finally to build:
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 -S bash pacman msys2-runtime --noconfirm --needed
Next, exit the console and restart Msys2.
Finally, once back at the console, execute:
pacman -Su --noconfirm
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).
If you wish to build with the SDL renderer:
pacman -S mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_ttf
pacman -S mingw-w64-i686-SDL2 mingw-w64-i686-SDL2_ttf
If you wish to build with the QT5 debugger:
pacman -S mingw-w64-x86_64-qt5
pacman -S mingw-w64-i686-qt5
If you with to build the QMC2 frontend or similar:
pacman -S mingw-w64-x86_64-qt4
pacman -S mingw-w64-i686-qt4
To be able to generate the documentation from the source:
pacman -S doxygen
To be able to use ccache to speed-up (re)compilation
pacman -S mingw-w64-x86_64-ccache
pacman -S mingw-w64-i686-ccache
Used as build system for some other project that can be handy
pacman -S mingw-w64-x86_64-cmake
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" ..
If you wish to compile/link with the alternative Clang, go ahead and download STILL EXPERIMENTAL:
pacman -S mingw-w64-x86_64-clang mingw-w64-x86_64-clang-analyzer mingw-w64-x86_64-clang-tools-extra
pacman -S mingw-w64-i686-clang mingw-w64-i686-clang-analyzer mingw-w64-i686-clang-tools-extra