Building MAME using Microsoft Visual Studio compilers: Difference between revisions
From MAMEDEV Wiki
(updated path to python executable) |
(Add info about VS Community and remove VS2013 as it is no longer supported.) |
||
Line 1: | Line 1: | ||
By default, MAME is configured via the makefile to build using the MinGW gcc compiler. Although this is a nice cross-platform solution, debugging binaries built this way leaves a lot to be desired. | By default, MAME is configured via the makefile to build using the MinGW gcc compiler. Although this is a nice cross-platform solution, debugging binaries built this way leaves a lot to be desired. | ||
Alternatively, you can configure MAME to build using Visual Studio. Once you have done that, you can debug problems in MAME using the Visual Studio debugger, which is a huge step up from gdb. | |||
Since MAME uses modern C++ features, Visual Studio 2015 is required, and [https://www.visualstudio.com/en-us/news/vs2015-update2-vs.aspx Update 2] is preferred as it fixes various compiler bugs. If you don't have a paid license, [https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx Visual Community 2015] is available from Microsoft for free (but requires sign-in with a Microsoft account). | |||
Here's how to make it work: | Here's how to make it work: | ||
Line 9: | Line 11: | ||
# Once you've done that, simply run: <code>make vs2015 PYTHON_EXECUTABLE=c:/msys64/mingw64/bin/python.exe</code> and wait for it to create projects | # Once you've done that, simply run: <code>make vs2015 PYTHON_EXECUTABLE=c:/msys64/mingw64/bin/python.exe</code> and wait for it to create projects | ||
# In order not to specify PYTHON_EXECUTABLE all the time, just place it in system variables | # In order not to specify PYTHON_EXECUTABLE all the time, just place it in system variables | ||
# If you are building with XP compatibility enabled run <code>make vs2015_xp</code> | |||
# If you are building with XP compatibility enabled run <code>make vs2015_xp | |||
# Browse to folder containing solution file and open it with Visual Studio | # Browse to folder containing solution file and open it with Visual Studio | ||
# Inside Visual Studio you can change to Debug/Release x86 or x64 builds | # Inside Visual Studio you can change to Debug/Release x86 or x64 builds |
Revision as of 13:24, 2 June 2016
By default, MAME is configured via the makefile to build using the MinGW gcc compiler. Although this is a nice cross-platform solution, debugging binaries built this way leaves a lot to be desired.
Alternatively, you can configure MAME to build using Visual Studio. Once you have done that, you can debug problems in MAME using the Visual Studio debugger, which is a huge step up from gdb.
Since MAME uses modern C++ features, Visual Studio 2015 is required, and Update 2 is preferred as it fixes various compiler bugs. If you don't have a paid license, Visual Community 2015 is available from Microsoft for free (but requires sign-in with a Microsoft account).
Here's how to make it work:
- You must already have an environment that can build MAME using the MinGW tools. Although you won't be using gcc to compile, you will be using several of the other tools included in the standard MAME MinGW Development Environment
- Switch to the directory where the root MAME makefile lives.
- Once you've done that, simply run:
make vs2015 PYTHON_EXECUTABLE=c:/msys64/mingw64/bin/python.exe
and wait for it to create projects - In order not to specify PYTHON_EXECUTABLE all the time, just place it in system variables
- If you are building with XP compatibility enabled run
make vs2015_xp
- Browse to folder containing solution file and open it with Visual Studio
- Inside Visual Studio you can change to Debug/Release x86 or x64 builds
- While doing development please note that you need to update LUA files in scripts folders in order to add new sources and regenerate projects
- Note that all parameters for partial compilation works so you can do
make SUBTARGET=tiny vs2015
ormake vs2015 SUBTARGET=drivername SOURCES=src\mame\drivers\drivername.cpp
Back to How MAME Works