MAME is occasionally useful for me to build from scratch for reference, especially using Visual Studio so I can debug. Each time I do, I have to re-learn how to do it which wastes my time so I am taking notes here to prevent that.
Visual Studio build process
- Some DirectX SDK should be installed and DXSDK_DIR should be defined in the PATH (the installer will do this).
- Follow the instructions here: http://mamedev.org/devwiki/index.php/Building_MAME_using_Microsoft_Visual_Studio_compilers
- I put my mame mingw install at c:\progs\ming-mame so adjust these instructions accordingly
- Create a few batch files the MAME source code directory. They should look like this:
buildprep.bat IMPORTANT: the ming path MUST come before the rest of the %PATH% stuff; otherwise random cygwin installs could mess up everything
set PATH=c:\progs\ming-mame\mingw64-w32\bin;%PATH% Set Lib=%DXSDK_DIR%Lib\x86;%Lib% Set Include=%DXSDK_DIR%Include;%Include%
make.exe all -j3 MSVC_BUILD=1 DEBUG=1 SYMBOLS=1 DIRECT3D=9 DIRECTINPUT=8
- Modify (mameroot)\src\osd\windows\vconv.c by removing the "/Oi" string from the optimization list. If you want to see the visual studio command line (useful for debugging), search for PRINT_COMMAND_LINE in vconv.c and modify the code accordingly.
- Launch a visual studio (I used 2008) command prompt, run buildprep batch file, then run build batch file and it should work.