Browse Source

[cmake, docs] msys: allow bundled FFmpeg, update dep/caveat docs, faster linking on Release mode (#2921)

Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2921
Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
pull/2936/head
crueter 2 months ago
parent
commit
c70abc8e43
No known key found for this signature in database GPG Key ID: 425ACD2D4830EBC6
  1. 17
      CMakeLists.txt
  2. 5
      CMakeModules/CPMUtil.cmake
  3. 62
      docs/Caveats.md
  4. 23
      docs/Deps.md
  5. 2
      src/common/thread.cpp

17
CMakeLists.txt

@ -37,6 +37,12 @@ endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules")
# https://gitlab.kitware.com/cmake/cmake/-/merge_requests/11112
# This works totally fine on MinGW64, but not CLANG{,ARM}64
if(MINGW AND CXX_CLANG)
set(CMAKE_SYSTEM_VERSION 10.0.0)
endif()
# NB: this does not account for SPARC # NB: this does not account for SPARC
# If you get Eden working on SPARC, please shoot crueter@crueter.xyz multiple emails # If you get Eden working on SPARC, please shoot crueter@crueter.xyz multiple emails
# and you will be hailed for eternity # and you will be hailed for eternity
@ -221,6 +227,7 @@ if(YUZU_ENABLE_LTO)
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ${COMPILER_SUPPORTS_LTO}) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ${COMPILER_SUPPORTS_LTO})
endif() endif()
option(USE_CCACHE "Use ccache for compilation" OFF) option(USE_CCACHE "Use ccache for compilation" OFF)
set(CCACHE_PATH "ccache" CACHE STRING "Path to ccache binary") set(CCACHE_PATH "ccache" CACHE STRING "Path to ccache binary")
if(USE_CCACHE) if(USE_CCACHE)
@ -265,9 +272,11 @@ if (ANDROID OR WIN32 OR APPLE OR PLATFORM_SUN)
# your own copy of it. # your own copy of it.
set(DEFAULT_ENABLE_OPENSSL OFF) set(DEFAULT_ENABLE_OPENSSL OFF)
endif() endif()
if (ENABLE_WEB_SERVICE) if (ENABLE_WEB_SERVICE)
set(DEFAULT_ENABLE_OPENSSL ON) set(DEFAULT_ENABLE_OPENSSL ON)
endif() endif()
option(ENABLE_OPENSSL "Enable OpenSSL backend for ISslConnection" ${DEFAULT_ENABLE_OPENSSL}) option(ENABLE_OPENSSL "Enable OpenSSL backend for ISslConnection" ${DEFAULT_ENABLE_OPENSSL})
if (ENABLE_OPENSSL) if (ENABLE_OPENSSL)
set(DEFAULT_YUZU_USE_BUNDLED_OPENSSL OFF) set(DEFAULT_YUZU_USE_BUNDLED_OPENSSL OFF)
@ -894,6 +903,14 @@ if(MSVC)
) )
endif() endif()
if (MINGW)
# This saves a truly ridiculous amount of time during linking
# In my tests, without this it takes 2 mins, with it takes 3-5 seconds
# or on GitHub Actions, 10 minutes -> 3 seconds
set(MINGW_FLAGS "-Wl,--strip-all -Wl,--gc-sections")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${MINGW_FLAGS}")
endif()
add_subdirectory(src) add_subdirectory(src)
# Set yuzu project or yuzu-cmd project as default StartUp Project in Visual Studio depending on whether QT is enabled or not # Set yuzu project or yuzu-cmd project as default StartUp Project in Visual Studio depending on whether QT is enabled or not

5
CMakeModules/CPMUtil.cmake

@ -586,11 +586,12 @@ function(AddCIPackage)
set(ARTIFACT_REPO ${PKG_ARGS_REPO}) set(ARTIFACT_REPO ${PKG_ARGS_REPO})
set(ARTIFACT_PACKAGE ${PKG_ARGS_PACKAGE}) set(ARTIFACT_PACKAGE ${PKG_ARGS_PACKAGE})
if ((MSVC AND ARCHITECTURE_x86_64) AND NOT "windows-amd64" IN_LIST DISABLED_PLATFORMS)
# TODO: separate MinGW packages if applicable
if ((WIN32 AND ARCHITECTURE_x86_64) AND NOT "windows-amd64" IN_LIST DISABLED_PLATFORMS)
add_ci_package(windows-amd64) add_ci_package(windows-amd64)
endif() endif()
if ((MSVC AND ARCHITECTURE_arm64) AND NOT "windows-arm64" IN_LIST DISABLED_PLATFORMS)
if ((WIN32 AND ARCHITECTURE_arm64) AND NOT "windows-arm64" IN_LIST DISABLED_PLATFORMS)
add_ci_package(windows-arm64) add_ci_package(windows-arm64)
endif() endif()

62
docs/Caveats.md

@ -13,12 +13,11 @@
## Arch Linux ## Arch Linux
- httplib AUR package is broken. Set `httplib_FORCE_BUNDLED=ON` if you have it installed.
- Eden is also available as an [AUR package](https://aur.archlinux.org/packages/eden-git). If you are unable to build, either use that or compare your process to the PKGBUILD.
Eden is also available as an [AUR package](https://aur.archlinux.org/packages/eden-git). If you are unable to build, either use that or compare your process to the PKGBUILD.
## Gentoo Linux ## Gentoo Linux
Do not use the system sirit or xbyak packages.
Enable the GURU repository to install [`games-emulation/eden`](https://gitweb.gentoo.org/repo/proj/guru.git/tree/games-emulation/eden). This repository also contains some additional dependencies, such as mcl, sirit, oaknut, etc.
## macOS ## macOS
@ -102,3 +101,60 @@ cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -- -j`nproc` cmake --build build -- -j`nproc`
cmake --install build cmake --install build
``` ```
## MSYS2
`qt6-static` isn't supported yet.
Only the `MINGW64` environment is tested; however, all of the others should work (in theory) sans `MINGW32`.
Currently, only FFmpeg can be used as a system dependency; the others will result in linker errors.
When packaging an MSYS2 build, you will need to copy all dependent DLLs recursively alongside the `windeployqt6`; for example:
```sh
# MSYS_TOOLCHAIN is typically just mingw64
# since Windows is case-insensitive, you can set this to $MSYSTEM
# or, if cross-compiling from Linux, set it to usr/x86_64-w64-mingw32
export PATH="/${MSYS_TOOLCHAIN}/bin:$PATH"
# grab deps of a dll or exe and place them in the current dir
deps() {
# string parsing is fun
objdump -p "$1" | grep -e ".DLL Name:" | cut -d" " -f3 | while read -r dll; do
[ -z "$dll" ] && continue
# bin directory is used for DLLs, so we can do a quick "hack"
# and use command to find the path of the DLL
dllpath=$(command -v "$dll" 2>/dev/null || true)
[ -z "$dllpath" ] && continue
# explicitly include system32/syswow64 deps
# these aren't needed to be bundled, as all systems include them
case "$dllpath" in
*System32* | *SysWOW64*) continue ;;
esac
# avoid copying deps multiple times
if [ ! -f "$dll" ]; then
echo "$dllpath"
cp "$dllpath" "$dll"
# also grab the dependencies of the dependent DLL; e.g.
# double-conversion is a dep of Qt6Core.dll but NOT eden.exe
deps "$dllpath"
fi
done
}
# NB: must be done in a directory containing eden.exe
deps eden.exe
# deploy Qt plugins and such
windeployqt6 --release --no-compiler-runtime \
--no-opengl-sw --no-system-dxc-compiler --no-system-d3d-compiler eden.exe
# grab deps for Qt plugins
find ./*/ -name "*.dll" | while read -r dll; do deps "$dll"; done
```

23
docs/Deps.md

@ -87,6 +87,15 @@ Notes for writers: Include build tools as well, assume user has NOTHING installe
Click on the arrows to expand. Click on the arrows to expand.
<details>
<summary>Gentoo Linux</summary>
GURU must be enabled:
```
sudo
</details>
<details> <details>
<summary>Arch Linux</summary> <summary>Arch Linux</summary>
@ -149,6 +158,8 @@ apk add g++ git cmake make mbedtls-dev mbedtls-static mesa-dev qt6-qtbase-dev qt
`mbedtls-static` has to be specified otherwise `libeverest.a` and `libp256m.a` will fail to be found. `mbedtls-static` has to be specified otherwise `libeverest.a` and `libp256m.a` will fail to be found.
</details> </details>
<details>
<summary>Void Linux</summary> <summary>Void Linux</summary>
```sh ```sh
@ -158,6 +169,7 @@ xbps-install -Su git make cmake clang pkg-config patch mbedtls-devel SPIRV-Tools
Yes, `nlohmann-json` is just named `json-c++`. Why? Yes, `nlohmann-json` is just named `json-c++`. Why?
</details> </details>
<details> <details>
<summary>NixOS</summary> <summary>NixOS</summary>
@ -234,24 +246,27 @@ Then install the libraries: `sudo pkg install qt6 boost glslang libzip library/l
* Download and install all dependencies: * Download and install all dependencies:
``` ```
BASE="git make autoconf libtool automake-wrapper jq patch" BASE="git make autoconf libtool automake-wrapper jq patch"
MINGW="SDL2 cmake python-pip qt6-base toolchain ffmpeg boost catch fmt lz4 nlohmann-json openssl zlib zstd enet opus mbedtls vulkan-devel libusb vulkan-memory-allocator unordered_dense clang ccache"
MINGW="qt6-base qt6-tools qt6-translations qt6-svg cmake toolchain clang python-pip openssl vulkan-memory-allocator vulkan-devel glslang boost fmt lz4 nlohmann-json zlib zstd enet opus mbedtls libusb unordered_dense"
packages="$BASE" packages="$BASE"
for pkg in $MINGW; do for pkg in $MINGW; do
packages="$packages mingw-w64-x86_64-$pkg" packages="$packages mingw-w64-x86_64-$pkg"
done done
pacman -Syu --needed --noconfirm $packages
pacman -Syuu --needed --noconfirm $packages
``` ```
* Notes: * Notes:
- Using `qt6-static` is possible but currently untested. - Using `qt6-static` is possible but currently untested.
- Other environments are entirely untested, but should theoretically work provided you install all the necessary packages. - Other environments are entirely untested, but should theoretically work provided you install all the necessary packages.
- Clang is installed as it generally works better here. You can compile with GCC just fine, however.
- GCC is proven to work better with the MinGW environment. If you choose to use Clang, you *may* be better off using the clang64 environment.
- Add `qt-creator` to the `MINGW` variable to install Qt Creator. You can then create a Start Menu shortcut to the MinGW Qt Creator by running `powershell "\$s=(New-Object -COM WScript.Shell).CreateShortcut('C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Qt Creator.lnk');\$s.TargetPath='C:\\msys64\\mingw64\\bin\\qtcreator.exe';\$s.Save()"` in Git Bash or MSYS2. - Add `qt-creator` to the `MINGW` variable to install Qt Creator. You can then create a Start Menu shortcut to the MinGW Qt Creator by running `powershell "\$s=(New-Object -COM WScript.Shell).CreateShortcut('C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Qt Creator.lnk');\$s.TargetPath='C:\\msys64\\mingw64\\bin\\qtcreator.exe';\$s.Save()"` in Git Bash or MSYS2.
* Add MinGW binaries to the PATH if they aren't already: * Add MinGW binaries to the PATH if they aren't already:
* `echo 'PATH=/mingw64/bin:$PATH' >> ~/.bashrc` * `echo 'PATH=/mingw64/bin:$PATH' >> ~/.bashrc`
* or `echo 'PATH=/mingw64/bin:$PATH' >> ~/.zshrc` * or `echo 'PATH=/mingw64/bin:$PATH' >> ~/.zshrc`
[Caveats](./Caveats.md#msys2).
</details> </details>
<details> <details>
<summary>HaikuOS</summary> <summary>HaikuOS</summary>
@ -263,6 +278,8 @@ pkgman install git cmake patch libfmt_devel nlohmann_json lz4_devel opus_devel b
[Caveats](./Caveats.md#haikuos). [Caveats](./Caveats.md#haikuos).
</details> </details>
<details>
<summary>RedoxOS</summary> <summary>RedoxOS</summary>
TODO: Fix syscall crashes (heavy IO stalls and hangup due to net mutexes?) TODO: Fix syscall crashes (heavy IO stalls and hangup due to net mutexes?)

2
src/common/thread.cpp

@ -109,7 +109,7 @@ void SetCurrentThreadName(const char* name) {
buf[len] = '\0'; buf[len] = '\0';
pthread_setname_np(pthread_self(), buf); pthread_setname_np(pthread_self(), buf);
} }
#elif !defined(_WIN32) || defined(_MSC_VER)
#elif defined(_WIN32)
// mingw stub // mingw stub
(void)name; (void)name;
#else #else

Loading…
Cancel
Save