From 2d6aca45635ffcafd28cf6ccf26018edf85c4651 Mon Sep 17 00:00:00 2001 From: Steveice10 <1269164+Steveice10@users.noreply.github.com> Date: Mon, 26 Jun 2023 17:42:00 -0700 Subject: [PATCH] build: Rework CI and move all bundling into new build target. (#6556) * build: Rework CI and move all bundling into new build target. * ci: Use "mingw" in msys2 release names for compatibility. * ci: Use "osx" in macOS release names for compatibility. * ci: Disable macOS upload. Will be moved to a separate PR for canary merge. --- .ci/{android/build.sh => android.sh} | 9 +- .ci/android/upload.sh | 23 -- .../script.sh => clang-format.sh} | 0 .ci/common/post-upload.sh | 28 -- .ci/common/pre-upload.sh | 6 - .ci/linux-appimage/build.sh | 3 - .ci/linux-appimage/docker.sh | 24 -- .ci/linux-appimage/upload.sh | 5 - .ci/linux-clang-format/build.sh | 3 - .ci/linux-clang-format/docker.sh | 4 - .ci/linux-fresh/build.sh | 3 - .ci/linux-fresh/docker.sh | 7 - .ci/linux-fresh/upload.sh | 19 -- .ci/linux-frozen/build.sh | 3 - .ci/linux-frozen/docker.sh | 15 -- .ci/linux-frozen/install_package.py | 52 ---- .ci/linux-mingw/build.sh | 3 - .ci/linux-mingw/docker.sh | 30 --- .ci/linux-mingw/scan_dll.py | 122 --------- .ci/linux-mingw/upload.sh | 13 - .ci/linux.sh | 20 ++ .../universal.sh => macos-universal.sh} | 28 +- .ci/macos.sh | 24 ++ .ci/macos/build.sh | 34 --- .ci/macos/deps.sh | 3 - .ci/macos/upload.sh | 16 -- .ci/pack.sh | 48 ++++ .ci/{source/build.sh => source.sh} | 6 +- .ci/{transifex/docker.sh => transifex.sh} | 4 +- .ci/transifex/build.sh | 3 - .ci/windows-msvc/build.sh | 20 -- .ci/windows-msvc/deps.sh | 10 - .ci/windows-msvc/upload.ps1 | 41 --- .ci/windows.sh | 17 ++ .github/workflows/ci.yml | 205 ++++++++------- CMakeLists.txt | 65 +++-- CMakeModules/BuildInstaller.cmake | 2 +- CMakeModules/BundleLibraries.cmake | 66 ----- CMakeModules/BundleTarget.cmake | 243 ++++++++++++++++++ CMakeModules/CopyCitraOpensslDeps.cmake | 6 - CMakeModules/CopyCitraQt6Deps.cmake | 46 ---- CMakeModules/DownloadExternals.cmake | 46 +--- CMakeModules/MSVCCache.cmake | 12 - CMakeModules/MinGWCross.cmake | 52 ---- dist/citra-qt.desktop | 15 ++ dist/citra-room.desktop | 10 + dist/citra.desktop | 6 +- externals/CMakeLists.txt | 13 +- .../cmake-modules/WindowsCopyFiles.cmake | 28 -- externals/httplib/httplib.h | 6 + src/CMakeLists.txt | 23 +- src/android/app/build.gradle | 42 ++- src/audio_core/hle/wmf_decoder_utils.cpp | 2 +- src/citra/CMakeLists.txt | 16 -- src/citra_qt/CMakeLists.txt | 25 -- src/common/logging/text_formatter.cpp | 2 +- src/dedicated_room/CMakeLists.txt | 4 - 57 files changed, 614 insertions(+), 967 deletions(-) rename .ci/{android/build.sh => android.sh} (51%) delete mode 100755 .ci/android/upload.sh rename .ci/{linux-clang-format/script.sh => clang-format.sh} (100%) delete mode 100755 .ci/common/post-upload.sh delete mode 100755 .ci/common/pre-upload.sh delete mode 100755 .ci/linux-appimage/build.sh delete mode 100755 .ci/linux-appimage/docker.sh delete mode 100755 .ci/linux-appimage/upload.sh delete mode 100755 .ci/linux-clang-format/build.sh delete mode 100755 .ci/linux-clang-format/docker.sh delete mode 100755 .ci/linux-fresh/build.sh delete mode 100755 .ci/linux-fresh/docker.sh delete mode 100755 .ci/linux-fresh/upload.sh delete mode 100755 .ci/linux-frozen/build.sh delete mode 100755 .ci/linux-frozen/docker.sh delete mode 100755 .ci/linux-frozen/install_package.py delete mode 100755 .ci/linux-mingw/build.sh delete mode 100755 .ci/linux-mingw/docker.sh delete mode 100755 .ci/linux-mingw/scan_dll.py delete mode 100755 .ci/linux-mingw/upload.sh create mode 100755 .ci/linux.sh rename .ci/{macos/universal.sh => macos-universal.sh} (56%) create mode 100755 .ci/macos.sh delete mode 100755 .ci/macos/build.sh delete mode 100755 .ci/macos/deps.sh delete mode 100755 .ci/macos/upload.sh create mode 100755 .ci/pack.sh rename .ci/{source/build.sh => source.sh} (82%) rename .ci/{transifex/docker.sh => transifex.sh} (92%) delete mode 100755 .ci/transifex/build.sh delete mode 100644 .ci/windows-msvc/build.sh delete mode 100644 .ci/windows-msvc/deps.sh delete mode 100644 .ci/windows-msvc/upload.ps1 create mode 100644 .ci/windows.sh delete mode 100644 CMakeModules/BundleLibraries.cmake create mode 100644 CMakeModules/BundleTarget.cmake delete mode 100644 CMakeModules/CopyCitraOpensslDeps.cmake delete mode 100644 CMakeModules/CopyCitraQt6Deps.cmake delete mode 100755 CMakeModules/MSVCCache.cmake delete mode 100644 CMakeModules/MinGWCross.cmake create mode 100644 dist/citra-qt.desktop create mode 100644 dist/citra-room.desktop delete mode 100644 externals/cmake-modules/WindowsCopyFiles.cmake diff --git a/.ci/android/build.sh b/.ci/android.sh similarity index 51% rename from .ci/android/build.sh rename to .ci/android.sh index 727f855d33..6c22922061 100755 --- a/.ci/android/build.sh +++ b/.ci/android.sh @@ -5,7 +5,10 @@ export NDK_CCACHE=$(which ccache) BUILD_FLAVOR=canary || BUILD_FLAVOR=nightly -ccache -s +if [ ! -z "${ANDROID_KEYSTORE_B64}" ]; then + export ANDROID_KEYSTORE_FILE="${GITHUB_WORKSPACE}/ks.jks" + base64 --decode <<< "${ANDROID_KEYSTORE_B64}" > "${ANDROID_KEYSTORE_FILE}" +fi cd src/android chmod +x ./gradlew @@ -13,3 +16,7 @@ chmod +x ./gradlew ./gradlew bundle${BUILD_FLAVOR}Release ccache -s + +if [ ! -z "${ANDROID_KEYSTORE_B64}" ]; then + rm "${ANDROID_KEYSTORE_FILE}" +fi diff --git a/.ci/android/upload.sh b/.ci/android/upload.sh deleted file mode 100755 index 32bcb4c5bb..0000000000 --- a/.ci/android/upload.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -ex - -. ./.ci/common/pre-upload.sh - -REV_NAME="citra-android-${GITDATE}-${GITREV}" -[ "${GITHUB_REPOSITORY}" = "citra-emu/citra-canary" ] && - BUILD_FLAVOR=canary || - BUILD_FLAVOR=nightly - -cp src/android/app/build/outputs/apk/${BUILD_FLAVOR}/release/app-${BUILD_FLAVOR}-release.apk \ - "artifacts/${REV_NAME}.apk" -cp src/android/app/build/outputs/bundle/${BUILD_FLAVOR}Release/app-${BUILD_FLAVOR}-release.aab \ - "artifacts/${REV_NAME}.aab" - -if [ ! -z "${ANDROID_KEYSTORE_B64}" ] -then - echo "Signing apk..." - base64 --decode <<< "${ANDROID_KEYSTORE_B64}" > ks.jks - - apksigner sign --ks ks.jks \ - --ks-key-alias "${ANDROID_KEY_ALIAS}" \ - --ks-pass env:ANDROID_KEYSTORE_PASS "artifacts/${REV_NAME}.apk" -fi diff --git a/.ci/linux-clang-format/script.sh b/.ci/clang-format.sh similarity index 100% rename from .ci/linux-clang-format/script.sh rename to .ci/clang-format.sh diff --git a/.ci/common/post-upload.sh b/.ci/common/post-upload.sh deleted file mode 100755 index 27d92d8bd3..0000000000 --- a/.ci/common/post-upload.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -ex - -# Copy documentation -cp license.txt "$REV_NAME" -cp README.md "$REV_NAME" - -# Copy cross-platform scripting support -cp -r dist/scripting "$REV_NAME" - -tar $COMPRESSION_FLAGS "$ARCHIVE_NAME" "$REV_NAME" - -# Find out what release we are building -if [[ "$GITHUB_REF_NAME" =~ ^canary- ]] || [[ "$GITHUB_REF_NAME" =~ ^nightly- ]]; then - RELEASE_NAME=$(echo $GITHUB_REF_NAME | cut -d- -f1) - if [ "$NAME" = "linux-mingw" ]; then - RELEASE_NAME="${RELEASE_NAME}-mingw" - fi -else - RELEASE_NAME=head -fi - -mv "$REV_NAME" $RELEASE_NAME - -7z a "$REV_NAME.7z" $RELEASE_NAME - -# move the compiled archive into the artifacts directory to be uploaded by travis releases -mv "$ARCHIVE_NAME" artifacts/ -mv "$REV_NAME.7z" artifacts/ diff --git a/.ci/common/pre-upload.sh b/.ci/common/pre-upload.sh deleted file mode 100755 index 3c2fc79a2c..0000000000 --- a/.ci/common/pre-upload.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -ex - -GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`" -GITREV="`git show -s --format='%h'`" - -mkdir -p artifacts diff --git a/.ci/linux-appimage/build.sh b/.ci/linux-appimage/build.sh deleted file mode 100755 index 2d921a253a..0000000000 --- a/.ci/linux-appimage/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -ex -mkdir -p "$HOME/.ccache" -docker run -v $(pwd):/citra -v "$HOME/.ccache":/root/.ccache citraemu/build-environments:linux-appimage /bin/bash -ex /citra/.ci/linux/docker.sh diff --git a/.ci/linux-appimage/docker.sh b/.ci/linux-appimage/docker.sh deleted file mode 100755 index 4ba27798f2..0000000000 --- a/.ci/linux-appimage/docker.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -#Building Citra -mkdir build -cd build -cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ -DENABLE_QT_TRANSLATION=ON -DCITRA_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DUSE_DISCORD_PRESENCE=ON -ninja - -ctest -VV -C Release - -#Circumvent missing LibFuse in Docker, by extracting the AppImage -export APPIMAGE_EXTRACT_AND_RUN=1 - -#Building AppDir -DESTDIR="./AppDir" ninja install -mv ./AppDir/usr/local/bin ./AppDir/usr -mv ./AppDir/usr/local/share ./AppDir/usr -rm -rf ./AppDir/usr/local -QMAKE=/usr/lib/qt6/bin/qmake /linuxdeploy-x86_64.AppImage --appdir AppDir --plugin qt --plugin checkrt -sed -i 's/*XFCE*/*X-Cinnamon*|*XFCE*/g' ./AppDir/apprun-hooks/linuxdeploy-plugin-qt-hook.sh -sed -i '/export QT_QPA_PLATFORMTHEME=gtk3/a \ \ \ \ \ \ \ \ export GDK_BACKEND=x11' ./AppDir/apprun-hooks/linuxdeploy-plugin-qt-hook.sh - -#Build AppImage -QMAKE=/usr/lib/qt6/bin/qmake /linuxdeploy-x86_64.AppImage --appdir AppDir --output appimage diff --git a/.ci/linux-appimage/upload.sh b/.ci/linux-appimage/upload.sh deleted file mode 100755 index eee699b1cc..0000000000 --- a/.ci/linux-appimage/upload.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -ex - -. .ci/common/pre-upload.sh -REV_NAME="citra-linux-${GITDATE}-${GITREV}" -mv build/Citra*.AppImage "${GITHUB_WORKSPACE}"/artifacts/${REV_NAME}.AppImage diff --git a/.ci/linux-clang-format/build.sh b/.ci/linux-clang-format/build.sh deleted file mode 100755 index d92afe146a..0000000000 --- a/.ci/linux-clang-format/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -ex -mkdir -p "$HOME/.ccache" -docker run -v $(pwd):/citra -v "$HOME/.ccache":/root/.ccache citraemu/build-environments:linux-clang-format /bin/bash -ex /citra/.ci/clang-format/docker.sh diff --git a/.ci/linux-clang-format/docker.sh b/.ci/linux-clang-format/docker.sh deleted file mode 100755 index 9a2da17e34..0000000000 --- a/.ci/linux-clang-format/docker.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -ex - -# Run clang-format -./.ci/linux-clang-format/script.sh diff --git a/.ci/linux-fresh/build.sh b/.ci/linux-fresh/build.sh deleted file mode 100755 index c3db025f45..0000000000 --- a/.ci/linux-fresh/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -ex -mkdir -p "$HOME/.ccache" -docker run -v $(pwd):/citra -v "$HOME/.ccache":/root/.ccache citraemu/build-environments:linux-fresh /bin/bash -ex /citra/.ci/linux/docker.sh diff --git a/.ci/linux-fresh/docker.sh b/.ci/linux-fresh/docker.sh deleted file mode 100755 index fd145ed629..0000000000 --- a/.ci/linux-fresh/docker.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -ex - -mkdir build && cd build -cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ -DENABLE_QT_TRANSLATION=ON -DCITRA_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DUSE_DISCORD_PRESENCE=ON -ninja - -ctest -VV -C Release diff --git a/.ci/linux-fresh/upload.sh b/.ci/linux-fresh/upload.sh deleted file mode 100755 index 9c783169e8..0000000000 --- a/.ci/linux-fresh/upload.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -ex - -. .ci/common/pre-upload.sh - -REV_NAME="citra-linux-${GITDATE}-${GITREV}" -ARCHIVE_NAME="${REV_NAME}.tar.xz" -COMPRESSION_FLAGS="-cJvf" - -mkdir "$REV_NAME" - -cp build/bin/Release/citra "$REV_NAME" -cp build/bin/Release/citra-room "$REV_NAME" -cp build/bin/Release/citra-qt "$REV_NAME" - -# We need icons on Linux for .desktop entries -mkdir "$REV_NAME/dist" -cp dist/icon.png "$REV_NAME/dist/citra.png" - -. .ci/common/post-upload.sh diff --git a/.ci/linux-frozen/build.sh b/.ci/linux-frozen/build.sh deleted file mode 100755 index 113e0fde6a..0000000000 --- a/.ci/linux-frozen/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -ex -mkdir -p "$HOME/.ccache" -docker run -v $(pwd):/citra -v "$HOME/.ccache":/root/.ccache citraemu/build-environments:linux-frozen /bin/bash -ex /citra/.ci/linux-frozen/docker.sh diff --git a/.ci/linux-frozen/docker.sh b/.ci/linux-frozen/docker.sh deleted file mode 100755 index 036ab8e495..0000000000 --- a/.ci/linux-frozen/docker.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -ex - -mkdir -p ~/bin/gold -echo '#!/bin/bash' > ~/bin/gold/ld -echo 'gold "$@"' >> ~/bin/gold/ld -chmod a+x ~/bin/gold/ld -export CFLAGS="-B$HOME/bin/gold $CFLAGS" -export CXXFLAGS="-B$HOME/bin/gold $CXXFLAGS" - - -mkdir build && cd build -cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ -ninja - -ctest -VV -C Release diff --git a/.ci/linux-frozen/install_package.py b/.ci/linux-frozen/install_package.py deleted file mode 100755 index 54060bec81..0000000000 --- a/.ci/linux-frozen/install_package.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/python - -import sys -import re -import subprocess -from launchpadlib.launchpad import Launchpad - -if sys.version_info[0] > 2: - xrange = range - -cachedir = '/.launchpadlib/cache/' -launchpad = Launchpad.login_anonymously( - 'grab build info', 'production', cachedir, version='devel') - -processed_packages = [] -deb_file_list = [] - - -def get_url(pkg, distro): - build_ref = launchpad.archives.getByReference(reference='ubuntu').getPublishedBinaries( - binary_name=pkg[0], distro_arch_series='https://api.launchpad.net/devel/ubuntu/' + distro + '/amd64', version=pkg[1], exact_match=True, order_by_date=True).entries[0] - build_link = build_ref['build_link'] - deb_name = '{}_{}_{}.deb'.format(pkg[0], pkg[1], 'amd64' if build_ref['architecture_specific'] else 'all') - deb_link = build_link + '/+files/' + deb_name - return [deb_link, deb_name] - - -def list_dependencies(deb_file): - t = subprocess.check_output( - ['bash', '-c', '(dpkg -I {} | grep -oP "^ Depends\: \K.*$") || true'.format(deb_file)]) - deps = [i.strip() for i in t.split(',')] - equals_re = re.compile(r'^(.*) \(= (.*)\)$') - return [equals_re.sub(r'\1=\2', i).split('=') for i in filter(equals_re.match, deps)] - - -def get_package(pkg, distro): - if pkg in processed_packages: - return - print('Getting {}...'.format(pkg[0])) - url = get_url(pkg, distro) - subprocess.check_call(['wget', '--quiet', url[0], '-O', url[1]]) - for dep in list_dependencies(url[1]): - get_package(dep, distro) - processed_packages.append(pkg) - deb_file_list.append('./' + url[1]) - - -for i in xrange(1, len(sys.argv), 3): - get_package([sys.argv[i], sys.argv[i + 1]], sys.argv[i + 2]) - -subprocess.check_call( - ['apt-get', 'install', '-y', '--force-yes'] + deb_file_list) diff --git a/.ci/linux-mingw/build.sh b/.ci/linux-mingw/build.sh deleted file mode 100755 index 386bcd0112..0000000000 --- a/.ci/linux-mingw/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -ex -mkdir "$HOME/.ccache" || true -docker run -v $(pwd):/citra -v "$HOME/.ccache":/root/.ccache citraemu/build-environments:linux-mingw /bin/bash -ex /citra/.ci/linux-mingw/docker.sh diff --git a/.ci/linux-mingw/docker.sh b/.ci/linux-mingw/docker.sh deleted file mode 100755 index df1a4c9bf0..0000000000 --- a/.ci/linux-mingw/docker.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -ex - -# override CI ccache size -mkdir -p "$HOME/.ccache/" -echo 'max_size = 3.0G' > "$HOME/.ccache/ccache.conf" - -mkdir build && cd build -cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE="$(pwd)/../CMakeModules/MinGWCross.cmake" -DCITRA_USE_CCACHE=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_QT_TRANSLATION=ON -DCITRA_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DUSE_DISCORD_PRESENCE=ON -DENABLE_MF=ON -DCMAKE_NO_SYSTEM_FROM_IMPORTED=TRUE -DCOMPILE_WITH_DWARF=OFF -ninja - -echo "Tests skipped" -#ctest -VV -C Release - -ccache -s - -echo 'Prepare binaries...' -cd .. -mkdir package - -QT_PLATFORM_DLL_PATH='/usr/x86_64-w64-mingw32/lib/qt6/plugins/platforms/' -find build/ -name "citra*.exe" -exec cp {} 'package' \; - -# copy Qt plugins -mkdir package/platforms -cp "${QT_PLATFORM_DLL_PATH}/qwindows.dll" package/platforms/ -cp -rv "${QT_PLATFORM_DLL_PATH}/../multimedia/" package/ -cp -rv "${QT_PLATFORM_DLL_PATH}/../imageformats/" package/ -cp -rv "${QT_PLATFORM_DLL_PATH}/../styles/" package/ - -python3 .ci/linux-mingw/scan_dll.py package/*.exe package/imageformats/*.dll "package/" diff --git a/.ci/linux-mingw/scan_dll.py b/.ci/linux-mingw/scan_dll.py deleted file mode 100755 index 54f7828ac6..0000000000 --- a/.ci/linux-mingw/scan_dll.py +++ /dev/null @@ -1,122 +0,0 @@ -try: - import lief -except ImportError: - import pefile -import sys -import re -import os -import queue -import shutil - -# constant definitions -KNOWN_SYS_DLLS = ['WINMM.DLL', 'MSVCRT.DLL', 'VERSION.DLL', 'MPR.DLL', - 'DWMAPI.DLL', 'UXTHEME.DLL', 'DNSAPI.DLL', 'IPHLPAPI.DLL'] -# below is for Ubuntu 18.04 with specified PPA enabled, if you are using -# other distro or different repositories, change the following accordingly -DLL_PATH = [ - '/usr/x86_64-w64-mingw32/bin/', - '/usr/x86_64-w64-mingw32/lib/', - '/usr/lib/gcc/x86_64-w64-mingw32/9.3-posix/' -] - -missing = [] - - -def parse_imports_lief(filename): - results = [] - pe = lief.parse(filename) - for entry in pe.imports: - name = entry.name - if name.upper() not in KNOWN_SYS_DLLS and not re.match(string=name, pattern=r'.*32\.DLL'): - results.append(name) - return results - - -def parse_imports(file_name): - if globals().get('lief'): - return parse_imports_lief(file_name) - - results = [] - pe = pefile.PE(file_name, fast_load=True) - pe.parse_data_directories() - - for entry in pe.DIRECTORY_ENTRY_IMPORT: - current = entry.dll.decode() - current_u = current.upper() # b/c Windows is often case insensitive - # here we filter out system dlls - # dll w/ names like *32.dll are likely to be system dlls - if current_u.upper() not in KNOWN_SYS_DLLS and not re.match(string=current_u, pattern=r'.*32\.DLL'): - results.append(current) - - return results - - -def parse_imports_recursive(file_name, path_list=[]): - q = queue.Queue() # create a FIFO queue - # file_name can be a string or a list for the convience - if isinstance(file_name, str): - q.put(file_name) - elif isinstance(file_name, list): - for i in file_name: - q.put(i) - full_list = [] - while q.qsize(): - current = q.get_nowait() - print('> %s' % current) - deps = parse_imports(current) - # if this dll does not have any import, ignore it - if not deps: - continue - for dep in deps: - # the dependency already included in the list, skip - if dep in full_list: - continue - # find the requested dll in the provided paths - full_path = find_dll(dep) - if not full_path: - missing.append(dep) - continue - full_list.append(dep) - q.put(full_path) - path_list.append(full_path) - return full_list - - -def find_dll(name): - for path in DLL_PATH: - for root, _, files in os.walk(path): - for f in files: - if name.lower() == f.lower(): - return os.path.join(root, f) - - -def deploy(name, dst, dry_run=False): - dlls_path = [] - parse_imports_recursive(name, dlls_path) - for dll_entry in dlls_path: - if not dry_run: - shutil.copy(dll_entry, dst) - else: - print('[Dry-Run] Copy %s to %s' % (dll_entry, dst)) - print('Deploy completed.') - return dlls_path - - -def main(): - if len(sys.argv) < 3: - print('Usage: %s [files to examine ...] [target deploy directory]') - return 1 - to_deploy = sys.argv[1:-1] - tgt_dir = sys.argv[-1] - if not os.path.isdir(tgt_dir): - print('%s is not a directory.' % tgt_dir) - return 1 - print('Scanning dependencies...') - deploy(to_deploy, tgt_dir) - if missing: - print('Following DLLs are not found: %s' % ('\n'.join(missing))) - return 0 - - -if __name__ == '__main__': - main() diff --git a/.ci/linux-mingw/upload.sh b/.ci/linux-mingw/upload.sh deleted file mode 100755 index 1f229291da..0000000000 --- a/.ci/linux-mingw/upload.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -ex - -. .ci/common/pre-upload.sh - -REV_NAME="citra-windows-mingw-${GITDATE}-${GITREV}" -ARCHIVE_NAME="${REV_NAME}.tar.gz" -COMPRESSION_FLAGS="-czvf" - -mkdir "$REV_NAME" -# get around the permission issues -cp -r package/* "$REV_NAME" - -. .ci/common/post-upload.sh diff --git a/.ci/linux.sh b/.ci/linux.sh new file mode 100755 index 0000000000..dff7f55317 --- /dev/null +++ b/.ci/linux.sh @@ -0,0 +1,20 @@ +#!/bin/sh -ex + +mkdir build && cd build +cmake .. -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DENABLE_QT_TRANSLATION=ON \ + -DCITRA_ENABLE_COMPATIBILITY_REPORTING=ON \ + -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \ + -DUSE_DISCORD_PRESENCE=ON +ninja + +if [ "$TARGET" = "appimage" ]; then + ninja bundle +fi + +ccache -s + +ctest -VV -C Release diff --git a/.ci/macos/universal.sh b/.ci/macos-universal.sh similarity index 56% rename from .ci/macos/universal.sh rename to .ci/macos-universal.sh index 6bc52b8caf..57a0a60af6 100755 --- a/.ci/macos/universal.sh +++ b/.ci/macos-universal.sh @@ -1,43 +1,37 @@ #!/bin/bash -ex -. .ci/common/pre-upload.sh - -REV_NAME="citra-osx-${GITDATE}-${GITREV}" -ARCHIVE_NAME="${REV_NAME}.tar.gz" -COMPRESSION_FLAGS="-czvf" - ARTIFACTS_LIST=($ARTIFACTS) +BUNDLE_DIR=build/bundle +mkdir build + # Set up the base artifact to combine into. BASE_ARTIFACT=${ARTIFACTS_LIST[0]} BASE_ARTIFACT_ARCH="${BASE_ARTIFACT##*-}" -tar xf $BASE_ARTIFACT/$REV_NAME.tar.gz -C $BASE_ARTIFACT -mv $BASE_ARTIFACT/$REV_NAME $REV_NAME +mv $BASE_ARTIFACT $BUNDLE_DIR # Executable binary paths that need to be combined. BIN_PATHS=(citra citra-room citra-qt.app/Contents/MacOS/citra-qt) # Dylib paths that need to be combined. IFS=$'\n' -DYLIB_PATHS=($(cd $REV_NAME && find . -name '*.dylib')) +DYLIB_PATHS=($(cd $BUNDLE_DIR && find . -name '*.dylib')) unset IFS # Combine all of the executable binaries and dylibs. for OTHER_ARTIFACT in "${ARTIFACTS_LIST[@]:1}"; do OTHER_ARTIFACT_ARCH="${OTHER_ARTIFACT##*-}" - tar xf $OTHER_ARTIFACT/$REV_NAME.tar.gz -C $OTHER_ARTIFACT - for BIN_PATH in "${BIN_PATHS[@]}"; do - lipo -create -output $REV_NAME/$BIN_PATH $REV_NAME/$BIN_PATH $OTHER_ARTIFACT/$REV_NAME/$BIN_PATH + lipo -create -output $BUNDLE_DIR/$BIN_PATH $BUNDLE_DIR/$BIN_PATH $OTHER_ARTIFACT/$BIN_PATH done for DYLIB_PATH in "${DYLIB_PATHS[@]}"; do # Only merge if the libraries do not have conflicting arches, otherwise it will fail. - DYLIB_INFO=`file $REV_NAME/$DYLIB_PATH` - OTHER_DYLIB_INFO=`file $OTHER_ARTIFACT/$REV_NAME/$DYLIB_PATH` + DYLIB_INFO=`file $BUNDLE_DIR/$DYLIB_PATH` + OTHER_DYLIB_INFO=`file $OTHER_ARTIFACT/$DYLIB_PATH` if ! [[ "$DYLIB_INFO" =~ "$OTHER_ARTIFACT_ARCH" ]] && ! [[ "$OTHER_DYLIB_INFO" =~ "$BASE_ARTIFACT_ARCH" ]]; then - lipo -create -output $REV_NAME/$DYLIB_PATH $REV_NAME/$DYLIB_PATH $OTHER_ARTIFACT/$REV_NAME/$DYLIB_PATH + lipo -create -output $BUNDLE_DIR/$DYLIB_PATH $BUNDLE_DIR/$DYLIB_PATH $OTHER_ARTIFACT/$DYLIB_PATH fi done done @@ -45,7 +39,5 @@ done # Re-sign executables and bundles after combining. APP_PATHS=(citra citra-room citra-qt.app) for APP_PATH in "${APP_PATHS[@]}"; do - codesign --deep -fs - $REV_NAME/$APP_PATH + codesign --deep -fs - $BUNDLE_DIR/$APP_PATH done - -. .ci/common/post-upload.sh diff --git a/.ci/macos.sh b/.ci/macos.sh new file mode 100755 index 0000000000..7beabe199a --- /dev/null +++ b/.ci/macos.sh @@ -0,0 +1,24 @@ +#!/bin/bash -ex + +mkdir build && cd build +# TODO: LibreSSL ASM disabled due to platform detection issues in cross-compile build. +cmake .. -GNinja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_OSX_ARCHITECTURES="$TARGET" \ + -DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DENABLE_QT_TRANSLATION=ON \ + -DCITRA_ENABLE_COMPATIBILITY_REPORTING=ON \ + -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \ + -DUSE_DISCORD_PRESENCE=ON \ + -DENABLE_ASM=OFF +ninja +ninja bundle + +ccache -s + +CURRENT_ARCH=`arch` +if [ "$TARGET" = "$CURRENT_ARCH" ]; then + ctest -VV -C Release +fi diff --git a/.ci/macos/build.sh b/.ci/macos/build.sh deleted file mode 100755 index 9ef3f4973e..0000000000 --- a/.ci/macos/build.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -ex - -set -o pipefail - -export PATH="/usr/local/opt/ccache/libexec:$PATH" -# ccache configurations -export CCACHE_CPP2=yes -export CCACHE_SLOPPINESS=time_macros - -export CC="ccache clang" -export CXX="ccache clang++" -export OBJC="clang" -export ASM="clang" - -ccache -s - -mkdir build && cd build -# TODO: LibreSSL ASM disabled due to platform detection issues in build. -cmake .. -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_OSX_ARCHITECTURES="$TARGET_ARCH" \ - -DENABLE_QT_TRANSLATION=ON \ - -DCITRA_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} \ - -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \ - -DUSE_DISCORD_PRESENCE=ON \ - -DENABLE_ASM=OFF \ - -GNinja -ninja - -ccache -s - -CURRENT_ARCH=`arch` -if [ "$TARGET_ARCH" = "$CURRENT_ARCH" ]; then - ctest -VV -C Release -fi diff --git a/.ci/macos/deps.sh b/.ci/macos/deps.sh deleted file mode 100755 index ac2775b599..0000000000 --- a/.ci/macos/deps.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -ex - -brew install ccache glslang ninja || true diff --git a/.ci/macos/upload.sh b/.ci/macos/upload.sh deleted file mode 100755 index c529d28ef1..0000000000 --- a/.ci/macos/upload.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -ex - -. .ci/common/pre-upload.sh - -REV_NAME="citra-osx-${GITDATE}-${GITREV}" -ARCHIVE_NAME="${REV_NAME}.tar.gz" -COMPRESSION_FLAGS="-czvf" - -mkdir "$REV_NAME" - -cp -a build/bin/Release/citra "$REV_NAME" -cp -a build/bin/Release/libs "$REV_NAME" -cp -a build/bin/Release/citra-qt.app "$REV_NAME" -cp -a build/bin/Release/citra-room "$REV_NAME" - -. .ci/common/post-upload.sh diff --git a/.ci/pack.sh b/.ci/pack.sh new file mode 100755 index 0000000000..3609f38446 --- /dev/null +++ b/.ci/pack.sh @@ -0,0 +1,48 @@ +#!/bin/bash -ex + +GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`" +GITREV="`git show -s --format='%h'`" +REV_NAME="citra-${OS}-${TARGET}-${GITDATE}-${GITREV}" + +# Find out what release we are building +if [[ "$GITHUB_REF_NAME" =~ ^canary- ]] || [[ "$GITHUB_REF_NAME" =~ ^nightly- ]]; then + RELEASE_NAME=$(echo $GITHUB_REF_NAME | cut -d- -f1) + # For compatibility with existing installs, use mingw/osx in the archive and target names. + if [ "$TARGET" = "msys2" ]; then + REV_NAME="citra-${OS}-mingw-${GITDATE}-${GITREV}" + RELEASE_NAME="${RELEASE_NAME}-mingw" + elif [ "$OS" = "macos" ]; then + REV_NAME="citra-osx-${TARGET}-${GITDATE}-${GITREV}" + fi +else + RELEASE_NAME=head +fi + +mkdir -p artifacts + +if [ -z "${UPLOAD_RAW}" ]; then + # Archive and upload the artifacts. + mkdir "$REV_NAME" + mv build/bundle/* "$REV_NAME" + + if [ "$OS" = "windows" ]; then + ARCHIVE_NAME="${REV_NAME}.zip" + powershell Compress-Archive "$REV_NAME" "$ARCHIVE_NAME" + else + ARCHIVE_NAME="${REV_NAME}.tar.gz" + tar czvf "$ARCHIVE_NAME" "$REV_NAME" + fi + + mv "$REV_NAME" $RELEASE_NAME + 7z a "$REV_NAME.7z" $RELEASE_NAME + + mv "$ARCHIVE_NAME" artifacts/ + mv "$REV_NAME.7z" artifacts/ +else + # Directly upload the raw artifacts, renamed with the revision. + for ARTIFACT in build/bundle/*; do + FILENAME=$(basename "$ARTIFACT") + EXTENSION="${FILENAME##*.}" + mv "$ARTIFACT" "artifacts/$REV_NAME.$EXTENSION" + done +fi diff --git a/.ci/source/build.sh b/.ci/source.sh similarity index 82% rename from .ci/source/build.sh rename to .ci/source.sh index fb212cb985..16d9e04ea6 100755 --- a/.ci/source/build.sh +++ b/.ci/source.sh @@ -1,9 +1,13 @@ #!/bin/bash -ex -. .ci/common/pre-upload.sh +GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`" +GITREV="`git show -s --format='%h'`" REV_NAME="citra-unified-source-${GITDATE}-${GITREV}" + COMPAT_LIST='dist/compatibility_list/compatibility_list.json' +mkdir artifacts + pip3 install git-archive-all wget -q https://api.citra-emu.org/gamedb -O "${COMPAT_LIST}" git describe --abbrev=0 --always HEAD > GIT-COMMIT diff --git a/.ci/transifex/docker.sh b/.ci/transifex.sh similarity index 92% rename from .ci/transifex/docker.sh rename to .ci/transifex.sh index 7da7d5265a..c51af2d263 100755 --- a/.ci/transifex/docker.sh +++ b/.ci/transifex.sh @@ -1,6 +1,4 @@ -#!/bin/bash -e - -set -x +#!/bin/bash -ex echo -e "\e[1m\e[33mBuild tools information:\e[0m" cmake --version diff --git a/.ci/transifex/build.sh b/.ci/transifex/build.sh deleted file mode 100755 index f2eb544f0e..0000000000 --- a/.ci/transifex/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -e - -docker run -e TRANSIFEX_API_TOKEN="${TRANSIFEX_API_TOKEN}" -v "$(pwd)":/citra citraemu/build-environments:linux-transifex /bin/sh -e /citra/.travis/transifex/docker.sh diff --git a/.ci/windows-msvc/build.sh b/.ci/windows-msvc/build.sh deleted file mode 100644 index a811171c61..0000000000 --- a/.ci/windows-msvc/build.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -ex - -mkdir build && cd build -cmake .. \ - -DCMAKE_BUILD_TYPE=Release \ - -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE="$(pwd)/../CMakeModules/MSVCCache.cmake" \ - -DCITRA_USE_CCACHE=ON \ - -DENABLE_QT_TRANSLATION=ON \ - -DCITRA_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} \ - -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \ - -DUSE_DISCORD_PRESENCE=ON \ - -DENABLE_MF=ON \ - -DOPENSSL_DLL_DIR="C:\Program Files\OpenSSL\bin" - -ninja -# show the caching efficiency -buildcache -s - -ctest -VV -C Release || echo "::error ::Test error occurred on Windows MSVC build" diff --git a/.ci/windows-msvc/deps.sh b/.ci/windows-msvc/deps.sh deleted file mode 100644 index 769c9a7073..0000000000 --- a/.ci/windows-msvc/deps.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -ex - -BUILDCACHE_VERSION="0.22.3" - -choco install wget ninja -# Install buildcache -wget "https://github.com/mbitsnbites/buildcache/releases/download/v${BUILDCACHE_VERSION}/buildcache-win-mingw.zip" -7z x 'buildcache-win-mingw.zip' -mv ./buildcache/bin/buildcache.exe "/c/ProgramData/chocolatey/bin" -rm -rf ./buildcache/ diff --git a/.ci/windows-msvc/upload.ps1 b/.ci/windows-msvc/upload.ps1 deleted file mode 100644 index b2a203905b..0000000000 --- a/.ci/windows-msvc/upload.ps1 +++ /dev/null @@ -1,41 +0,0 @@ - -$GITDATE = $(git show -s --date=short --format='%ad') -replace "-", "" -$GITREV = $(git show -s --format='%h') - -# Find out what release we are building -if ( $env:GITHUB_REF_NAME -like "*canary-*" -or $env:GITHUB_REF_NAME -like "*nightly-*" ) { - $RELEASE_NAME = ${env:GITHUB_REF_NAME}.split("-")[0] - $RELEASE_NAME = "${RELEASE_NAME}-msvc" -} -else { - $RELEASE_NAME = "head" -} - -$MSVC_BUILD_ZIP = "citra-windows-msvc-$GITDATE-$GITREV.zip" -replace " ", "" -$MSVC_SEVENZIP = "citra-windows-msvc-$GITDATE-$GITREV.7z" -replace " ", "" - -$BUILD_DIR = ".\build\bin\Release" - -# Create artifact directories -mkdir $RELEASE_NAME -mkdir "artifacts" - -echo "Starting to pack ${RELEASE_NAME}" - -Copy-Item $BUILD_DIR\* -Destination $RELEASE_NAME -Recurse -Remove-Item $RELEASE_NAME\tests.* -ErrorAction ignore -Remove-Item $RELEASE_NAME\*.pdb -ErrorAction ignore - -# Copy documentation -Copy-Item license.txt -Destination $RELEASE_NAME -Copy-Item README.md -Destination $RELEASE_NAME - -# Copy cross-platform scripting support -Copy-Item dist\scripting -Destination $RELEASE_NAME -Recurse - -# Build the final release artifacts -7z a -tzip $MSVC_BUILD_ZIP $RELEASE_NAME\* -7z a $MSVC_SEVENZIP $RELEASE_NAME - -Copy-Item $MSVC_BUILD_ZIP -Destination "artifacts" -Copy-Item $MSVC_SEVENZIP -Destination "artifacts" diff --git a/.ci/windows.sh b/.ci/windows.sh new file mode 100644 index 0000000000..2dc94d5d3d --- /dev/null +++ b/.ci/windows.sh @@ -0,0 +1,17 @@ +#!/bin/sh -ex + +mkdir build && cd build +cmake .. -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DENABLE_QT_TRANSLATION=ON \ + -DCITRA_ENABLE_COMPATIBILITY_REPORTING=ON \ + -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \ + -DUSE_DISCORD_PRESENCE=ON +ninja +ninja bundle + +ccache -s + +ctest -VV -C Release || echo "::error ::Test error occurred on Windows build" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54040b8e93..b6a277fd49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,41 +20,7 @@ jobs: - name: Build env: COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} - run: ./.ci/linux-clang-format/docker.sh - build: - runs-on: ubuntu-latest - strategy: - matrix: - image: ["linux-appimage", "linux-fresh", "linux-frozen", "linux-mingw"] - container: - image: citraemu/build-environments:${{ matrix.image }} - options: -u 1001 - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Set up cache - uses: actions/cache@v3 - with: - path: ~/.ccache - key: ${{ runner.os }}-${{ matrix.image }}-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-${{ matrix.image }}- - - name: Build - run: ./.ci/${{ matrix.image }}/docker.sh - env: - ENABLE_COMPATIBILITY_REPORTING: "ON" - - name: Pack - run: ./.ci/${{ matrix.image }}/upload.sh - if: ${{ matrix.image == 'linux-appimage' || matrix.image == 'linux-mingw' }} - env: - NAME: ${{ matrix.image }} - - name: Upload - uses: actions/upload-artifact@v3 - if: ${{ matrix.image == 'linux-appimage' || matrix.image == 'linux-mingw' }} - with: - name: ${{ matrix.image }} - path: artifacts/ + run: ./.ci/clang-format.sh source: if: ${{ !github.head_ref }} runs-on: ubuntu-latest @@ -63,17 +29,57 @@ jobs: with: submodules: recursive - name: Pack - run: ./.ci/source/build.sh + run: ./.ci/source.sh - name: Upload uses: actions/upload-artifact@v3 with: name: source path: artifacts/ + linux: + runs-on: ubuntu-latest + strategy: + matrix: + target: ["appimage", "fresh"] + container: + image: citraemu/build-environments:linux-${{ matrix.target }} + options: -u 1001 + env: + CCACHE_DIR: ${{ github.workspace }}/.ccache + OS: linux + TARGET: ${{ matrix.target }} + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: Set up cache + uses: actions/cache@v3 + with: + path: ${{ env.CCACHE_DIR }} + key: ${{ runner.os }}-${{ matrix.target }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-${{ matrix.target }}- + - name: Build + run: ./.ci/linux.sh + - name: Pack + run: ./.ci/pack.sh + if: ${{ matrix.target == 'appimage' }} + - name: Upload + uses: actions/upload-artifact@v3 + if: ${{ matrix.target == 'appimage' }} + with: + name: ${{ env.OS }}-${{ env.TARGET }} + path: artifacts/ macos: runs-on: macos-latest strategy: matrix: - arch: ["x86_64", "arm64"] + target: ["x86_64", "arm64"] + env: + CCACHE_CPP2: yes + CCACHE_SLOPPINESS: time_macros + CCACHE_DIR: ${{ github.workspace }}/.ccache + OS: macos + TARGET: ${{ matrix.target }} steps: - uses: actions/checkout@v3 with: @@ -81,59 +87,66 @@ jobs: - name: Set up cache uses: actions/cache@v3 with: - path: ~/Library/Caches/ccache - key: ${{ runner.os }}-macos-${{ matrix.arch }}-${{ github.sha }} + path: ${{ env.CCACHE_DIR }} + key: ${{ runner.os }}-${{ matrix.target }}-${{ github.sha }} restore-keys: | - ${{ runner.os }}-macos-${{ matrix.arch }}- - - name: Install dependencies - run: ./.ci/macos/deps.sh + ${{ runner.os }}-${{ matrix.target }}- + - name: Install tools + run: brew install ccache glslang ninja - name: Build - run: ./.ci/macos/build.sh - env: - MACOSX_DEPLOYMENT_TARGET: "11" - ENABLE_COMPATIBILITY_REPORTING: "ON" - TARGET_ARCH: ${{ matrix.arch }} - - name: Pack - run: ./.ci/macos/upload.sh - - name: Upload - uses: actions/upload-artifact@v3 + run: ./.ci/macos.sh + - name: Prepare outputs for caching + run: mv build/bundle $OS-$TARGET + - name: Cache outputs for universal build + uses: actions/cache/save@v3 with: - name: macos-${{ matrix.arch }} - path: artifacts/ + path: ${{ env.OS }}-${{ env.TARGET }} + key: ${{ runner.os }}-${{ matrix.target }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }} macos-universal: runs-on: macos-latest needs: macos + env: + OS: macos + TARGET: universal steps: - uses: actions/checkout@v3 with: submodules: recursive - - name: Download x86 build - uses: actions/download-artifact@master + - name: Download x86_64 build from cache + uses: actions/cache/restore@v3 with: - name: macos-x86_64 - path: macos-x86_64/ - - name: Download ARM64 build - uses: actions/download-artifact@master + path: ${{ env.OS }}-x86_64 + key: ${{ runner.os }}-x86_64-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }} + fail-on-cache-miss: true + - name: Download ARM64 build from cache + uses: actions/cache/restore@v3 with: - name: macos-arm64 - path: macos-arm64/ + path: ${{ env.OS }}-arm64 + key: ${{ runner.os }}-arm64-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }} + fail-on-cache-miss: true - name: Create universal app - run: ./.ci/macos/universal.sh + run: ./.ci/macos-universal.sh env: - ARTIFACTS: macos-x86_64 macos-arm64 + ARTIFACTS: ${{ env.OS }}-x86_64 ${{ env.OS }}-arm64 + - name: Pack + run: ./.ci/pack.sh # - name: Upload # uses: actions/upload-artifact@v3 # with: -# name: macos +# name: ${{ env.OS }}-${{ env.TARGET }} # path: artifacts/ - - name: Delete intermediate artifacts - uses: geekyeggo/delete-artifact@v2 - with: - name: | - macos-x86_64 - macos-arm64 windows: runs-on: windows-latest + strategy: + matrix: + target: ["msvc", "msys2"] + defaults: + run: + shell: ${{ (matrix.target == 'msys2' && 'msys2') || 'bash' }} {0} + env: + CCACHE_DIR: ${{ github.workspace }}/.ccache + OS: windows + TARGET: ${{ matrix.target }} steps: - uses: actions/checkout@v3 with: @@ -141,15 +154,26 @@ jobs: - name: Set up cache uses: actions/cache@v3 with: - path: ~/.buildcache - key: ${{ runner.os }}-win-${{ github.sha }} + path: ${{ env.CCACHE_DIR }} + key: ${{ runner.os }}-${{ matrix.target }}-${{ github.sha }} restore-keys: | - ${{ runner.os }}-win- - - name: Install dependencies - run: ./.ci/windows-msvc/deps.sh - shell: bash + ${{ runner.os }}-${{ matrix.target }}- - name: Set up MSVC uses: ilammy/msvc-dev-cmd@v1 + if: ${{ matrix.target == 'msvc' }} + - name: Install MSVC extra tools + run: choco install ccache ninja wget + if: ${{ matrix.target == 'msvc' }} + - name: Set up MSYS2 + uses: msys2/setup-msys2@v2 + if: ${{ matrix.target == 'msys2' }} + with: + msystem: clang64 + update: true + install: git make p7zip + pacboy: >- + toolchain:p ccache:p cmake:p ninja:p + qt6-base:p qt6-multimedia:p qt6-multimedia-wmf:p qt6-tools:p - name: Setup Vulkan SDK uses: humbletim/setup-vulkan-sdk@v1.2.0 with: @@ -159,19 +183,19 @@ jobs: - name: Test glslangValidator run: glslangValidator --version - name: Build - run: ./.ci/windows-msvc/build.sh - shell: bash - env: - ENABLE_COMPATIBILITY_REPORTING: "ON" + run: ./.ci/windows.sh - name: Pack - run: ./.ci/windows-msvc/upload.ps1 + run: ./.ci/pack.sh - name: Upload uses: actions/upload-artifact@v3 with: - name: msvc + name: ${{ env.OS }}-${{ env.TARGET }} path: artifacts/ android: runs-on: ubuntu-latest + env: + OS: android + TARGET: universal steps: - uses: actions/checkout@v3 with: @@ -198,18 +222,21 @@ jobs: sudo apt-get update -y sudo apt-get install ccache glslang-dev glslang-tools apksigner -y - name: Build - run: JAVA_HOME=$JAVA_HOME_17_X64 ./.ci/android/build.sh - - name: Copy and sign artifacts + run: JAVA_HOME=$JAVA_HOME_17_X64 ./.ci/android.sh env: ANDROID_KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE_B64 }} ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} ANDROID_KEYSTORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASS }} - run: ./.ci/android/upload.sh + - name: Pack + run: ../../../.ci/pack.sh + working-directory: src/android/app + env: + UPLOAD_RAW: 1 - name: Upload uses: actions/upload-artifact@v3 with: - name: android - path: artifacts/ + name: ${{ env.OS }}-${{ env.TARGET }} + path: src/android/app/artifacts/ transifex: runs-on: ubuntu-latest container: citraemu/build-environments:linux-transifex @@ -220,12 +247,12 @@ jobs: submodules: recursive fetch-depth: 0 - name: Update Translation - run: ./.ci/transifex/docker.sh + run: ./.ci/transifex.sh env: TX_TOKEN: ${{ secrets.TRANSIFEX_API_TOKEN }} release: runs-on: ubuntu-latest - needs: [build, android, macos-universal, source, windows] + needs: [windows, linux, macos-universal, android, source] if: ${{ startsWith(github.ref, 'refs/tags/') }} steps: - uses: actions/download-artifact@v3 diff --git a/CMakeLists.txt b/CMakeLists.txt index ccbe6cdd7a..265d1bcb10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,11 @@ if (IOS) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH) endif() -option(ENABLE_LTO "Enable link time optimization" OFF) +if (CMAKE_BUILD_TYPE STREQUAL Debug) + set(IS_DEBUG_BUILD ON) +else() + set(IS_DEBUG_BUILD OFF) +endif() option(ENABLE_SDL2 "Enable using SDL2" ON) CMAKE_DEPENDENT_OPTION(ENABLE_SDL2_FRONTEND "Enable the SDL2 frontend" ON "ENABLE_SDL2;NOT ANDROID AND NOT IOS" OFF) @@ -30,15 +34,11 @@ option(USE_SYSTEM_SDL2 "Use the system SDL2 lib (instead of the bundled one)" OF option(ENABLE_QT "Enable the Qt frontend" ON) option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF) CMAKE_DEPENDENT_OPTION(ENABLE_QT_UPDATER "Enable built-in updater for the Qt frontend" ON "NOT IOS" OFF) -CMAKE_DEPENDENT_OPTION(CITRA_USE_BUNDLED_QT "Download bundled Qt binaries" ON "ENABLE_QT;MSVC OR APPLE" OFF) CMAKE_DEPENDENT_OPTION(ENABLE_TESTS "Enable generating tests executable" ON "NOT IOS" OFF) CMAKE_DEPENDENT_OPTION(ENABLE_DEDICATED_ROOM "Enable generating dedicated room executable" ON "NOT ANDROID AND NOT IOS" OFF) option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON) -if (MSVC) - set(OPENSSL_DLL_DIR "" CACHE PATH "Location of the Openssl dlls") -endif() CMAKE_DEPENDENT_OPTION(ENABLE_CUBEB "Enables the cubeb audio backend" ON "NOT IOS" OFF) option(ENABLE_OPENAL "Enables the OpenAL audio backend" ON) @@ -47,30 +47,22 @@ CMAKE_DEPENDENT_OPTION(ENABLE_LIBUSB "Enable libusb for GameCube Adapter support option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF) -option(CITRA_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON) - CMAKE_DEPENDENT_OPTION(ENABLE_MF "Use Media Foundation decoder (preferred over FFmpeg)" ON "WIN32" OFF) CMAKE_DEPENDENT_OPTION(ENABLE_AUDIOTOOLBOX "Use AudioToolbox decoder (preferred over FFmpeg)" ON "APPLE" OFF) -CMAKE_DEPENDENT_OPTION(COMPILE_WITH_DWARF "Add DWARF debugging information" ON "MINGW" OFF) - -option(USE_SYSTEM_BOOST "Use the system Boost libs (instead of the bundled ones)" OFF) - - -CMAKE_DEPENDENT_OPTION(CITRA_USE_BUNDLED_MOLTENVK "Download the bundled MoltenVK" ON "APPLE" OFF) - -CMAKE_DEPENDENT_OPTION(CITRA_BUNDLE_LIBRARIES "Bundle dependent libraries with the output executables" ON "APPLE" OFF) - +# Compile options +CMAKE_DEPENDENT_OPTION(COMPILE_WITH_DWARF "Add DWARF debugging information" ${IS_DEBUG_BUILD} "MINGW" OFF) +option(ENABLE_LTO "Enable link time optimization" OFF) +option(CITRA_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON) option(CITRA_WARNINGS_AS_ERRORS "Enable warnings as errors" ON) -if (CITRA_USE_PRECOMPILED_HEADERS) - if (MSVC AND CCACHE) - # buildcache does not properly cache PCH files, leading to compilation errors. - # See https://github.com/mbitsnbites/buildcache/discussions/230 - message(WARNING "Buildcache does not properly support Precompiled Headers. Disabling PCH") - set(CITRA_USE_PRECOMPILED_HEADERS OFF) - endif() -endif() +# System library options +CMAKE_DEPENDENT_OPTION(USE_SYSTEM_QT "Use the system Qt lib (instead of the bundled one)" OFF "ENABLE_QT;MSVC OR APPLE" ON) +CMAKE_DEPENDENT_OPTION(USE_SYSTEM_MOLTENVK "Use the system MoltenVK lib (instead of the bundled one)" OFF "APPLE" OFF) +option(USE_SYSTEM_SDL2 "Use the system SDL2 lib (instead of the bundled one)" OFF) +option(USE_SYSTEM_BOOST "Use the system Boost libs (instead of the bundled ones)" OFF) +option(USE_SYSTEM_OPENSSL "Use the system OpenSSL libs (instead of the bundled LibreSSL)" OFF) + if (CITRA_USE_PRECOMPILED_HEADERS) message(STATUS "Using Precompiled Headers.") set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON) @@ -203,8 +195,8 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) if (ENABLE_QT) - if (CITRA_USE_BUNDLED_QT) - download_qt_external(6.5.0) + if (NOT USE_SYSTEM_QT) + download_qt(6.5.0) endif() find_package(Qt6 REQUIRED COMPONENTS Widgets Multimedia Concurrent) @@ -216,13 +208,6 @@ if (ENABLE_QT) if (ENABLE_QT_TRANSLATION) find_package(Qt6 REQUIRED COMPONENTS LinguistTools) endif() - - if (NOT CITRA_USE_BUNDLED_QT) - # Make sure the Qt bin directory is in the prefix path for later use, such as in post-build scripts. - get_target_property(qmake_executable Qt6::qmake IMPORTED_LOCATION) - get_filename_component(qt_bin_dir "${qmake_executable}" DIRECTORY) - list(APPEND CMAKE_PREFIX_PATH ${qt_bin_dir}) - endif() endif() # Ensure libusb is properly configured (based on dolphin libusb include) @@ -245,7 +230,7 @@ find_package(tsl-robin-map QUIET) # ====================================== if (APPLE) - if (CITRA_USE_BUNDLED_MOLTENVK) + if (NOT USE_SYSTEM_MOLTENVK) download_moltenvk() endif() find_library(MOLTENVK_LIBRARY MoltenVK REQUIRED) @@ -309,7 +294,7 @@ if (CLANG_FORMAT) add_custom_target(clang-format COMMAND powershell.exe -Command "Get-ChildItem '${SRCS}/*' -Include *.cpp,*.h,*.mm -Recurse | Foreach {&'${CLANG_FORMAT}' -i $_.fullname}" COMMENT ${CCOMMENT}) - endif() + endif() else() add_custom_target(clang-format COMMAND find ${SRCS} -iname *.h -o -iname *.cpp -o -iname *.mm | xargs ${CLANG_FORMAT} -i @@ -401,6 +386,14 @@ else() set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT citra) endif() +# Create target for outputting distributable bundles. +if (NOT ANDROID AND NOT IOS) + include(BundleTarget) + bundle_target(citra) + bundle_target(citra-qt) + bundle_target(citra-room) +endif() + # Installation instructions # ========================= @@ -409,7 +402,7 @@ endif() # http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html # http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html if(ENABLE_QT AND UNIX AND NOT APPLE) - install(FILES "${PROJECT_SOURCE_DIR}/dist/citra.desktop" + install(FILES "${PROJECT_SOURCE_DIR}/dist/citra-qt.desktop" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications") install(FILES "${PROJECT_SOURCE_DIR}/dist/citra.svg" DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps") diff --git a/CMakeModules/BuildInstaller.cmake b/CMakeModules/BuildInstaller.cmake index 2d86278761..07700bc512 100644 --- a/CMakeModules/BuildInstaller.cmake +++ b/CMakeModules/BuildInstaller.cmake @@ -12,7 +12,7 @@ endif() list(APPEND CMAKE_MODULE_PATH "${BASE_DIR}/CMakeModules") include(DownloadExternals) -download_qt_external(tools_ifw QT_PREFIX) +download_qt(tools_ifw QT_PREFIX) file(GLOB_RECURSE INSTALLER_BASE "${QT_PREFIX}/**/installerbase*") file(GLOB_RECURSE BINARY_CREATOR "${QT_PREFIX}/**/binarycreator*") diff --git a/CMakeModules/BundleLibraries.cmake b/CMakeModules/BundleLibraries.cmake deleted file mode 100644 index c2f852b244..0000000000 --- a/CMakeModules/BundleLibraries.cmake +++ /dev/null @@ -1,66 +0,0 @@ -# Bundles libraries with an output executable. -# Parameters: -# - TYPE: "qt" or "standalone". The type of app to bundle. -# - "qt" uses windeployqt/macdeployqt to bundle Qt and other libraries. -# - "standalone" copies dependent libraries to a "libs" folder alongside the executable file. -# - EXECUTABLE_PATH: Path to the executable binary. - -# TODO: This does not really work fully for Windows yet, some libraries are missing from the output. -# TODO: Leaving a basic framework of Windows support here to be iterated on in the future. -if (WIN32) - message(FATAL_ERROR "Advanced library bundling is not yet supported for Windows.") -endif() - -if ("${TYPE}" STREQUAL "qt") - get_filename_component(executable_dir ${EXECUTABLE_PATH} DIRECTORY) - - # Bundle dependencies using appropriate Qt tool. - if (WIN32) - find_program(WINDEPLOYQT_EXECUTABLE windeployqt) - execute_process(COMMAND ${WINDEPLOYQT_EXECUTABLE} ${EXECUTABLE_PATH} - --no-compiler-runtime --no-system-d3d-compiler --no-opengl-sw --no-translations - --plugindir "${executable_dir}/plugins") - elseif (APPLE) - get_filename_component(contents_dir ${executable_dir} DIRECTORY) - get_filename_component(bundle_dir ${contents_dir} DIRECTORY) - - find_program(MACDEPLOYQT_EXECUTABLE macdeployqt) - execute_process(COMMAND ${MACDEPLOYQT_EXECUTABLE} ${bundle_dir} -executable=${EXECUTABLE_PATH} -always-overwrite) - - # Bundling libraries can rewrite path information and break code signatures of system libraries. - # Perform an ad-hoc re-signing on the whole app bundle to fix this. - execute_process(COMMAND codesign --deep -fs - ${bundle_dir}) - else() - message(FATAL_ERROR "Unsupported OS for Qt-based library bundling.") - endif() -else() - # Resolve dependent library files. - file(GET_RUNTIME_DEPENDENCIES - EXECUTABLES ${EXECUTABLE_PATH} - RESOLVED_DEPENDENCIES_VAR resolved_deps - UNRESOLVED_DEPENDENCIES_VAR unresolved_deps - POST_EXCLUDE_REGEXES ".*system32/.*\\.dll") - - # Determine libraries directory. - get_filename_component(executable_dir ${EXECUTABLE_PATH} DIRECTORY) - if (WIN32) - # Same directory since we don't have rpath. - set(lib_dir ${executable_dir}) - else() - set(lib_dir ${executable_dir}/libs) - endif() - - # Copy library files to bundled output. - file(MAKE_DIRECTORY ${lib_dir}) - foreach (lib_file ${resolved_deps}) - # Use native copy to turn symlinks into normal files. - execute_process(COMMAND cp -L ${lib_file} ${lib_dir}) - endforeach() - - # Add libs directory to executable rpath where applicable. - if (APPLE) - execute_process(COMMAND install_name_tool -add_rpath "@loader_path/libs" ${EXECUTABLE_PATH}) - elseif (UNIX) - execute_process(COMMAND patchelf --set-rpath '$ORIGIN/../libs' ${EXECUTABLE_PATH}) - endif() -endif() diff --git a/CMakeModules/BundleTarget.cmake b/CMakeModules/BundleTarget.cmake new file mode 100644 index 0000000000..af95f5d4ec --- /dev/null +++ b/CMakeModules/BundleTarget.cmake @@ -0,0 +1,243 @@ + +if (BUNDLE_TARGET_EXECUTE) + # --- Bundling method logic --- + + function(bundle_qt executable_path) + if (WIN32) + get_filename_component(executable_parent_dir "${executable_path}" DIRECTORY) + find_program(windeployqt_executable windeployqt6) + + # Create a qt.conf file pointing to the app directory. + # This ensures Qt can find its plugins. + file(WRITE "${executable_parent_dir}/qt.conf" "[Paths]\nprefix = .") + + message(STATUS "Executing windeployqt for executable ${executable_path}") + execute_process(COMMAND "${windeployqt_executable}" "${executable_path}" + --no-compiler-runtime --no-system-d3d-compiler --no-opengl-sw --no-translations + --plugindir "${executable_parent_dir}/plugins") + + # Remove the FFmpeg multimedia plugin as we don't include FFmpeg. + # We want to use the Windows media plugin instead, which is also included. + file(REMOVE "${executable_parent_dir}/plugins/multimedia/ffmpegmediaplugin.dll") + elseif (APPLE) + get_filename_component(executable_name "${executable_path}" NAME_WE) + find_program(MACDEPLOYQT_EXECUTABLE macdeployqt6) + + message(STATUS "Executing macdeployqt for executable ${executable_path}") + execute_process( + COMMAND "${MACDEPLOYQT_EXECUTABLE}" + "${executable_path}" + "-executable=${executable_path}/Contents/MacOS/${executable_name}" + -always-overwrite) + + # Bundling libraries can rewrite path information and break code signatures of system libraries. + # Perform an ad-hoc re-signing on the whole app bundle to fix this. + execute_process(COMMAND codesign --deep -fs - "${executable_path}") + else() + message(FATAL_ERROR "Unsupported OS for Qt bundling.") + endif() + endfunction() + + function(bundle_appimage bundle_dir executable_path source_path binary_path linuxdeploy_executable enable_qt) + get_filename_component(executable_name "${executable_path}" NAME_WE) + set(appdir_path "${binary_path}/AppDir-${executable_name}") + + if (enable_qt) + # Find qmake to make sure the plugin uses the right version of Qt. + find_program(QMAKE_EXECUTABLE qmake6) + + set(extra_linuxdeploy_env "QMAKE=${QMAKE_EXECUTABLE}") + set(extra_linuxdeploy_args --plugin qt) + endif() + + message(STATUS "Creating AppDir for executable ${executable_path}") + execute_process(COMMAND ${CMAKE_COMMAND} -E env + ${extra_linuxdeploy_env} + "${linuxdeploy_executable}" + ${extra_linuxdeploy_args} + --plugin checkrt + --executable "${executable_path}" + --icon-file "${source_path}/dist/citra.svg" + --desktop-file "${source_path}/dist/${executable_name}.desktop" + --appdir "${appdir_path}") + + if (enable_qt) + set(qt_hook_file "${appdir_path}/apprun-hooks/linuxdeploy-plugin-qt-hook.sh") + file(READ "${qt_hook_file}" qt_hook_contents) + # Add Cinnamon to list of DEs for GTK3 theming. + string(REPLACE + "*XFCE*" + "*X-Cinnamon*|*XFCE*" + qt_hook_contents "${qt_hook_contents}") + # Wayland backend crashes due to changed schemas in Gnome 40. + string(REPLACE + "export QT_QPA_PLATFORMTHEME=gtk3" + "export QT_QPA_PLATFORMTHEME=gtk3; export GDK_BACKEND=x11" + qt_hook_contents "${qt_hook_contents}") + file(WRITE "${qt_hook_file}" "${qt_hook_contents}") + endif() + + message(STATUS "Creating AppImage for executable ${executable_path}") + execute_process(COMMAND ${CMAKE_COMMAND} -E env + "OUTPUT=${bundle_dir}/${executable_name}.AppImage" + "${linuxdeploy_executable}" + --output appimage + --appdir "${appdir_path}") + endfunction() + + function(bundle_standalone executable_path original_executable_path bundle_library_paths) + get_filename_component(executable_parent_dir "${executable_path}" DIRECTORY) + + # Resolve dependent library files if they were not passed in. + message(STATUS "Determining runtime dependencies of ${executable_path} using library paths ${bundle_library_paths}") + file(GET_RUNTIME_DEPENDENCIES + EXECUTABLES ${original_executable_path} + RESOLVED_DEPENDENCIES_VAR resolved_deps + UNRESOLVED_DEPENDENCIES_VAR unresolved_deps + DIRECTORIES ${bundle_library_paths} + POST_EXCLUDE_REGEXES ".*system32.*") + + if (WIN32) + # Same directory since we don't have rpath. + set(lib_dir "${executable_parent_dir}") + else() + set(lib_dir "${executable_parent_dir}/libs") + endif() + + # Copy files to bundled output. + if (resolved_deps) + file(MAKE_DIRECTORY ${lib_dir}) + foreach (lib_file IN LISTS resolved_deps) + message(STATUS "Bundling library ${lib_file}") + # Use native copy to turn symlinks into normal files. + execute_process(COMMAND cp -L "${lib_file}" "${lib_dir}") + endforeach() + endif() + + # Add libs directory to executable rpath where applicable. + if (APPLE) + execute_process(COMMAND install_name_tool -add_rpath "@loader_path/libs" "${executable_path}") + elseif (UNIX) + execute_process(COMMAND patchelf --set-rpath '$ORIGIN/../libs' "${executable_path}") + endif() + endfunction() + + # --- Root bundling logic --- + + set(bundle_dir ${BINARY_PATH}/bundle) + file(MAKE_DIRECTORY ${bundle_dir}) + + # On Linux, always bundle an AppImage. + if (DEFINED LINUXDEPLOY) + bundle_appimage("${bundle_dir}" "${EXECUTABLE_PATH}" "${SOURCE_PATH}" "${BINARY_PATH}" "${LINUXDEPLOY}" ${BUNDLE_QT}) + else() + message(STATUS "Copying base executable ${EXECUTABLE_PATH} to output directory ${bundle_dir}") + file(COPY ${EXECUTABLE_PATH} DESTINATION ${bundle_dir}) + get_filename_component(bundled_executable_name "${EXECUTABLE_PATH}" NAME) + set(bundled_executable_path "${bundle_dir}/${bundled_executable_name}") + + if (BUNDLE_QT) + bundle_qt("${bundled_executable_path}") + endif() + + if (WIN32 OR NOT BUNDLE_QT) + bundle_standalone("${bundled_executable_path}" "${EXECUTABLE_PATH}" "${BUNDLE_LIBRARY_PATHS}") + endif() + endif() +else() + # --- Bundling target creation logic --- + + # Downloads and extracts a linuxdeploy component. + function(download_linuxdeploy_component base_dir name executable_name) + set(executable_file "${base_dir}/${executable_name}") + if (NOT EXISTS "${executable_file}") + message(STATUS "Downloading ${executable_name}") + file(DOWNLOAD + "https://github.com/linuxdeploy/${name}/releases/download/continuous/${executable_name}" + "${executable_file}" SHOW_PROGRESS) + file(CHMOD "${executable_file}" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) + + get_filename_component(executable_ext "${executable_file}" LAST_EXT) + if (executable_ext STREQUAL ".AppImage") + message(STATUS "Extracting ${executable_name}") + execute_process( + COMMAND "${executable_file}" --appimage-extract + WORKING_DIRECTORY "${base_dir}") + else() + message(STATUS "Copying ${executable_name}") + file(COPY "${executable_file}" DESTINATION "${base_dir}/squashfs-root/usr/bin/") + endif() + endif() + endfunction() + + # Adds a target to the bundle target, packing in required libraries. + function(bundle_target target_name) + # Create base bundle target if it does not exist. + if (NOT TARGET bundle) + message(STATUS "Creating base bundle target") + + add_custom_target(bundle) + add_custom_command( + TARGET bundle + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/license.txt" "${CMAKE_BINARY_DIR}/bundle/") + add_custom_command( + TARGET bundle + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/README.md" "${CMAKE_BINARY_DIR}/bundle/") + add_custom_command( + TARGET bundle + COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/dist/scripting" "${CMAKE_BINARY_DIR}/bundle/scripting") + endif() + + set(BUNDLE_EXECUTABLE_PATH "$") + if (target_name MATCHES ".*qt") + set(BUNDLE_QT ON) + if (APPLE) + # For Qt targets on Apple, expect an app bundle. + set(BUNDLE_EXECUTABLE_PATH "$") + endif() + else() + set(BUNDLE_QT OFF) + endif() + + # Build a list of library search paths from prefix paths. + foreach(prefix_path IN LISTS CMAKE_PREFIX_PATH CMAKE_SYSTEM_PREFIX_PATH) + if (WIN32) + list(APPEND BUNDLE_LIBRARY_PATHS "${prefix_path}/bin") + endif() + list(APPEND BUNDLE_LIBRARY_PATHS "${prefix_path}/lib") + endforeach() + foreach(library_path IN LISTS CMAKE_SYSTEM_LIBRARY_PATH) + list(APPEND BUNDLE_LIBRARY_PATHS "${library_path}") + endforeach() + + # On Linux, prepare linuxdeploy and any required plugins. + if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(LINUXDEPLOY_BASE "${CMAKE_BINARY_DIR}/externals/linuxdeploy") + + # Download plugins first so they don't overwrite linuxdeploy's AppRun file. + download_linuxdeploy_component("${LINUXDEPLOY_BASE}" "linuxdeploy-plugin-qt" "linuxdeploy-plugin-qt-x86_64.AppImage") + download_linuxdeploy_component("${LINUXDEPLOY_BASE}" "linuxdeploy-plugin-checkrt" "linuxdeploy-plugin-checkrt-x86_64.sh") + download_linuxdeploy_component("${LINUXDEPLOY_BASE}" "linuxdeploy" "linuxdeploy-x86_64.AppImage") + + set(EXTRA_BUNDLE_ARGS "-DLINUXDEPLOY=${LINUXDEPLOY_BASE}/squashfs-root/AppRun") + endif() + + message(STATUS "Adding ${target_name} to bundle target") + + add_custom_target(bundle-${target_name} + COMMAND ${CMAKE_COMMAND} + "-DCMAKE_PREFIX_PATH=\"${CMAKE_PREFIX_PATH}\"" + "-DBUNDLE_TARGET_EXECUTE=1" + "-DTARGET=${target_name}" + "-DSOURCE_PATH=${CMAKE_SOURCE_DIR}" + "-DBINARY_PATH=${CMAKE_BINARY_DIR}" + "-DEXECUTABLE_PATH=${BUNDLE_EXECUTABLE_PATH}" + "-DBUNDLE_LIBRARY_PATHS=\"${BUNDLE_LIBRARY_PATHS}\"" + "-DBUNDLE_QT=${BUNDLE_QT}" + ${EXTRA_BUNDLE_ARGS} + -P "${CMAKE_SOURCE_DIR}/CMakeModules/BundleTarget.cmake" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" + DEPENDS ${target_name}) + add_dependencies(bundle bundle-${target_name}) + endfunction() +endif() diff --git a/CMakeModules/CopyCitraOpensslDeps.cmake b/CMakeModules/CopyCitraOpensslDeps.cmake deleted file mode 100644 index e53ad628f6..0000000000 --- a/CMakeModules/CopyCitraOpensslDeps.cmake +++ /dev/null @@ -1,6 +0,0 @@ -function(copy_citra_openssl_deps target_dir) - include(WindowsCopyFiles) - set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/$/") - windows_copy_files(${target_dir} ${OPENSSL_DLL_DIR} ${DLL_DEST} libcrypto-1_1-x64.dll) - windows_copy_files(${target_dir} ${OPENSSL_DLL_DIR} ${DLL_DEST} libssl-1_1-x64.dll) -endfunction(copy_citra_openssl_deps) diff --git a/CMakeModules/CopyCitraQt6Deps.cmake b/CMakeModules/CopyCitraQt6Deps.cmake deleted file mode 100644 index 4d5aa7d3f5..0000000000 --- a/CMakeModules/CopyCitraQt6Deps.cmake +++ /dev/null @@ -1,46 +0,0 @@ -function(copy_citra_Qt6_deps target_dir) - include(WindowsCopyFiles) - set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/$/") - set(Qt6_DLL_DIR "${Qt6_DIR}/../../../bin") - set(Qt6_PLATFORMS_DIR "${Qt6_DIR}/../../../plugins/platforms/") - set(Qt6_MULTIMEDIA_DIR "${Qt6_DIR}/../../../plugins/multimedia/") - set(Qt6_STYLES_DIR "${Qt6_DIR}/../../../plugins/styles/") - set(Qt6_IMAGEFORMATS_DIR "${Qt6_DIR}/../../../plugins/imageformats/") - set(PLATFORMS ${DLL_DEST}plugins/platforms/) - set(MULTIMEDIA ${DLL_DEST}plugins/multimedia/) - set(STYLES ${DLL_DEST}plugins/styles/) - set(IMAGEFORMATS ${DLL_DEST}plugins/imageformats/) - windows_copy_files(${target_dir} ${Qt6_DLL_DIR} ${DLL_DEST} - icudt*.dll - icuin*.dll - icuuc*.dll - Qt6Core$<$:d>.* - Qt6Gui$<$:d>.* - Qt6Widgets$<$:d>.* - Qt6Concurrent$<$:d>.* - Qt6Multimedia$<$:d>.* - Qt6Network$<$:d>.* - ) - windows_copy_files(citra-qt ${Qt6_PLATFORMS_DIR} ${PLATFORMS} qwindows$<$:d>.*) - windows_copy_files(citra-qt ${Qt6_MULTIMEDIA_DIR} ${MULTIMEDIA} - windowsmediaplugin$<$:d>.* - ) - windows_copy_files(citra-qt ${Qt6_STYLES_DIR} ${STYLES} qwindowsvistastyle$<$:d>.*) - windows_copy_files(${target_dir} ${Qt6_IMAGEFORMATS_DIR} ${IMAGEFORMATS} - qgif$<$:d>.dll - qicns$<$:d>.dll - qico$<$:d>.dll - qjpeg$<$:d>.dll - qsvg$<$:d>.dll - qtga$<$:d>.dll - qtiff$<$:d>.dll - qwbmp$<$:d>.dll - qwebp$<$:d>.dll - ) - - # Create an empty qt.conf file. Qt will detect that this file exists, and use the folder that its in as the root folder. - # This way it'll look for plugins in the root/plugins/ folder - add_custom_command(TARGET citra-qt POST_BUILD - COMMAND ${CMAKE_COMMAND} -E touch ${DLL_DEST}qt.conf - ) -endfunction(copy_citra_Qt6_deps) diff --git a/CMakeModules/DownloadExternals.cmake b/CMakeModules/DownloadExternals.cmake index ec9a524a7d..6448e1f251 100644 --- a/CMakeModules/DownloadExternals.cmake +++ b/CMakeModules/DownloadExternals.cmake @@ -1,60 +1,28 @@ -# This function downloads a binary library package from our external repo. -# Params: -# remote_path: path to the file to download, relative to the remote repository root -# prefix_var: name of a variable which will be set with the path to the extracted contents -function(download_bundled_external remote_path lib_name prefix_var) - get_external_prefix(${lib_name} prefix) - if (NOT EXISTS "${prefix}") - message(STATUS "Downloading binaries for ${lib_name}...") - - if (WIN32) - set(repo_base "ext-windows-bin/raw/master") - elseif (APPLE) - set(repo_base "ext-macos-bin/raw/main") - else() - message(FATAL_ERROR "Bundled libraries are unsupported for this OS.") - endif() - - file(DOWNLOAD - https://github.com/citra-emu/${repo_base}/${remote_path}${lib_name}.7z - "${CMAKE_BINARY_DIR}/externals/${lib_name}.7z" SHOW_PROGRESS) - execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${CMAKE_BINARY_DIR}/externals/${lib_name}.7z" - WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals") - endif() - - # For packages that include the /usr/local prefix, include it in the prefix path. - if (EXISTS "${prefix}/usr/local") - set(prefix "${prefix}/usr/local") - endif() - - message(STATUS "Using bundled binaries at ${prefix}") - set(${prefix_var} "${prefix}" PARENT_SCOPE) -endfunction() - # This function downloads Qt using aqt. # Params: # target: Qt dependency to install. Specify a version number to download Qt, or "tools_(name)" for a specific build tool. # prefix_var: Name of a variable which will be set with the path to the extracted contents. -function(download_qt_external target) +function(download_qt target) # Determine installation parameters for OS, architecture, and compiler if (WIN32) set(host "windows") set(type "desktop") if (MINGW) - set(arch_path "mingw81") - elseif ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND "x86_64" IN_LIST ARCHITECTURE) + set(arch "win64_mingw") + set(arch_path "mingw_64") + elseif (MSVC) if ("arm64" IN_LIST ARCHITECTURE) set(arch_path "msvc2019_arm64") elseif ("x86_64" IN_LIST ARCHITECTURE) set(arch_path "msvc2019_64") else() - message(FATAL_ERROR "Unsupported bundled Qt architecture. Disable CITRA_USE_BUNDLED_QT and provide your own.") + message(FATAL_ERROR "Unsupported bundled Qt architecture. Enable USE_SYSTEM_QT and provide your own.") endif() + set(arch "win64_${arch_path}") else() - message(FATAL_ERROR "Unsupported bundled Qt toolchain. Disable CITRA_USE_BUNDLED_QT and provide your own.") + message(FATAL_ERROR "Unsupported bundled Qt toolchain. Enable USE_SYSTEM_QT and provide your own.") endif() - set(arch "win64_${arch_path}") elseif (APPLE) set(host "mac") if (IOS) diff --git a/CMakeModules/MSVCCache.cmake b/CMakeModules/MSVCCache.cmake deleted file mode 100755 index 1b64593a3a..0000000000 --- a/CMakeModules/MSVCCache.cmake +++ /dev/null @@ -1,12 +0,0 @@ -# buildcache wrapper -OPTION(CITRA_USE_CCACHE "Use buildcache for compilation" OFF) -IF(CITRA_USE_CCACHE) - FIND_PROGRAM(CCACHE buildcache) - IF (CCACHE) - MESSAGE(STATUS "Using buildcache found in PATH") - SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE}) - SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE}) - ELSE(CCACHE) - MESSAGE(WARNING "CITRA_USE_CCACHE enabled, but no buildcache executable found") - ENDIF(CCACHE) -ENDIF(CITRA_USE_CCACHE) diff --git a/CMakeModules/MinGWCross.cmake b/CMakeModules/MinGWCross.cmake deleted file mode 100644 index a21f03ab3e..0000000000 --- a/CMakeModules/MinGWCross.cmake +++ /dev/null @@ -1,52 +0,0 @@ -SET(MINGW_PREFIX /usr/x86_64-w64-mingw32/) -SET(CMAKE_SYSTEM_NAME Windows) -SET(CMAKE_SYSTEM_PROCESSOR x86_64) - - -SET(CMAKE_FIND_ROOT_PATH ${MINGW_PREFIX}) -SET(SDL2_PATH ${MINGW_PREFIX}) -SET(MINGW_TOOL_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32-) - -# Specify the cross compiler -SET(CMAKE_C_COMPILER ${MINGW_TOOL_PREFIX}gcc) -SET(CMAKE_CXX_COMPILER ${MINGW_TOOL_PREFIX}g++) -SET(CMAKE_RC_COMPILER ${MINGW_TOOL_PREFIX}windres) - -# Mingw tools -SET(STRIP ${MINGW_TOOL_PREFIX}strip) -SET(WINDRES ${MINGW_TOOL_PREFIX}windres) -SET(ENV{PKG_CONFIG} ${MINGW_TOOL_PREFIX}pkg-config) - -# ccache wrapper -OPTION(CITRA_USE_CCACHE "Use ccache for compilation" OFF) -IF(CITRA_USE_CCACHE) - FIND_PROGRAM(CCACHE ccache) - IF (CCACHE) - MESSAGE(STATUS "Using ccache found in PATH") - SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE}) - SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE}) - ELSE(CCACHE) - MESSAGE(WARNING "CITRA_USE_CCACHE enabled, but no ccache found") - ENDIF(CCACHE) -ENDIF(CITRA_USE_CCACHE) - -# Search for programs in the build host directories -SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) - - -# Echo modified cmake vars to screen for debugging purposes -IF(NOT DEFINED ENV{MINGW_DEBUG_INFO}) - MESSAGE("") - MESSAGE("Custom cmake vars: (blank = system default)") - MESSAGE("-----------------------------------------") - MESSAGE("* CMAKE_C_COMPILER : ${CMAKE_C_COMPILER}") - MESSAGE("* CMAKE_CXX_COMPILER : ${CMAKE_CXX_COMPILER}") - MESSAGE("* CMAKE_RC_COMPILER : ${CMAKE_RC_COMPILER}") - MESSAGE("* WINDRES : ${WINDRES}") - MESSAGE("* ENV{PKG_CONFIG} : $ENV{PKG_CONFIG}") - MESSAGE("* STRIP : ${STRIP}") - MESSAGE("* CITRA_USE_CCACHE : ${CITRA_USE_CCACHE}") - MESSAGE("") - # So that the debug info only appears once - SET(ENV{MINGW_DEBUG_INFO} SHOWN) -ENDIF() diff --git a/dist/citra-qt.desktop b/dist/citra-qt.desktop new file mode 100644 index 0000000000..cc4ec41a23 --- /dev/null +++ b/dist/citra-qt.desktop @@ -0,0 +1,15 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=Citra +GenericName=3DS Emulator +GenericName[fr]=Émulateur 3DS +Comment=Nintendo 3DS video game console emulator +Comment[fr]=Émulateur de console de jeu Nintendo 3DS +Icon=citra +TryExec=citra-qt +Exec=citra-qt %f +Categories=Game;Emulator;Qt; +MimeType=application/x-ctr-3dsx;application/x-ctr-cci;application/x-ctr-cia;application/x-ctr-cxi; +Keywords=3DS;Nintendo; +PrefersNonDefaultGPU=true diff --git a/dist/citra-room.desktop b/dist/citra-room.desktop new file mode 100644 index 0000000000..89df53bbdd --- /dev/null +++ b/dist/citra-room.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=Citra Room +Comment=Multiplayer room host for Citra +Icon=citra +TryExec=citra-room +Exec=citra-room %f +Categories=Game;Emulator; +Keywords=3DS;Nintendo diff --git a/dist/citra.desktop b/dist/citra.desktop index cc4ec41a23..24468cd133 100644 --- a/dist/citra.desktop +++ b/dist/citra.desktop @@ -7,9 +7,9 @@ GenericName[fr]=Émulateur 3DS Comment=Nintendo 3DS video game console emulator Comment[fr]=Émulateur de console de jeu Nintendo 3DS Icon=citra -TryExec=citra-qt -Exec=citra-qt %f -Categories=Game;Emulator;Qt; +TryExec=citra +Exec=citra %f +Categories=Game;Emulator; MimeType=application/x-ctr-3dsx;application/x-ctr-cci;application/x-ctr-cia;application/x-ctr-cxi; Keywords=3DS;Nintendo; PrefersNonDefaultGPU=true diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index bc23530f38..79c7d57e42 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -156,6 +156,7 @@ target_include_directories(enet INTERFACE ./enet/include) if (ENABLE_CUBEB) set(BUILD_TESTS OFF CACHE BOOL "") set(BUILD_TOOLS OFF CACHE BOOL "") + set(BUNDLE_SPEEX ON CACHE BOOL "") add_subdirectory(cubeb EXCLUDE_FROM_ALL) endif() @@ -170,10 +171,14 @@ add_library(json-headers INTERFACE) target_include_directories(json-headers INTERFACE ./json) if (ENABLE_WEB_SERVICE) - find_package(OpenSSL 1.1) - if (OPENSSL_FOUND) - set(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto) - else() + if (USE_SYSTEM_OPENSSL) + find_package(OpenSSL 1.1) + if (OPENSSL_FOUND) + set(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto) + endif() + endif() + + if (NOT OPENSSL_FOUND) # LibreSSL set(LIBRESSL_SKIP_INSTALL ON CACHE BOOL "") set(OPENSSLDIR "/etc/ssl/") diff --git a/externals/cmake-modules/WindowsCopyFiles.cmake b/externals/cmake-modules/WindowsCopyFiles.cmake deleted file mode 100644 index a21b2e2d7f..0000000000 --- a/externals/cmake-modules/WindowsCopyFiles.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2016 Citra Emulator Project -# Licensed under GPLv2 or any later version -# Refer to the license.txt file included. - -# This file provides the function windows_copy_files. -# This is only valid on Windows. - -# Include guard -if(__windows_copy_files) - return() -endif() -set(__windows_copy_files YES) - -# Any number of files to copy from SOURCE_DIR to DEST_DIR can be specified after DEST_DIR. -# This copying happens post-build. -function(windows_copy_files TARGET SOURCE_DIR DEST_DIR) - # windows commandline expects the / to be \ so switch them - string(REPLACE "/" "\\\\" SOURCE_DIR ${SOURCE_DIR}) - string(REPLACE "/" "\\\\" DEST_DIR ${DEST_DIR}) - - # /NJH /NJS /NDL /NFL /NC /NS /NP - Silence any output - # cmake adds an extra check for command success which doesn't work too well with robocopy - # so trick it into thinking the command was successful with the || cmd /c "exit /b 0" - add_custom_command(TARGET ${TARGET} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E make_directory ${DEST_DIR} - COMMAND robocopy ${SOURCE_DIR} ${DEST_DIR} ${ARGN} /NJH /NJS /NDL /NFL /NC /NS /NP || cmd /c "exit /b 0" - ) -endfunction() diff --git a/externals/httplib/httplib.h b/externals/httplib/httplib.h index d380af0c0b..3657b47946 100644 --- a/externals/httplib/httplib.h +++ b/externals/httplib/httplib.h @@ -233,6 +233,12 @@ using socket_t = int; #undef X509_EXTENSIONS #undef PKCS7_SIGNER_INFO +// libressl will warn without this, which becomes an error. +#undef OCSP_REQUEST +#undef OCSP_RESPONSE +#undef PKCS7_ISSUER_AND_SERIAL +#undef __WINCRYPT_H__ + #ifdef _MSC_VER #pragma comment(lib, "crypt32.lib") #pragma comment(lib, "cryptui.lib") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8676db5fdb..acfc1d7d91 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -85,7 +85,7 @@ if (MSVC) # Since MSVC's debugging information is not very deterministic, so we have to disable it # when using ccache or other caching tools if (CITRA_USE_CCACHE OR CITRA_USE_PRECOMPILED_HEADERS) - # Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21 + # Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21 add_compile_options(/Z7) else() add_compile_options(/Zi) @@ -110,28 +110,21 @@ else() add_compile_options("-stdlib=libc++") endif() - # Set file offset size to 64 bits. - # - # On modern Unixes, this is typically already the case. The lone exception is - # glibc, which may default to 32 bits. glibc allows this to be configured - # by setting _FILE_OFFSET_BITS. - if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW) - add_definitions(-D_FILE_OFFSET_BITS=64) - endif() - if (MINGW) add_definitions(-DMINGW_HAS_SECURE_API) if (COMPILE_WITH_DWARF) add_compile_options("-gdwarf") endif() - - if (MINGW_STATIC_BUILD) - add_definitions(-DQT_STATICPLUGIN) - add_compile_options("-static") - endif() endif() if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW) + # Set file offset size to 64 bits. + # + # On modern Unixes, this is typically already the case. The lone exception is + # glibc, which may default to 32 bits. glibc allows this to be configured + # by setting _FILE_OFFSET_BITS. + add_definitions(-D_FILE_OFFSET_BITS=64) + # GNU ar: Create thin archive files. # Requires binutils-2.19 or later. set(CMAKE_C_ARCHIVE_CREATE " qcTP ") diff --git a/src/android/app/build.gradle b/src/android/app/build.gradle index 1010c40e45..df7e43b5ea 100644 --- a/src/android/app/build.gradle +++ b/src/android/app/build.gradle @@ -38,13 +38,16 @@ android { ndk.abiFilters abiFilter } - signingConfigs { - //release { - // storeFile file('') - // storePassword System.getenv('ANDROID_KEYPASS') - // keyAlias = 'key0' - // keyPassword System.getenv('ANDROID_KEYPASS') - //} + def keystoreFile = System.getenv('ANDROID_KEYSTORE_FILE') + if (keystoreFile != null) { + signingConfigs { + release { + storeFile file(keystoreFile) + storePassword System.getenv('ANDROID_KEYSTORE_PASS') + keyAlias System.getenv('ANDROID_KEY_ALIAS') + keyPassword System.getenv('ANDROID_KEYSTORE_PASS') + } + } } applicationVariants.all { variant -> @@ -56,7 +59,7 @@ android { // Signed by release key, allowing for upload to Play Store. release { - signingConfig signingConfigs.debug + signingConfig keystoreFile != null ? signingConfigs.release : signingConfigs.debug } // builds a release build that doesn't need signing @@ -107,8 +110,7 @@ android { cmake { arguments "-DENABLE_QT=0", // Don't use QT "-DENABLE_SDL2=0", // Don't use SDL - "-DANDROID_ARM_NEON=true", // cryptopp requires Neon to work - "-DBUNDLE_SPEEX=ON" + "-DANDROID_ARM_NEON=true" // cryptopp requires Neon to work abiFilters abiFilter } @@ -168,3 +170,23 @@ def getVersion() { return versionName } + +// Add task to each variant for copying output APKs to bundle directory. +android.applicationVariants.all { variant -> + def capitalizedName = variant.name.capitalize() + def copyTask = tasks.register("copyBundle${capitalizedName}") { + doLast { + project.copy { + from variant.outputs[0].outputFile.parentFile + include '*.apk' + into layout.buildDirectory.dir("bundle") + } + project.copy { + from layout.buildDirectory.dir("outputs/bundle/${variant.name}") + include '*.aab' + into layout.buildDirectory.dir("bundle") + } + } + } + tasks.named("bundle${capitalizedName}").get().configure { finalizedBy copyTask } +} diff --git a/src/audio_core/hle/wmf_decoder_utils.cpp b/src/audio_core/hle/wmf_decoder_utils.cpp index 1d0f2f81b2..e71bb2f192 100644 --- a/src/audio_core/hle/wmf_decoder_utils.cpp +++ b/src/audio_core/hle/wmf_decoder_utils.cpp @@ -30,7 +30,7 @@ void ReportError(std::string msg, HRESULT hr) { unique_mfptr MFDecoderInit(GUID audio_format) { HRESULT hr = S_OK; - MFT_REGISTER_TYPE_INFO reg = {0}; + MFT_REGISTER_TYPE_INFO reg{}; GUID category = MFT_CATEGORY_AUDIO_DECODER; IMFActivate** activate; unique_mfptr transform; diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt index 5793505a2e..682dbbaa6a 100644 --- a/src/citra/CMakeLists.txt +++ b/src/citra/CMakeLists.txt @@ -29,22 +29,6 @@ if(UNIX AND NOT APPLE) install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") endif() -if (MSVC AND ENABLE_WEB_SERVICE AND OPENSSL_DLL_DIR) - include(CopyCitraOpensslDeps) - copy_citra_openssl_deps(citra) -endif() - if (CITRA_USE_PRECOMPILED_HEADERS) target_precompile_headers(citra PRIVATE precompiled_headers.h) endif() - -if (CITRA_BUNDLE_LIBRARIES) - add_custom_command(TARGET citra - POST_BUILD - COMMAND ${CMAKE_COMMAND} - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} - -DTYPE=standalone - -DEXECUTABLE_PATH=$ - -P ${CMAKE_SOURCE_DIR}/CMakeModules/BundleLibraries.cmake - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) -endif() diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 8b4a0e6483..f23b185556 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -290,22 +290,6 @@ elseif(WIN32) endif() endif() -if (CITRA_BUNDLE_LIBRARIES) - if (APPLE) - set(BUNDLE_DIR "$") - endif() - - add_custom_command(TARGET citra-qt - POST_BUILD - COMMAND ${CMAKE_COMMAND} - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} - -DTYPE=qt - -DEXECUTABLE_PATH=$ - -DBUNDLE_PATH=${BUNDLE_DIR} - -P ${CMAKE_SOURCE_DIR}/CMakeModules/BundleLibraries.cmake - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) -endif() - create_target_directory_groups(citra-qt) target_link_libraries(citra-qt PRIVATE audio_core citra_common citra_core input_common network video_core) @@ -360,15 +344,6 @@ if(UNIX AND NOT APPLE) install(TARGETS citra-qt RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") endif() -if (MSVC) - include(CopyCitraQt6Deps) - copy_citra_Qt6_deps(citra-qt) - if (ENABLE_WEB_SERVICE AND OPENSSL_DLL_DIR) - include(CopyCitraOpensslDeps) - copy_citra_openssl_deps(citra-qt) - endif() -endif() - if (NOT APPLE) target_compile_definitions(citra-qt PRIVATE HAS_OPENGL) endif() diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp index a0fd9fea38..7f713b1484 100644 --- a/src/common/logging/text_formatter.cpp +++ b/src/common/logging/text_formatter.cpp @@ -44,7 +44,7 @@ void PrintColoredMessage(const Entry& entry) { return; } - CONSOLE_SCREEN_BUFFER_INFO original_info = {0}; + CONSOLE_SCREEN_BUFFER_INFO original_info{}; GetConsoleScreenBufferInfo(console_handle, &original_info); WORD color = 0; diff --git a/src/dedicated_room/CMakeLists.txt b/src/dedicated_room/CMakeLists.txt index e319f5f87d..7f130a9a82 100644 --- a/src/dedicated_room/CMakeLists.txt +++ b/src/dedicated_room/CMakeLists.txt @@ -12,10 +12,6 @@ target_link_libraries(citra-room PRIVATE citra_common network) if (ENABLE_WEB_SERVICE) target_compile_definitions(citra-room PRIVATE -DENABLE_WEB_SERVICE) target_link_libraries(citra-room PRIVATE web_service) - if (MSVC AND OPENSSL_DLL_DIR) - include(CopyCitraOpensslDeps) - copy_citra_openssl_deps(citra-room) - endif() endif() target_link_libraries(citra-room PRIVATE cryptopp)