Building for Windows

freiro edited this page Dec 16, 2016 · 12 revisions

MSVC Build for Windows

Minimal Dependencies

On Windows, all library dependencies are automatically included within the "externals" folder or can be downloaded on-demand. To build Citra, you simply need to install:

  • Visual Studio 2015 Community - Make sure to select C++ support in the installer.
  • CMake - Used to generate Visual Studio project files. 2
  • Git - We recommend msysgit. 3
  • While installing Git Bash, you should tell it to include Git in your system path. (Choose the "Use Git from the Windows Command Prompt" option.) If you missed that, don't worry, you'll just have to manually tell CMake where your git.exe is, since it's used to include version info into the built executable. 4

Cloning Citra in Git:

git clone --recursive https://github.com/citra-emu/citra.git
cd citra

9

NOTE: Citra by default downloads to C:\Users<user-name>\citra

Building

  • Open cmake-gui and point it to the Citra directory. Default:C:\Users<user name>\citra 10
    • For the build directory, use a build/ subdirectory inside the source directory or some other directory of your choice. (Tell CMake to create it.)

11

  • Click the "Configure" button and choose "Visual Studio 14 2015 Win64".
  • When CMake gives you an error, find the CITRA_USE_BUNDLED_SDL2 and CITRA_USE_BUNDLED_QT options on the list and check their respective checkboxes. Click configure again. CMake will now download the required libraries.

13

  • Click "Generate" to create the project files.

14

  • Open the solution file citra.sln in Visual Studio 2015, which is located in the build folder.

15

  • Depending on which frontend (SDL2 or Qt) you want to build or run, select "citra" or "citra-qt" in the Solution Explorer, right-click and "Set as StartUp Project".

16

17

  • Select the appropriate build type, Debug for debug purposes or Release for performance (in case of doubt choose the latest).

18

  • Press F5 or select Build → Rebuild Solution in the menu.

19

  • NOTE: Please refer to Common Issues if any errors. If you did not find a solution feel free to ask us in the IRC channel: #citra @ Freenode.

Mingw-w64 Build with MSYS2

Note that these instructions are a draft, and are dependant on the mingw build changes to be merged

Prerequistes to install

Make sure to follow the instructions and update to the latest version by running pacman -Syu as many times as needed.

Install citra dependancies for mingw-w64

  • Open the "MSYS2 MinGW 64-bit" (mingw64.exe) shell
  • Download and install all dependencies using: pacman -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-qt5 mingw-w64-x86_64-SDL2 mingw-w64-x86_64-cmake git

Clone the citra repository with git.

  • git clone --recursive https://github.com/citra-emu/citra.git
  • cd citra

Run the following commands to build citra (dynamic linked build)

mkdir build && cd build
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=mingw32-make -DCMAKE_CXX_FLAGS="-DMICROPROFILE_ENABLED=0" ..
# should we use `make`?
mingw32-make -j4
# test citra out with
./src/citra_qt/citra-qt.exe
Note! This build is not a static build meaning that you need to include all of the dlls with the exe in order to use it.

Creating a static build (Optional)

  • Instead of installing mingw-w64-x86_64-qt5 install mingw-w64-x86_64-qt5-static
  • Add -DMINGW_STATIC_BUILD to the cmake command line

Building without Qt (Optional)

Doesn't require the rather large Qt dependency, but you will lack a GUI frontend.

  • Pass the -DENABLE_QT=no flag to cmake

Clang build using clang-cl

Prerequistes to install

  • LLVM - The clang compiler
  • Visual Studio 2015 Community - Make sure to select C++ support in the installer.
  • CMake - Used to generate Visual Studio project files.
  • Git - We recommend msysgit. Follow the installers instructions.

Clone the citra repository with git.

  • git clone --recursive https://github.com/citra-emu/citra.git
  • cd citra

Run the following commands to build citra

mkdir build
cd build
cmake.exe .. -TLLVM-vs2014 -G"Visual Studio 14 2015 Win64" -DCITRA_USE_BUNDLED_SDL2=1 -DCITRA_USE_BUNDLED_QT=1 -DCMAKE_BUILD_TYPE=Release
cmake --build --target citra-qt
# test citra out with
.\bin\Release\citra-qt