torzu/build-for-windows.md
anon b5e4a009b4 add build guides (#16)
Reviewed-on: http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu/pulls/16
Co-authored-by: anon <anon@noreply.localhost>
Co-committed-by: anon <anon@noreply.localhost>
2024-07-19 19:22:35 +00:00

8.2 KiB

Method I: 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 yuzu, you need to install:

  • Visual Studio 2022 Community - Make sure to select C++ support in the installer. Make sure to update to the latest version if already installed.
  • CMake - Used to generate Visual Studio project files. Does not matter if either 32-bit or 64-bit version is installed.
  • Vulkan SDK - Make sure to select Latest SDK.

2

3

  • While installing Git Bash, you should tell it to include Git in your system path. (Choose the "Git from the command line and also from 3rd-party software" 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 yuzu with Git

from Codeberg repo (the --recursive option automatically clones the required Git submodules):

git clone --depth 1 --recursive https://codeberg.org/litucks/torzu.git
cd torzu

from Torzu repo (assuming Tor is installed as a service):

git -c http.proxy=socks5h://127.0.0.1:9050 clone --depth 1 http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu.git
cd torzu
git submodule update --init --recursive

9

  • (Note: yuzu by default downloads to C:\Users\<user-name>\yuzu (Master) or C:\Users\<user-name>\yuzu-mainline (Mainline)

Building

  • Open the CMake GUI application and point it to the torzu directory.

    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 11

  • Click the "Configure" button and choose Visual Studio 17 2022, with x64 for the optional platform.

    12

    • (Note: If you used GitHub's own app to clone, run git submodule update --init --recursive to get the remaining dependencies)
  • If you get an error about missing packages, enable YUZU_USE_BUNDLED_VCPKG, and then click Configure again.

    • (You may also want to disable YUZU_TESTS in this case since Catch2 is not yet supported with this.)

    13

  • Click "Generate" to create the project files.

    15

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

    16

  • Depending if you want a graphical user interface or not (yuzu has the graphical user interface, while yuzu-cmd doesn't), select yuzu or yuzu-cmd in the Solution Explorer, right-click and Set as StartUp Project.

    17 18

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

    19

  • Right-click the project you want to build and press Build in the submenu or press F5.

    20

Method II: MinGW-w64 Build with MSYS2

Prerequisites to install

  • MSYS2
  • Vulkan SDK - Make sure to select Latest SDK.
  • Make sure to follow the instructions and update to the latest version by running pacman -Syu as many times as needed.

Install yuzu dependencies for MinGW-w64

  • Open the MSYS2 MinGW 64-bit (mingw64.exe) shell
  • Download and install all dependencies using: pacman -Syu git make mingw-w64-x86_64-SDL2 mingw-w64-x86_64-cmake mingw-w64-x86_64-python-pip mingw-w64-x86_64-qt5 mingw-w64-x86_64-toolchain autoconf libtool automake-wrapper
  • Add MinGW binaries to the PATH: echo 'PATH=/mingw64/bin:$PATH' >> ~/.bashrc
  • Add glslangValidator to the PATH: echo 'PATH=$(readlink -e /c/VulkanSDK/*/Bin/):$PATH' >> ~/.bashrc

Clone the yuzu repository with Git

from Codeberg repo (the --recursive option automatically clones the required Git submodules):

git clone --depth 1 --recursive https://codeberg.org/litucks/torzu.git
cd torzu

from Torzu repo (assuming Tor is installed as a service):

git -c http.proxy=socks5h://127.0.0.1:9050 clone --depth 1 http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu.git
cd torzu
git submodule update --init --recursive

Run the following commands to build yuzu (dynamically linked build)

mkdir build && cd build
cmake -G "MSYS Makefiles" -DYUZU_USE_BUNDLED_VCPKG=ON -DYUZU_TESTS=OFF ..
make -j$(nproc)
# test yuzu out with
./bin/yuzu.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!)

e.g.

cp externals/ffmpeg-*/bin/*.dll bin/

Bonus Note: Running programs from inside MSYS2 MinGW x64 shell has a different %PATH% than directly from explorer. This different %PATH% has the locations of the other DLLs required. image

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

Method III: CLion Environment Setup

Minimal Dependencies

To build yuzu, you need to install the following:

  • CLion - This IDE is not free; for a free alternative, check Method I
  • Vulkan SDK - Make sure to select the Latest SDK.

Cloning yuzu with CLion

  • Clone the Repository:

1 2 3

Building & Setup

  • Once Cloned, You will be taken to a prompt like the image below:

4

  • Set the settings to the image below:
  • Change Build type: Release
  • Change Name: Release
  • Change Toolchain Visual Studio
  • Change Generator: Let CMake decide
  • Change Build directory: build

5

  • Click OK; now Clion will build a directory and index your code to allow for IntelliSense. Please be patient.
  • Once this process has been completed (No loading bar bottom right), you can now build yuzu
  • In the top right, click on the drop-down menu, select all configurations, then select yuzu

6

  • Now run by clicking the play button or pressing Shift+F10, and yuzu will auto-launch once built.

7

Building from the command line with MSVC

from Codeberg repo (the --recursive option automatically clones the required Git submodules):

git clone --depth 1 --recursive https://codeberg.org/litucks/torzu.git
cd torzu

from Torzu repo (assuming Tor is installed as a service):

git -c http.proxy=socks5h://127.0.0.1:9050 clone --depth 1 http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu.git
cd torzu
git submodule update --init --recursive

followed by:

mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -A x64
cmake --build . --config Release