diff --git a/AppImage-build-alpine-inner.sh b/AppImage-build-alpine-inner.sh new file mode 100644 index 000000000..6c23ee19d --- /dev/null +++ b/AppImage-build-alpine-inner.sh @@ -0,0 +1,328 @@ +sudo bwrap --bind . / --ro-bind / /host --dev-bind /run /run --dev-bind /dev /dev --proc /proc --dev-bind /sys /sys --ro-bind /etc/resolv.conf /etc/resolv.conf --setenv PATH '/sbin:/bin:/usr/sbin:/usr/bin' --setenv HOME /root /bin/ash + +apk add git gcc g++ yasm glslang cmake samurai make patch openssl-dev autoconf automake libtool libudev-zero-dev qt5-qtbase-dev qt5-qtmultimedia-dev glslang glslang-static libintl pulseaudio-dev alsa-lib-dev sndio-dev libxkbcommon-dev libunwind-dev ffmpeg-dev + +ln -s /usr/lib /usr/lib64 + +cmake .. -DCMAKE_BUILD_TYPE=Release -DYUZU_USE_CPM=ON -DYUZU_TESTS=OFF -DENABLE_QT_TRANSLATION=OFF -DTZ_LINK_INTL=ON -GNinja + + + + +apk add linux-headers git gcc g++ cmake meson samurai make patch autoconf automake libtool pkgconf python3 gettext bison flex xrandr-dev xtrans util-macros gperf gettext-dev elfutils-dev + +mkdir /static +mkdir /static/lib +ln -s /static/lib /static/lib64 +mkdir /static/share +mkdir /static/lib/pkgconfig +ln -s /static/lib/pkgconfig /static/share/pkgconfig + +python3 -m venv venv +. venv/bin/activate +pip install mako packaging PyYAML + +export PREFIX=/static +export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig" +export PATH="$PREFIX/bin:$PATH" + +git clone https://git.tukaani.org/xz.git --depth 1 --recursive +cd xz +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +git clone https://github.com/madler/zlib.git -b v1.3.1 +cd zlib +prefix="$PREFIX" ./configure +make -j$(nproc) +make install +cd .. + +git clone https://github.com/facebook/zstd.git --depth 1 --recursive -b v1.5.7 +cd zstd +mkdir cmakebuild +cd cmakebuild +cmake ../build/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$PREFIX" -DBUILD_SHARED_LIBS=OFF -DZSTD_BUILD_STATIC=ON -DZSTD_BUILD_TESTS=OFF -G Ninja +ninja install +cd .. +cd .. + +git clone https://github.com/openssl/openssl.git --depth 1 --recursive -b openssl-3.5.0 +cd openssl +./Configure --prefix="$PREFIX" --openssldir="$PREFIX/ssl" --static -static +make -j$(nproc) +make install +cd .. + +git clone https://github.com/illiliti/libudev-zero.git --depth 1 --recursive -b 1.0.3 +cd libudev-zero +make -j$(nproc) PREFIX="$PREFIX" install +cd .. + +git clone https://github.com/llvm/llvm-project.git --depth 1 --recursive -b llvmorg-20.1.7 +cd llvm-project +mkdir build +cd build +cmake ../llvm -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$PREFIX" -DBUILD_SHARED_LIBS=OFF -DLLVM_ENABLE_PROJECTS="clang;lld;libclc" -DLLVM_TARGETS_TO_BUILD=all -DLLVM_ENABLE_RUNTIMES="" -DLLVM_ENABLE_BINDINGS=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_OPTIMIZED_TABLEGEN=ON -DBUILD_SHARED_LIBS=OFF -DCLANG_ENABLE_HLSL=ON -DCLANG_ENABLE_ARCMT=OFF -DCLANG_ENABLE_STATIC_ANALYZER=OFF -G Ninja +ninja install +cd ../.. + +git clone https://gitlab.freedesktop.org/xorg/lib/libpciaccess.git --depth 1 --recursive -b libpciaccess-0.18.1 +cd libpciaccess +meson setup build --prefix "$PREFIX" -Ddefault_library=static +cd build +ninja install +cd ../.. + +git clone https://gitlab.freedesktop.org/mesa/libdrm.git --depth 1 --recursive -b libdrm-2.4.125 +cd libdrm +meson setup build --prefix "$PREFIX" -Ddefault_library=static +cd build +ninja install +cd ../.. + +git clone https://github.com/KhronosGroup/SPIRV-Headers.git --depth 1 --recursive -b vulkan-sdk-1.4.313.0 +cd SPIRV-Headers +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$PREFIX" -DBUILD_SHARED_LIBS=OFF -DSPIRV_HEADERS_ENABLE_TESTS=OFF -DSPIRV_HEADERS_ENABLE_INSTALL=ON -G Ninja +ninja install +cd ../.. + +git clone https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git --depth 1 --recursive -b v20.1.3 +cd SPIRV-LLVM-Translator +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$PREFIX" -DBUILD_SHARED_LIBS=OFF -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=$PREFIX/include/spirv/ -G Ninja +ninja install +cd ../.. + +git clone https://github.com/KhronosGroup/SPIRV-Tools.git --depth 1 --recursive -b v2025.1 +cd SPIRV-Tools +ln -s /root/SPIRV-Headers external/spirv-headers +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$PREFIX" -DBUILD_SHARED_LIBS=OFF -DENABLE_SPIRV_TOOLS_INSTALL=ON -G Ninja +ninja install +cd ../.. + +wget https://xorg.freedesktop.org/archive/individual/proto/xcb-proto-1.17.0.tar.gz +tar xfv xcb-proto-*.tar.gz +cd xcb-proto-*/ +./configure --prefix="$PREFIX" +make install +cd .. + +git clone https://gitlab.freedesktop.org/xorg/util/macros.git --depth 1 --recursive -b util-macros-1.20.2 +cd macros +./autogen.sh +./configure --prefix="$PREFIX" +make install +cd .. + +wget https://xorg.freedesktop.org/archive/individual/proto/xorgproto-2024.1.tar.xz +tar xfv xorgproto-*.tar.xz +cd xorgproto-*/ +./configure --prefix="$PREFIX" +make install +cd .. + +wget https://www.x.org/pub/individual/lib/libXau-1.0.12.tar.xz +tar xfv libXau-*.tar.xz +cd libXau-*/ +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +wget https://xorg.freedesktop.org/archive/individual/lib/libxcb-1.17.0.tar.gz +tar xfv libxcb-*.tar.gz +cd libxcb-*/ +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes --enable-dri3 +make $(nproc) +make install +cd .. + +git clone https://gitlab.freedesktop.org/xorg/lib/libx11.git --depth 1 --recursive -b libX11-1.8.12 +cd libx11 +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +git clone https://gitlab.freedesktop.org/xorg/lib/libxrender.git --depth 1 --recursive -b libXrender-0.9.12 +cd libxrender +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +git clone https://gitlab.freedesktop.org/xorg/lib/libxcb-util.git --depth 1 --recursive -b xcb-util-0.4.1-gitlab +cd libxcb-util +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +git clone https://gitlab.freedesktop.org/xorg/lib/libxcb-keysyms.git --depth 1 --recursive -b xcb-util-keysyms-0.4.1 +cd libxcb-keysyms +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +git clone https://gitlab.freedesktop.org/xorg/lib/libxcb-image.git --depth 1 --recursive -b xcb-util-image-0.4.1-gitlab +cd libxcb-image +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +git clone https://gitlab.freedesktop.org/alanc/libxcb-render-util.git --depth 1 --recursive -b xcb-util-renderutil-0.3.10 +cd libxcb-render-util +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +git clone https://gitlab.freedesktop.org/xorg/lib/libxext.git --depth 1 --recursive -b libXext-1.3.6 +cd libxext +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +git clone https://gitlab.freedesktop.org/xorg/lib/libxfixes.git --depth 1 --recursive -b libXfixes-6.0.1 +cd libxfixes +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +git clone https://gitlab.freedesktop.org/xorg/lib/libxshmfence.git --depth 1 --recursive -b libxshmfence-1.3.3 +cd libxshmfence +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +git clone https://gitlab.freedesktop.org/xorg/lib/libxrandr.git --depth 1 --recursive -b libXrandr-1.5.4 +cd libxrandr +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +git clone https://gitlab.freedesktop.org/xorg/lib/libxxf86vm.git --depth 1 --recursive -b libXxf86vm-1.1.6 +cd libxxf86vm +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +git clone https://gitlab.freedesktop.org/xorg/lib/libxcb-wm.git --depth 1 --recursive -b xcb-util-wm-0.4.2 +cd libxcb-wm +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +git clone https://gitlab.freedesktop.org/freetype/freetype.git --depth 1 --recursive -b VER-2-13-3 +cd freetype +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +git clone https://gitlab.freedesktop.org/xorg/lib/libice.git --depth 1 --recursive -b libICE-1.1.2 +cd libice +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +git clone https://gitlab.freedesktop.org/xorg/lib/libsm.git --depth 1 --recursive -b libSM-1.2.6 +cd libsm +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +git clone https://gitlab.freedesktop.org/fontconfig/fontconfig.git --depth 1 --recursive -b 2.16.2 +cd fontconfig +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +git clone https://github.com/xkbcommon/libxkbcommon.git --depth 1 --recursive -b xkbcommon-1.10.0 +cd libxkbcommon +meson setup build --prefix "$PREFIX" -Ddefault_library=static -Denable-xkbregistry=false -Denable-wayland=false -Denable-tools=false -Dc_link_args="$PREFIX/lib/libXau.a" +cd build +ninja install +cd ../.. + +git clone https://gitlab.freedesktop.org/mesa/mesa.git --depth 1 --recursive -b mesa-25.1.3 +cd mesa +meson setup build -Dvulkan-drivers= -Dgallium-drivers=nouveau,r300,r600,radeonsi,zink -Dplatforms=x11 -Degl-native-platform=x11 -Dstatic-libclc=all -Dcpp_rtti=false +cd build +ninja install +cd ../.. + +git clone https://git.ffmpeg.org/ffmpeg.git --depth 1 --recursive -b n7.1.1 +cd ffmpeg +./configure --prefix="$PREFIX" --enable-gpl --disable-programs --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages +make -j$(nproc) +make install +cd .. + +git clone https://github.com/libusb/libusb.git --depth 1 --recursive +cd libusb +./autogen.sh +./configure --prefix="$PREFIX" --enable-shared=no --enable-static=yes +make -j$(nproc) +make install +cd .. + +wget https://download.qt.io/official_releases/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz +tar xfv qt-everywhere-src-*.tar.xz +cd qt-everywhere-src-*/ +./configure -prefix "$PREFIX" -static -release -opensource -confirm-license -qt-zlib -qt-libpng -qt-webp -qt-libjpeg -qt-freetype -skip qt3d -skip qtactiveqt -skip qtandroidextras -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdeclarative -skip qtdoc -skip qtgamepad -skip qtlocation -skip qtlottie -skip qtmacextras -skip qtnetworkauth -skip qtpurchasing -skip qtquick3d -skip qtquickcontrols -skip qtquickcontrols2 -skip qtquicktimeline -skip qtremoteobjects -skip qtscript -skip qtsensors -skip qtspeech -skip qtwayland -skip qtwebglplugin -skip qtwebview -skip webengine -make libs -nomake examples -nomake tests +make -j$(nproc) +make install +cd .. + +find /static -name \*.so -exec rm -vf {} \; + +cd torzu +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DYUZU_USE_CPM=ON -DYUZU_TESTS=OFF -DENABLE_QT=OFF -DTZ_LINK_INTL=ON -G Ninja +ninja yuzu +cd ../.. + +# /root/llvm-project/llvm/tools/llvm-config/llvm-config.cpp +# : replace all LinkMode = LinkModeShared with LinkMode = LinkModeStatic + +# /root/qt-everywhere-src-5.15.2/qtbase/include/QtCore/../../src/corelib/global/qfloat16.h +# /root/qt-everywhere-src-5.15.2/qtbase/src/corelib/text/qbytearraymatcher.h +# : add #include diff --git a/AppImage-build-debian-inner.sh b/AppImage-build-debian-inner.sh index 34aa7252a..7ab128967 100755 --- a/AppImage-build-debian-inner.sh +++ b/AppImage-build-debian-inner.sh @@ -14,7 +14,12 @@ ulimit -n 50000 # Install dependencies apt -y install cmake ninja-build build-essential autoconf pkg-config locales wget git file mold libtool lsb-release wget software-properties-common gnupg \ - qtbase5-dev qtmultimedia5-dev qtbase5-private-dev glslang-tools libssl-dev libavcodec-dev libavfilter-dev libavutil-dev libswscale-dev libpulse-dev libasound2-dev + glslang-tools libssl-dev libavcodec-dev libavfilter-dev libavutil-dev libswscale-dev libpulse-dev libasound2-dev libudev-dev libice6 +if [ "$BUILD_QT" = 1 ]; then + apt -y install libxcb-composite0-dev libxcb-damage0-dev libxcb-dpms0-dev libxcb-dri2-0-dev libxcb-dri3-dev libxcb-ewmh-dev libxcb-present-dev libxcb-record0-dev libxcb-res0-dev libxcb-screensaver0-dev libxcb-xf86dri0-dev libxcb-xtest0-dev libxcb-xv0-dev libxcb-xvmc0-dev libfontconfig1-dev libfreetype6-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-cursor-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-util-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev libgl-dev +else + apt -y install qt6-base-dev qt6-base-private-dev qt6-multimedia-dev qt6-qpa-plugins +fi if [ ! "$BUILD_USE_CPM" = 1 ]; then apt -y install libfmt-dev libenet-dev liblz4-dev nlohmann-json3-dev zlib1g-dev libopus-dev libsimpleini-dev libstb-dev libzstd-dev libusb-1.0-0-dev libcubeb-dev libcpp-jwt-dev libvulkan-dev gamemode-dev libasound2-dev libglu1-mesa-dev libxext-dev mesa-common-dev libva-dev @@ -49,29 +54,40 @@ mount -t overlay overlay -olowerdir=torzu-src-ro,upperdir=torzu-src-upper,workdi EXTRA_COMPILE_FLAGS="" EXTRA_CMAKE_FLAGS="" if [ "$BUILD_USE_CLANG" = 1 ]; then - EXTRA_CMAKE_FLAGS="-DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19" + export CC=clang-19 CXX=clang++-19 + EXTRA_CMAKE_FLAGS="-DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX" + EXTRA_COMPILE_FLAGS="-fuse-ld=lld-19 -Wno-unused-command-line-argument" FATLTO_FLAG="-flto=full" else FATLTO_FLAG="-flto" fi if [ "$BUILD_USE_THIN_LTO" = 1 ]; then - EXTRA_COMPILE_FLAGS="-flto=thin" + EXTRA_COMPILE_FLAGS="$EXTRA_COMPILE_FLAGS -flto=thin" fi if [ "$BUILD_USE_FAT_LTO" = 1 ]; then - EXTRA_COMPILE_FLAGS="$FATLTO_FLAG" + EXTRA_COMPILE_FLAGS="$EXTRA_COMPILE_FLAGS $FATLTO_FLAG" fi if [ "$BUILD_USE_CPM" = 1 ]; then EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DYUZU_USE_CPM=ON" fi +if [ "$BUILD_QT" = 1 ]; then + EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DYUZU_BUILD_QT6=ON" + if [ "$BUILD_PREFER_STATIC" = 1 ]; then + EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DYUZU_BUILD_QT6_STATIC=ON" + fi +fi +if [ "$BUILD_PREFER_STATIC" = 1 ]; then + EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DBUILD_SHARED_LIBS=OFF -DCMAKE_FIND_LIBRARY_SUFFIXES=.a;.so" +fi # Build Torzu cd /tmp mkdir torzu-build cd torzu-build -cmake /tmp/torzu-src -GNinja -DCMAKE_BUILD_TYPE=Release -DYUZU_TESTS=OFF -DENABLE_QT_TRANSLATION=OFF -DSPIRV_WERROR=OFF -DCMAKE_FIND_LIBRARY_SUFFIXES=".a;.so" -DSPIRV-Headers_SOURCE_DIR=/tmp/torzu-src/externals/SPIRV-Headers -DCMAKE_{C,CXX}_FLAGS="$EXTRA_COMPILE_FLAGS -fdata-sections -ffunction-sections" -DCMAKE_{EXE,SHARED}_LINKER_FLAGS="-Wl,--gc-sections" $EXTRA_CMAKE_FLAGS +cmake /tmp/torzu-src -GNinja -DCMAKE_BUILD_TYPE=Release -DYUZU_TESTS=OFF -DENABLE_QT_TRANSLATION=OFF -DSPIRV_WERROR=OFF -DSPIRV-Headers_SOURCE_DIR=/tmp/torzu-src/externals/SPIRV-Headers -DCMAKE_{C,CXX}_FLAGS="$EXTRA_COMPILE_FLAGS -fdata-sections -ffunction-sections" -DCMAKE_{EXE,SHARED}_LINKER_FLAGS="-Wl,--gc-sections" $EXTRA_CMAKE_FLAGS ninja || ( echo "Compilation has failed. Dropping you into a shell so you can inspect the situation. Run 'ninja' to retry and exit shell once compilation has finished successfully." - echo "Note that any changes made here will not be reflected to the host environment, but changes made from the host environment will be reflected here." + echo "Note that any changes made here will not be reflected to the host environment." bash ) diff --git a/AppImage-build-debian.sh b/AppImage-build-debian.sh index 73fd10177..95d088f71 100755 --- a/AppImage-build-debian.sh +++ b/AppImage-build-debian.sh @@ -21,12 +21,21 @@ case $i in export BUILD_USE_CPM=1 echo "-> Using CPM to download most dependencies." ;; + -q|--build-qt) + export BUILD_QT=1 + echo "-> Building Qt." + ;; + -s|--prefer-static) + export BUILD_PREFER_STATIC=1 + export QTSTATIC=true + echo "-> Preferring static libraries." + ;; -k|--keep-rootfs) BUILD_KEEP_ROOTFS=1 echo "-> Not deleting rootfs after successful build." ;; *) - echo "Usage: $0 [--clang/-l] [--thin-lto/-o] [--fat-lto/-O] [--use-cpm/-p] [--keep-rootfs/-k]" + echo "Usage: $0 [--clang/-l] [--thin-lto/-o] [--fat-lto/-O] [--use-cpm/-p] [--build-qt/-q] [--prefer-static/-s] [--keep-rootfs/-k]" exit 1 ;; esac @@ -51,11 +60,14 @@ rm -rf "$TORZU_SOURCE_DIR/AppImageBuilder/build" cd /tmp echo "Cleaning up before build..." rm -rf torzu-debian-appimage-rootfs -[ -d rootfs-torzu-appimage-build ] || - debootstrap stable rootfs-torzu-appimage-build http://deb.debian.org/debian/ +if ! [ -d rootfs-torzu-appimage-build ]; then + debootstrap bookworm rootfs-torzu-appimage-build http://deb.debian.org/debian/ +else + rm -rf rootfs-torzu-appimage-build/tmp/* +fi bwrap --bind rootfs-torzu-appimage-build / \ --unshare-pid \ - --dev-bind /dev /dev --proc /proc --tmpfs /tmp --ro-bind /sys /sys --dev-bind /run /run \ + --dev-bind /dev /dev --proc /proc --ro-bind /sys /sys --dev-bind /run /run \ --tmpfs /var/tmp \ --chmod 1777 /tmp \ --ro-bind /etc/resolv.conf /etc/resolv.conf \ diff --git a/AppImageBuilder/build.sh b/AppImageBuilder/build.sh index 79dc76ff8..fc78219a4 100755 --- a/AppImageBuilder/build.sh +++ b/AppImageBuilder/build.sh @@ -52,7 +52,7 @@ if [ ! -d "$QTDIR" ]; then fi fi fi -if [ $QTFOUND == "true" ]; then +if [ $QTFOUND == "true" ] || [ -n "$QTSTATIC" ]; then echo "QT plugins from $QTDIR will be used." # Copy system dependencies used to build and required by the yuzu binary @@ -69,9 +69,11 @@ if [ $QTFOUND == "true" ]; then copy_libs "$YUZU_BIN_GUI" # Copy QT dependency folders, path determined above - echo "Copying Qt dependencies..." - mkdir ./build/qt5 - cp -rv "$QTDIR"/{imageformats,platforms,platformthemes,xcbglintegrations} ./build/qt5/ + if [ -z "$QTSTATIC" ]; then + echo "Copying Qt dependencies..." + mkdir ./build/qt5 + cp -rv "$QTDIR"/{imageformats,platforms,platformthemes,xcbglintegrations} ./build/qt5/ + fi # Discover indirect dependencies (mostly from runtime-loaded Qt plugins) echo "Copying extra dependencies..." diff --git a/CMakeLists.txt b/CMakeLists.txt index 70e5e0487..70b5692e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,11 +31,20 @@ cmake_dependent_option(ENABLE_LIBUSB "Enable the use of LibUSB" ON "NOT ANDROID" option(ENABLE_OPENGL "Enable OpenGL" ON) mark_as_advanced(FORCE ENABLE_OPENGL) option(ENABLE_QT "Enable the Qt frontend" ON) -option(ENABLE_QT6 "Allow usage of Qt6 to be attempted" OFF) set(QT6_LOCATION "" CACHE PATH "Additional Location to search for Qt6 libraries like C:/Qt/6.3.1/msvc2019_64/") -option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" ON) -CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" "${MSVC}" "ENABLE_QT" OFF) +if (ENABLE_QT) + option(YUZU_BUILD_QT6 "Build Qt6 at configure time" OFF) + if (YUZU_BUILD_QT6) + option(YUZU_BUILD_QT6_STATIC "Build Qt6 statically" OFF) + endif() + + option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" ON) + + option(YUZU_USE_QT_MULTIMEDIA "Use QtMultimedia for Camera" OFF) + + option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF) +endif() option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON) @@ -55,10 +64,6 @@ else() set(YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS OFF) endif() -option(YUZU_USE_QT_MULTIMEDIA "Use QtMultimedia for Camera" OFF) - -option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF) - option(ENABLE_CUBEB "Enables the cubeb audio backend" ON) option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF) @@ -411,7 +416,9 @@ else() add_library(Opus::opus ALIAS opus) add_library(lz4::lz4 ALIAS lz4) add_library(zstd::zstd ALIAS libzstd) - add_library(zstd::libzstd ALIAS libzstd) + if (NOT YUZU_BUILD_QT6) + add_library(zstd::libzstd ALIAS libzstd) + endif() add_library(nlohmann::json ALIAS nlohmann_json) # Enet specific setup to add missing include dir @@ -421,6 +428,114 @@ else() add_library(enet::enet ALIAS enet_fixed) endif() +if (YUZU_BUILD_QT6) + set(QT_VERSION "6.9.1") + set(QT_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/qt-install") + set(QT_SOURCE_DIR "${CMAKE_BINARY_DIR}/qt-src") + set(QT_TARBALL_PATH "${CMAKE_BINARY_DIR}/qt-${QT_VERSION}.tar.xz") + + # Extract major and minor versions from QT_VERSION + string(REPLACE "." ";" QT_VERSION_PARTS "${QT_VERSION}") + list(GET QT_VERSION_PARTS 0 QT_MAJOR) + list(GET QT_VERSION_PARTS 1 QT_MINOR) + + set(QT_URL "https://download.qt.io/archive/qt/${QT_MAJOR}.${QT_MINOR}/${QT_VERSION}/single/qt-everywhere-src-${QT_VERSION}.tar.xz") + + set(QT_SUBMODULES "qtbase,qttranslations") + if (YUZU_USE_QT_MULTIMEDIA) + set(QT_SUBMODULES "${QT_SUBMODULES},qtmultimedia") + endif() + + if (YUZU_BUILD_QT6_STATIC) + set(QT_LIBTYPE "-static") + else() + set(QT_LIBTYPE "-shared") + endif() + + # Check prerequisites + find_program(NINJA_EXECUTABLE ninja) + if(NOT NINJA_EXECUTABLE) + message(FATAL_ERROR "'ninja' executable not found. Install it or ensure it's in your PATH. It's required for building Qt6.") + endif() + + # Download Qt source + if (NOT EXISTS ${QT_TARBALL_PATH}) + message(STATUS "Downloading Qt library sources. This will take some time...") + file(DOWNLOAD + ${QT_URL} + ${QT_TARBALL_PATH} + SHOW_PROGRESS + STATUS download_status + ) + + # Check download success + list(GET download_status 0 status_code) + if(NOT status_code EQUAL 0) + list(GET download_status 1 error_msg) + message(FATAL_ERROR "Download failed: ${error_msg}") + endif() + endif() + + # Extract source + if (NOT EXISTS "${QT_SOURCE_DIR}/qt-everywhere-src-${QT_VERSION}/CMakeLists.txt") + message(STATUS "Extracting Qt library sources. This will take some time...") + file(ARCHIVE_EXTRACT + INPUT ${QT_TARBALL_PATH} + DESTINATION ${QT_SOURCE_DIR} + ) + endif() + + # Configure Qt + message(STATUS "Configuring Qt library. This will take some time...") + if (MSVC) + set(QT_CONFIGURE_COMMAND "${QT_SOURCE_DIR}/qt-everywhere-src-${QT_VERSION}/configure.bat") + else() + set(QT_CONFIGURE_COMMAND "${QT_SOURCE_DIR}/qt-everywhere-src-${QT_VERSION}/configure") + endif() + message(STATUS "Configuring Qt library using ${QT_CONFIGURE_COMMAND}") + file(MAKE_DIRECTORY "${QT_SOURCE_DIR}/build") + execute_process(COMMAND ${QT_CONFIGURE_COMMAND} + -opensource -confirm-license + -prefix "${QT_INSTALL_PREFIX}" + -release ${QT_LIBTYPE} -ltcg + -submodules ${QT_SUBMODULES} + -no-feature-vulkan + -nomake examples -nomake tests + -qt-doubleconversion -no-glib -qt-pcre -qt-zlib -qt-harfbuzz -qt-libpng -qt-libjpeg + WORKING_DIRECTORY "${QT_SOURCE_DIR}/build" + RESULT_VARIABLE ret + ) + if (NOT ret EQUAL "0") + message(FATAL_ERROR "Qt library failed to configure.") + endif() + + # Build and install Qt + message(STATUS "Building Qt library. This will take some time...") + execute_process(COMMAND ${CMAKE_COMMAND} --build "${QT_SOURCE_DIR}/build" --parallel + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE ret + ) + if (NOT ret EQUAL "0") + message(FATAL_ERROR "Qt library failed to build.") + endif() + + message(STATUS "Installing Qt library. This will take some time...") + execute_process(COMMAND ${CMAKE_COMMAND} --install "${QT_SOURCE_DIR}/build" + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE ret + ) + if (NOT ret EQUAL "0") + message(FATAL_ERROR "Qt library failed to install.") + endif() + + # Add Qt installation to search path + message(STATUS "Qt library installed to ${QT_INSTALL_PREFIX}") + list(PREPEND CMAKE_PREFIX_PATH ${QT_INSTALL_PREFIX}) + list(PREPEND CMAKE_MODULE_PATH ${QT_INSTALL_PREFIX}/lib/cmake) + set(Qt6_DIR "${QT_INSTALL_PREFIX}/lib/cmake/Qt6" CACHE PATH "" FORCE) + set(QT_QMAKE_EXECUTABLE "${QT_INSTALL_PREFIX}/bin/qmake6" CACHE PATH "" FORCE) +endif() + if (NOT YUZU_USE_EXTERNAL_VULKAN_HEADERS) if (NOT YUZU_USE_CPM) find_package(VulkanHeaders 1.3.274 REQUIRED) @@ -492,7 +607,7 @@ if (UNIX AND NOT APPLE) endif() # Please consider this as a stub -if(ENABLE_QT6 AND Qt6_LOCATION) +if(Qt6_LOCATION) list(APPEND CMAKE_PREFIX_PATH "${Qt6_LOCATION}") endif() @@ -522,146 +637,22 @@ endfunction(set_yuzu_qt_components) # Qt5 requires that we find components, so it doesn't fit our pretty little find package function if(ENABLE_QT) - set(QT_VERSION 5.15) + set(QT_VERSION 6.3.1) # These are used to specify minimum versions - set(QT5_VERSION 5.15) set(QT6_VERSION 6.3.1) set_yuzu_qt_components() - if (ENABLE_QT6) - find_package(Qt6 ${QT6_VERSION} COMPONENTS ${YUZU_QT_COMPONENTS}) - endif() + find_package(Qt6 ${QT6_VERSION} COMPONENTS ${YUZU_QT_COMPONENTS}) if (Qt6_FOUND) + message(STATUS "yuzu/CMakeLists.txt: Found Qt6 at ${Qt6_CONFIG} (widgets at ${Qt6Widgets_CONFIG})") message(STATUS "yuzu/CMakeLists.txt: Qt6Widgets_VERSION ${Qt6Widgets_VERSION}, setting QT_VERSION") set(QT_VERSION ${Qt6Widgets_VERSION}) set(QT_MAJOR_VERSION 6) # Qt6 sets cxx_std_17 and we need to undo that set_target_properties(Qt6::Platform PROPERTIES INTERFACE_COMPILE_FEATURES "") else() - message(STATUS "yuzu/CMakeLists.txt: Qt6 not found/not selected, trying for Qt5") - # When Qt6 partially found, need this set to use Qt5 when not specifying version - set(QT_DEFAULT_MAJOR_VERSION 5) - set(QT_MAJOR_VERSION 5) - - set(YUZU_USE_QT_MULTIMEDIA ON) - # Check for system Qt on Linux, fallback to bundled Qt - if (UNIX AND NOT APPLE) - if (NOT YUZU_USE_BUNDLED_QT) - find_package(Qt5 ${QT5_VERSION} COMPONENTS Widgets DBus Multimedia) - endif() - if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND (NOT Qt5_FOUND OR YUZU_USE_BUNDLED_QT)) - # Check for dependencies, then enable bundled Qt download - - # Check that the system GLIBCXX version is compatible - find_program(OBJDUMP objdump) - if (NOT OBJDUMP) - message(FATAL_ERROR "Required program `objdump` not found.") - endif() - find_library(LIBSTDCXX libstdc++.so.6) - execute_process( - COMMAND - ${OBJDUMP} -T ${LIBSTDCXX} - COMMAND - grep GLIBCXX_3.4.28 - COMMAND - sed "s/[0-9a-f]*.* //" - COMMAND - sed "s/ .*//" - COMMAND - sort -u - OUTPUT_VARIABLE - GLIBCXX_MET - ) - if (NOT GLIBCXX_MET) - message(FATAL_ERROR "Qt too old or not found, and bundled Qt package is not \ - compatible with this system. Either install Qt ${QT_VERSION}, or provide the path \ - to Qt by setting the variable Qt5_ROOT.") - endif() - - # Check for headers - find_package(PkgConfig REQUIRED) - pkg_check_modules(QT_DEP_GLU QUIET glu>=9.0.0) - if (NOT QT_DEP_GLU_FOUND) - message(FATAL_ERROR "Qt bundled package dependency `glu` not found. \ - Perhaps `libglu1-mesa-dev` needs to be installed?") - endif() - pkg_check_modules(QT_DEP_MESA QUIET dri>=20.0.8) - if (NOT QT_DEP_MESA_FOUND) - message(FATAL_ERROR "Qt bundled package dependency `dri` not found. \ - Perhaps `mesa-common-dev` needs to be installed?") - endif() - - # Check for X libraries - set(BUNDLED_QT_REQUIREMENTS - libxcb-icccm.so.4 - libxcb-image.so.0 - libxcb-keysyms.so.1 - libxcb-randr.so.0 - libxcb-render-util.so.0 - libxcb-render.so.0 - libxcb-shape.so.0 - libxcb-shm.so.0 - libxcb-sync.so.1 - libxcb-xfixes.so.0 - libxcb-xinerama.so.0 - libxcb-xkb.so.1 - libxcb.so.1 - libxkbcommon-x11.so.0 - libxkbcommon.so.0 - ) - set(UNRESOLVED_QT_DEPS "") - foreach (REQUIREMENT ${BUNDLED_QT_REQUIREMENTS}) - find_library(BUNDLED_QT_${REQUIREMENT} ${REQUIREMENT}) - if (NOT BUNDLED_QT_${REQUIREMENT}) - set(UNRESOLVED_QT_DEPS ${UNRESOLVED_QT_DEPS} ${REQUIREMENT}) - endif() - unset(BUNDLED_QT_${REQUIREMENT}) - endforeach() - unset(BUNDLED_QT_REQUIREMENTS) - - if (NOT "${UNRESOLVED_QT_DEPS}" STREQUAL "") - message(FATAL_ERROR "Bundled Qt package missing required dependencies: ${UNRESOLVED_QT_DEPS}") - endif() - - set(YUZU_USE_BUNDLED_QT ON CACHE BOOL "Download bundled Qt" FORCE) - endif() - if (YUZU_USE_BUNDLED_QT) - # Binary package currently does not support Qt webengine, so make sure it's disabled - set(YUZU_USE_QT_WEB_ENGINE OFF CACHE BOOL "Use Qt Webengine" FORCE) - endif() - endif() - - set(YUZU_QT_NO_CMAKE_SYSTEM_PATH) - - if(YUZU_USE_BUNDLED_QT) - ## if ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND ARCHITECTURE_x86_64) - if ((MSVC_VERSION GREATER_EQUAL 1920) AND ARCHITECTURE_x86_64) - set(QT_BUILD qt-5.15.2-msvc2019_64) - elseif ((${CMAKE_SYSTEM_NAME} STREQUAL "Linux") AND NOT MINGW AND ARCHITECTURE_x86_64) - set(QT_BUILD qt5_5_15_2) - else() - message(FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable YUZU_USE_BUNDLED_QT and provide your own.") - endif() - - if (DEFINED QT_BUILD) - download_bundled_external("qt/" ${QT_BUILD} QT_PREFIX) - execute_process(COMMAND chmod +x ${QT_PREFIX}/bin/moc.exe ERROR_QUIET) - execute_process(COMMAND chmod +x ${QT_PREFIX}/bin/uic.exe ERROR_QUIET) - execute_process(COMMAND chmod +x ${QT_PREFIX}/bin/rcc.exe ERROR_QUIET) - execute_process(COMMAND chmod +x ${QT_PREFIX}/bin/lrelease.exe ERROR_QUIET) - endif() - - set(QT_PREFIX_HINT HINTS "${QT_PREFIX}") - - set(YUZU_QT_NO_CMAKE_SYSTEM_PATH "NO_CMAKE_SYSTEM_PATH") - # Binary package for Qt5 has Qt Multimedia - set(YUZU_USE_QT_MULTIMEDIA ON CACHE BOOL "Use Qt Multimedia" FORCE) - endif() - - set_yuzu_qt_components() - find_package(Qt5 ${QT5_VERSION} COMPONENTS ${YUZU_QT_COMPONENTS} ${QT_PREFIX_HINT} ${YUZU_QT_NO_CMAKE_SYSTEM_PATH}) + message(FATAL_ERROR "yuzu/CMakeLists.txt: Qt6 not found, but is now required") endif() - endif() # find SDL2 exports a bunch of variables that are needed, so its easier to do this outside of the yuzu_find_package @@ -674,7 +665,6 @@ if (ENABLE_SDL2) else() message(FATAL_ERROR "No bundled SDL2 binaries for your toolchain. Disable YUZU_USE_BUNDLED_SDL2 and provide your own.") endif() - if (DEFINED SDL2_VER) download_bundled_external("sdl2/" ${SDL2_VER} SDL2_PREFIX) endif() diff --git a/build-for-android.md b/build-for-android.md index f2d1724f4..77a8a8524 100644 --- a/build-for-android.md +++ b/build-for-android.md @@ -45,7 +45,7 @@ https://developer.android.com/studio/intro ``` sudo apt-get update sudo apt-get install -y sdkmanager openjdk-21-jdk build-essential curl git pkg-config glslang-tools zip -sudo sdkmanager "ndk;26.3.11579264" "platforms;android-35" "build-tools;35.0.0" "cmake;3.22.1" "platform-tools;35.0.5" +sudo sdkmanager "ndk;26.3.11579264" "platforms;android-35" "build-tools;35.0.0" "cmake;3.22.1" "platform-tools;35.0.2" sudo update-alternatives --config java # Select Java 21 here if possible ``` diff --git a/build-for-windows.md b/build-for-windows.md index 918dbfacf..2cc688e73 100644 --- a/build-for-windows.md +++ b/build-for-windows.md @@ -77,7 +77,7 @@ cd torzu git submodule update --init --recursive mkdir build cd build -cmake .. -G "Visual Studio 17 2022" -A x64 -DYUZU_TESTS=OFF +cmake .. -G "Visual Studio 17 2022" -A x64 -DYUZU_TESTS=OFF -DYUZU_BUILD_QT6=ON cmake --build . --config Release ``` * You'll find the resulting files in the `build/bin/Release` folder. To make it a portable install with all AppData files local to the torzu folder, add a "user" folder: @@ -173,12 +173,27 @@ https://github.com/mstorsjo/msvc-wine https://apt.llvm.org +https://kb.firedaemon.com/support/solutions/articles/4000121705#Download-OpenSSL + +https://github.com/clamwin/openssl + ``` # Probably not needed, use if include files can't be found -exec bwrap --bind / / --ro-bind '/opt/msvc/Windows Kits/10/Include/10.0.22621.0/ucrt' /usr/include --dev /dev /bin/bash +exec bwrap --bind / / --tmpfs /usr/include --tmpfs /usr/lib/pkgconfig --tmpfs /usr/lib/x86_64-linux-gnu/pkgconfig --tmpfs /usr/lib/cmake --dev /dev /bin/bash ``` ``` -CC=clang-cl-19 CXX=clang-cl-19 cmake /tmp/torzu -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_{C,CXX}_FLAGS:STRING="--target=x86_64-windows-msvc /EHa -Wno-unused-command-line-argument -Wno-unknown-argument -flto=full -fdata-sections -ffunction-sections" -DCMAKE_EXE_LINKER_FLAGS="-Wl,--gc-sections" -DCMAKE_SYSTEM_NAME:STRING=Windows -DYUZU_USE_BUNDLED_VCPKG=OFF -DYUZU_USE_CPM=ON -DENABLE_OPENSSL=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_LIBUSB=OFF -DYUZU_TESTS=OFF -GNinja +# in build/linux +../../configure -opensource -confirm-license -prefix ~/qt-everywhere-src-6.9.1/inst/linux -release ${QT_LIBTYPE} -ltcg -submodules qtbase,qttranslations,qtmultimedia -no-feature-vulkan -nomake examples -nomake tests -qt-doubleconversion -no-glib -qt-pcre -qt-zlib -qt-harfbuzz -qt-libpng -qt-libjpeg +ninja install + +# in build/windows +cp -rv ../../qtmultimedia/src/multimedia/windows qtbase/include/QtMultimedia/private +CC=clang-cl-19 CXX=clang-cl-19 CFLAGS="--target=x86_64-windows-msvc -fuse-ld=lld-link-19" CXXFLAGS="--target=x86_64-windows-msvc -fuse-ld=lld-link-19" ../../configure -opensource -confirm-license -prefix ~/qt-everywhere-src-6.9.1/inst/windows -release -static -ltcg -submodules qtbase,qtdeclarative,qtmultimedia -skip qtactiveqt -no-feature-vulkan -nomake examples -nomake tests -qt-doubleconversion -no-glib -qt-pcre -qt-zlib -qt-harfbuzz -qt-libpng -qt-libjpeg -platform win32-clang-msvc -qt-host-path ~/qt-everywhere-src-6.9.1/inst/linux -- -DCMAKE_SYSTEM_NAME=Windows +ninja +ninja install +``` +``` +CC=clang-cl-19 CXX=clang-cl-19 cmake /tmp/torzu -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_ASM_FLAGS="--target=x86_64-windows-msvc" -DCMAKE_{C,CXX}_FLAGS:STRING="--target=x86_64-windows-msvc -DNOMINMAX /EHa -Wno-unused-command-line-argument -Wno-unknown-argument -flto=full -fdata-sections -ffunction-sections" -DCMAKE_EXE_LINKER_FLAGS="-Wl,--gc-sections" -DCMAKE_SYSTEM_NAME:STRING=Windows -DYUZU_USE_BUNDLED_VCPKG=OFF -DYUZU_USE_CPM=ON -DENABLE_OPENSSL=OFF -DENABLE_WEB_SERVICE=OFF -DENABLE_LIBUSB=OFF -DYUZU_TESTS=OFF -DQT_QMAKE_EXECUTABLE:FILEPATH=/home/user/qt-everywhere-src-6.9.1/inst/windows/bin/qmake -DCMAKE_PREFIX_PATH:PATH=/home/user/qt-everywhere-src-6.9.1/inst -GNinja ``` --- diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 4a45430f2..a0907cb3c 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -50,10 +50,31 @@ if ((ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64) AND NOT TARGET dynarmic::dynarmi endif() # getopt -if (MSVC) +include(CheckIncludeFile) +check_include_file(getopt.h HAS_GETOPT) +if (NOT HAS_GETOPT) + message(STATUS "Using bundled getopt") add_subdirectory(getopt) endif() +# clang_rt_builtins +check_c_source_compiles(" +#include + +volatile __uint128_t a = 100; +volatile __uint128_t b = 2; + +int main() { + __uint128_t result = a / b; + (void)result; + return 0; +} +" HAVE_UDIVTI3) +if(NOT HAVE_UDIVTI3) + message(STATUS "Adding clang_rt_builtins due to missing __udivti3") + add_subdirectory(clang_rt_builtins) +endif() + # Glad add_subdirectory(glad) diff --git a/externals/clang_rt_builtins/CMakeLists.txt b/externals/clang_rt_builtins/CMakeLists.txt new file mode 100644 index 000000000..39984df77 --- /dev/null +++ b/externals/clang_rt_builtins/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.10) +project(clang_rt_builtins C) + +add_library(clang_rt_builtins STATIC udivti3.c) diff --git a/externals/clang_rt_builtins/udivti3.c b/externals/clang_rt_builtins/udivti3.c new file mode 100644 index 000000000..a9d1414e5 --- /dev/null +++ b/externals/clang_rt_builtins/udivti3.c @@ -0,0 +1,36 @@ +typedef unsigned __int128 tu_int; + +tu_int __udivti3(tu_int a, tu_int b) +{ + if (b == 0) { + // Handle division by zero (could also trigger a fault) + return 0; + } + + if (b > a) { + return 0; + } + + int shift; + for (shift = 0;; shift++) { + if (shift >= 128) { + break; + } + tu_int shifted_b = b << shift; + if (shifted_b > a || (shifted_b >> shift) != b) { + break; + } + } + shift--; + + tu_int quotient = 0; + for (; shift >= 0; shift--) { + tu_int shifted_b = b << shift; + if (shifted_b <= a) { + quotient |= (tu_int) 1 << shift; + a -= shifted_b; + } + } + + return quotient; +} diff --git a/externals/getopt/CMakeLists.txt b/externals/getopt/CMakeLists.txt index 4797fe01c..32db3a6b6 100644 --- a/externals/getopt/CMakeLists.txt +++ b/externals/getopt/CMakeLists.txt @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: 2015 Greg Wicks # SPDX-License-Identifier: GPL-2.0-or-later -add_library(getopt +add_library(getopt STATIC getopt.c getopt.h ) @@ -9,4 +9,4 @@ add_library(getopt create_target_directory_groups(getopt) target_compile_definitions(getopt PUBLIC STATIC_GETOPT) -target_include_directories(getopt INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories(getopt PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 80e999b69..17379dedd 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -218,6 +218,10 @@ if(ARCHITECTURE_x86_64) target_link_libraries(common PRIVATE xbyak::xbyak) endif() +if (TARGET clang_rt_builtins) + target_link_libraries(common PUBLIC clang_rt_builtins) +endif() + if (HAS_NCE) target_sources(common PRIVATE diff --git a/src/dedicated_room/CMakeLists.txt b/src/dedicated_room/CMakeLists.txt index fdd5e1e50..a92620524 100644 --- a/src/dedicated_room/CMakeLists.txt +++ b/src/dedicated_room/CMakeLists.txt @@ -19,6 +19,10 @@ if (MSVC) endif() target_link_libraries(yuzu-room PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) +if (TARGET getopt) + target_link_libraries(yuzu-room PRIVATE getopt) +endif() + if(UNIX AND NOT APPLE) install(TARGETS yuzu-room) endif() diff --git a/src/shader_recompiler/frontend/ir/microinstruction.cpp b/src/shader_recompiler/frontend/ir/microinstruction.cpp index 84417980b..cfd617c67 100644 --- a/src/shader_recompiler/frontend/ir/microinstruction.cpp +++ b/src/shader_recompiler/frontend/ir/microinstruction.cpp @@ -250,7 +250,8 @@ bool Inst::AreAllArgsImmediates() const { if (op == Opcode::Phi) { throw LogicError("Testing for all arguments are immediates on phi instruction"); } - return std::all_of(args.begin(), args.begin() + NumArgs(), + return std::all_of(args.begin(), + args.begin() + static_cast(NumArgs()), [](const IR::Value& value) { return value.IsImmediate(); }); } diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 4bb91cf1c..aaaeb1df5 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -348,6 +348,15 @@ target_sources(yuzu ${THEMES} ) +target_compile_definitions(yuzu PUBLIC YUZU_QT_VERSION_STR="${Qt6Widgets_VERSION}") + +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + qt_import_plugins(yuzu + INCLUDE Qt6::QXcbIntegrationPlugin + EXCLUDE_BY_TYPE sqldrivers + ) +endif() + if (APPLE) set(MACOSX_ICON "../../dist/yuzu.icns") set_source_files_properties(${MACOSX_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) @@ -449,7 +458,8 @@ if(UNIX AND NOT APPLE) install(TARGETS yuzu) endif() -if (WIN32 AND QT_VERSION VERSION_GREATER_EQUAL 6) +get_target_property(QT_TARGET_TYPE Qt6::Widgets TYPE) +if (WIN32 AND QT_VERSION VERSION_GREATER_EQUAL 6 AND QT_TARGET_TYPE STREQUAL "SHARED_LIBRARY") set(YUZU_EXE_DIR "$") add_custom_command(TARGET yuzu POST_BUILD COMMAND ${WINDEPLOYQT_EXECUTABLE} "${YUZU_EXE_DIR}/yuzu.exe" --dir "${YUZU_EXE_DIR}" --libdir "${YUZU_EXE_DIR}" --plugindir "${YUZU_EXE_DIR}/plugins" --no-compiler-runtime --no-opengl-sw --no-system-d3d-compiler --no-translations --verbose 0) endif() diff --git a/src/yuzu/about_dialog.cpp b/src/yuzu/about_dialog.cpp index 61a6efc7c..e21971644 100644 --- a/src/yuzu/about_dialog.cpp +++ b/src/yuzu/about_dialog.cpp @@ -3,6 +3,7 @@ #include #include + #include "common/scm_rev.h" #include "ui_aboutdialog.h" #include "yuzu/about_dialog.h" @@ -24,9 +25,9 @@ AboutDialog::AboutDialog(QWidget* parent) if (!yuzu_logo.isNull()) { ui->labelLogo->setPixmap(yuzu_logo.pixmap(200)); } - ui->labelBuildInfo->setText( - ui->labelBuildInfo->text().arg(QString::fromStdString(yuzu_build_version), - QString::fromUtf8(Common::g_build_date).left(10))); + ui->labelBuildInfo->setText(ui->labelBuildInfo->text().arg( + QString::fromStdString(yuzu_build_version), + QString::fromUtf8(Common::g_build_date).left(10), QString::fromUtf8(YUZU_QT_VERSION_STR))); } AboutDialog::~AboutDialog() = default; diff --git a/src/yuzu/aboutdialog.ui b/src/yuzu/aboutdialog.ui index dafd8df7f..621ee687c 100644 --- a/src/yuzu/aboutdialog.ui +++ b/src/yuzu/aboutdialog.ui @@ -82,7 +82,7 @@ - <html><head/><body><p>%1 (%2)</p></body></html> + <html><head/><body><p>%1 (%2) with Qt %3</p></body></html> diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 69e47c6e0..420b36566 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -53,6 +53,7 @@ #include "yuzu/multiplayer/state.h" #include "yuzu/util/controller_navigation.h" + // These are wrappers to avoid the calls to CreateDirectory and CreateFile because of the Windows // defines. static FileSys::VirtualDir VfsFilesystemCreateDirectoryWrapper( @@ -5212,9 +5213,6 @@ static void SetHighDPIAttributes() { QApplication::setHighDpiScaleFactorRoundingPolicy( Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); #endif - - QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); } int main(int argc, char* argv[]) { diff --git a/src/yuzu_cmd/CMakeLists.txt b/src/yuzu_cmd/CMakeLists.txt index f86d991b8..d81280711 100644 --- a/src/yuzu_cmd/CMakeLists.txt +++ b/src/yuzu_cmd/CMakeLists.txt @@ -36,6 +36,10 @@ if (YUZU_CMD) endif() target_link_libraries(yuzu-cmd PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads) + if (TARGET getopt) + target_link_libraries(yuzu-cmd PRIVATE getopt) + endif() + create_resource("../../dist/yuzu.bmp" "yuzu_cmd/yuzu_icon.h" "yuzu_icon") target_include_directories(yuzu-cmd PRIVATE ${RESOURCES_DIR}) @@ -64,4 +68,4 @@ if (YUZU_CMD) endif() create_target_directory_groups(yuzu-cmd) -endif() \ No newline at end of file +endif()