From 4a6f5ee78f67c4cc4086b8927b7d24f458463a3b Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sat, 12 Jan 2019 02:23:28 +1100 Subject: better documentation for compiling on Windows (nw) --- docs/source/initialsetup/compilingmame.rst | 82 ++++++++++++++++++++++++++---- 1 file changed, 73 insertions(+), 9 deletions(-) (limited to 'docs/source/initialsetup') diff --git a/docs/source/initialsetup/compilingmame.rst b/docs/source/initialsetup/compilingmame.rst index 993ffb8e5fb..3b0c8ddea58 100644 --- a/docs/source/initialsetup/compilingmame.rst +++ b/docs/source/initialsetup/compilingmame.rst @@ -36,15 +36,79 @@ Rebuilding MAME on a dual-core (e.g. i3 or laptop i5) machine: Microsoft Windows ----------------- -Here are specific notes about compiling MAME for Microsoft Windows. - -* Refer to `the MAME tools site `_ for the latest toolkit for getting MAME compiled on Windows. - -* You will need to download the toolset from that link to begin. Periodically, these tools are updated and newer versions of MAME from that point on will **require** updated tools to compile. - -* You can do compilation on Visual Studio 2017 (if installed on your PC) by using **make vs2017**. This will always regenerate the settings, so **REGENIE=1** is *not* needed. - -* Make sure you get SDL 2 2.0.3 or 2.0.4 as earlier versions are buggy. +MAME for Windows is built using the MSYS2 environment. You will need Windows 7 +or later and a reasonably up-to-date MSYS2 installation. We strongly recommend +building MAME on a 64-bit system. Instructions may need to be adjusted for +32-bit systems. + +* A pre-packaged MSYS2 installation including the prerequisites for building + MAME can be downloaded from the `MAME Build Tools + `_ page. +* After initial installation, you can update the MSYS2 environment using the + **pacman** (Arch package manage) command. +* By default, MAME will be built using native Windows OS interfaces for + window management, audio/video output, font rendering, etc. If you want to + use the portable SDL (Simple DirectMedia Layer) interfaces instead, you can + add **OSD=sdl** to the make options. The main emulator binary will have an + ``sdl`` prefix prepended (e.g. ``sdlmame64.exe`` or ``sdlmame.exe``). You + will need to install the MSYS2 packages for SDL 2 version 2.0.3 or later. +* By default, MAME will include the native Windows debugger. To also inculde + the portable Qt debugger, add **USE_QTDEBUG=1** to the make options. You + will need to install the MSYS2 packages for Qt 5. + +Using a standard MSYS2 installation +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You may also build MAME using a standard MSYS2 installation and adding the tools +needed for building MAME. These instructions assume you have some familiarity +with MSYS2 and the **pacman** package manager. + +* Install the MSYS2 environment from the `MSYS2 homepage + `_. +* Download the latest version of the ``mame-essentials`` package from the + `MAME package repository `_ and install it + using the **pacman** command. +* Add the ``mame`` repository to ``/etc/pacman.conf`` using + ``/etc/pacman.d/mirrorlist.mame`` for locations. +* Install packages necessary to build MAME. At the very least, you'll need + ``bash``, ``git``, ``make``. +* For 64-bit builds you'll need ``mingw-w64-i686-gcc`` and + ``mingw-w64-x86_64-python2``. +* For 32-bit builds you'll need ``mingw-w64-x86_64-gcc`` and + ``mingw-w64-i686-python2``. +* For debugging you may want to install ``gdb``. +* To build against the portable SDL interfaces, you'll need + ``mingw-w64-x86_64-SDL2`` and ``mingw-w64-x86_64-SDL2_ttf`` for 64-bit builds, + or ``mingw-w64-i686-SDL2`` and ``mingw-w64-i686-SDL2_ttf`` for 32-bit builds. +* To build the Qt debugger, you'll need ``mingw-w64-x86_64-qt5`` for 64-bit + builds, or ``mingw-w64-i686-qt5`` for 32-bit builds. +* To generate API documentation from source, you'll need ``doxygen``. +* For 64-bit builds, open **MSYS2 MinGW 64-bit** from the start menu, and set + up the environment variables ``MINGW64`` to ``/mingw64`` and ``MINGW32`` to an + empty string (e.g. using the command **export MINGW64=/mingw64 MINGW32=** in + the Bash shell). +* For 32-bit builds, open **MSYS2 MinGW 32-bit** from the start menu, and set + up the environment variables ``MINGW32`` to ``/mingw32`` and ``MINGW64`` to an + empty string (e.g. using the command **export MINGW32=/mingw32 MINGW64=** in + the Bash shell). + +Building with Microsoft Visual Studio +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +* You can generate Visual Studio 2017 projects using **make vs2017**. The + solution and project files will be created in + ``build/projects/windows/mame/vs2017`` by default (the name of the ``build`` + folder can be changed using the ``BUILDDIR`` option). This will always + regenerate the settings, so **REGENIE=1** is *not* needed. +* Adding **MSBUILD=1** to the make options will build build the solution using + the Microsoft Build Engine after generating the project files. Note that this + requires paths and environment variables to be configured so the correct + Visual Studio tools can be located. +* MAME can only be compiled with the Visual Studio 15.7.6 tools. Bugs in newer + versions of the Microsoft Visual C/C++ compiler prevent it from compiling + MAME. +* The MSYS2 environment is still required to generate the project files, convert + built-in layouts, compile UI translations, etc. .. _compiling-fedora: -- cgit v1.2.3-70-g09d2 From ff8cda02cbe3fff19e9050eca09fb64ab7240aa2 Mon Sep 17 00:00:00 2001 From: Firehawke <34792592+Firehawke@users.noreply.github.com> Date: Sun, 13 Jan 2019 09:18:09 -0700 Subject: Correct compilation packages (for #4507) and finish cleanup on previous docs updates. (nw) (#4509) * Correct the compilation packages [partial for #4507] (nw) * Minor corrections, joymap adjustments (nw) --- docs/source/commandline/commandline-all.rst | 16 +++++++++------- docs/source/initialsetup/compilingmame.rst | 4 ++-- 2 files changed, 11 insertions(+), 9 deletions(-) (limited to 'docs/source/initialsetup') diff --git a/docs/source/commandline/commandline-all.rst b/docs/source/commandline/commandline-all.rst index bfb8e142f9d..9ecba9e9bea 100644 --- a/docs/source/commandline/commandline-all.rst +++ b/docs/source/commandline/commandline-all.rst @@ -925,6 +925,7 @@ Core State/Playback Options **-[no]snapbilinear** Specify if the snapshot or movie should have bilinear filtering applied. + Shutting this off can improve performance while recording video to a file. The default is ON (**-snapbilinear**). @@ -1313,8 +1314,7 @@ Core Video Options rendered at its original resolution before being scaled. At higher settings, the screen is expanded in both axes by a factor of ** using nearest-neighbor sampling before applying filters or shaders. With - **-video d3d**, this produces a less blurry image at the expense of a - little (on nearly all modern architectures) speed. + **-video d3d**, this produces a less blurry image at the expense of speed. The default is ``1``. @@ -1373,7 +1373,8 @@ Core Per-Window Options .. _mame-commandline-screen: -NOTE: **Multiple Screens may fail to work correctly on some Mac machines as of right now.** +NOTE: **Multiple Screens may fail to work correctly on some Mac machines as of +right now.** **-screen** ** @@ -1991,9 +1992,9 @@ Core Input Options To specify the map for this parameter, you can specify a string of rows separated by a '.' (which indicates the end of a row), like so: - +-------------------------------------------------------------------------------------------+ - | 777888999.777888999.777888999.444555666.444555666.444555666.111222333.111222333.111222333 | - +-------------------------------------------------------------------------------------------+ + +-------------------------------------------------------------------------------------------------------+ + | **-joymap 777888999.777888999.777888999.444555666.444555666.444555666.111222333.111222333.111222333** | + +-------------------------------------------------------------------------------------------------------+ However, this can be reduced using several shorthands supported by the parameter. If information about a row is missing, then it is assumed that @@ -2003,7 +2004,8 @@ Core Input Options up/down symmetry is assumed. By using these shorthands, the 81 character map can be simply specified by - this 11 character string: 7778...4445 + this 11 character string: 7778...4445 (which means we then use + **-joymap 7778...4445**) Looking at the first row, 7778 is only 4 characters long. The 5th entry can't use symmetry, so it is assumed to be equal to the previous character diff --git a/docs/source/initialsetup/compilingmame.rst b/docs/source/initialsetup/compilingmame.rst index 3b0c8ddea58..8c21a550b16 100644 --- a/docs/source/initialsetup/compilingmame.rst +++ b/docs/source/initialsetup/compilingmame.rst @@ -72,9 +72,9 @@ with MSYS2 and the **pacman** package manager. ``/etc/pacman.d/mirrorlist.mame`` for locations. * Install packages necessary to build MAME. At the very least, you'll need ``bash``, ``git``, ``make``. -* For 64-bit builds you'll need ``mingw-w64-i686-gcc`` and +* For 64-bit builds you'll need ``mingw-w64-x86_64-gcc`` and ``mingw-w64-x86_64-python2``. -* For 32-bit builds you'll need ``mingw-w64-x86_64-gcc`` and +* For 32-bit builds you'll need ``mingw-w64-i686-gcc`` and ``mingw-w64-i686-python2``. * For debugging you may want to install ``gdb``. * To build against the portable SDL interfaces, you'll need -- cgit v1.2.3-70-g09d2 From 2619be3e182c8661f9111611290a668a2e679f1a Mon Sep 17 00:00:00 2001 From: algestam Date: Tue, 22 Jan 2019 19:09:26 +0100 Subject: Doc: Minor fix (nw) (#4547) --- docs/source/initialsetup/compilingmame.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/source/initialsetup') diff --git a/docs/source/initialsetup/compilingmame.rst b/docs/source/initialsetup/compilingmame.rst index 8c21a550b16..44af60a91df 100644 --- a/docs/source/initialsetup/compilingmame.rst +++ b/docs/source/initialsetup/compilingmame.rst @@ -319,10 +319,10 @@ ARCHOPTS_CXX source files. ARCHOPTS_OBJC Additional command-line options to pass to the compiler when compiling - Objecive-C source files. + Objective-C source files. ARCHOPTS_OBJCXX Additional command-line options to pass to the compiler when compiling - Objecive-C++ source files. + Objective-C++ source files. Library/framework locations ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3-70-g09d2 From 995ba92e833e40c27760ad9a6e80d46dee48f06f Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 28 Jan 2019 03:59:45 +1100 Subject: update docs (nw) --- docs/source/commandline/commandline-all.rst | 9 +++++---- docs/source/initialsetup/compilingmame.rst | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'docs/source/initialsetup') diff --git a/docs/source/commandline/commandline-all.rst b/docs/source/commandline/commandline-all.rst index 9ecba9e9bea..d7026de24b9 100644 --- a/docs/source/commandline/commandline-all.rst +++ b/docs/source/commandline/commandline-all.rst @@ -2159,12 +2159,13 @@ Debugging Options **-[no]oslog** - Output ``error.log`` data to the system diagnostic output, if one is + Output ``error.log`` messages to the system diagnostic output, if one is present. - On Windows, the ``error.log`` data goes nowhere if no debugger is present. - On other operating systems, the ``error.log`` data will go to standard - error output, which typically goes to the console or terminal window. + By default messages are sent to the standard error output (this is typically + displayed in the terminal or command prompt window, or saved to a system log + file). On Windows, if a debugger is attached (e.g. the Visual Studio + debugger or WinDbg), messages will be sent to the debugger instead. The default is OFF (**-nooslog**). diff --git a/docs/source/initialsetup/compilingmame.rst b/docs/source/initialsetup/compilingmame.rst index 44af60a91df..1c102f66e63 100644 --- a/docs/source/initialsetup/compilingmame.rst +++ b/docs/source/initialsetup/compilingmame.rst @@ -392,8 +392,8 @@ Issues with specific compiler versions Adding **DEPRECATED=0** to your build options works around this by disabling deprecation warnings. * MinGW GCC 7 for Windows i386 produces spurious out-of-bounds access warnings. - Adding **NOWERROR=1** to your build options works around this by disabling - deprecation warnings. + Adding **NOWERROR=1** to your build options works around this by not treating + warnings as errors. * Initial versions of GNU libstdc++ 6 have a broken ``std::unique_ptr`` implementation. If you encounter errors with ``std::unique_ptr`` you need to upgrade to a newer version of libstdc++ that fixes the issue. -- cgit v1.2.3-70-g09d2 From 8ffff5d2d3bcebbdbefec2508ddd2ecd264a399a Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 18 Feb 2019 21:13:44 +1100 Subject: (nw) misc stuff: * Document cross-compilation options * Use lowercase for some libraries that are lowercase in system32 on Windows anyway * Make USE_BUNDLED_LIB_SDL2=0 not use the bundled SDL --- docs/source/initialsetup/compilingmame.rst | 35 +++++++++++++++++++++++++++--- makefile | 2 ++ scripts/src/osd/sdl.lua | 16 +++++++------- scripts/src/tools.lua | 16 +++++++------- 4 files changed, 50 insertions(+), 19 deletions(-) (limited to 'docs/source/initialsetup') diff --git a/docs/source/initialsetup/compilingmame.rst b/docs/source/initialsetup/compilingmame.rst index 1c102f66e63..44d416d3108 100644 --- a/docs/source/initialsetup/compilingmame.rst +++ b/docs/source/initialsetup/compilingmame.rst @@ -252,15 +252,27 @@ IGNORE_GIT revision description in the version string. Tool locations -~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~ OVERRIDE_CC - Set the C/Objective-C compiler command. + Set the C/Objective-C compiler command. (This sets the target C compiler + command when cross-compiling.) OVERRIDE_CXX - Set the C++/Objective-C++ compiler command. + Set the C++/Objective-C++ compiler command. (This sets the target C++ + compiler command when cross-compiling.) +OVERRIDE_LD + Set the linker command. This is often not necessary or useful because the C + or C++ compiler command is used to invoke the linker. (This sets the target + linker command when cross-compiling.) PYTHON_EXECUTABLE Set the Python interpreter command. You need Python 2.7 or Python 3 to build MAME. +CROSS_BUILD + Set to **1** to use separate host and target compilers and linkers, as + required for cross-compilation. In this case, **OVERRIDE_CC**, + **OVERRIDE_CXX** and **OVERRIDE_LD** set the target C compiler, C++ compiler + and linker commands, while **CC**, **CXX** and **LD** set the host C + compiler, C++ compiler and linker commands. Optional features ~~~~~~~~~~~~~~~~~ @@ -439,6 +451,23 @@ variables. Unusual Build Configurations ---------------------------- +Cross-compiling MAME +~~~~~~~~~~~~~~~~~~~~ + +MAME's build system has basic support for cross-compilation. Set +**CROSS_BUILD=1** to enable separate host and target compilers, set +**OVERRIDE_CC** and **OVERRIDE_CXX** to the target C/C++ compiler commands, and +if necessary set **CC** and **CXX** to the host C/C++ compiler commands. If the +target OS is different to the host OS, set it with **TARGETOS**. For example it +may be possible to build a MinGW32 x64 build on a Linux host using a command +like this: + +**make TARGETOS=windows PTR64=1 OVERRIDE_CC=x86_64-w64-mingw32-gcc OVERRIDE_CXX=x86_64-w64-mingw32-g++ OVERRIDE_LD=x86_64-w64-mingw32-ld MINGW64=/usr** + +(The additional packages required for producing a standard MinGW32 x64 build on +a Fedora Linux host are `mingw64-gcc-c++`, `mingw64-winpthreads-static` and +their dependencies. Non-standard builds may require additional packages.) + Using libc++ on Linux ~~~~~~~~~~~~~~~~~~~~~ diff --git a/makefile b/makefile index d5dc79988f3..1895eeffcfc 100644 --- a/makefile +++ b/makefile @@ -505,8 +505,10 @@ endif # reverse logic for this one ifdef USE_BUNDLED_LIB_SDL2 +ifneq '$(USE_BUNDLED_LIB_SDL2)' '0' PARAMS += --with-bundled-sdl2 endif +endif #------------------------------------------------- # distribution may change things diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index 28e126ecee3..c9a63dcb24e 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -52,16 +52,16 @@ function maintargetosdoptions(_target,_subtarget) configuration { "mingw*"} links { "SDL2", - "Imm32", - "Version", - "Ole32", - "OleAut32", + "imm32", + "version", + "ole32", + "oleaut32", } configuration { "vs*" } links { "SDL2", - "Imm32", - "Version", + "imm32", + "version", } configuration { } else @@ -74,8 +74,8 @@ function maintargetosdoptions(_target,_subtarget) configuration { "vs*" } links { "SDL2", - "Imm32", - "Version", + "imm32", + "version", } configuration { } else diff --git a/scripts/src/tools.lua b/scripts/src/tools.lua index 157cbde1e7e..25790c257ac 100644 --- a/scripts/src/tools.lua +++ b/scripts/src/tools.lua @@ -819,16 +819,16 @@ if (_OPTIONS["osd"] == "sdl") then configuration { "mingw*"} links { "SDL2", - "Imm32", - "Version", - "Ole32", - "OleAut32", + "imm32", + "version", + "ole32", + "oleaut32", } configuration { "vs*" } links { "SDL2", - "Imm32", - "Version", + "imm32", + "version", } configuration { } else @@ -841,8 +841,8 @@ if (_OPTIONS["osd"] == "sdl") then configuration { "vs*" } links { "SDL2", - "Imm32", - "Version", + "imm32", + "version", } configuration { } else -- cgit v1.2.3-70-g09d2 From 34ebe564b0d515ed05cfbdca9d31456b7f91d990 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 18 Feb 2019 21:55:45 +1100 Subject: (nw) omission, formatting --- docs/source/initialsetup/compilingmame.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/source/initialsetup') diff --git a/docs/source/initialsetup/compilingmame.rst b/docs/source/initialsetup/compilingmame.rst index 44d416d3108..b8a854db322 100644 --- a/docs/source/initialsetup/compilingmame.rst +++ b/docs/source/initialsetup/compilingmame.rst @@ -438,7 +438,7 @@ a **CFLAGS** or **CXXFLAGS** environment variable). You can check to see whether the ``_FORTIFY_SOURCE`` macro is a built-in macro with your version of GCC with a command like this: -**gcc -dM -E - | grep _FORTIFY_SOURCE** +**gcc -dM -E - < /dev/null | grep _FORTIFY_SOURCE** If ``_FORTIFY_SOURCE`` is defined to a non-zero value by default, you can work around it by adding **-U_FORTIFY_SOURCE** to the compiler flags (e.g. by using @@ -465,7 +465,7 @@ like this: **make TARGETOS=windows PTR64=1 OVERRIDE_CC=x86_64-w64-mingw32-gcc OVERRIDE_CXX=x86_64-w64-mingw32-g++ OVERRIDE_LD=x86_64-w64-mingw32-ld MINGW64=/usr** (The additional packages required for producing a standard MinGW32 x64 build on -a Fedora Linux host are `mingw64-gcc-c++`, `mingw64-winpthreads-static` and +a Fedora Linux host are ``mingw64-gcc-c++``, ``mingw64-winpthreads-static`` and their dependencies. Non-standard builds may require additional packages.) Using libc++ on Linux -- cgit v1.2.3-70-g09d2