diff --git a/README.md b/README.md index cefaa77d7..c55616738 100644 --- a/README.md +++ b/README.md @@ -66,9 +66,9 @@ Most of the development happens on [Dark Git](http://vub63vv26q6v27xzv2dtcd25xum To clone this git repository, you can use these commands given tor is installed and running: - git -c http.proxy=socks5h://127.0.0.1:9050 clone http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu.git + 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 --depth 1 --recursive + git submodule update --init --recursive Alternatively, you can clone from the [Codeberg mirror repository](https://codeberg.org/litucks/torzu): @@ -84,8 +84,9 @@ The GitHub mirror repository has been taken down. The new mirror repository is l ## Building -* __Linux__: [Linux Build](http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu/wiki/Building-for-Linux) -* __Windows__: [Windows Build](http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu/wiki/Building-for-Windows) +* [Android Build](http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu/build-for-android.md) (Codeberg [alt](https://codeberg.org/litucks/torzu/build-for-android.md)) +* [Linux Build](http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu/build-for-linux.md) (Codeberg [alt](https://codeberg.org/litucks/torzu/build-for-linux.md)) +* [Windows Build](http://vub63vv26q6v27xzv2dtcd25xumubshogm67yrpaz2rculqxs7jlfqad.onion/torzu-emu/torzu/build-for-windows.md) (Codeberg [alt](https://codeberg.org/litucks/torzu/build-for-windows.md)) ## License diff --git a/build-for-android.md b/build-for-android.md new file mode 100644 index 000000000..d1b218db5 --- /dev/null +++ b/build-for-android.md @@ -0,0 +1,32 @@ +## Note: These build instructions are a work-in-progress. +### Dependencies +* [Android Studio](https://developer.android.com/studio) +* [NDK 25.2.9519653 and CMake 3.22.1](https://developer.android.com/studio/projects/install-ndk#default-version) +* [Git](https://git-scm.com/download) +#### WINDOWS ONLY - Additional Dependencies + * **[Visual Studio 2022 Community](https://visualstudio.microsoft.com/downloads/)** - **Make sure to select "Desktop development with C++" support in the installer. Make sure to update to the latest version if already installed.** + * **[Vulkan SDK](https://vulkan.lunarg.com/sdk/home#windows)** - **Make sure to select Latest SDK.** +### 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 +``` +yuzu by default will be cloned into: +* `C:\Users\\torzu` on Windows +* `~/torzu` on Linux +* And wherever on macOS +### Building +1. Start Android Studio, on the startup dialog select `Open`. +2. Navigate to the `torzu/src/android` directory and click on `OK`. +3. In `Build > Select Build Variant`, select `release` or `relWithDebInfo` as the "Active build variant". +4. Build the project with `Build > Make Project` or run it on an Android device with `Run > Run 'app'`. + +### Additional Resources +https://developer.android.com/studio/intro diff --git a/build-for-linux.md b/build-for-linux.md new file mode 100644 index 000000000..f11a3b0a5 --- /dev/null +++ b/build-for-linux.md @@ -0,0 +1,137 @@ +### Dependencies + +You'll need to download and install the following to build yuzu: + + * [GCC](https://gcc.gnu.org/) v11+ (for C++20 support) & misc + * This page is being updated as we transition to GCC 11 + * If GCC 12 is installed, [Clang](https://clang.llvm.org/) v14+ is required for compiling + * [CMake](https://www.cmake.org/) 3.15+ + +The following are handled by yuzu's externals: + + * [FFmpeg](https://ffmpeg.org/) + * [SDL2](https://www.libsdl.org/download-2.0.php) 2.0.18+ + * [opus](https://opus-codec.org/downloads/) + +If version 5.15.2 is not already installed, pre-compiled binaries for Qt 5.15.2 will be downloaded from [here](https://github.com/litucks/ext-linux-bin) automatically by CMake: + + * [Qt](https://qt-project.org/downloads) 5.15+ + +All other dependencies will be downloaded by [vcpkg](https://vcpkg.io/) if needed: + + * [Boost](https://www.boost.org/users/download/) 1.79.0+ + * [Catch2](https://github.com/catchorg/Catch2) 2.13.7 - 2.13.9 + * [fmt](https://fmt.dev/) 8.0.1+ + * [lz4](http://www.lz4.org) 1.8+ + * [nlohmann_json](https://github.com/nlohmann/json) 3.8+ + * [OpenSSL](https://www.openssl.org/source/) + * [ZLIB](https://www.zlib.net/) 1.2+ + * [zstd](https://facebook.github.io/zstd/) 1.5+ + +If an ARM64 build is intended, export `VCPKG_FORCE_SYSTEM_BINARIES=1`. + +Dependencies are listed here as commands that can be copied/pasted. Of course, they should be inspected before being run. + +- Arch / Manjaro: + - `sudo pacman -Syu --needed base-devel boost catch2 cmake ffmpeg fmt git glslang libzip lz4 mbedtls ninja nlohmann-json openssl opus qt5 sdl2 zlib zstd zip unzip` + - Building with QT Web Engine needs to be specified when running CMake with the param `-DCMAKE_CXX_FLAGS="-I/usr/include/qt/QtWebEngineWidgets"` with qt5-webengine installed. + - GCC 11 or later is required. +- Ubuntu / Linux Mint / Debian: + - `sudo apt-get install autoconf cmake g++-11 gcc-11 git glslang-tools libasound2 libboost-context-dev libglu1-mesa-dev libhidapi-dev libpulse-dev libtool libudev-dev libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 libxcb-xkb1 libxext-dev libxkbcommon-x11-0 mesa-common-dev nasm ninja-build qtbase5-dev qtbase5-private-dev qtwebengine5-dev qtmultimedia5-dev libmbedtls-dev catch2 libfmt-dev liblz4-dev nlohmann-json3-dev libzstd-dev libssl-dev libavfilter-dev libavcodec-dev libswscale-dev` + - Ubuntu 22.04, Linux Mint 20, or Debian Bullseye or later is required. + - Users need to manually specify building with QT Web Engine enabled. This is done using the parameter `-DYUZU_USE_QT_WEB_ENGINE=ON` when running CMake. + - Users need to manually specify building with GCC 11. This can be done by adding the parameters `-DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11` when running CMake. i.e. + - Users need to manually disable building SDL2 from externals if they intend to use the version provided by their system by adding the parameters `-DYUZU_USE_EXTERNAL_SDL2=OFF` + +``` +git submodule update --init --recursive +cmake .. -GNinja -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 +``` + +- Fedora: + - `sudo dnf install autoconf ccache cmake fmt-devel gcc{,-c++} glslang hidapi-devel json-devel libtool libusb1-devel libzstd-devel lz4-devel nasm ninja-build openssl-devel pulseaudio-libs-devel qt5-linguist qt5-qtbase{-private,}-devel qt5-qtwebengine-devel qt5-qtmultimedia-devel speexdsp-devel wayland-devel zlib-devel ffmpeg-devel libXext-devel` + - Fedora 32 or later is required. + - Due to GCC 12, Fedora 36 or later users need to install `clang`, and configure CMake to use it via `-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang` + - CMake arguments to force system libraries: + - SDL2: `-DYUZU_USE_BUNDLED_SDL2=OFF -DYUZU_USE_EXTERNAL_SDL2=OFF` + - FFmpeg: `-DYUZU_USE_EXTERNAL_FFMPEG=OFF` + - [RPM Fusion](https://rpmfusion.org/) (free) is required to install `ffmpeg-devel` +- Gentoo: + - **\*\*Disclaimer\*\***: this dependency list was written by a novice Gentoo user who first set it up with a DE, and then based this list off of the Fedora dependency list. This may be missing some requirements, or includes too many. Caveat emptor. + - `emerge --ask app-arch/lz4 dev-libs/boost dev-libs/hidapi dev-libs/libzip dev-libs/openssl dev-qt/linguist dev-qt/qtconcurrent dev-qt/qtcore dev-util/cmake dev-util/glslang dev-vcs/git media-libs/alsa-lib media-libs/opus media-sound/pulseaudio media-video/ffmpeg net-libs/mbedtls sys-libs/zlib x11-libs/libXext` + - GCC 11 or later is required. + - Users may need to append `pulseaudio`, `bindist` and `context` to the `USE` flag. + +### 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 +``` + +### Building yuzu in Release Mode (Optimized) + +If you need to run ctests, you can disable `-DYUZU_TESTS=OFF` and install Catch2. + +```bash +mkdir build && cd build +cmake .. -GNinja -DYUZU_USE_BUNDLED_VCPKG=ON -DYUZU_TESTS=OFF +ninja +sudo ninja install +``` + +Optionally, you can use `cmake-gui ..` to adjust various options (e.g. disable the Qt GUI). + +### Building yuzu in Debug Mode (Slow) + +```bash +mkdir build && cd build +cmake .. -GNinja -DCMAKE_BUILD_TYPE=Debug -DYUZU_USE_BUNDLED_VCPKG=ON -DYUZU_TESTS=OFF +ninja +``` + +### Building with debug symbols + +```bash +mkdir build && cd build +cmake .. -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DYUZU_USE_BUNDLED_VCPKG=ON -DYUZU_TESTS=OFF +ninja +``` + +### Running without installing + +After building, the binaries `yuzu` and `yuzu-cmd` (depending on your build options) will end up in `build/bin/`. + + ```bash + # SDL + cd build/bin/ + ./yuzu-cmd + + # Qt + cd build/bin/ + ./yuzu + ``` + +### Debugging + +1. Enable CPU debugging + ![](https://raw.githubusercontent.com/flathub/org.yuzu_emu.yuzu/master/assets/yuzu-settings-2.png) +2. Disable both Host MMU emulation options + ![](https://raw.githubusercontent.com/flathub/org.yuzu_emu.yuzu/master/assets/yuzu-settings-1.png) +3. Run gdb + +```bash +cd data +gdb ../build/bin/yuzu # Start GDB +(gdb) handle SIGSEGV nostop # Disable SIGSEGV exceptions, which are used by yuzu for memory access +(gdb) run # Run yuzu under GDB + +(gdb) bt # Print a backtrace of the entire callstack to see which codepath the crash occurred on \ No newline at end of file diff --git a/build-for-macos.md b/build-for-macos.md new file mode 100644 index 000000000..a7c90172d --- /dev/null +++ b/build-for-macos.md @@ -0,0 +1,40 @@ +# This article was written for developers. yuzu support for macOS is not ready for casual use. + +# NOTE: yuzu officially discontinued support for MacOS when Apple deprecated OpenGL... this is provided as-is but may not work. +--- + +Install dependencies from Homebrew: +```sh +brew install autoconf automake boost@1.76 ccache ffmpeg fmt glslang hidapi libtool libusb lz4 ninja nlohmann-json openssl pkg-config qt@5 sdl2 speexdsp zlib zlib zstd +``` + +Build with debug symbols (vcpkg is not currently used due to broken boost-context library): +```sh +mkdir build && cd build +export Qt5_DIR="/opt/homebrew/opt/qt@5/lib/cmake" +cmake .. -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DYUZU_USE_BUNDLED_VCPKG=OFF -DYUZU_TESTS=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_LIBUSB=OFF +ninja +``` + +TODO: use newer vcpkg. This fixes the boost context library, and allows using the web service +TODO: figure out what's up with libusb +- TODO: use newer vcpkg. This fixes the boost context library, and allows using the web service +- TODO: figure out what's up with libusb + +Run the output: +``` +bin/yuzu.app/Contents/MacOS/yuzu +``` + +--- + +To run with MoltenVK, install additional dependencies: +```sh +brew install molten-vk vulkan-loader +``` + +Run with Vulkan loader path: +```sh +export LIBVULKAN_PATH=/opt/homebrew/lib/libvulkan.dylib +bin/yuzu.app/Contents/MacOS/yuzu +``` \ No newline at end of file diff --git a/build-for-windows.md b/build-for-windows.md new file mode 100644 index 000000000..0efbf146e --- /dev/null +++ b/build-for-windows.md @@ -0,0 +1,202 @@ +## 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](https://visualstudio.microsoft.com/downloads/)** - **Make sure to select C++ support in the installer. Make sure to update to the latest version if already installed.** + * **[CMake](https://cmake.org/download/)** - Used to generate Visual Studio project files. Does not matter if either 32-bit or 64-bit version is installed. + * **[Vulkan SDK](https://vulkan.lunarg.com/sdk/home#windows)** - **Make sure to select Latest SDK.** + + ![2](https://i.imgur.com/giDwuTm.png) + + * **Git** - We recommend [Git for Windows](https://gitforwindows.org). + + ![3](https://i.imgur.com/UeSzkBw.png) + + * 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](https://i.imgur.com/x0rRs1t.png) + +### 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](https://i.imgur.com/CcxIAht.png) + +* *(Note: yuzu by default downloads to `C:\Users\\yuzu` (Master) or `C:\Users\\yuzu-mainline` (Mainline)* + +### Building + +* Open the CMake GUI application and point it to the `torzu` directory. + + ![10](https://i.imgur.com/qOslIWv.png) + +* 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](https://i.imgur.com/cNnhs22.png) + ![11](https://github.com/yuzu-emu/yuzu/assets/20753089/738efcab-0da6-44ce-889d-becf3712db10) + +* Click the "Configure" button and choose `Visual Studio 17 2022`, with `x64` for the optional platform. + + ![12](https://i.imgur.com/DKiREaK.png) + + * *(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](https://user-images.githubusercontent.com/22451773/180585999-07316d6e-9751-4d11-b957-1cf57cd7cd58.png) + +* Click "Generate" to create the project files. + + ![15](https://i.imgur.com/5LKg92k.png) + +* Open the solution file `yuzu.sln` in Visual Studio 2022, which is located in the build folder. + + ![16](https://i.imgur.com/208yMml.png) + +* 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](https://i.imgur.com/nPMajnn.png) ![18](https://i.imgur.com/BDMLzRZ.png) + +* Select the appropriate build type, Debug for debug purposes or Release for performance (in case of doubt choose Release). + + ![19](https://i.imgur.com/qxg4roC.png) + +* Right-click the project you want to build and press Build in the submenu or press F5. + + ![20](https://i.imgur.com/CkQgOFW.png) + + +## Method II: MinGW-w64 Build with MSYS2 + +### Prerequisites to install + +* [MSYS2](https://www.msys2.org) +* [Vulkan SDK](https://vulkan.lunarg.com/sdk/home#windows) - **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) + +```bash +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. +```Bash +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](https://user-images.githubusercontent.com/190571/165000848-005e8428-8a82-41b1-bb4d-4ce7797cdac8.png) + + +### 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](https://www.jetbrains.com/clion/) - This IDE is not free; for a free alternative, check Method I +* [Vulkan SDK](https://vulkan.lunarg.com/sdk/home#windows) - Make sure to select the Latest SDK. + +### Cloning yuzu with CLion + +* Clone the Repository: + +![1](https://user-images.githubusercontent.com/42481638/216899046-0d41d7d6-8e4d-4ed2-9587-b57088af5214.png) +![2](https://user-images.githubusercontent.com/42481638/216899061-b2ea274a-e88c-40ae-bf0b-4450b46e9fea.png) +![3](https://user-images.githubusercontent.com/42481638/216899076-0e5988c4-d431-4284-a5ff-9ecff973db76.png) + + + +### Building & Setup + +* Once Cloned, You will be taken to a prompt like the image below: + +![4](https://user-images.githubusercontent.com/42481638/216899092-3fe4cec6-a540-44e3-9e1e-3de9c2fffc2f.png) + +* 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](https://user-images.githubusercontent.com/42481638/216899164-6cee8482-3d59-428f-b1bc-e6dc793c9b20.png) + +* 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](https://user-images.githubusercontent.com/42481638/216899226-975048e9-bc6d-4ec1-bc2d-bd8a1e15ed04.png) + +* Now run by clicking the play button or pressing Shift+F10, and yuzu will auto-launch once built. + +![7](https://user-images.githubusercontent.com/42481638/216899275-d514ec6a-e563-470e-81e2-3e04f0429b68.png) + +## 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 +``` \ No newline at end of file