Skip to content

Compilation guide (Windows)

Hans-Kristian Arntzen edited this page Aug 10, 2013 · 17 revisions

Compiling RetroArch for Windows is done with the MinGW toolchain. Both 32-bit and 64-bit variants should work.

Building RetroArch

Download and run Git for Windows, and you should be able to get a bash shell with Git working.

You'll also need the MinGW-w64 toolchain here. There are many builds to choose from. Generally, from left pane, pick WIN32 or WIN64 downloads, Personal Builds, and go from there (I personally use rubenvb's builds, but that's me). You'll want to see x86_64-w64-mingw32 for 64-bit toolchains and i686-w64-mingw32 for 32-bit toolchains.

For example, x86_64-w64-mingw32-gcc-4.8.0-win64 means the toolchain compiles code for x86_64-w64-mingw32 (64-bit) and the compiler itself runs on win64. There are builds that run on other setups, like Cygwin, OSX and Linux which are used to cross compile for Windows.

After you have downloaded and extracted the archive, make sure you set the PATH environmental variable to point to bin/ directory. After setup correctly, you should be able to run gcc -v in the Git shell.

On the forum there is a prepackaged Win64 setup that includes Git and MinGW-w64 like described above.

Then you can check out the source tree:

git clone git://github.com/Themaister/RetroArch.git
cd RetroArch

Now we need to download the library pack and the headers pack, and extract them into the top directory of RetroArch. Pick the 32-bit or 64-bit archives depending on which architecture you're building for:

http://themaister.net/retroarch-dl/RetroArch-win32-libs.zip (32-bit)
http://themaister.net/retroarch-dl/RetroArch-win32-headers.zip (32-bit)
http://themaister.net/retroarch-dl/RetroArch-win64-headers.zip (64-bit)
http://themaister.net/retroarch-dl/RetroArch-win64-libs.zip (64-bit)

Now build:

mingw32-make -f Makefile.win # If your compiler isn't called gcc/g++, you can set the proper compiler name with CC= and CXX=, standard Unix fare. You will also need to set WINDRES=.

Building GUI

Since the command-line isn't very comfortable on Windows, you will most likely want RetroArch-Phoenix or RGUI. To build Phoenix:

git clone git://github.com/Themaister/RetroArch-Phoenix.git
cd RetroArch-Phoenix
mingw32-make -f Makefile.win

Then you can move the retroarch-phoenix.exe into the folder you built RetroArch to make your life easier :)

Building libretro implementation

RetroArch does not include a libretro implementation by default. Refer to a libretro implementation how to build the DLL or libretro-super.

Building on Linux with MinGW cross chain

Building with a cross chain on Linux is probably the most convenient option. You should have unzip and wget installed for maximum laziness! :D You might need to install DirectX headers (dinput.h, dsound.h) properly. It is also here strongly recommended to use MinGW-w64 cross compilers (x86_64-w64-mingw32 and i686-w64-mingw32).

git clone git://github.com/Themaister/RetroArch.git
cd RetroArch
make -f Makefile.win libs_x86 # libs_x86_64 if you're cross building for x64 Windows.
make -f Makefile.win CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ # Cross-chain might be called differently on your distro.

Building GUI

Nothing unexpected here:

git clone git://github.com/Themaister/RetroArch-Phoenix.git
cd RetroArch-Phoenix
make -f Makefile.win CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ WINDRES=i686-w64-mingw32-windres # Will work for 64-bit compilers as well :)

Distributing readily usable .zip packages.

If you want to make distribution builds you can use the retroarch-mingw-build.sh script included in the top directory. It will checkout the latest sources, download libraries, and build distributable .zip files for both 32-bit and 64-bit in "slim" and "full" variants as found in the downloads section. It will also include the GUI:

NOBUILD_64BIT=1 MINGW32_BASE=i686-w64-mingw32 ./retroarch-mingw-build.sh # Build for just 32-bit.
NOBUILD_32BIT=1 MINGW64_BASE=x86_64-w64-mingw32 ./retroarch-mingw-build.sh # Build for just 64-bit.
MINGW32_BASE=i686-w64-mingw32 MINGW64_BASE=x86_64-w64-mingw32 ./retroarch-mingw-build.sh # Build for both.

The names of the cross chains vary from distro to distro.