mirror of
https://github.com/citra-emu/citra-nightly.git
synced 2025-09-27 16:07:13 +00:00
Compare commits
400 commits
nightly-19
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
0ff3440232 | ||
|
69e758d738 | ||
|
f4768cd26c | ||
|
e0d2c1308e | ||
|
4f9fc88bb3 | ||
|
d857743075 | ||
|
b5042a5257 | ||
|
e524542a40 | ||
|
3a4ebb1413 | ||
|
cbe8987036 | ||
|
da5aa70fc9 | ||
|
749a721aa2 | ||
|
bb003c2bd4 | ||
|
7638f87f74 | ||
|
aa6809e2a8 | ||
|
5e02be75a3 | ||
|
b9c9beeee5 | ||
|
de993dcfbd | ||
|
3c9157b1ec | ||
|
0c40c10022 | ||
|
2766118e33 | ||
|
06b26691ba | ||
|
d41ce64f7b | ||
|
1165a708d5 | ||
|
19784355f9 | ||
|
aa6a29d7e1 | ||
|
106364e01e | ||
|
d5a1bd07f3 | ||
|
8afa27718c | ||
|
8e2415f455 | ||
|
c978c074db | ||
|
cb92ec278e | ||
|
9f5d5c6ddd | ||
|
480604ec72 | ||
|
63feac6bb3 | ||
|
469f76b075 | ||
|
7a4854c519 | ||
|
d1e3dddf6a | ||
|
265e8193b9 | ||
|
e8c20fa782 | ||
|
95ae46f6a8 | ||
|
41fe75acb7 | ||
|
1744537d85 | ||
|
bea863efff | ||
|
89e13a85a7 | ||
|
549fdd0736 | ||
|
eddc4a029c | ||
|
82294425e3 | ||
|
77fce3cf82 | ||
|
8d82adb3d3 | ||
|
228f26d1e4 | ||
|
789654d7da | ||
|
ca3b2306d5 | ||
|
8e87bd606c | ||
|
f26044bb88 | ||
|
c59ef7d793 | ||
|
6a7841d4b0 | ||
|
a2d1c4a94c | ||
|
9c84721d84 | ||
|
cca8c08a9a | ||
|
72c1075402 | ||
|
30c53c9509 | ||
|
da9f382d2c | ||
|
a177769c3b | ||
|
f346949989 | ||
|
37f0a7484f | ||
|
19d5695aa3 | ||
|
6cbdc73f53 | ||
|
81ee7ad893 | ||
|
2ce0a9e899 | ||
|
015e42be05 | ||
|
57696b2c11 | ||
|
c8c2beaeff | ||
|
6069fac76d | ||
|
7bacb78ce3 | ||
|
0165012ba4 | ||
|
96aa1b3a08 | ||
|
b2c740ee0e | ||
|
bc352e8168 | ||
|
4f00eb20db | ||
|
8b6a9b0dd8 | ||
|
62409f8139 | ||
|
0df72f3873 | ||
|
f2ee9baec7 | ||
|
8e2037b3ff | ||
|
c6bcbc02de | ||
|
36db566428 | ||
|
9b147d3f9c | ||
|
7dd9174d31 | ||
|
5a7f615da1 | ||
|
811303ea54 | ||
|
5bcdcffd96 | ||
|
2bb7f89c30 | ||
|
602f4f60d8 | ||
|
3113ae6616 | ||
|
bd4ec251cd | ||
|
b6b98af105 | ||
|
60a280af24 | ||
|
178e602589 | ||
|
dccb8f6b17 | ||
|
f177433d41 | ||
|
71b88c4c1f | ||
|
c7e9f8449e | ||
|
2e369c03b8 | ||
|
a47d8a7b4d | ||
|
02ba5c652b | ||
|
762ddfd07b | ||
|
d680b79725 | ||
|
2b20082581 | ||
|
15ea0c6336 | ||
|
9a6d15ab74 | ||
|
60584e861d | ||
|
070853b465 | ||
|
24b5ffbfca | ||
|
4d9eedd0d8 | ||
|
59df319f48 | ||
|
875f5eaad5 | ||
|
ea9f522c0c | ||
|
55e0b02863 | ||
|
59beeac4c7 | ||
|
0ed909e782 | ||
|
9da78f6126 | ||
|
0842ee6d7b | ||
|
6ec079ede8 | ||
|
83b329f6e1 | ||
|
db7b929e47 | ||
|
dc8425a986 | ||
|
670e9936a4 | ||
|
c0ecdb689d | ||
|
68e6a2185d | ||
|
09b36c589b | ||
|
1dc0fa7bb5 | ||
|
85bd1be852 | ||
|
c17ec1d1aa | ||
|
33a1f27a99 | ||
|
5733c8681e | ||
|
f8ae41dfe3 | ||
|
52254537b7 | ||
|
98f17f8f04 | ||
|
ca6dae1744 | ||
|
b6acebcb11 | ||
|
ba702043f0 | ||
|
2a4c60c1dd | ||
|
a1532f813b | ||
|
26d5727b19 | ||
|
680e132318 | ||
|
90a5d989e7 | ||
|
de40153fa4 | ||
|
e9936e01c2 | ||
|
e28c2a390c | ||
|
63d1830429 | ||
|
88cc6acb4d | ||
|
3b31720c4d | ||
|
f9bbae81aa | ||
|
1c793deece | ||
|
d5b50a9fc0 | ||
|
168f168c33 | ||
|
312068eebf | ||
|
5118798c30 | ||
|
831c9c4a38 | ||
|
23ca10472a | ||
|
6f05dd9d1d | ||
|
19cc8e626b | ||
|
ceeda05798 | ||
|
222b1cc0d7 | ||
|
b74c91457e | ||
|
1c75d895fc | ||
|
271218b733 | ||
|
80213bf88f | ||
|
fa08df21a5 | ||
|
80ac6c03b5 | ||
|
d4f31bc617 | ||
|
13d02c14e0 | ||
|
84f9e9a10f | ||
|
fcc0fd671a | ||
|
ee372572a6 | ||
|
7930e1ea86 | ||
|
4dd6e12e46 | ||
|
1d4d421097 | ||
|
3f4b57635e | ||
|
86566f1c14 | ||
|
3f1f0aa7c2 | ||
|
8fe147b8f9 | ||
|
5193a5d222 | ||
|
1f6393e7d5 | ||
|
9b2a5926a6 | ||
|
e13735b624 | ||
|
3218af38d0 | ||
|
1cf64ffaef | ||
|
998b9a9525 | ||
|
27bad3a699 | ||
|
1570aeffcb | ||
|
09ee80f590 | ||
|
b10f3d96f5 | ||
|
b5d744bcae | ||
|
89d5d4a2b6 | ||
|
4284893044 | ||
|
79ea06b226 | ||
|
8d811913a5 | ||
|
ac9d72a95c | ||
|
d3ce43782d | ||
|
597a2e8ead | ||
|
b231a22ea5 | ||
|
1110c01657 | ||
|
45ef11654a | ||
|
259dbf17dc | ||
|
ec55807669 | ||
|
36146459f8 | ||
|
597297ffb4 | ||
|
4ac10c4a9d | ||
|
2416258117 | ||
|
6d4e462e42 | ||
|
ef43776c7b | ||
|
1caf569f16 | ||
|
2d83fff581 | ||
|
e49b3c75bd | ||
|
956b0868fd | ||
|
4c59443ed2 | ||
|
07839fb3ce | ||
|
3d55270de6 | ||
|
40ba5226c6 | ||
|
775a25b492 | ||
|
897d1fa957 | ||
|
1acb03b579 | ||
|
4220f69c06 | ||
|
6264b6d43c | ||
|
6cfd00e42d | ||
|
6244f9e3fd | ||
|
f5b8888686 | ||
|
2961dcf0fd | ||
|
492aa3cb10 | ||
|
7931aac3b7 | ||
|
053b3618dc | ||
|
483e877001 | ||
|
72ff0c5337 | ||
|
0ce956ba00 | ||
|
b28ade1ee8 | ||
|
9ec4954380 | ||
|
38a0a85777 | ||
|
376d33cff4 | ||
|
50f22d1f59 | ||
|
1492d73ccb | ||
|
60d815fada | ||
|
38f310f716 | ||
|
a35f8cbb78 | ||
|
6cfb8e02a8 | ||
|
5ced2c7af9 | ||
|
327a00b4d5 | ||
|
d0b8974845 | ||
|
d19fe9aa4c | ||
|
270d3eb7eb | ||
|
003a4ec09b | ||
|
279208347e | ||
|
af5202f6cb | ||
|
28c542c2c2 | ||
|
d1c16bad78 | ||
|
542209c993 | ||
|
8aee625a14 | ||
|
d2d37411bc | ||
|
43cedf59af | ||
|
30fcdc5474 | ||
|
ee3eab5054 | ||
|
dfa2fd0e0d | ||
|
8f8c54201d | ||
|
9be4fd8b91 | ||
|
bbb47cd753 | ||
|
0b0d3a4ac3 | ||
|
6aa31d6ec2 | ||
|
3e254d01ee | ||
|
928f352c94 | ||
|
e2d8eef5fa | ||
|
9e898bca06 | ||
|
cab0ad50f0 | ||
|
5ad58e0605 | ||
|
1159e4d928 | ||
|
93c7c6a995 | ||
|
81a5e2355a | ||
|
d2260bafef | ||
|
d1f600601d | ||
|
8b218e1b7d | ||
|
04aeecabcf | ||
|
df57012c50 | ||
|
61cf550d0c | ||
|
f2e0748a22 | ||
|
edf157200d | ||
|
a94297922b | ||
|
894c1c85a5 | ||
|
e129f07047 | ||
|
cf54210f42 | ||
|
b2092de871 | ||
|
6ddf4b241f | ||
|
f3d92dd3b8 | ||
|
1a6860f35c | ||
|
bc0bf4d3d2 | ||
|
1d3bf64f13 | ||
|
c3609785ff | ||
|
66404a669f | ||
|
6a1fd38063 | ||
|
a27971e723 | ||
|
eb8d2941c9 | ||
|
af78268dd5 | ||
|
baca2bfc6b | ||
|
33a2113b71 | ||
|
1f07ab8643 | ||
|
b739bd2632 | ||
|
f76165d848 | ||
|
ac78b74c45 | ||
|
a478bedb12 | ||
|
6d0cd5b00e | ||
|
5b52849f90 | ||
|
20f4677f80 | ||
|
0048e61fc7 | ||
|
aaeba6759e | ||
|
ebac2e4978 | ||
|
5b9f4d4129 | ||
|
b1b6f08926 | ||
|
7e6a761f07 | ||
|
6f7612f73d | ||
|
88ea66053e | ||
|
970f2284d8 | ||
|
baf3ea4beb | ||
|
35e208b447 | ||
|
f8b8b6e53c | ||
|
a955f02771 | ||
|
3fedc68230 | ||
|
335fb78c5c | ||
|
22c4eb86d7 | ||
|
964f9ee3cf | ||
|
bb364d9bc0 | ||
|
51996c54f0 | ||
|
539a1a0b6e | ||
|
8b21b902f2 | ||
|
19107cec4b | ||
|
a537f56766 | ||
|
b5e1a27a7e | ||
|
a9e390b1b1 | ||
|
71582a72a4 | ||
|
e783b0d4a9 | ||
|
700c00f021 | ||
|
9cb14044ec | ||
|
8b6b58a364 | ||
|
e043caac27 | ||
|
0bedb28bdc | ||
|
c10ffda91f | ||
|
5e8ae4fa8a | ||
|
7a7f485640 | ||
|
bbf833bceb | ||
|
8eebb83c2c | ||
|
d702915624 | ||
|
943d5eeddf | ||
|
f3ac6f054f | ||
|
a94af8ea62 | ||
|
6da4853360 | ||
|
b738584832 | ||
|
1cb34ea0d3 | ||
|
662bb9ba77 | ||
|
26e3f96983 | ||
|
cd3244f139 | ||
|
e5310b25d4 | ||
|
80033b84cb | ||
|
cf9bb90ae3 | ||
|
4ccd9f24fb | ||
|
753b36c6ef | ||
|
c00768d6d0 | ||
|
4383f6d80a | ||
|
dc5ca96c0f | ||
|
9d4609e29a | ||
|
df9cc1b84c | ||
|
13a8969824 | ||
|
d7b4260389 | ||
|
2126c240cd | ||
|
0b37c1da57 | ||
|
9527bfffed | ||
|
ba98bf058a | ||
|
c88acf7405 | ||
|
71aea7e571 | ||
|
3d0a3c2c45 | ||
|
9c3e2d0f50 | ||
|
0ddb095273 | ||
|
52b9007fcf | ||
|
e112421db8 | ||
|
ae6fda8638 | ||
|
197c1adcba | ||
|
fe027a96fb | ||
|
637ade3b25 | ||
|
a1443356f1 | ||
|
aa39430e2c | ||
|
8f51dd9513 | ||
|
98e9f4c32e | ||
|
a8340395a3 | ||
|
3641b9891d | ||
|
8e8ca7d9d0 | ||
|
b57773b1cf | ||
|
b559c078bc | ||
|
5c86147ef4 | ||
|
399f3d4e32 | ||
|
173b84c8ff | ||
|
b4c38372d1 | ||
|
4fd0cbebdb | ||
|
ca2d87e5e3 |
|
@ -15,7 +15,7 @@ chmod +x ./gradlew
|
|||
./gradlew assemble${BUILD_FLAVOR}Release
|
||||
./gradlew bundle${BUILD_FLAVOR}Release
|
||||
|
||||
ccache -s
|
||||
ccache -s -v
|
||||
|
||||
if [ ! -z "${ANDROID_KEYSTORE_B64}" ]; then
|
||||
rm "${ANDROID_KEYSTORE_FILE}"
|
||||
|
|
|
@ -7,7 +7,7 @@ if grep -nrI '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .ci* dis
|
|||
fi
|
||||
|
||||
# Default clang-format points to default 3.5 version one
|
||||
CLANG_FORMAT=clang-format-12
|
||||
CLANG_FORMAT=clang-format-15
|
||||
$CLANG_FORMAT --version
|
||||
|
||||
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
|
||||
|
|
15
.ci/ios.sh
Executable file
15
.ci/ios.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash -ex
|
||||
|
||||
mkdir build && cd build
|
||||
cmake .. -GNinja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_SYSTEM_NAME=iOS \
|
||||
-DCMAKE_OSX_ARCHITECTURES=arm64 \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-DENABLE_QT_TRANSLATION=ON \
|
||||
-DCITRA_ENABLE_COMPATIBILITY_REPORTING=ON \
|
||||
-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON
|
||||
ninja
|
||||
|
||||
ccache -s -v
|
17
.ci/linux.sh
17
.ci/linux.sh
|
@ -1,10 +1,19 @@
|
|||
#!/bin/sh -ex
|
||||
#!/bin/bash -ex
|
||||
|
||||
if [ "$TARGET" = "appimage" ]; then
|
||||
# Compile the AppImage we distribute with Clang.
|
||||
export EXTRA_CMAKE_FLAGS=(-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_LINKER=/etc/bin/ld.lld)
|
||||
else
|
||||
# For the linux-fresh verification target, verify compilation without PCH as well.
|
||||
export EXTRA_CMAKE_FLAGS=(-DCITRA_USE_PRECOMPILED_HEADERS=OFF)
|
||||
fi
|
||||
|
||||
mkdir build && cd build
|
||||
cmake .. -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
"${EXTRA_CMAKE_FLAGS[@]}" \
|
||||
-DENABLE_QT_TRANSLATION=ON \
|
||||
-DCITRA_ENABLE_COMPATIBILITY_REPORTING=ON \
|
||||
-DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON \
|
||||
|
@ -13,8 +22,10 @@ ninja
|
|||
|
||||
if [ "$TARGET" = "appimage" ]; then
|
||||
ninja bundle
|
||||
# TODO: Our AppImage environment currently uses an older ccache version without the verbose flag.
|
||||
ccache -s
|
||||
else
|
||||
ccache -s -v
|
||||
fi
|
||||
|
||||
ccache -s
|
||||
|
||||
ctest -VV -C Release
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
#!/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
|
||||
-DUSE_DISCORD_PRESENCE=ON
|
||||
ninja
|
||||
ninja bundle
|
||||
|
||||
ccache -s
|
||||
ccache -s -v
|
||||
|
||||
CURRENT_ARCH=`arch`
|
||||
if [ "$TARGET" = "$CURRENT_ARCH" ]; then
|
||||
|
|
80
.ci/pack.sh
80
.ci/pack.sh
|
@ -1,48 +1,80 @@
|
|||
#!/bin/bash -ex
|
||||
|
||||
# Determine the full revision name.
|
||||
GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`"
|
||||
GITREV="`git show -s --format='%h'`"
|
||||
REV_NAME="citra-${OS}-${TARGET}-${GITDATE}-${GITREV}"
|
||||
REV_NAME="citra-$OS-$TARGET-$GITDATE-$GITREV"
|
||||
|
||||
# Find out what release we are building
|
||||
# Determine the name of the release being built.
|
||||
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
|
||||
# Archive and upload the artifacts.
|
||||
mkdir artifacts
|
||||
|
||||
if [ -z "${UPLOAD_RAW}" ]; then
|
||||
# Archive and upload the artifacts.
|
||||
function pack_artifacts() {
|
||||
ARTIFACTS_PATH="$1"
|
||||
|
||||
# Set up root directory for archive.
|
||||
mkdir "$REV_NAME"
|
||||
mv build/bundle/* "$REV_NAME"
|
||||
if [ -f "$ARTIFACTS_PATH" ]; then
|
||||
mv "$ARTIFACTS_PATH" "$REV_NAME"
|
||||
|
||||
if [ "$OS" = "windows" ]; then
|
||||
ARCHIVE_NAME="${REV_NAME}.zip"
|
||||
powershell Compress-Archive "$REV_NAME" "$ARCHIVE_NAME"
|
||||
# Use file extension to differentiate archives.
|
||||
FILENAME=$(basename "$ARTIFACT")
|
||||
EXTENSION="${FILENAME##*.}"
|
||||
ARCHIVE_NAME="$REV_NAME.$EXTENSION"
|
||||
else
|
||||
ARCHIVE_NAME="${REV_NAME}.tar.gz"
|
||||
tar czvf "$ARCHIVE_NAME" "$REV_NAME"
|
||||
mv "$ARTIFACTS_PATH"/* "$REV_NAME"
|
||||
|
||||
ARCHIVE_NAME="$REV_NAME"
|
||||
fi
|
||||
|
||||
mv "$REV_NAME" $RELEASE_NAME
|
||||
7z a "$REV_NAME.7z" $RELEASE_NAME
|
||||
# Create .zip/.tar.gz
|
||||
if [ "$OS" = "windows" ]; then
|
||||
ARCHIVE_FULL_NAME="$ARCHIVE_NAME.zip"
|
||||
powershell Compress-Archive "$REV_NAME" "$ARCHIVE_FULL_NAME"
|
||||
elif [ "$OS" = "android" ]; then
|
||||
ARCHIVE_FULL_NAME="$ARCHIVE_NAME.zip"
|
||||
zip -r "$ARCHIVE_FULL_NAME" "$REV_NAME"
|
||||
else
|
||||
ARCHIVE_FULL_NAME="$ARCHIVE_NAME.tar.gz"
|
||||
tar czvf "$ARCHIVE_FULL_NAME" "$REV_NAME"
|
||||
fi
|
||||
mv "$ARCHIVE_FULL_NAME" artifacts/
|
||||
|
||||
mv "$ARCHIVE_NAME" artifacts/
|
||||
mv "$REV_NAME.7z" artifacts/
|
||||
else
|
||||
# Directly upload the raw artifacts, renamed with the revision.
|
||||
if [ -z "$SKIP_7Z" ]; then
|
||||
# Create .7z
|
||||
ARCHIVE_FULL_NAME="$ARCHIVE_NAME.7z"
|
||||
mv "$REV_NAME" "$RELEASE_NAME"
|
||||
7z a "$ARCHIVE_FULL_NAME" "$RELEASE_NAME"
|
||||
mv "$ARCHIVE_FULL_NAME" artifacts/
|
||||
|
||||
# Clean up created release artifacts directory.
|
||||
rm -rf "$RELEASE_NAME"
|
||||
else
|
||||
# Clean up created rev artifacts directory.
|
||||
rm -rf "$REV_NAME"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -n "$UNPACKED" ]; then
|
||||
# Copy the artifacts to be uploaded unpacked.
|
||||
for ARTIFACT in build/bundle/*; do
|
||||
FILENAME=$(basename "$ARTIFACT")
|
||||
EXTENSION="${FILENAME##*.}"
|
||||
|
||||
mv "$ARTIFACT" "artifacts/$REV_NAME.$EXTENSION"
|
||||
done
|
||||
elif [ -n "$PACK_INDIVIDUALLY" ]; then
|
||||
# Pack and upload the artifacts one-by-one.
|
||||
for ARTIFACT in build/bundle/*; do
|
||||
pack_artifacts "$ARTIFACT"
|
||||
done
|
||||
else
|
||||
# Pack all of the artifacts into a single archive.
|
||||
pack_artifacts build/bundle
|
||||
fi
|
||||
|
|
|
@ -12,6 +12,6 @@ cmake .. -G Ninja \
|
|||
ninja
|
||||
ninja bundle
|
||||
|
||||
ccache -s
|
||||
ccache -s -v
|
||||
|
||||
ctest -VV -C Release || echo "::error ::Test error occurred on Windows build"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
name: citra-ci
|
||||
name: citra-build
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -8,30 +8,17 @@ on:
|
|||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
clang-format:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: citraemu/build-environments:linux-fresh
|
||||
options: -u 1001
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build
|
||||
env:
|
||||
COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
|
||||
run: ./.ci/clang-format.sh
|
||||
source:
|
||||
if: ${{ !github.head_ref }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Pack
|
||||
run: ./.ci/source.sh
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: source
|
||||
path: artifacts/
|
||||
|
@ -45,14 +32,16 @@ jobs:
|
|||
options: -u 1001
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
CCACHE_COMPILERCHECK: content
|
||||
CCACHE_SLOPPINESS: time_macros
|
||||
OS: linux
|
||||
TARGET: ${{ matrix.target }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Set up cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: ${{ runner.os }}-${{ matrix.target }}-${{ github.sha }}
|
||||
|
@ -64,62 +53,60 @@ jobs:
|
|||
run: ./.ci/pack.sh
|
||||
if: ${{ matrix.target == 'appimage' }}
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
if: ${{ matrix.target == 'appimage' }}
|
||||
with:
|
||||
name: ${{ env.OS }}-${{ env.TARGET }}
|
||||
path: artifacts/
|
||||
macos:
|
||||
runs-on: macos-latest
|
||||
runs-on: ${{ (matrix.target == 'x86_64' && 'macos-13') || 'macos-14' }}
|
||||
strategy:
|
||||
matrix:
|
||||
target: ["x86_64", "arm64"]
|
||||
env:
|
||||
CCACHE_CPP2: yes
|
||||
CCACHE_SLOPPINESS: time_macros
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
CCACHE_COMPILERCHECK: content
|
||||
CCACHE_SLOPPINESS: time_macros
|
||||
OS: macos
|
||||
TARGET: ${{ matrix.target }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Set up cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: ${{ runner.os }}-${{ matrix.target }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{ matrix.target }}-
|
||||
- name: Install tools
|
||||
run: brew install ccache glslang ninja
|
||||
run: brew install ccache ninja
|
||||
- name: Build
|
||||
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
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ${{ env.OS }}-${{ env.TARGET }}
|
||||
key: ${{ runner.os }}-${{ matrix.target }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
macos-universal:
|
||||
runs-on: macos-latest
|
||||
runs-on: macos-14
|
||||
needs: macos
|
||||
env:
|
||||
OS: macos
|
||||
TARGET: universal
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: actions/checkout@v4
|
||||
- name: Download x86_64 build from cache
|
||||
uses: actions/cache/restore@v3
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
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
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ env.OS }}-arm64
|
||||
key: ${{ runner.os }}-arm64-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
|
@ -130,11 +117,11 @@ jobs:
|
|||
ARTIFACTS: ${{ env.OS }}-x86_64 ${{ env.OS }}-arm64
|
||||
- name: Pack
|
||||
run: ./.ci/pack.sh
|
||||
# - name: Upload
|
||||
# uses: actions/upload-artifact@v3
|
||||
# with:
|
||||
# name: ${{ env.OS }}-${{ env.TARGET }}
|
||||
# path: artifacts/
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.OS }}-${{ env.TARGET }}
|
||||
path: artifacts/
|
||||
windows:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
|
@ -145,14 +132,16 @@ jobs:
|
|||
shell: ${{ (matrix.target == 'msys2' && 'msys2') || 'bash' }} {0}
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
CCACHE_COMPILERCHECK: content
|
||||
CCACHE_SLOPPINESS: time_macros
|
||||
OS: windows
|
||||
TARGET: ${{ matrix.target }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Set up cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: ${{ runner.os }}-${{ matrix.target }}-${{ github.sha }}
|
||||
|
@ -161,7 +150,7 @@ jobs:
|
|||
- name: Set up MSVC
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
if: ${{ matrix.target == 'msvc' }}
|
||||
- name: Install MSVC extra tools
|
||||
- name: Install extra tools (MSVC)
|
||||
run: choco install ccache ninja wget
|
||||
if: ${{ matrix.target == 'msvc' }}
|
||||
- name: Set up MSYS2
|
||||
|
@ -173,40 +162,37 @@ jobs:
|
|||
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:
|
||||
vulkan-query-version: latest
|
||||
vulkan-components: Glslang
|
||||
vulkan-use-cache: true
|
||||
- name: Test glslangValidator
|
||||
run: glslangValidator --version
|
||||
qt6-base:p qt6-multimedia:p qt6-multimedia-wmf:p qt6-tools:p qt6-translations:p
|
||||
- name: Disable line ending translation
|
||||
run: git config --global core.autocrlf input
|
||||
- name: Build
|
||||
run: ./.ci/windows.sh
|
||||
- name: Pack
|
||||
run: ./.ci/pack.sh
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.OS }}-${{ env.TARGET }}
|
||||
path: artifacts/
|
||||
android:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
CCACHE_COMPILERCHECK: content
|
||||
CCACHE_SLOPPINESS: time_macros
|
||||
OS: android
|
||||
TARGET: universal
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Set up cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
~/.ccache
|
||||
${{ env.CCACHE_DIR }}
|
||||
key: ${{ runner.os }}-android-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-android-
|
||||
|
@ -220,7 +206,7 @@ jobs:
|
|||
run: |
|
||||
sudo add-apt-repository -y ppa:theofficialgman/gpu-tools
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install ccache glslang-dev glslang-tools apksigner -y
|
||||
sudo apt-get install ccache apksigner -y
|
||||
- name: Build
|
||||
run: JAVA_HOME=$JAVA_HOME_17_X64 ./.ci/android.sh
|
||||
env:
|
||||
|
@ -231,31 +217,42 @@ jobs:
|
|||
run: ../../../.ci/pack.sh
|
||||
working-directory: src/android/app
|
||||
env:
|
||||
UPLOAD_RAW: 1
|
||||
UNPACKED: 1
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.OS }}-${{ env.TARGET }}
|
||||
path: src/android/app/artifacts/
|
||||
transifex:
|
||||
runs-on: ubuntu-latest
|
||||
container: citraemu/build-environments:linux-fresh
|
||||
if: ${{ github.repository == 'citra-emu/citra' && !github.head_ref }}
|
||||
ios:
|
||||
runs-on: macos-14
|
||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
CCACHE_COMPILERCHECK: content
|
||||
CCACHE_SLOPPINESS: time_macros
|
||||
OS: ios
|
||||
TARGET: arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
- name: Update Translation
|
||||
run: ./.ci/transifex.sh
|
||||
env:
|
||||
TX_TOKEN: ${{ secrets.TRANSIFEX_API_TOKEN }}
|
||||
- name: Set up cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: ${{ runner.os }}-ios-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-ios-
|
||||
- name: Install tools
|
||||
run: brew install ccache ninja
|
||||
- name: Build
|
||||
run: ./.ci/ios.sh
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [windows, linux, macos-universal, android, source]
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
steps:
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
- name: Create release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
8
.github/workflows/ci-merge.js
vendored
8
.github/workflows/ci-merge.js
vendored
|
@ -11,7 +11,7 @@ async function checkBaseChanges(github, context) {
|
|||
repository(name:$name, owner:$owner) {
|
||||
ref(qualifiedName:$ref) {
|
||||
target {
|
||||
... on Commit { id pushedDate oid }
|
||||
... on Commit { id committedDate oid }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,9 +22,9 @@ async function checkBaseChanges(github, context) {
|
|||
ref: 'refs/heads/master',
|
||||
};
|
||||
const result = await github.graphql(query, variables);
|
||||
const pushedAt = result.repository.ref.target.pushedDate;
|
||||
console.log(`Last commit pushed at ${pushedAt}.`);
|
||||
const delta = new Date() - new Date(pushedAt);
|
||||
const committedAt = result.repository.ref.target.committedDate;
|
||||
console.log(`Last commit committed at ${committedAt}.`);
|
||||
const delta = new Date() - new Date(committedAt);
|
||||
if (delta <= DETECTION_TIME_FRAME) {
|
||||
console.info('New changes detected, triggering a new build.');
|
||||
return true;
|
||||
|
|
22
.github/workflows/format.yml
vendored
Normal file
22
.github/workflows/format.yml
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
name: citra-format
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "*" ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
clang-format:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: citraemu/build-environments:linux-fresh
|
||||
options: -u 1001
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Build
|
||||
env:
|
||||
COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
|
||||
run: ./.ci/clang-format.sh
|
16
.github/workflows/publish.yml
vendored
16
.github/workflows/publish.yml
vendored
|
@ -20,11 +20,11 @@ jobs:
|
|||
if: ${{ github.event.inputs.nightly != 'false' && github.repository == 'citra-emu/citra' }}
|
||||
steps:
|
||||
# this checkout is required to make sure the GitHub Actions scripts are available
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
name: Pre-checkout
|
||||
with:
|
||||
submodules: false
|
||||
- uses: actions/github-script@v6
|
||||
- uses: actions/github-script@v7
|
||||
id: check-changes
|
||||
name: 'Check for new changes'
|
||||
env:
|
||||
|
@ -38,7 +38,7 @@ jobs:
|
|||
return checkBaseChanges(github, context);
|
||||
- run: npm install execa@5
|
||||
if: ${{ steps.check-changes.outputs.result == 'true' }}
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
name: Checkout
|
||||
if: ${{ steps.check-changes.outputs.result == 'true' }}
|
||||
with:
|
||||
|
@ -46,7 +46,7 @@ jobs:
|
|||
fetch-depth: 0
|
||||
submodules: true
|
||||
token: ${{ secrets.ALT_GITHUB_TOKEN }}
|
||||
- uses: actions/github-script@v6
|
||||
- uses: actions/github-script@v7
|
||||
name: 'Update and tag new commits'
|
||||
if: ${{ steps.check-changes.outputs.result == 'true' }}
|
||||
env:
|
||||
|
@ -62,11 +62,11 @@ jobs:
|
|||
if: ${{ github.event.inputs.canary != 'false' && github.repository == 'citra-emu/citra' }}
|
||||
steps:
|
||||
# this checkout is required to make sure the GitHub Actions scripts are available
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
name: Pre-checkout
|
||||
with:
|
||||
submodules: false
|
||||
- uses: actions/github-script@v6
|
||||
- uses: actions/github-script@v7
|
||||
id: check-changes
|
||||
name: 'Check for new changes'
|
||||
env:
|
||||
|
@ -79,7 +79,7 @@ jobs:
|
|||
return checkCanaryChanges(github, context);
|
||||
- run: npm install execa@5
|
||||
if: ${{ steps.check-changes.outputs.result == 'true' }}
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
name: Checkout
|
||||
if: ${{ steps.check-changes.outputs.result == 'true' }}
|
||||
with:
|
||||
|
@ -87,7 +87,7 @@ jobs:
|
|||
fetch-depth: 0
|
||||
submodules: true
|
||||
token: ${{ secrets.ALT_GITHUB_TOKEN }}
|
||||
- uses: actions/github-script@v6
|
||||
- uses: actions/github-script@v7
|
||||
name: 'Check and merge canary changes'
|
||||
if: ${{ steps.check-changes.outputs.result == 'true' }}
|
||||
env:
|
||||
|
|
20
.github/workflows/transifex.yml
vendored
Normal file
20
.github/workflows/transifex.yml
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
name: citra-transifex
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
transifex:
|
||||
runs-on: ubuntu-latest
|
||||
container: citraemu/build-environments:linux-fresh
|
||||
if: ${{ github.repository == 'citra-emu/citra' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
- name: Update Translation
|
||||
run: ./.ci/transifex.sh
|
||||
env:
|
||||
TX_TOKEN: ${{ secrets.TRANSIFEX_API_TOKEN }}
|
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -9,10 +9,14 @@ src/common/scm_rev.cpp
|
|||
|
||||
# Project/editor files
|
||||
*.swp
|
||||
*.kdev4
|
||||
.idea/
|
||||
.vs/
|
||||
.vscode/
|
||||
.cache/
|
||||
.kdev4/
|
||||
cmake-build-debug/
|
||||
cmake-build-release/
|
||||
CMakeLists.txt.user*
|
||||
|
||||
# *nix related
|
||||
|
@ -41,4 +45,6 @@ Thumbs.db
|
|||
repo/
|
||||
|
||||
# GitHub Actions generated files
|
||||
.ccache/
|
||||
node_modules/
|
||||
VULKAN_SDK/
|
||||
|
|
13
.gitmodules
vendored
13
.gitmodules
vendored
|
@ -36,7 +36,7 @@
|
|||
url = https://github.com/mozilla/cubeb
|
||||
[submodule "discord-rpc"]
|
||||
path = externals/discord-rpc
|
||||
url = https://github.com/discord/discord-rpc.git
|
||||
url = https://github.com/yuzu-emu/discord-rpc.git
|
||||
[submodule "cpp-jwt"]
|
||||
path = externals/cpp-jwt
|
||||
url = https://github.com/arun11299/cpp-jwt.git
|
||||
|
@ -79,6 +79,15 @@
|
|||
[submodule "sirit"]
|
||||
path = externals/sirit
|
||||
url = https://github.com/yuzu-emu/sirit
|
||||
[submodule "faad2"]
|
||||
path = externals/faad2/faad2
|
||||
url = https://github.com/knik0/faad2
|
||||
[submodule "library-headers"]
|
||||
path = externals/library-headers/library-headers
|
||||
path = externals/library-headers
|
||||
url = https://github.com/citra-emu/ext-library-headers.git
|
||||
[submodule "libadrenotools"]
|
||||
path = externals/libadrenotools
|
||||
url = https://github.com/bylaws/libadrenotools
|
||||
[submodule "oaknut"]
|
||||
path = externals/oaknut
|
||||
url = https://github.com/merryhime/oaknut.git
|
||||
|
|
13
.lgtm.yml
13
.lgtm.yml
|
@ -1,13 +0,0 @@
|
|||
path_classifiers:
|
||||
library: "externals"
|
||||
extraction:
|
||||
cpp:
|
||||
prepare:
|
||||
packages:
|
||||
- "libsdl2-dev"
|
||||
- "qtmultimedia5-dev"
|
||||
- "clang-format-6.0"
|
||||
- "libtbb-dev"
|
||||
- "libjack-jackd2-dev"
|
||||
- "doxygen"
|
||||
- "graphviz"
|
160
CMakeLists.txt
160
CMakeLists.txt
|
@ -5,6 +5,10 @@ cmake_minimum_required(VERSION 3.15)
|
|||
cmake_policy(SET CMP0092 NEW)
|
||||
# Enforce new LTO setting
|
||||
cmake_policy(SET CMP0069 NEW)
|
||||
# Honor visibility properties for all targets
|
||||
# Set the default so subdirectory cmake_minimum_required calls won't unset the policy.
|
||||
cmake_policy(SET CMP0063 NEW)
|
||||
set(CMAKE_POLICY_DEFAULT_CMP0063 NEW)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules")
|
||||
|
@ -13,17 +17,46 @@ include(CMakeDependentOption)
|
|||
|
||||
project(citra LANGUAGES C CXX ASM)
|
||||
|
||||
if (IOS)
|
||||
# Enable searching CMAKE_PREFIX_PATH for bundled dependencies.
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
|
||||
# Some submodules like to pick their own default build type if not specified.
|
||||
# Make sure we default to Release build type always, unless the generator has custom types.
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
# Silence warnings on empty objects, for example when platform-specific code is #ifdef'd out.
|
||||
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||
|
||||
if (IOS)
|
||||
# Minimum iOS 14
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "14.0")
|
||||
|
||||
# Enable searching CMAKE_PREFIX_PATH for bundled dependencies.
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)
|
||||
else()
|
||||
# Minimum macOS 11
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
set(IS_DEBUG_BUILD ON)
|
||||
set(IS_RELEASE_BUILD OFF)
|
||||
else()
|
||||
set(IS_DEBUG_BUILD OFF)
|
||||
set(IS_RELEASE_BUILD ON)
|
||||
endif()
|
||||
|
||||
# LTO takes too much memory and time using MSVC.
|
||||
if (NOT MSVC AND IS_RELEASE_BUILD)
|
||||
set(DEFAULT_ENABLE_LTO ON)
|
||||
else()
|
||||
set(DEFAULT_ENABLE_LTO OFF)
|
||||
endif()
|
||||
|
||||
option(ENABLE_SDL2 "Enable using SDL2" ON)
|
||||
|
@ -39,33 +72,35 @@ CMAKE_DEPENDENT_OPTION(ENABLE_TESTS "Enable generating tests executable" ON "NOT
|
|||
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)
|
||||
option(ENABLE_SCRIPTING "Enable RPC server for scripting" ON)
|
||||
|
||||
CMAKE_DEPENDENT_OPTION(ENABLE_CUBEB "Enables the cubeb audio backend" ON "NOT IOS" OFF)
|
||||
option(ENABLE_OPENAL "Enables the OpenAL audio backend" ON)
|
||||
|
||||
CMAKE_DEPENDENT_OPTION(ENABLE_LIBUSB "Enable libusb for GameCube Adapter support" ON "NOT IOS" OFF)
|
||||
|
||||
option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(ENABLE_SOFTWARE_RENDERER "Enables the software renderer" ON "NOT ANDROID" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(ENABLE_OPENGL "Enables the OpenGL renderer" ON "NOT APPLE" OFF)
|
||||
option(ENABLE_VULKAN "Enables the Vulkan renderer" 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)
|
||||
option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" 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(ENABLE_LTO "Enable link time optimization" ${DEFAULT_ENABLE_LTO})
|
||||
option(CITRA_USE_PRECOMPILED_HEADERS "Use precompiled headers" ON)
|
||||
option(CITRA_WARNINGS_AS_ERRORS "Enable warnings as errors" ON)
|
||||
|
||||
# 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)
|
||||
include(CitraHandleSystemLibs)
|
||||
|
||||
if (CITRA_USE_PRECOMPILED_HEADERS)
|
||||
message(STATUS "Using Precompiled Headers.")
|
||||
set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON)
|
||||
|
||||
# This ensures that pre-compiled headers won't invalidate build caches for every fresh checkout.
|
||||
if(NOT MSVC AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
list(APPEND CMAKE_CXX_COMPILE_OPTIONS_CREATE_PCH -Xclang -fno-pch-timestamp)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS ${PROJECT_SOURCE_DIR}/.git/hooks/pre-commit)
|
||||
|
@ -183,6 +218,10 @@ add_definitions(-DBOOST_NO_CXX98_FUNCTION_BASE)
|
|||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Apply consistent visibility settings.
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET default)
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN NO)
|
||||
|
||||
# set up output paths for executable binaries
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin/$<CONFIG>)
|
||||
|
||||
|
@ -196,7 +235,7 @@ find_package(Threads REQUIRED)
|
|||
|
||||
if (ENABLE_QT)
|
||||
if (NOT USE_SYSTEM_QT)
|
||||
download_qt(6.5.0)
|
||||
download_qt(6.6.0)
|
||||
endif()
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Widgets Multimedia Concurrent)
|
||||
|
@ -208,19 +247,26 @@ if (ENABLE_QT)
|
|||
if (ENABLE_QT_TRANSLATION)
|
||||
find_package(Qt6 REQUIRED COMPONENTS LinguistTools)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Ensure libusb is properly configured (based on dolphin libusb include)
|
||||
if (ENABLE_LIBUSB)
|
||||
if(NOT APPLE)
|
||||
include(FindPkgConfig)
|
||||
find_package(LibUSB)
|
||||
if (NOT DEFINED QT_TARGET_PATH)
|
||||
# Determine the location of the compile target's Qt.
|
||||
get_target_property(qtcore_path Qt6::Core LOCATION_Release)
|
||||
string(FIND "${qtcore_path}" "/bin/" qtcore_path_bin_pos REVERSE)
|
||||
string(FIND "${qtcore_path}" "/lib/" qtcore_path_lib_pos REVERSE)
|
||||
if (qtcore_path_bin_pos GREATER qtcore_path_lib_pos)
|
||||
string(SUBSTRING "${qtcore_path}" 0 ${qtcore_path_bin_pos} QT_TARGET_PATH)
|
||||
else()
|
||||
string(SUBSTRING "${qtcore_path}" 0 ${qtcore_path_lib_pos} QT_TARGET_PATH)
|
||||
endif()
|
||||
endif()
|
||||
if (NOT LIBUSB_FOUND)
|
||||
add_subdirectory(externals/libusb)
|
||||
set(LIBUSB_INCLUDE_DIR "")
|
||||
set(LIBUSB_LIBRARIES usb)
|
||||
|
||||
if (NOT DEFINED QT_HOST_PATH)
|
||||
# Use the same for host Qt if none is defined.
|
||||
set(QT_HOST_PATH "${QT_TARGET_PATH}")
|
||||
endif()
|
||||
|
||||
message(STATUS "Using target Qt at ${QT_TARGET_PATH}")
|
||||
message(STATUS "Using host Qt at ${QT_HOST_PATH}")
|
||||
endif()
|
||||
|
||||
# Use system tsl::robin_map if available (otherwise we fallback to version bundled with dynarmic)
|
||||
|
@ -230,20 +276,22 @@ find_package(tsl-robin-map QUIET)
|
|||
# ======================================
|
||||
|
||||
if (APPLE)
|
||||
if (NOT USE_SYSTEM_MOLTENVK)
|
||||
download_moltenvk()
|
||||
endif()
|
||||
find_library(MOLTENVK_LIBRARY MoltenVK REQUIRED)
|
||||
message(STATUS "Using MoltenVK at ${MOLTENVK_LIBRARY}.")
|
||||
|
||||
if (NOT IOS)
|
||||
# Umbrella framework for everything GUI-related
|
||||
find_library(COCOA_LIBRARY Cocoa REQUIRED)
|
||||
endif()
|
||||
|
||||
find_library(AVFOUNDATION_LIBRARY AVFoundation REQUIRED)
|
||||
find_library(IOSURFACE_LIBRARY IOSurface REQUIRED)
|
||||
set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${AVFOUNDATION_LIBRARY} ${IOSURFACE_LIBRARY} ${MOLTENVK_LIBRARY})
|
||||
|
||||
if (ENABLE_VULKAN)
|
||||
if (NOT USE_SYSTEM_MOLTENVK)
|
||||
download_moltenvk()
|
||||
endif()
|
||||
find_library(MOLTENVK_LIBRARY MoltenVK REQUIRED)
|
||||
message(STATUS "Using MoltenVK at ${MOLTENVK_LIBRARY}.")
|
||||
set(PLATFORM_LIBRARIES ${PLATFORM_LIBRARIES} ${MOLTENVK_LIBRARY})
|
||||
endif()
|
||||
elseif (WIN32)
|
||||
set(PLATFORM_LIBRARIES winmm ws2_32)
|
||||
if (MINGW)
|
||||
|
@ -258,7 +306,7 @@ endif()
|
|||
# against all the src files. This should be used before making a pull request.
|
||||
# =======================================================================
|
||||
|
||||
set(CLANG_FORMAT_POSTFIX "-12")
|
||||
set(CLANG_FORMAT_POSTFIX "-15")
|
||||
find_program(CLANG_FORMAT
|
||||
NAMES clang-format${CLANG_FORMAT_POSTFIX}
|
||||
clang-format
|
||||
|
@ -331,13 +379,6 @@ function(get_timestamp _var)
|
|||
set(${_var} "${timestamp}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Prevent boost from linking against libs when building
|
||||
add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY
|
||||
-DBOOST_SYSTEM_NO_LIB
|
||||
-DBOOST_DATE_TIME_NO_LIB
|
||||
-DBOOST_REGEX_NO_LIB
|
||||
)
|
||||
|
||||
# generate git/build information
|
||||
include(GetGitRevisionDescription)
|
||||
get_git_head_revision(GIT_REF_SPEC GIT_REV)
|
||||
|
@ -345,22 +386,23 @@ git_describe(GIT_DESC --always --long --dirty)
|
|||
git_branch_name(GIT_BRANCH)
|
||||
get_timestamp(BUILD_DATE)
|
||||
|
||||
if (NOT USE_SYSTEM_BOOST)
|
||||
add_definitions( -DBOOST_ALL_NO_LIB )
|
||||
# Boost
|
||||
# Prevent boost from linking against libs when building
|
||||
add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY
|
||||
-DBOOST_SYSTEM_NO_LIB
|
||||
-DBOOST_DATE_TIME_NO_LIB
|
||||
-DBOOST_REGEX_NO_LIB
|
||||
)
|
||||
if (USE_SYSTEM_BOOST)
|
||||
find_package(Boost 1.70.0 COMPONENTS container locale serialization iostreams REQUIRED)
|
||||
endif()
|
||||
|
||||
enable_testing()
|
||||
add_subdirectory(externals)
|
||||
|
||||
# See externals/CMakeLists.txt
|
||||
foreach(def ${CRYPTOPP_COMPILE_DEFINITIONS})
|
||||
add_definitions(-D${def})
|
||||
endforeach()
|
||||
|
||||
# Boost
|
||||
if (USE_SYSTEM_BOOST)
|
||||
find_package(Boost 1.70.0 COMPONENTS serialization iostreams REQUIRED)
|
||||
else()
|
||||
# Boost (bundled)
|
||||
if (NOT USE_SYSTEM_BOOST)
|
||||
add_definitions( -DBOOST_ALL_NO_LIB )
|
||||
add_library(Boost::boost ALIAS boost)
|
||||
add_library(Boost::serialization ALIAS boost_serialization)
|
||||
add_library(Boost::iostreams ALIAS boost_iostreams)
|
||||
|
@ -375,6 +417,19 @@ if (ENABLE_SDL2 AND USE_SYSTEM_SDL2)
|
|||
add_library(SDL2::SDL2 ALIAS SDL2)
|
||||
endif()
|
||||
|
||||
if (ENABLE_LIBUSB AND USE_SYSTEM_LIBUSB)
|
||||
include(FindPkgConfig)
|
||||
find_package(LibUSB)
|
||||
endif()
|
||||
|
||||
if (USE_SYSTEM_SOUNDTOUCH)
|
||||
include(FindPkgConfig)
|
||||
find_package(SoundTouch REQUIRED)
|
||||
add_library(SoundTouch INTERFACE)
|
||||
target_link_libraries(SoundTouch INTERFACE "${SOUNDTOUCH_LIBRARIES}")
|
||||
target_include_directories(SoundTouch INTERFACE "${SOUNDTOUCH_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(dist/installer)
|
||||
|
||||
|
@ -387,6 +442,7 @@ else()
|
|||
endif()
|
||||
|
||||
# Create target for outputting distributable bundles.
|
||||
# Not supported for mobile platforms as distributables are built differently.
|
||||
if (NOT ANDROID AND NOT IOS)
|
||||
include(BundleTarget)
|
||||
if (ENABLE_SDL2_FRONTEND)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# To use this as a script, make sure you pass in the variables BASE_DIR, SRC_DIR, BUILD_DIR, and TARGET_FILE
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
if(WIN32)
|
||||
set(PLATFORM "windows")
|
||||
|
@ -12,7 +13,8 @@ endif()
|
|||
|
||||
list(APPEND CMAKE_MODULE_PATH "${BASE_DIR}/CMakeModules")
|
||||
include(DownloadExternals)
|
||||
download_qt(tools_ifw QT_PREFIX)
|
||||
download_qt(tools_ifw)
|
||||
get_external_prefix(qt QT_PREFIX)
|
||||
|
||||
file(GLOB_RECURSE INSTALLER_BASE "${QT_PREFIX}/**/installerbase*")
|
||||
file(GLOB_RECURSE BINARY_CREATOR "${QT_PREFIX}/**/binarycreator*")
|
||||
|
|
|
@ -2,37 +2,104 @@
|
|||
if (BUNDLE_TARGET_EXECUTE)
|
||||
# --- Bundling method logic ---
|
||||
|
||||
function(symlink_safe_copy from to)
|
||||
if (WIN32)
|
||||
# Use cmake copy for maximum compatibility.
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${from}" "${to}"
|
||||
RESULT_VARIABLE cp_result)
|
||||
else()
|
||||
# Use native copy to turn symlinks into normal files.
|
||||
execute_process(COMMAND cp -L "${from}" "${to}"
|
||||
RESULT_VARIABLE cp_result)
|
||||
endif()
|
||||
if (NOT cp_result EQUAL "0")
|
||||
message(FATAL_ERROR "cp \"${from}\" \"${to}\" failed: ${cp_result}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(bundle_qt executable_path)
|
||||
if (WIN32)
|
||||
# Perform standalone bundling first to copy over all used libraries, as windeployqt does not do this.
|
||||
bundle_standalone("${executable_path}" "${EXECUTABLE_PATH}" "${BUNDLE_LIBRARY_PATHS}")
|
||||
|
||||
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 = .")
|
||||
file(WRITE "${executable_parent_dir}/qt.conf" "[Paths]\nPrefix = .")
|
||||
|
||||
find_program(windeployqt_executable windeployqt6 PATHS "${QT_HOST_PATH}/bin")
|
||||
find_program(qtpaths_executable qtpaths6 PATHS "${QT_HOST_PATH}/bin")
|
||||
|
||||
# TODO: Hack around windeployqt's poor cross-compilation support by
|
||||
# TODO: making a local copy with a prefix pointing to the target Qt.
|
||||
if (NOT "${QT_HOST_PATH}" STREQUAL "${QT_TARGET_PATH}")
|
||||
set(windeployqt_dir "${BINARY_PATH}/windeployqt_copy")
|
||||
file(MAKE_DIRECTORY "${windeployqt_dir}")
|
||||
symlink_safe_copy("${windeployqt_executable}" "${windeployqt_dir}/windeployqt.exe")
|
||||
symlink_safe_copy("${qtpaths_executable}" "${windeployqt_dir}/qtpaths.exe")
|
||||
symlink_safe_copy("${QT_HOST_PATH}/bin/Qt6Core.dll" "${windeployqt_dir}")
|
||||
|
||||
if (EXISTS "${QT_TARGET_PATH}/share")
|
||||
# Unix-style Qt; we need to wire up the paths manually.
|
||||
file(WRITE "${windeployqt_dir}/qt.conf" "\
|
||||
[Paths]\n
|
||||
Prefix = ${QT_TARGET_PATH}\n \
|
||||
ArchData = ${QT_TARGET_PATH}/share/qt6\n \
|
||||
Binaries = ${QT_TARGET_PATH}/bin\n \
|
||||
Data = ${QT_TARGET_PATH}/share/qt6\n \
|
||||
Documentation = ${QT_TARGET_PATH}/share/qt6/doc\n \
|
||||
Headers = ${QT_TARGET_PATH}/include/qt6\n \
|
||||
Libraries = ${QT_TARGET_PATH}/lib\n \
|
||||
LibraryExecutables = ${QT_TARGET_PATH}/share/qt6/bin\n \
|
||||
Plugins = ${QT_TARGET_PATH}/share/qt6/plugins\n \
|
||||
QmlImports = ${QT_TARGET_PATH}/share/qt6/qml\n \
|
||||
Translations = ${QT_TARGET_PATH}/share/qt6/translations\n \
|
||||
")
|
||||
else()
|
||||
# Windows-style Qt; the defaults should suffice.
|
||||
file(WRITE "${windeployqt_dir}/qt.conf" "[Paths]\nPrefix = ${QT_TARGET_PATH}")
|
||||
endif()
|
||||
|
||||
set(windeployqt_executable "${windeployqt_dir}/windeployqt.exe")
|
||||
set(qtpaths_executable "${windeployqt_dir}/qtpaths.exe")
|
||||
endif()
|
||||
|
||||
message(STATUS "Executing windeployqt for executable ${executable_path}")
|
||||
execute_process(COMMAND "${windeployqt_executable}" "${executable_path}"
|
||||
--qtpaths "${qtpaths_executable}"
|
||||
--no-compiler-runtime --no-system-d3d-compiler --no-opengl-sw --no-translations
|
||||
--plugindir "${executable_parent_dir}/plugins")
|
||||
--plugindir "${executable_parent_dir}/plugins"
|
||||
RESULT_VARIABLE windeployqt_result)
|
||||
if (NOT windeployqt_result EQUAL "0")
|
||||
message(FATAL_ERROR "windeployqt failed: ${windeployqt_result}")
|
||||
endif()
|
||||
|
||||
# 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)
|
||||
find_program(macdeployqt_executable macdeployqt6 PATHS "${QT_HOST_PATH}/bin")
|
||||
|
||||
message(STATUS "Executing macdeployqt for executable ${executable_path}")
|
||||
message(STATUS "Executing macdeployqt at \"${macdeployqt_executable}\" for executable \"${executable_path}\"")
|
||||
execute_process(
|
||||
COMMAND "${MACDEPLOYQT_EXECUTABLE}"
|
||||
COMMAND "${macdeployqt_executable}"
|
||||
"${executable_path}"
|
||||
"-executable=${executable_path}/Contents/MacOS/${executable_name}"
|
||||
-always-overwrite)
|
||||
-always-overwrite
|
||||
RESULT_VARIABLE macdeployqt_result)
|
||||
if (NOT macdeployqt_result EQUAL "0")
|
||||
message(FATAL_ERROR "macdeployqt failed: ${macdeployqt_result}")
|
||||
endif()
|
||||
|
||||
# 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}")
|
||||
execute_process(COMMAND codesign --deep -fs - "${executable_path}"
|
||||
RESULT_VARIABLE codesign_result)
|
||||
if (NOT codesign_result EQUAL "0")
|
||||
message(FATAL_ERROR "codesign failed: ${codesign_result}")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported OS for Qt bundling.")
|
||||
endif()
|
||||
|
@ -44,9 +111,9 @@ if (BUNDLE_TARGET_EXECUTE)
|
|||
|
||||
if (enable_qt)
|
||||
# Find qmake to make sure the plugin uses the right version of Qt.
|
||||
find_program(QMAKE_EXECUTABLE qmake6)
|
||||
find_program(qmake_executable qmake6 PATHS "${QT_HOST_PATH}/bin")
|
||||
|
||||
set(extra_linuxdeploy_env "QMAKE=${QMAKE_EXECUTABLE}")
|
||||
set(extra_linuxdeploy_env "QMAKE=${qmake_executable}")
|
||||
set(extra_linuxdeploy_args --plugin qt)
|
||||
endif()
|
||||
|
||||
|
@ -59,7 +126,11 @@ if (BUNDLE_TARGET_EXECUTE)
|
|||
--executable "${executable_path}"
|
||||
--icon-file "${source_path}/dist/citra.svg"
|
||||
--desktop-file "${source_path}/dist/${executable_name}.desktop"
|
||||
--appdir "${appdir_path}")
|
||||
--appdir "${appdir_path}"
|
||||
RESULT_VARIABLE linuxdeploy_appdir_result)
|
||||
if (NOT linuxdeploy_appdir_result EQUAL "0")
|
||||
message(FATAL_ERROR "linuxdeploy failed to create AppDir: ${linuxdeploy_appdir_result}")
|
||||
endif()
|
||||
|
||||
if (enable_qt)
|
||||
set(qt_hook_file "${appdir_path}/apprun-hooks/linuxdeploy-plugin-qt-hook.sh")
|
||||
|
@ -82,7 +153,11 @@ if (BUNDLE_TARGET_EXECUTE)
|
|||
"OUTPUT=${bundle_dir}/${executable_name}.AppImage"
|
||||
"${linuxdeploy_executable}"
|
||||
--output appimage
|
||||
--appdir "${appdir_path}")
|
||||
--appdir "${appdir_path}"
|
||||
RESULT_VARIABLE linuxdeploy_appimage_result)
|
||||
if (NOT linuxdeploy_appimage_result EQUAL "0")
|
||||
message(FATAL_ERROR "linuxdeploy failed to create AppImage: ${linuxdeploy_appimage_result}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(bundle_standalone executable_path original_executable_path bundle_library_paths)
|
||||
|
@ -109,43 +184,56 @@ if (BUNDLE_TARGET_EXECUTE)
|
|||
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}")
|
||||
symlink_safe_copy("${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}")
|
||||
execute_process(COMMAND install_name_tool -add_rpath "@loader_path/libs" "${executable_path}"
|
||||
RESULT_VARIABLE install_name_tool_result)
|
||||
if (NOT install_name_tool_result EQUAL "0")
|
||||
message(FATAL_ERROR "install_name_tool failed: ${install_name_tool_result}")
|
||||
endif()
|
||||
elseif (UNIX)
|
||||
execute_process(COMMAND patchelf --set-rpath '$ORIGIN/../libs' "${executable_path}")
|
||||
execute_process(COMMAND patchelf --set-rpath '$ORIGIN/../libs' "${executable_path}"
|
||||
RESULT_VARIABLE patchelf_result)
|
||||
if (NOT patchelf_result EQUAL "0")
|
||||
message(FATAL_ERROR "patchelf failed: ${patchelf_result}")
|
||||
endif()
|
||||
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)
|
||||
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
|
||||
if (IN_PLACE)
|
||||
message(FATAL_ERROR "Cannot bundle for Linux in-place.")
|
||||
endif()
|
||||
|
||||
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 (IN_PLACE)
|
||||
message(STATUS "Bundling dependencies in-place")
|
||||
set(bundled_executable_path "${EXECUTABLE_PATH}")
|
||||
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}")
|
||||
endif()
|
||||
|
||||
if (BUNDLE_QT)
|
||||
bundle_qt("${bundled_executable_path}")
|
||||
endif()
|
||||
|
||||
if (WIN32 OR NOT BUNDLE_QT)
|
||||
else()
|
||||
bundle_standalone("${bundled_executable_path}" "${EXECUTABLE_PATH}" "${BUNDLE_LIBRARY_PATHS}")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# --- Bundling target creation logic ---
|
||||
elseif (BUNDLE_TARGET_DOWNLOAD_LINUXDEPLOY)
|
||||
# --- linuxdeploy download logic ---
|
||||
|
||||
# Downloads and extracts a linuxdeploy component.
|
||||
function(download_linuxdeploy_component base_dir name executable_name)
|
||||
|
@ -153,7 +241,7 @@ else()
|
|||
if (NOT EXISTS "${executable_file}")
|
||||
message(STATUS "Downloading ${executable_name}")
|
||||
file(DOWNLOAD
|
||||
"https://github.com/linuxdeploy/${name}/releases/download/continuous/${executable_name}"
|
||||
"https://github.com/${name}/releases/download/continuous/${executable_name}"
|
||||
"${executable_file}" SHOW_PROGRESS)
|
||||
file(CHMOD "${executable_file}" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
|
||||
|
||||
|
@ -162,7 +250,11 @@ else()
|
|||
message(STATUS "Extracting ${executable_name}")
|
||||
execute_process(
|
||||
COMMAND "${executable_file}" --appimage-extract
|
||||
WORKING_DIRECTORY "${base_dir}")
|
||||
WORKING_DIRECTORY "${base_dir}"
|
||||
RESULT_VARIABLE extract_result)
|
||||
if (NOT extract_result EQUAL "0")
|
||||
message(FATAL_ERROR "AppImage extract failed: ${extract_result}")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Copying ${executable_name}")
|
||||
file(COPY "${executable_file}" DESTINATION "${base_dir}/squashfs-root/usr/bin/")
|
||||
|
@ -170,74 +262,113 @@ else()
|
|||
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")
|
||||
# Download plugins first so they don't overwrite linuxdeploy's AppRun file.
|
||||
download_linuxdeploy_component("${LINUXDEPLOY_PATH}" "linuxdeploy/linuxdeploy-plugin-qt" "linuxdeploy-plugin-qt-${LINUXDEPLOY_ARCH}.AppImage")
|
||||
download_linuxdeploy_component("${LINUXDEPLOY_PATH}" "darealshinji/linuxdeploy-plugin-checkrt" "linuxdeploy-plugin-checkrt.sh")
|
||||
download_linuxdeploy_component("${LINUXDEPLOY_PATH}" "linuxdeploy/linuxdeploy" "linuxdeploy-${LINUXDEPLOY_ARCH}.AppImage")
|
||||
else()
|
||||
# --- Bundling target creation logic ---
|
||||
|
||||
add_custom_target(bundle)
|
||||
# Creates the base bundle target with common files and pre-bundle steps.
|
||||
function(create_base_bundle_target)
|
||||
message(STATUS "Creating base bundle target")
|
||||
|
||||
add_custom_target(bundle)
|
||||
add_custom_command(
|
||||
TARGET bundle
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bundle/")
|
||||
add_custom_command(
|
||||
TARGET bundle
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bundle/dist/")
|
||||
add_custom_command(
|
||||
TARGET bundle
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/dist/icon.png" "${CMAKE_BINARY_DIR}/bundle/dist/citra.png")
|
||||
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")
|
||||
|
||||
# On Linux, add a command to prepare linuxdeploy and any required plugins before any bundling occurs.
|
||||
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
|
||||
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")
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DBUNDLE_TARGET_DOWNLOAD_LINUXDEPLOY=1"
|
||||
"-DLINUXDEPLOY_PATH=${CMAKE_BINARY_DIR}/externals/linuxdeploy"
|
||||
"-DLINUXDEPLOY_ARCH=${CMAKE_HOST_SYSTEM_PROCESSOR}"
|
||||
-P "${CMAKE_SOURCE_DIR}/CMakeModules/BundleTarget.cmake"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Adds a target to the bundle target, packing in required libraries.
|
||||
# If in_place is true, the bundling will be done in-place as part of the specified target.
|
||||
function(bundle_target_internal target_name in_place)
|
||||
# Create base bundle target if it does not exist.
|
||||
if (NOT in_place AND NOT TARGET bundle)
|
||||
create_base_bundle_target()
|
||||
endif()
|
||||
|
||||
set(BUNDLE_EXECUTABLE_PATH "$<TARGET_FILE:${target_name}>")
|
||||
set(bundle_executable_path "$<TARGET_FILE:${target_name}>")
|
||||
if (target_name MATCHES ".*qt")
|
||||
set(BUNDLE_QT ON)
|
||||
set(bundle_qt ON)
|
||||
if (APPLE)
|
||||
# For Qt targets on Apple, expect an app bundle.
|
||||
set(BUNDLE_EXECUTABLE_PATH "$<TARGET_BUNDLE_DIR:${target_name}>")
|
||||
set(bundle_executable_path "$<TARGET_BUNDLE_DIR:${target_name}>")
|
||||
endif()
|
||||
else()
|
||||
set(BUNDLE_QT OFF)
|
||||
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)
|
||||
foreach(prefix_path IN LISTS CMAKE_FIND_ROOT_PATH CMAKE_PREFIX_PATH CMAKE_SYSTEM_PREFIX_PATH)
|
||||
if (WIN32)
|
||||
list(APPEND BUNDLE_LIBRARY_PATHS "${prefix_path}/bin")
|
||||
list(APPEND bundle_library_paths "${prefix_path}/bin")
|
||||
endif()
|
||||
list(APPEND BUNDLE_LIBRARY_PATHS "${prefix_path}/lib")
|
||||
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}")
|
||||
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")
|
||||
if (in_place)
|
||||
message(STATUS "Adding in-place bundling to ${target_name}")
|
||||
set(dest_target ${target_name})
|
||||
else()
|
||||
message(STATUS "Adding ${target_name} to bundle target")
|
||||
set(dest_target bundle)
|
||||
add_dependencies(bundle ${target_name})
|
||||
endif()
|
||||
|
||||
message(STATUS "Adding ${target_name} to bundle target")
|
||||
|
||||
add_custom_target(bundle-${target_name}
|
||||
add_custom_command(TARGET ${dest_target} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
"-DCMAKE_PREFIX_PATH=\"${CMAKE_PREFIX_PATH}\""
|
||||
"-DQT_HOST_PATH=\"${QT_HOST_PATH}\""
|
||||
"-DQT_TARGET_PATH=\"${QT_TARGET_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}
|
||||
"-DEXECUTABLE_PATH=${bundle_executable_path}"
|
||||
"-DBUNDLE_LIBRARY_PATHS=\"${bundle_library_paths}\""
|
||||
"-DBUNDLE_QT=${bundle_qt}"
|
||||
"-DIN_PLACE=${in_place}"
|
||||
"-DLINUXDEPLOY=${CMAKE_BINARY_DIR}/externals/linuxdeploy/squashfs-root/AppRun"
|
||||
-P "${CMAKE_SOURCE_DIR}/CMakeModules/BundleTarget.cmake"
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
|
||||
DEPENDS ${target_name})
|
||||
add_dependencies(bundle bundle-${target_name})
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
|
||||
endfunction()
|
||||
|
||||
# Adds a target to the bundle target, packing in required libraries.
|
||||
function(bundle_target target_name)
|
||||
bundle_target_internal("${target_name}" OFF)
|
||||
endfunction()
|
||||
|
||||
# Bundles the target in-place, packing in required libraries.
|
||||
function(bundle_target_in_place target_name)
|
||||
bundle_target_internal("${target_name}" ON)
|
||||
endfunction()
|
||||
endif()
|
||||
|
|
|
@ -1,39 +1,61 @@
|
|||
|
||||
# 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 target)
|
||||
set(CURRENT_MODULE_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
# Determines parameters based on the host and target for downloading the right Qt binaries.
|
||||
function(determine_qt_parameters target host_out type_out arch_out arch_path_out host_type_out host_arch_out host_arch_path_out)
|
||||
if (target MATCHES "tools_.*")
|
||||
set(tool ON)
|
||||
else()
|
||||
set(tool OFF)
|
||||
endif()
|
||||
|
||||
# Determine installation parameters for OS, architecture, and compiler
|
||||
if (WIN32)
|
||||
set(host "windows")
|
||||
set(type "desktop")
|
||||
if (MINGW)
|
||||
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")
|
||||
|
||||
if (NOT tool)
|
||||
if (MINGW)
|
||||
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. Enable USE_SYSTEM_QT and provide your own.")
|
||||
endif()
|
||||
set(arch "win64_${arch_path}")
|
||||
|
||||
# In case we're cross-compiling, prepare to also fetch the correct host Qt tools.
|
||||
if (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64")
|
||||
set(host_arch_path "msvc2019_64")
|
||||
elseif (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "ARM64")
|
||||
# TODO: msvc2019_arm64 doesn't include some of the required tools for some reason,
|
||||
# TODO: so until it does, just use msvc2019_64 under x86_64 emulation.
|
||||
# set(host_arch_path "msvc2019_arm64")
|
||||
set(host_arch_path "msvc2019_64")
|
||||
endif()
|
||||
set(host_arch "win64_${host_arch_path}")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported bundled Qt architecture. Enable USE_SYSTEM_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}")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported bundled Qt toolchain. Enable USE_SYSTEM_QT and provide your own.")
|
||||
endif()
|
||||
elseif (APPLE)
|
||||
set(host "mac")
|
||||
if (IOS)
|
||||
set(type "desktop")
|
||||
set(arch "clang_64")
|
||||
set(arch_path "macos")
|
||||
|
||||
if (IOS AND NOT tool)
|
||||
set(host_type "${type}")
|
||||
set(host_arch "${arch}")
|
||||
set(host_arch_path "${arch_path}")
|
||||
|
||||
set(type "ios")
|
||||
set(arch "ios")
|
||||
set(arch_path "ios")
|
||||
set(host_arch_path "macos")
|
||||
else()
|
||||
set(type "desktop")
|
||||
set(arch "clang_64")
|
||||
set(arch_path "macos")
|
||||
endif()
|
||||
else()
|
||||
set(host "linux")
|
||||
|
@ -42,28 +64,65 @@ function(download_qt target)
|
|||
set(arch_path "linux")
|
||||
endif()
|
||||
|
||||
get_external_prefix(qt base_path)
|
||||
file(MAKE_DIRECTORY "${base_path}")
|
||||
set(${host_out} "${host}" PARENT_SCOPE)
|
||||
set(${type_out} "${type}" PARENT_SCOPE)
|
||||
set(${arch_out} "${arch}" PARENT_SCOPE)
|
||||
set(${arch_path_out} "${arch_path}" PARENT_SCOPE)
|
||||
if (DEFINED host_type)
|
||||
set(${host_type_out} "${host_type}" PARENT_SCOPE)
|
||||
else()
|
||||
set(${host_type_out} "${type}" PARENT_SCOPE)
|
||||
endif()
|
||||
if (DEFINED host_arch)
|
||||
set(${host_arch_out} "${host_arch}" PARENT_SCOPE)
|
||||
else()
|
||||
set(${host_arch_out} "${arch}" PARENT_SCOPE)
|
||||
endif()
|
||||
if (DEFINED host_arch_path)
|
||||
set(${host_arch_path_out} "${host_arch_path}" PARENT_SCOPE)
|
||||
else()
|
||||
set(${host_arch_path_out} "${arch_path}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# Download Qt binaries for a specifc configuration.
|
||||
function(download_qt_configuration prefix_out target host type arch arch_path base_path)
|
||||
if (target MATCHES "tools_.*")
|
||||
set(prefix "${base_path}")
|
||||
set(install_args install-tool --outputdir ${base_path} ${host} desktop ${target})
|
||||
set(tool ON)
|
||||
else()
|
||||
set(tool OFF)
|
||||
endif()
|
||||
|
||||
set(install_args -c "${CURRENT_MODULE_DIR}/aqt_config.ini")
|
||||
if (tool)
|
||||
set(prefix "${base_path}/Tools")
|
||||
set(install_args ${install_args} install-tool --outputdir ${base_path} ${host} desktop ${target})
|
||||
else()
|
||||
set(prefix "${base_path}/${target}/${arch_path}")
|
||||
if (host_arch_path)
|
||||
set(host_flag "--autodesktop")
|
||||
set(host_prefix "${base_path}/${target}/${host_arch_path}")
|
||||
endif()
|
||||
set(install_args install-qt --outputdir ${base_path} ${host} ${type} ${target} ${arch} ${host_flag} -m qtmultimedia)
|
||||
set(install_args ${install_args} install-qt --outputdir ${base_path} ${host} ${type} ${target} ${arch}
|
||||
-m qtmultimedia --archives qttranslations qttools qtsvg qtbase)
|
||||
endif()
|
||||
|
||||
if (NOT EXISTS "${prefix}")
|
||||
message(STATUS "Downloading binaries for Qt...")
|
||||
message(STATUS "Downloading Qt binaries for ${target}:${host}:${type}:${arch}:${arch_path}")
|
||||
set(AQT_PREBUILD_BASE_URL "https://github.com/miurahr/aqtinstall/releases/download/v3.1.9")
|
||||
if (WIN32)
|
||||
set(aqt_path "${base_path}/aqt.exe")
|
||||
file(DOWNLOAD
|
||||
https://github.com/miurahr/aqtinstall/releases/download/v3.1.4/aqt.exe
|
||||
${aqt_path} SHOW_PROGRESS)
|
||||
if (NOT EXISTS "${aqt_path}")
|
||||
file(DOWNLOAD
|
||||
${AQT_PREBUILD_BASE_URL}/aqt.exe
|
||||
${aqt_path} SHOW_PROGRESS)
|
||||
endif()
|
||||
execute_process(COMMAND ${aqt_path} ${install_args}
|
||||
WORKING_DIRECTORY ${base_path})
|
||||
elseif (APPLE)
|
||||
set(aqt_path "${base_path}/aqt-macos")
|
||||
if (NOT EXISTS "${aqt_path}")
|
||||
file(DOWNLOAD
|
||||
${AQT_PREBUILD_BASE_URL}/aqt-macos
|
||||
${aqt_path} SHOW_PROGRESS)
|
||||
endif()
|
||||
execute_process(COMMAND chmod +x ${aqt_path})
|
||||
execute_process(COMMAND ${aqt_path} ${install_args}
|
||||
WORKING_DIRECTORY ${base_path})
|
||||
else()
|
||||
|
@ -76,18 +135,38 @@ function(download_qt target)
|
|||
execute_process(COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${aqt_install_path} python3 -m aqt ${install_args}
|
||||
WORKING_DIRECTORY ${base_path})
|
||||
endif()
|
||||
|
||||
message(STATUS "Downloaded Qt binaries for ${target}:${host}:${type}:${arch}:${arch_path} to ${prefix}")
|
||||
endif()
|
||||
|
||||
message(STATUS "Using downloaded Qt binaries at ${prefix}")
|
||||
set(${prefix_out} "${prefix}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Add the Qt prefix path so CMake can locate it.
|
||||
# This function downloads Qt using aqt.
|
||||
# The path of the downloaded content will be added to the CMAKE_PREFIX_PATH.
|
||||
# QT_TARGET_PATH is set to the Qt for the compile target platform.
|
||||
# QT_HOST_PATH is set to a host-compatible Qt, for running tools.
|
||||
# Params:
|
||||
# target: Qt dependency to install. Specify a version number to download Qt, or "tools_(name)" for a specific build tool.
|
||||
function(download_qt target)
|
||||
determine_qt_parameters("${target}" host type arch arch_path host_type host_arch host_arch_path)
|
||||
|
||||
get_external_prefix(qt base_path)
|
||||
file(MAKE_DIRECTORY "${base_path}")
|
||||
|
||||
download_qt_configuration(prefix "${target}" "${host}" "${type}" "${arch}" "${arch_path}" "${base_path}")
|
||||
if (DEFINED host_arch_path AND NOT "${host_arch_path}" STREQUAL "${arch_path}")
|
||||
download_qt_configuration(host_prefix "${target}" "${host}" "${host_type}" "${host_arch}" "${host_arch_path}" "${base_path}")
|
||||
else()
|
||||
set(host_prefix "${prefix}")
|
||||
endif()
|
||||
|
||||
set(QT_TARGET_PATH "${prefix}" CACHE STRING "")
|
||||
set(QT_HOST_PATH "${host_prefix}" CACHE STRING "")
|
||||
|
||||
# Add the target Qt prefix path so CMake can locate it.
|
||||
list(APPEND CMAKE_PREFIX_PATH "${prefix}")
|
||||
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE)
|
||||
|
||||
if (DEFINED host_prefix)
|
||||
message(STATUS "Using downloaded host Qt binaries at ${host_prefix}")
|
||||
set(QT_HOST_PATH "${host_prefix}" CACHE STRING "")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(download_moltenvk)
|
||||
|
@ -101,7 +180,7 @@ function(download_moltenvk)
|
|||
set(MOLTENVK_TAR "${CMAKE_BINARY_DIR}/externals/MoltenVK.tar")
|
||||
if (NOT EXISTS ${MOLTENVK_DIR})
|
||||
if (NOT EXISTS ${MOLTENVK_TAR})
|
||||
file(DOWNLOAD https://github.com/KhronosGroup/MoltenVK/releases/latest/download/MoltenVK-all.tar
|
||||
file(DOWNLOAD https://github.com/KhronosGroup/MoltenVK/releases/download/v1.2.7-rc2/MoltenVK-all.tar
|
||||
${MOLTENVK_TAR} SHOW_PROGRESS)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -57,9 +57,7 @@ if (DEFINED ENV{CI})
|
|||
set(BUILD_VERSION ${CMAKE_MATCH_1})
|
||||
endif()
|
||||
if (BUILD_VERSION)
|
||||
# This leaves a trailing space on the last word, but we actually want that
|
||||
# because of how it's styled in the title bar.
|
||||
set(BUILD_FULLNAME "${REPO_NAME} ${BUILD_VERSION} ")
|
||||
set(BUILD_FULLNAME "${REPO_NAME} ${BUILD_VERSION}")
|
||||
else()
|
||||
set(BUILD_FULLNAME "")
|
||||
endif()
|
||||
|
|
|
@ -4,26 +4,36 @@ include(GenerateBuildInfo)
|
|||
# The variable SRC_DIR must be passed into the script (since it uses the current build directory for all values of CMAKE_*_DIR)
|
||||
set(VIDEO_CORE "${SRC_DIR}/src/video_core")
|
||||
set(HASH_FILES
|
||||
"${VIDEO_CORE}/renderer_opengl/gl_shader_decompiler.cpp"
|
||||
"${VIDEO_CORE}/renderer_opengl/gl_shader_decompiler.h"
|
||||
"${VIDEO_CORE}/renderer_opengl/gl_shader_disk_cache.cpp"
|
||||
"${VIDEO_CORE}/renderer_opengl/gl_shader_disk_cache.h"
|
||||
"${VIDEO_CORE}/renderer_opengl/gl_shader_gen.cpp"
|
||||
"${VIDEO_CORE}/renderer_opengl/gl_shader_gen.h"
|
||||
"${VIDEO_CORE}/renderer_opengl/gl_shader_util.cpp"
|
||||
"${VIDEO_CORE}/renderer_opengl/gl_shader_util.h"
|
||||
"${VIDEO_CORE}/renderer_vulkan/vk_shader_util.cpp"
|
||||
"${VIDEO_CORE}/renderer_vulkan/vk_shader_util.h"
|
||||
"${VIDEO_CORE}/shader/generator/glsl_fs_shader_gen.cpp"
|
||||
"${VIDEO_CORE}/shader/generator/glsl_fs_shader_gen.h"
|
||||
"${VIDEO_CORE}/shader/generator/glsl_shader_decompiler.cpp"
|
||||
"${VIDEO_CORE}/shader/generator/glsl_shader_decompiler.h"
|
||||
"${VIDEO_CORE}/shader/generator/glsl_shader_gen.cpp"
|
||||
"${VIDEO_CORE}/shader/generator/glsl_shader_gen.h"
|
||||
"${VIDEO_CORE}/shader/generator/pica_fs_config.cpp"
|
||||
"${VIDEO_CORE}/shader/generator/pica_fs_config.h"
|
||||
"${VIDEO_CORE}/shader/generator/shader_gen.cpp"
|
||||
"${VIDEO_CORE}/shader/generator/shader_gen.h"
|
||||
"${VIDEO_CORE}/shader/generator/shader_uniforms.cpp"
|
||||
"${VIDEO_CORE}/shader/generator/shader_uniforms.h"
|
||||
"${VIDEO_CORE}/shader/generator/spv_fs_shader_gen.cpp"
|
||||
"${VIDEO_CORE}/shader/generator/spv_fs_shader_gen.h"
|
||||
"${VIDEO_CORE}/shader/shader.cpp"
|
||||
"${VIDEO_CORE}/shader/shader.h"
|
||||
"${VIDEO_CORE}/pica.cpp"
|
||||
"${VIDEO_CORE}/pica.h"
|
||||
"${VIDEO_CORE}/regs_framebuffer.h"
|
||||
"${VIDEO_CORE}/regs_lighting.h"
|
||||
"${VIDEO_CORE}/regs_pipeline.h"
|
||||
"${VIDEO_CORE}/regs_rasterizer.h"
|
||||
"${VIDEO_CORE}/regs_shader.h"
|
||||
"${VIDEO_CORE}/regs_texturing.h"
|
||||
"${VIDEO_CORE}/regs.cpp"
|
||||
"${VIDEO_CORE}/regs.h"
|
||||
"${VIDEO_CORE}/pica/regs_framebuffer.h"
|
||||
"${VIDEO_CORE}/pica/regs_lighting.h"
|
||||
"${VIDEO_CORE}/pica/regs_pipeline.h"
|
||||
"${VIDEO_CORE}/pica/regs_rasterizer.h"
|
||||
"${VIDEO_CORE}/pica/regs_shader.h"
|
||||
"${VIDEO_CORE}/pica/regs_texturing.h"
|
||||
"${VIDEO_CORE}/pica/regs_internal.cpp"
|
||||
"${VIDEO_CORE}/pica/regs_internal.h"
|
||||
)
|
||||
set(COMBINED "")
|
||||
foreach (F IN LISTS HASH_FILES)
|
||||
|
|
29
CMakeModules/aqt_config.ini
Normal file
29
CMakeModules/aqt_config.ini
Normal file
|
@ -0,0 +1,29 @@
|
|||
[aqt]
|
||||
concurrency: 2
|
||||
|
||||
[mirrors]
|
||||
trusted_mirrors:
|
||||
https://download.qt.io
|
||||
blacklist:
|
||||
https://qt.mirror.constant.com
|
||||
https://mirrors.ocf.berkeley.edu
|
||||
https://mirrors.ustc.edu.cn
|
||||
https://mirrors.tuna.tsinghua.edu.cn
|
||||
https://mirrors.geekpie.club
|
||||
https://mirrors-wan.geekpie.club
|
||||
https://mirrors.sjtug.sjtu.edu.cn
|
||||
fallbacks:
|
||||
https://qtproject.mirror.liquidtelecom.com/
|
||||
https://mirrors.aliyun.com/qt/
|
||||
https://ftp.jaist.ac.jp/pub/qtproject/
|
||||
https://ftp.yz.yamagata-u.ac.jp/pub/qtproject/
|
||||
https://qt-mirror.dannhauer.de/
|
||||
https://ftp.fau.de/qtproject/
|
||||
https://mirror.netcologne.de/qtproject/
|
||||
https://mirrors.dotsrc.org/qtproject/
|
||||
https://www.nic.funet.fi/pub/mirrors/download.qt-project.org/
|
||||
https://master.qt.io/
|
||||
https://mirrors.ukfast.co.uk/sites/qt.io/
|
||||
https://ftp2.nluug.nl/languages/qt/
|
||||
https://ftp1.nluug.nl/languages/qt/
|
||||
|
34
dist/apple/Info.plist.in
vendored
34
dist/apple/Info.plist.in
vendored
|
@ -21,9 +21,43 @@
|
|||
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
|
||||
<!-- Fixed -->
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.games</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>3ds</string>
|
||||
<string>3dsx</string>
|
||||
<string>cci</string>
|
||||
<string>cxi</string>
|
||||
<string>cia</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Nintendo 3DS File</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Default</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>elf</string>
|
||||
<string>axf</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Unix Executable and Linkable Format</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Alternate</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>This app requires camera access to emulate the 3DS's cameras.</string>
|
||||
<key>NSMicrophoneUsageDescription</key>
|
||||
|
|
8
dist/dumpkeys/DumpKeys.gm9
vendored
8
dist/dumpkeys/DumpKeys.gm9
vendored
|
@ -287,5 +287,13 @@ dumptxt -p $[OUT] "nfcSecret1Seed=$[NFC_SEED_1]"
|
|||
dumptxt -p $[OUT] "nfcSecret1HmacKey=$[NFC_HMAC_KEY_1]"
|
||||
dumptxt -p $[OUT] "nfcIv=$[NFC_IV]"
|
||||
|
||||
# Dump seeddb.bin as well
|
||||
|
||||
set SEEDDB_IN "0:/gm9/out/seeddb.bin"
|
||||
set SEEDDB_OUT "0:/gm9/seeddb.bin"
|
||||
|
||||
sdump -w seeddb.bin
|
||||
cp -w $[SEEDDB_IN] $[SEEDDB_OUT]
|
||||
|
||||
@Exit
|
||||
|
||||
|
|
2
dist/dumpkeys/README.md
vendored
2
dist/dumpkeys/README.md
vendored
|
@ -6,5 +6,5 @@ Usage:
|
|||
1. Copy "DumpKeys.gm9" into the "gm9/scripts/" directory on your SD card.
|
||||
2. Launch GodMode9, press the HOME button, select Scripts, and select "DumpKeys" from the list of scripts that appears.
|
||||
3. Wait for the script to complete and return you to the GodMode9 main menu.
|
||||
4. Power off your system and copy the "gm9/aes_keys.txt" file off of your SD card into "(Citra directory)/sysdata/".
|
||||
4. Power off your system and copy the "gm9/aes_keys.txt" and "gm9/seeddb.bin" files off of your SD card into "(Citra directory)/sysdata/".
|
||||
|
||||
|
|
2
dist/installer/CMakeLists.txt
vendored
2
dist/installer/CMakeLists.txt
vendored
|
@ -13,6 +13,8 @@ set(BUILD_DIR "${CMAKE_BINARY_DIR}/installer")
|
|||
set(DIST_DIR "${BUILD_DIR}/dist")
|
||||
set(TARGET_FILE "${DIST_DIR}/citra-setup-${PLATFORM}")
|
||||
|
||||
file(MAKE_DIRECTORY "${BUILD_DIR}" "${DIST_DIR}")
|
||||
|
||||
# Adds a custom target that will run the BuildInstaller.cmake file
|
||||
# CMake can't just run a cmake function as a custom command, so this is a way around it.
|
||||
# Calls the cmake command and runs a cmake file in "scripting" mode passing in variables with -D
|
||||
|
|
5
dist/languages/.tx/config
vendored
5
dist/languages/.tx/config
vendored
|
@ -7,3 +7,8 @@ source_file = en.ts
|
|||
source_lang = en
|
||||
type = QT
|
||||
|
||||
[o:citra:p:citra:r:android]
|
||||
file_filter = ../../src/android/app/src/main/res/values-<lang>/strings.xml
|
||||
source_file = ../../src/android/app/src/main/res/values/strings.xml
|
||||
type = ANDROID
|
||||
lang_map = es_ES:es, hu_HU:hu, ru_RU:ru, pt_BR:pt, zh_CN:zh
|
||||
|
|
3519
dist/languages/da_DK.ts
vendored
3519
dist/languages/da_DK.ts
vendored
File diff suppressed because it is too large
Load diff
3911
dist/languages/de.ts
vendored
3911
dist/languages/de.ts
vendored
File diff suppressed because it is too large
Load diff
3603
dist/languages/el.ts
vendored
3603
dist/languages/el.ts
vendored
File diff suppressed because it is too large
Load diff
3488
dist/languages/es_ES.ts
vendored
3488
dist/languages/es_ES.ts
vendored
File diff suppressed because it is too large
Load diff
3566
dist/languages/fi.ts
vendored
3566
dist/languages/fi.ts
vendored
File diff suppressed because it is too large
Load diff
3764
dist/languages/fr.ts
vendored
3764
dist/languages/fr.ts
vendored
File diff suppressed because it is too large
Load diff
5229
dist/languages/fi_FI.ts → dist/languages/hu_HU.ts
vendored
5229
dist/languages/fi_FI.ts → dist/languages/hu_HU.ts
vendored
File diff suppressed because it is too large
Load diff
3517
dist/languages/id.ts
vendored
3517
dist/languages/id.ts
vendored
File diff suppressed because it is too large
Load diff
3658
dist/languages/it.ts
vendored
3658
dist/languages/it.ts
vendored
File diff suppressed because it is too large
Load diff
3580
dist/languages/ja_JP.ts
vendored
3580
dist/languages/ja_JP.ts
vendored
File diff suppressed because it is too large
Load diff
3718
dist/languages/ko_KR.ts
vendored
3718
dist/languages/ko_KR.ts
vendored
File diff suppressed because it is too large
Load diff
3603
dist/languages/lt_LT.ts
vendored
3603
dist/languages/lt_LT.ts
vendored
File diff suppressed because it is too large
Load diff
3525
dist/languages/nb.ts
vendored
3525
dist/languages/nb.ts
vendored
File diff suppressed because it is too large
Load diff
4371
dist/languages/nl.ts
vendored
4371
dist/languages/nl.ts
vendored
File diff suppressed because it is too large
Load diff
3610
dist/languages/pl_PL.ts
vendored
3610
dist/languages/pl_PL.ts
vendored
File diff suppressed because it is too large
Load diff
3710
dist/languages/pt_BR.ts
vendored
3710
dist/languages/pt_BR.ts
vendored
File diff suppressed because it is too large
Load diff
3546
dist/languages/ro_RO.ts
vendored
3546
dist/languages/ro_RO.ts
vendored
File diff suppressed because it is too large
Load diff
3527
dist/languages/ru_RU.ts
vendored
3527
dist/languages/ru_RU.ts
vendored
File diff suppressed because it is too large
Load diff
3536
dist/languages/tr_TR.ts
vendored
3536
dist/languages/tr_TR.ts
vendored
File diff suppressed because it is too large
Load diff
3691
dist/languages/vi_VN.ts
vendored
3691
dist/languages/vi_VN.ts
vendored
File diff suppressed because it is too large
Load diff
3508
dist/languages/zh_CN.ts
vendored
3508
dist/languages/zh_CN.ts
vendored
File diff suppressed because it is too large
Load diff
3739
dist/languages/zh_TW.ts
vendored
3739
dist/languages/zh_TW.ts
vendored
File diff suppressed because it is too large
Load diff
10
dist/qt_themes/colorful_dark/icons/index.theme
vendored
10
dist/qt_themes/colorful_dark/icons/index.theme
vendored
|
@ -2,7 +2,13 @@
|
|||
Name=colorful_dark
|
||||
Comment=Colorful theme (Dark style)
|
||||
Inherits=default
|
||||
Directories=16x16
|
||||
|
||||
Directories=16x16,48x48,256x256
|
||||
|
||||
[16x16]
|
||||
Size=16
|
||||
|
||||
[48x48]
|
||||
Size=48
|
||||
|
||||
[256x256]
|
||||
Size=256
|
||||
|
|
|
@ -2,7 +2,13 @@
|
|||
Name=colorful_midnight_blue
|
||||
Comment=Colorful theme (Midnight Blue style)
|
||||
Inherits=default
|
||||
Directories=16x16
|
||||
Directories=16x16,48x48,256x256
|
||||
|
||||
[16x16]
|
||||
Size=16
|
||||
|
||||
[48x48]
|
||||
Size=48
|
||||
|
||||
[256x256]
|
||||
Size=256
|
||||
|
|
18
dist/qt_themes/default/style.qss
vendored
18
dist/qt_themes/default/style.qss
vendored
|
@ -12,17 +12,23 @@ QPushButton#GraphicsAPIStatusBarButton:hover {
|
|||
border: 1px solid #76797C;
|
||||
}
|
||||
|
||||
QPushButton#3DOptionStatusBarButton {
|
||||
color: #A5A5A5;
|
||||
font-weight: bold;
|
||||
QPushButton#TogglableStatusBarButton {
|
||||
color: #959595;
|
||||
border: 1px solid transparent;
|
||||
background-color: transparent;
|
||||
padding: 0px 3px 0px 3px;
|
||||
text-align: center;
|
||||
min-width: 60px;
|
||||
min-height: 20px;
|
||||
}
|
||||
|
||||
QPushButton#3DOptionStatusBarButton:hover {
|
||||
QPushButton#TogglableStatusBarButton:checked {
|
||||
color: #00FF00;
|
||||
}
|
||||
|
||||
QPushButton#TogglableStatusBarButton:hover {
|
||||
border: 1px solid #76797C;
|
||||
}
|
||||
|
||||
QPushButton#button_reset_defaults {
|
||||
min-width: 57px;
|
||||
padding: 4px 8px;
|
||||
}
|
||||
|
|
38
dist/qt_themes/qdarkstyle/style.qss
vendored
38
dist/qt_themes/qdarkstyle/style.qss
vendored
|
@ -1,19 +1,3 @@
|
|||
QPushButton#TogglableStatusBarButton {
|
||||
color: #959595;
|
||||
border: 1px solid transparent;
|
||||
background-color: transparent;
|
||||
padding: 0px 3px 0px 3px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
QPushButton#TogglableStatusBarButton:checked {
|
||||
color: palette(text);
|
||||
}
|
||||
|
||||
QPushButton#TogglableStatusBarButton:hover {
|
||||
border: 1px solid #76797C;
|
||||
}
|
||||
|
||||
QPushButton#GraphicsAPIStatusBarButton {
|
||||
color: #656565;
|
||||
border: 1px solid transparent;
|
||||
|
@ -26,6 +10,23 @@ QPushButton#GraphicsAPIStatusBarButton:hover {
|
|||
border: 1px solid #76797C;
|
||||
}
|
||||
|
||||
QPushButton#TogglableStatusBarButton {
|
||||
min-width: 0px;
|
||||
color: #656565;
|
||||
border: 1px solid transparent;
|
||||
background-color: transparent;
|
||||
padding: 0px 3px 0px 3px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
QPushButton#TogglableStatusBarButton:checked {
|
||||
color: #00FF00;
|
||||
}
|
||||
|
||||
QPushButton#TogglableStatusBarButton:hover {
|
||||
border: 1px solid #76797C;
|
||||
}
|
||||
|
||||
QToolTip {
|
||||
border: 1px solid #76797C;
|
||||
background-color: #5A7566;
|
||||
|
@ -298,6 +299,11 @@ QAbstractItemView:read-only {
|
|||
alternate-background-color: #232629;
|
||||
}
|
||||
|
||||
/* Workaround for https://bugreports.qt.io/browse/QTBUG-115529 */
|
||||
QAbstractItemView:item {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
QWidget:focus {
|
||||
border: 1px solid #3daee9;
|
||||
}
|
||||
|
|
|
@ -481,6 +481,11 @@ QAbstractItemView QLineEdit {
|
|||
padding: 2px;
|
||||
}
|
||||
|
||||
/* Workaround for https://bugreports.qt.io/browse/QTBUG-115529 */
|
||||
QAbstractItemView:item {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
/* QAbstractScrollArea ----------------------------------------------------
|
||||
|
||||
https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qabstractscrollarea
|
||||
|
@ -1067,6 +1072,10 @@ QPushButton:focus {
|
|||
border: 1px solid #1464A0;
|
||||
}
|
||||
|
||||
QPushButton#button_reset_defaults {
|
||||
padding: 3px 6px;
|
||||
}
|
||||
|
||||
/* QToolButton ------------------------------------------------------------
|
||||
|
||||
https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtoolbutton
|
||||
|
|
459
externals/CMakeLists.txt
vendored
459
externals/CMakeLists.txt
vendored
|
@ -4,7 +4,7 @@
|
|||
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
add_compile_options(/W0)
|
||||
else()
|
||||
add_compile_options(-Wno-error)
|
||||
add_compile_options(-w)
|
||||
endif()
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
|
||||
|
@ -12,58 +12,62 @@ include(DownloadExternals)
|
|||
include(ExternalProject)
|
||||
|
||||
# Boost
|
||||
set(BOOST_ROOT "${CMAKE_SOURCE_DIR}/externals/boost")
|
||||
set(Boost_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/boost")
|
||||
set(Boost_NO_SYSTEM_PATHS ON)
|
||||
add_library(boost INTERFACE)
|
||||
target_include_directories(boost SYSTEM INTERFACE ${Boost_INCLUDE_DIR})
|
||||
if (NOT USE_SYSTEM_BOOST)
|
||||
message(STATUS "Including vendored Boost library")
|
||||
set(BOOST_ROOT "${CMAKE_SOURCE_DIR}/externals/boost" CACHE STRING "")
|
||||
set(Boost_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/boost" CACHE STRING "")
|
||||
set(Boost_NO_SYSTEM_PATHS ON CACHE BOOL "")
|
||||
add_library(boost INTERFACE)
|
||||
target_include_directories(boost SYSTEM INTERFACE ${Boost_INCLUDE_DIR})
|
||||
|
||||
# Boost::serialization
|
||||
file(GLOB boost_serialization_SRC "${CMAKE_SOURCE_DIR}/externals/boost/libs/serialization/src/*.cpp")
|
||||
add_library(boost_serialization STATIC ${boost_serialization_SRC})
|
||||
target_link_libraries(boost_serialization PUBLIC boost)
|
||||
|
||||
# Boost::iostreams
|
||||
add_library(
|
||||
boost_iostreams
|
||||
STATIC
|
||||
${CMAKE_SOURCE_DIR}/externals/boost/libs/iostreams/src/file_descriptor.cpp
|
||||
${CMAKE_SOURCE_DIR}/externals/boost/libs/iostreams/src/mapped_file.cpp
|
||||
)
|
||||
target_link_libraries(boost_iostreams PUBLIC boost)
|
||||
# Boost::serialization
|
||||
file(GLOB boost_serialization_SRC "${CMAKE_SOURCE_DIR}/externals/boost/libs/serialization/src/*.cpp")
|
||||
add_library(boost_serialization STATIC ${boost_serialization_SRC})
|
||||
target_link_libraries(boost_serialization PUBLIC boost)
|
||||
|
||||
# Boost::iostreams
|
||||
add_library(
|
||||
boost_iostreams
|
||||
STATIC
|
||||
${CMAKE_SOURCE_DIR}/externals/boost/libs/iostreams/src/file_descriptor.cpp
|
||||
${CMAKE_SOURCE_DIR}/externals/boost/libs/iostreams/src/mapped_file.cpp
|
||||
)
|
||||
target_link_libraries(boost_iostreams PUBLIC boost)
|
||||
# Add additional boost libs here; remember to ALIAS them in the root CMakeLists!
|
||||
else()
|
||||
unset(BOOST_ROOT CACHE)
|
||||
unset(Boost_INCLUDE_DIR CACHE)
|
||||
set(Boost_NO_SYSTEM_PATHS OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
# Catch2
|
||||
set(CATCH_INSTALL_DOCS OFF)
|
||||
set(CATCH_INSTALL_EXTRAS OFF)
|
||||
add_subdirectory(catch2)
|
||||
add_library(catch2 INTERFACE)
|
||||
if(USE_SYSTEM_CATCH2)
|
||||
find_package(Catch2 3.0.0 REQUIRED)
|
||||
else()
|
||||
set(CATCH_INSTALL_DOCS OFF CACHE BOOL "")
|
||||
set(CATCH_INSTALL_EXTRAS OFF CACHE BOOL "")
|
||||
add_subdirectory(catch2)
|
||||
endif()
|
||||
target_link_libraries(catch2 INTERFACE Catch2::Catch2WithMain)
|
||||
|
||||
# Crypto++
|
||||
set(CRYPTOPP_BUILD_DOCUMENTATION OFF)
|
||||
set(CRYPTOPP_BUILD_TESTING OFF)
|
||||
set(CRYPTOPP_INSTALL OFF)
|
||||
set(CRYPTOPP_SOURCES "${CMAKE_SOURCE_DIR}/externals/cryptopp")
|
||||
add_subdirectory(cryptopp-cmake)
|
||||
if(USE_SYSTEM_CRYPTOPP)
|
||||
find_package(cryptopp REQUIRED)
|
||||
add_library(cryptopp INTERFACE)
|
||||
target_link_libraries(cryptopp INTERFACE cryptopp::cryptopp)
|
||||
else()
|
||||
if (WIN32 AND NOT MSVC AND "arm64" IN_LIST ARCHITECTURE)
|
||||
# TODO: CryptoPP ARM64 ASM does not seem to support Windows unless compiled with MSVC.
|
||||
# TODO: See https://github.com/weidai11/cryptopp/issues/1260
|
||||
set(CRYPTOPP_DISABLE_ASM ON CACHE BOOL "")
|
||||
endif()
|
||||
|
||||
# HACK: Mismatch between compilation of CryptoPP and headers used in Citra can cause runtime issues.
|
||||
# Pull out the compile definitions from CryptoPP and apply them to Citra as well to fix this.
|
||||
# See: https://github.com/weidai11/cryptopp/issues/1191
|
||||
get_source_file_property(CRYPTOPP_COMPILE_DEFINITIONS ${CRYPTOPP_SOURCES}/cryptlib.cpp TARGET_DIRECTORY cryptopp COMPILE_DEFINITIONS)
|
||||
set(CRYPTOPP_COMPILE_DEFINITIONS ${CRYPTOPP_COMPILE_DEFINITIONS} PARENT_SCOPE)
|
||||
|
||||
# HACK: The logic to set up the base include directory for CryptoPP does not work with Android SDK CMake 3.22.1.
|
||||
# Until there is a fixed version available, this code will detect and add in the proper include if it does not exist.
|
||||
if(ANDROID)
|
||||
message(STATUS "Applying CryptoPP include fix.")
|
||||
get_target_property(CRYPTOPP_INCLUDES cryptopp INTERFACE_INCLUDE_DIRECTORIES)
|
||||
foreach(CRYPTOPP_INCLUDE ${CRYPTOPP_INCLUDES})
|
||||
if("${CRYPTOPP_INCLUDE}" MATCHES "\\$<BUILD_INTERFACE:(.*)/cryptopp>")
|
||||
message(STATUS "Fixed include path: ${CMAKE_MATCH_1}")
|
||||
target_include_directories(cryptopp PUBLIC $<BUILD_INTERFACE:${CMAKE_MATCH_1}>)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
set(CRYPTOPP_BUILD_DOCUMENTATION OFF CACHE BOOL "")
|
||||
set(CRYPTOPP_BUILD_TESTING OFF CACHE BOOL "")
|
||||
set(CRYPTOPP_INSTALL OFF CACHE BOOL "")
|
||||
set(CRYPTOPP_SOURCES "${CMAKE_SOURCE_DIR}/externals/cryptopp" CACHE STRING "")
|
||||
add_subdirectory(cryptopp-cmake)
|
||||
endif()
|
||||
|
||||
# dds-ktx
|
||||
|
@ -72,19 +76,49 @@ target_include_directories(dds-ktx INTERFACE ./dds-ktx)
|
|||
|
||||
# fmt and Xbyak need to be added before dynarmic
|
||||
# libfmt
|
||||
option(FMT_INSTALL "" ON)
|
||||
add_subdirectory(fmt EXCLUDE_FROM_ALL)
|
||||
if(USE_SYSTEM_FMT)
|
||||
add_library(fmt INTERFACE)
|
||||
find_package(fmt REQUIRED)
|
||||
target_link_libraries(fmt INTERFACE fmt::fmt)
|
||||
else()
|
||||
option(FMT_INSTALL "" ON)
|
||||
add_subdirectory(fmt EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
|
||||
# Xbyak
|
||||
if ("x86_64" IN_LIST ARCHITECTURE)
|
||||
add_subdirectory(xbyak EXCLUDE_FROM_ALL)
|
||||
if(USE_SYSTEM_XBYAK)
|
||||
find_package(xbyak REQUIRED)
|
||||
add_library(xbyak INTERFACE)
|
||||
target_link_libraries(xbyak INTERFACE xbyak::xbyak)
|
||||
else()
|
||||
add_subdirectory(xbyak EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Oaknut
|
||||
if ("arm64" IN_LIST ARCHITECTURE)
|
||||
add_subdirectory(oaknut EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
# Dynarmic
|
||||
if ("x86_64" IN_LIST ARCHITECTURE OR "arm64" IN_LIST ARCHITECTURE)
|
||||
set(DYNARMIC_TESTS OFF)
|
||||
set(DYNARMIC_FRONTENDS "A32")
|
||||
add_subdirectory(dynarmic EXCLUDE_FROM_ALL)
|
||||
if(USE_SYSTEM_DYNARMIC)
|
||||
find_package(dynarmic REQUIRED)
|
||||
add_library(dynarmic INTERFACE)
|
||||
target_link_libraries(dynarmic INTERFACE dynarmic::dynarmic)
|
||||
# The dynarmic package's cmake files are helpfully completely silent
|
||||
# so we have to inform the user of its status ourselves
|
||||
if(TARGET dynarmic::dynarmic)
|
||||
message(STATUS "Found dynarmic")
|
||||
endif()
|
||||
else()
|
||||
set(DYNARMIC_TESTS OFF CACHE BOOL "")
|
||||
set(DYNARMIC_FRONTENDS "A32" CACHE STRING "")
|
||||
set(DYNARMIC_USE_PRECOMPILED_HEADERS ${CITRA_USE_PRECOMPILED_HEADERS} CACHE BOOL "")
|
||||
add_subdirectory(dynarmic EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# getopt
|
||||
|
@ -92,46 +126,59 @@ if (MSVC)
|
|||
add_subdirectory(getopt)
|
||||
endif()
|
||||
|
||||
# Glad
|
||||
add_subdirectory(glad)
|
||||
|
||||
# glslang
|
||||
set(SKIP_GLSLANG_INSTALL ON)
|
||||
set(ENABLE_GLSLANG_BINARIES OFF)
|
||||
set(ENABLE_SPVREMAPPER OFF)
|
||||
set(ENABLE_CTEST OFF)
|
||||
add_subdirectory(glslang)
|
||||
|
||||
# inih
|
||||
add_subdirectory(inih)
|
||||
if(USE_SYSTEM_INIH)
|
||||
find_package(inih REQUIRED COMPONENTS inih inir)
|
||||
add_library(inih INTERFACE)
|
||||
target_link_libraries(inih INTERFACE inih::inih inih::inir)
|
||||
else()
|
||||
add_subdirectory(inih)
|
||||
endif()
|
||||
|
||||
# MicroProfile
|
||||
add_library(microprofile INTERFACE)
|
||||
target_include_directories(microprofile INTERFACE ./microprofile)
|
||||
target_include_directories(microprofile SYSTEM INTERFACE ./microprofile)
|
||||
|
||||
# Nihstro
|
||||
add_library(nihstro-headers INTERFACE)
|
||||
target_include_directories(nihstro-headers INTERFACE ./nihstro/include)
|
||||
target_include_directories(nihstro-headers SYSTEM INTERFACE ./nihstro/include)
|
||||
if (MSVC)
|
||||
target_compile_options(nihstro-headers INTERFACE /W0)
|
||||
else()
|
||||
target_compile_options(nihstro-headers INTERFACE -Wno-error)
|
||||
# TODO: For some reason MSVC still applies this warning even with /W0 for externals.
|
||||
target_compile_options(nihstro-headers INTERFACE /wd4715)
|
||||
endif()
|
||||
|
||||
# Open Source Archives
|
||||
add_subdirectory(open_source_archives)
|
||||
|
||||
# faad2
|
||||
add_subdirectory(faad2 EXCLUDE_FROM_ALL)
|
||||
|
||||
# Dynamic library headers
|
||||
add_subdirectory(library-headers EXCLUDE_FROM_ALL)
|
||||
add_library(library-headers INTERFACE)
|
||||
|
||||
if (USE_SYSTEM_FFMPEG_HEADERS)
|
||||
find_path(SYSTEM_FFMPEG_INCLUDES NAMES libavutil/avutil.h)
|
||||
if (SYSTEM_FFMPEG_INCLUDES STREQUAL "SYSTEM_FFMPEG_INCLUDES-NOTFOUND")
|
||||
message(WARNING "System FFmpeg headers not found. Falling back on bundled headers.")
|
||||
else()
|
||||
message(STATUS "Using system FFmpeg headers.")
|
||||
target_include_directories(library-headers SYSTEM INTERFACE ${SYSTEM_FFMPEG_INCLUDES})
|
||||
set(FOUND_FFMPEG_HEADERS ON)
|
||||
endif()
|
||||
endif()
|
||||
if (NOT FOUND_FFMPEG_HEADERS)
|
||||
message(STATUS "Using bundled ffmpeg headers.")
|
||||
target_include_directories(library-headers SYSTEM INTERFACE ./library-headers/ffmpeg/include)
|
||||
endif()
|
||||
|
||||
# SoundTouch
|
||||
set(INTEGER_SAMPLES ON CACHE BOOL "")
|
||||
set(SOUNDSTRETCH OFF CACHE BOOL "")
|
||||
set(SOUNDTOUCH_DLL OFF CACHE BOOL "")
|
||||
add_subdirectory(soundtouch EXCLUDE_FROM_ALL)
|
||||
|
||||
# sirit
|
||||
add_subdirectory(sirit EXCLUDE_FROM_ALL)
|
||||
if(NOT USE_SYSTEM_SOUNDTOUCH)
|
||||
set(INTEGER_SAMPLES ON CACHE BOOL "")
|
||||
set(SOUNDSTRETCH OFF CACHE BOOL "")
|
||||
set(SOUNDTOUCH_DLL OFF CACHE BOOL "")
|
||||
add_subdirectory(soundtouch EXCLUDE_FROM_ALL)
|
||||
target_compile_definitions(SoundTouch PUBLIC SOUNDTOUCH_INTEGER_SAMPLES)
|
||||
endif()
|
||||
|
||||
# Teakra
|
||||
add_subdirectory(teakra EXCLUDE_FROM_ALL)
|
||||
|
@ -141,78 +188,158 @@ if (ENABLE_SDL2 AND NOT USE_SYSTEM_SDL2)
|
|||
add_subdirectory(sdl2)
|
||||
endif()
|
||||
|
||||
# libusb
|
||||
if (ENABLE_LIBUSB AND NOT USE_SYSTEM_LIBUSB)
|
||||
add_subdirectory(libusb)
|
||||
set(LIBUSB_INCLUDE_DIR "" PARENT_SCOPE)
|
||||
set(LIBUSB_LIBRARIES usb PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
# Zstandard
|
||||
set(ZSTD_LEGACY_SUPPORT OFF)
|
||||
set(ZSTD_BUILD_PROGRAMS OFF)
|
||||
set(ZSTD_BUILD_SHARED OFF)
|
||||
add_subdirectory(zstd/build/cmake EXCLUDE_FROM_ALL)
|
||||
target_include_directories(libzstd_static INTERFACE $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/externals/zstd/lib>)
|
||||
if(USE_SYSTEM_ZSTD)
|
||||
find_package(zstd REQUIRED)
|
||||
add_library(zstd INTERFACE)
|
||||
if(TARGET zstd::libzstd_shared)
|
||||
message(STATUS "Found system Zstandard")
|
||||
endif()
|
||||
target_link_libraries(zstd INTERFACE zstd::libzstd_shared)
|
||||
else()
|
||||
set(ZSTD_LEGACY_SUPPORT OFF)
|
||||
set(ZSTD_BUILD_PROGRAMS OFF)
|
||||
set(ZSTD_BUILD_SHARED OFF)
|
||||
add_subdirectory(zstd/build/cmake EXCLUDE_FROM_ALL)
|
||||
target_include_directories(libzstd_static INTERFACE $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/externals/zstd/lib>)
|
||||
add_library(zstd ALIAS libzstd_static)
|
||||
endif()
|
||||
|
||||
# ENet
|
||||
add_subdirectory(enet)
|
||||
target_include_directories(enet INTERFACE ./enet/include)
|
||||
if(USE_SYSTEM_ENET)
|
||||
find_package(libenet REQUIRED)
|
||||
add_library(enet INTERFACE)
|
||||
target_link_libraries(enet INTERFACE libenet::libenet)
|
||||
else()
|
||||
add_subdirectory(enet)
|
||||
target_include_directories(enet INTERFACE ./enet/include)
|
||||
endif()
|
||||
|
||||
# Cubeb
|
||||
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)
|
||||
if(USE_SYSTEM_CUBEB)
|
||||
find_package(cubeb REQUIRED)
|
||||
add_library(cubeb INTERFACE)
|
||||
target_link_libraries(cubeb INTERFACE cubeb::cubeb)
|
||||
if(TARGET cubeb::cubeb)
|
||||
message(STATUS "Found system cubeb")
|
||||
endif()
|
||||
else()
|
||||
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()
|
||||
endif()
|
||||
|
||||
# DiscordRPC
|
||||
if (USE_DISCORD_PRESENCE)
|
||||
# rapidjson used by discord-rpc is old and doesn't correctly detect endianness for some platforms.
|
||||
include(TestBigEndian)
|
||||
test_big_endian(RAPIDJSON_BIG_ENDIAN)
|
||||
if(RAPIDJSON_BIG_ENDIAN)
|
||||
add_compile_definitions(RAPIDJSON_ENDIAN=1)
|
||||
else()
|
||||
add_compile_definitions(RAPIDJSON_ENDIAN=0)
|
||||
endif()
|
||||
|
||||
# Apply a dummy CLANG_FORMAT_SUFFIX to disable discord-rpc's unnecessary automatic clang-format.
|
||||
set(CLANG_FORMAT_SUFFIX "dummy")
|
||||
|
||||
add_subdirectory(discord-rpc EXCLUDE_FROM_ALL)
|
||||
target_include_directories(discord-rpc INTERFACE ./discord-rpc/include)
|
||||
endif()
|
||||
|
||||
# JSON
|
||||
add_library(json-headers INTERFACE)
|
||||
target_include_directories(json-headers INTERFACE ./json)
|
||||
if (USE_SYSTEM_JSON)
|
||||
find_package(nlohmann_json REQUIRED)
|
||||
target_link_libraries(json-headers INTERFACE nlohmann_json::nlohmann_json)
|
||||
get_target_property(NLOHMANN_PREFIX nlohmann_json::nlohmann_json INTERFACE_INCLUDE_DIRECTORIES)
|
||||
# The nlohmann-json3 package expects "#include <nlohmann/json.hpp>"
|
||||
# Citra uses "#include <json.hpp>" so we have to add this manually
|
||||
target_include_directories(json-headers SYSTEM INTERFACE "${NLOHMANN_PREFIX}/nlohmann")
|
||||
else()
|
||||
target_include_directories(json-headers SYSTEM INTERFACE ./json)
|
||||
endif()
|
||||
|
||||
if (ENABLE_WEB_SERVICE)
|
||||
if (USE_SYSTEM_OPENSSL)
|
||||
find_package(OpenSSL 1.1)
|
||||
if (OPENSSL_FOUND)
|
||||
set(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
|
||||
# OpenSSL
|
||||
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/")
|
||||
add_subdirectory(libressl EXCLUDE_FROM_ALL)
|
||||
target_include_directories(ssl SYSTEM INTERFACE ./libressl/include)
|
||||
target_compile_definitions(ssl PRIVATE -DHAVE_INET_NTOP)
|
||||
get_directory_property(OPENSSL_LIBRARIES
|
||||
DIRECTORY libressl
|
||||
DEFINITION OPENSSL_LIBS)
|
||||
endif()
|
||||
|
||||
# httplib
|
||||
add_library(httplib INTERFACE)
|
||||
if(USE_SYSTEM_CPP_HTTPLIB)
|
||||
find_package(CppHttp 0.14.1)
|
||||
# Detect if system cpphttplib is a shared library
|
||||
# this breaks building as Citra relies on functions that are moved
|
||||
# into the shared object.
|
||||
get_target_property(HTTP_LIBS httplib::httplib INTERFACE_LINK_LIBRARIES)
|
||||
if(HTTP_LIBS)
|
||||
message(WARNING "Shared cpp-http (${HTTP_LIBS}) not supported. Falling back to bundled...")
|
||||
target_include_directories(httplib SYSTEM INTERFACE ./httplib)
|
||||
else()
|
||||
if(CppHttp_FOUND)
|
||||
target_link_libraries(httplib INTERFACE httplib::httplib)
|
||||
else()
|
||||
message(STATUS "Cpp-httplib not found or not suitable version! Falling back to bundled...")
|
||||
target_include_directories(httplib SYSTEM INTERFACE ./httplib)
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
target_include_directories(httplib SYSTEM INTERFACE ./httplib)
|
||||
endif()
|
||||
target_compile_options(httplib INTERFACE -DCPPHTTPLIB_OPENSSL_SUPPORT)
|
||||
target_link_libraries(httplib INTERFACE ${OPENSSL_LIBRARIES})
|
||||
|
||||
if (NOT OPENSSL_FOUND)
|
||||
# LibreSSL
|
||||
set(LIBRESSL_SKIP_INSTALL ON CACHE BOOL "")
|
||||
set(OPENSSLDIR "/etc/ssl/")
|
||||
add_subdirectory(libressl EXCLUDE_FROM_ALL)
|
||||
target_include_directories(ssl INTERFACE ./libressl/include)
|
||||
target_compile_definitions(ssl PRIVATE -DHAVE_INET_NTOP)
|
||||
get_directory_property(OPENSSL_LIBRARIES
|
||||
DIRECTORY libressl
|
||||
DEFINITION OPENSSL_LIBS)
|
||||
endif()
|
||||
if (UNIX AND NOT APPLE)
|
||||
add_subdirectory(gamemode)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
add_subdirectory(android-ifaddrs)
|
||||
endif()
|
||||
|
||||
# httplib
|
||||
add_library(httplib INTERFACE)
|
||||
target_include_directories(httplib INTERFACE ./httplib)
|
||||
target_compile_options(httplib INTERFACE -DCPPHTTPLIB_OPENSSL_SUPPORT)
|
||||
target_link_libraries(httplib INTERFACE ${OPENSSL_LIBRARIES})
|
||||
|
||||
# cpp-jwt
|
||||
add_library(cpp-jwt INTERFACE)
|
||||
target_include_directories(cpp-jwt INTERFACE ./cpp-jwt/include)
|
||||
target_compile_definitions(cpp-jwt INTERFACE CPP_JWT_USE_VENDORED_NLOHMANN_JSON)
|
||||
if (MSVC)
|
||||
target_compile_options(cpp-jwt INTERFACE /W0)
|
||||
# cpp-jwt
|
||||
if (ENABLE_WEB_SERVICE)
|
||||
if (USE_SYSTEM_CPP_JWT)
|
||||
find_package(cpp-jwt REQUIRED)
|
||||
add_library(cpp-jwt INTERFACE)
|
||||
target_link_libraries(cpp-jwt INTERFACE cpp-jwt::cpp-jwt)
|
||||
else()
|
||||
target_compile_options(cpp-jwt INTERFACE -Wno-error)
|
||||
add_library(cpp-jwt INTERFACE)
|
||||
target_include_directories(cpp-jwt SYSTEM INTERFACE ./cpp-jwt/include)
|
||||
target_compile_definitions(cpp-jwt INTERFACE CPP_JWT_USE_VENDORED_NLOHMANN_JSON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# lodepng
|
||||
add_subdirectory(lodepng)
|
||||
if(USE_SYSTEM_LODEPNG)
|
||||
add_library(lodepng INTERFACE)
|
||||
find_package(lodepng REQUIRED)
|
||||
target_link_libraries(lodepng INTERFACE lodepng::lodepng)
|
||||
else()
|
||||
add_subdirectory(lodepng)
|
||||
endif()
|
||||
|
||||
# (xperia64): Only use libyuv on Android b/c of build issues on Windows and mandatory JPEG
|
||||
if(ANDROID)
|
||||
|
@ -223,21 +350,81 @@ endif()
|
|||
|
||||
# OpenAL Soft
|
||||
if (ENABLE_OPENAL)
|
||||
set(ALSOFT_EMBED_HRTF_DATA OFF CACHE BOOL "")
|
||||
set(ALSOFT_EXAMPLES OFF CACHE BOOL "")
|
||||
set(ALSOFT_INSTALL OFF CACHE BOOL "")
|
||||
set(ALSOFT_INSTALL_CONFIG OFF CACHE BOOL "")
|
||||
set(ALSOFT_INSTALL_HRTF_DATA OFF CACHE BOOL "")
|
||||
set(ALSOFT_INSTALL_AMBDEC_PRESETS OFF CACHE BOOL "")
|
||||
set(ALSOFT_UTILS OFF CACHE BOOL "")
|
||||
set(LIBTYPE "STATIC" CACHE STRING "")
|
||||
add_subdirectory(openal-soft EXCLUDE_FROM_ALL)
|
||||
if(USE_SYSTEM_OPENAL)
|
||||
add_library(OpenAL INTERFACE)
|
||||
find_package(OpenAL REQUIRED)
|
||||
target_link_libraries(OpenAL INTERFACE OpenAL::OpenAL)
|
||||
else()
|
||||
set(ALSOFT_EMBED_HRTF_DATA OFF CACHE BOOL "")
|
||||
set(ALSOFT_EXAMPLES OFF CACHE BOOL "")
|
||||
set(ALSOFT_INSTALL OFF CACHE BOOL "")
|
||||
set(ALSOFT_INSTALL_CONFIG OFF CACHE BOOL "")
|
||||
set(ALSOFT_INSTALL_HRTF_DATA OFF CACHE BOOL "")
|
||||
set(ALSOFT_INSTALL_AMBDEC_PRESETS OFF CACHE BOOL "")
|
||||
set(ALSOFT_UTILS OFF CACHE BOOL "")
|
||||
set(LIBTYPE "STATIC" CACHE STRING "")
|
||||
add_subdirectory(openal-soft EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# VMA
|
||||
add_library(vma INTERFACE)
|
||||
target_include_directories(vma INTERFACE ./vma/include)
|
||||
# OpenGL dependencies
|
||||
if (ENABLE_OPENGL)
|
||||
# Glad
|
||||
add_subdirectory(glad)
|
||||
endif()
|
||||
|
||||
# vulkan-headers
|
||||
add_library(vulkan-headers INTERFACE)
|
||||
target_include_directories(vulkan-headers INTERFACE ./vulkan-headers/include)
|
||||
# Vulkan dependencies
|
||||
if (ENABLE_VULKAN)
|
||||
# glslang
|
||||
if(USE_SYSTEM_GLSLANG)
|
||||
find_package(glslang REQUIRED)
|
||||
add_library(glslang INTERFACE)
|
||||
add_library(SPIRV INTERFACE)
|
||||
target_link_libraries(glslang INTERFACE glslang::glslang)
|
||||
target_link_libraries(SPIRV INTERFACE glslang::SPIRV)
|
||||
# System include path is different from submodule include path
|
||||
get_target_property(GLSLANG_PREFIX glslang::SPIRV INTERFACE_INCLUDE_DIRECTORIES)
|
||||
target_include_directories(SPIRV SYSTEM INTERFACE "${GLSLANG_PREFIX}/glslang")
|
||||
else()
|
||||
set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "")
|
||||
set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "")
|
||||
set(ENABLE_SPVREMAPPER OFF CACHE BOOL "")
|
||||
set(ENABLE_CTEST OFF CACHE BOOL "")
|
||||
set(ENABLE_HLSL OFF CACHE BOOL "")
|
||||
set(BUILD_EXTERNAL OFF CACHE BOOL "")
|
||||
add_subdirectory(glslang)
|
||||
endif()
|
||||
|
||||
# sirit
|
||||
add_subdirectory(sirit EXCLUDE_FROM_ALL)
|
||||
|
||||
# VMA
|
||||
if(USE_SYSTEM_VMA)
|
||||
add_library(vma INTERFACE)
|
||||
find_package(VulkanMemoryAllocator REQUIRED)
|
||||
if(TARGET GPUOpen::VulkanMemoryAllocator)
|
||||
message(STATUS "Found VulkanMemoryAllocator")
|
||||
target_link_libraries(vma INTERFACE GPUOpen::VulkanMemoryAllocator)
|
||||
endif()
|
||||
else()
|
||||
add_library(vma INTERFACE)
|
||||
target_include_directories(vma SYSTEM INTERFACE ./vma/include)
|
||||
endif()
|
||||
|
||||
# vulkan-headers
|
||||
add_library(vulkan-headers INTERFACE)
|
||||
if(USE_SYSTEM_VULKAN_HEADERS)
|
||||
find_package(Vulkan REQUIRED)
|
||||
if(TARGET Vulkan::Headers)
|
||||
message(STATUS "Found Vulkan headers")
|
||||
target_link_libraries(vulkan-headers INTERFACE Vulkan::Headers)
|
||||
endif()
|
||||
else()
|
||||
target_include_directories(vulkan-headers SYSTEM INTERFACE ./vulkan-headers/include)
|
||||
endif()
|
||||
|
||||
# adrenotools
|
||||
if (ANDROID AND "arm64" IN_LIST ARCHITECTURE)
|
||||
add_subdirectory(libadrenotools)
|
||||
endif()
|
||||
endif()
|
||||
|
|
8
externals/android-ifaddrs/CMakeLists.txt
vendored
8
externals/android-ifaddrs/CMakeLists.txt
vendored
|
@ -1,8 +0,0 @@
|
|||
add_library(ifaddrs
|
||||
ifaddrs.c
|
||||
ifaddrs.h
|
||||
)
|
||||
|
||||
create_target_directory_groups(ifaddrs)
|
||||
|
||||
target_include_directories(ifaddrs INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
600
externals/android-ifaddrs/ifaddrs.c
vendored
600
externals/android-ifaddrs/ifaddrs.c
vendored
|
@ -1,600 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 2013, Kenneth MacKay
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "ifaddrs.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
|
||||
typedef struct NetlinkList
|
||||
{
|
||||
struct NetlinkList *m_next;
|
||||
struct nlmsghdr *m_data;
|
||||
unsigned int m_size;
|
||||
} NetlinkList;
|
||||
|
||||
static int netlink_socket(void)
|
||||
{
|
||||
int l_socket = socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
|
||||
if(l_socket < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct sockaddr_nl l_addr;
|
||||
memset(&l_addr, 0, sizeof(l_addr));
|
||||
l_addr.nl_family = AF_NETLINK;
|
||||
if(bind(l_socket, (struct sockaddr *)&l_addr, sizeof(l_addr)) < 0)
|
||||
{
|
||||
close(l_socket);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return l_socket;
|
||||
}
|
||||
|
||||
static int netlink_send(int p_socket, int p_request)
|
||||
{
|
||||
char l_buffer[NLMSG_ALIGN(sizeof(struct nlmsghdr)) + NLMSG_ALIGN(sizeof(struct rtgenmsg))];
|
||||
memset(l_buffer, 0, sizeof(l_buffer));
|
||||
struct nlmsghdr *l_hdr = (struct nlmsghdr *)l_buffer;
|
||||
struct rtgenmsg *l_msg = (struct rtgenmsg *)NLMSG_DATA(l_hdr);
|
||||
|
||||
l_hdr->nlmsg_len = NLMSG_LENGTH(sizeof(*l_msg));
|
||||
l_hdr->nlmsg_type = p_request;
|
||||
l_hdr->nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST;
|
||||
l_hdr->nlmsg_pid = 0;
|
||||
l_hdr->nlmsg_seq = p_socket;
|
||||
l_msg->rtgen_family = AF_UNSPEC;
|
||||
|
||||
struct sockaddr_nl l_addr;
|
||||
memset(&l_addr, 0, sizeof(l_addr));
|
||||
l_addr.nl_family = AF_NETLINK;
|
||||
return (sendto(p_socket, l_hdr, l_hdr->nlmsg_len, 0, (struct sockaddr *)&l_addr, sizeof(l_addr)));
|
||||
}
|
||||
|
||||
static int netlink_recv(int p_socket, void *p_buffer, size_t p_len)
|
||||
{
|
||||
struct msghdr l_msg;
|
||||
struct iovec l_iov = { p_buffer, p_len };
|
||||
struct sockaddr_nl l_addr;
|
||||
int l_result;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
l_msg.msg_name = (void *)&l_addr;
|
||||
l_msg.msg_namelen = sizeof(l_addr);
|
||||
l_msg.msg_iov = &l_iov;
|
||||
l_msg.msg_iovlen = 1;
|
||||
l_msg.msg_control = NULL;
|
||||
l_msg.msg_controllen = 0;
|
||||
l_msg.msg_flags = 0;
|
||||
int l_result = recvmsg(p_socket, &l_msg, 0);
|
||||
|
||||
if(l_result < 0)
|
||||
{
|
||||
if(errno == EINTR)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
return -2;
|
||||
}
|
||||
|
||||
if(l_msg.msg_flags & MSG_TRUNC)
|
||||
{ // buffer was too small
|
||||
return -1;
|
||||
}
|
||||
return l_result;
|
||||
}
|
||||
}
|
||||
|
||||
static struct nlmsghdr *getNetlinkResponse(int p_socket, int *p_size, int *p_done)
|
||||
{
|
||||
size_t l_size = 4096;
|
||||
void *l_buffer = NULL;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
free(l_buffer);
|
||||
l_buffer = malloc(l_size);
|
||||
|
||||
int l_read = netlink_recv(p_socket, l_buffer, l_size);
|
||||
*p_size = l_read;
|
||||
if(l_read == -2)
|
||||
{
|
||||
free(l_buffer);
|
||||
return NULL;
|
||||
}
|
||||
if(l_read >= 0)
|
||||
{
|
||||
pid_t l_pid = getpid();
|
||||
struct nlmsghdr *l_hdr;
|
||||
for(l_hdr = (struct nlmsghdr *)l_buffer; NLMSG_OK(l_hdr, (unsigned int)l_read); l_hdr = (struct nlmsghdr *)NLMSG_NEXT(l_hdr, l_read))
|
||||
{
|
||||
if((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(l_hdr->nlmsg_type == NLMSG_DONE)
|
||||
{
|
||||
*p_done = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if(l_hdr->nlmsg_type == NLMSG_ERROR)
|
||||
{
|
||||
free(l_buffer);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return l_buffer;
|
||||
}
|
||||
|
||||
l_size *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
static NetlinkList *newListItem(struct nlmsghdr *p_data, unsigned int p_size)
|
||||
{
|
||||
NetlinkList *l_item = malloc(sizeof(NetlinkList));
|
||||
l_item->m_next = NULL;
|
||||
l_item->m_data = p_data;
|
||||
l_item->m_size = p_size;
|
||||
return l_item;
|
||||
}
|
||||
|
||||
static void freeResultList(NetlinkList *p_list)
|
||||
{
|
||||
NetlinkList *l_cur;
|
||||
while(p_list)
|
||||
{
|
||||
l_cur = p_list;
|
||||
p_list = p_list->m_next;
|
||||
free(l_cur->m_data);
|
||||
free(l_cur);
|
||||
}
|
||||
}
|
||||
|
||||
static NetlinkList *getResultList(int p_socket, int p_request)
|
||||
{
|
||||
if(netlink_send(p_socket, p_request) < 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NetlinkList *l_list = NULL;
|
||||
NetlinkList *l_end = NULL;
|
||||
int l_size;
|
||||
int l_done = 0;
|
||||
while(!l_done)
|
||||
{
|
||||
struct nlmsghdr *l_hdr = getNetlinkResponse(p_socket, &l_size, &l_done);
|
||||
if(!l_hdr)
|
||||
{ // error
|
||||
freeResultList(l_list);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NetlinkList *l_item = newListItem(l_hdr, l_size);
|
||||
if(!l_list)
|
||||
{
|
||||
l_list = l_item;
|
||||
}
|
||||
else
|
||||
{
|
||||
l_end->m_next = l_item;
|
||||
}
|
||||
l_end = l_item;
|
||||
}
|
||||
return l_list;
|
||||
}
|
||||
|
||||
static size_t maxSize(size_t a, size_t b)
|
||||
{
|
||||
return (a > b ? a : b);
|
||||
}
|
||||
|
||||
static size_t calcAddrLen(sa_family_t p_family, int p_dataSize)
|
||||
{
|
||||
switch(p_family)
|
||||
{
|
||||
case AF_INET:
|
||||
return sizeof(struct sockaddr_in);
|
||||
case AF_INET6:
|
||||
return sizeof(struct sockaddr_in6);
|
||||
case AF_PACKET:
|
||||
return maxSize(sizeof(struct sockaddr_ll), offsetof(struct sockaddr_ll, sll_addr) + p_dataSize);
|
||||
default:
|
||||
return maxSize(sizeof(struct sockaddr), offsetof(struct sockaddr, sa_data) + p_dataSize);
|
||||
}
|
||||
}
|
||||
|
||||
static void makeSockaddr(sa_family_t p_family, struct sockaddr *p_dest, void *p_data, size_t p_size)
|
||||
{
|
||||
switch(p_family)
|
||||
{
|
||||
case AF_INET:
|
||||
memcpy(&((struct sockaddr_in*)p_dest)->sin_addr, p_data, p_size);
|
||||
break;
|
||||
case AF_INET6:
|
||||
memcpy(&((struct sockaddr_in6*)p_dest)->sin6_addr, p_data, p_size);
|
||||
break;
|
||||
case AF_PACKET:
|
||||
memcpy(((struct sockaddr_ll*)p_dest)->sll_addr, p_data, p_size);
|
||||
((struct sockaddr_ll*)p_dest)->sll_halen = p_size;
|
||||
break;
|
||||
default:
|
||||
memcpy(p_dest->sa_data, p_data, p_size);
|
||||
break;
|
||||
}
|
||||
p_dest->sa_family = p_family;
|
||||
}
|
||||
|
||||
static void addToEnd(struct ifaddrs **p_resultList, struct ifaddrs *p_entry)
|
||||
{
|
||||
if(!*p_resultList)
|
||||
{
|
||||
*p_resultList = p_entry;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct ifaddrs *l_cur = *p_resultList;
|
||||
while(l_cur->ifa_next)
|
||||
{
|
||||
l_cur = l_cur->ifa_next;
|
||||
}
|
||||
l_cur->ifa_next = p_entry;
|
||||
}
|
||||
}
|
||||
|
||||
static void interpretLink(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, struct ifaddrs **p_resultList)
|
||||
{
|
||||
struct ifinfomsg *l_info = (struct ifinfomsg *)NLMSG_DATA(p_hdr);
|
||||
|
||||
size_t l_nameSize = 0;
|
||||
size_t l_addrSize = 0;
|
||||
size_t l_dataSize = 0;
|
||||
|
||||
size_t l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifinfomsg));
|
||||
struct rtattr *l_rta;
|
||||
for(l_rta = (struct rtattr *)(((char *)l_info) + NLMSG_ALIGN(sizeof(struct ifinfomsg))); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize))
|
||||
{
|
||||
void *l_rtaData = RTA_DATA(l_rta);
|
||||
size_t l_rtaDataSize = RTA_PAYLOAD(l_rta);
|
||||
switch(l_rta->rta_type)
|
||||
{
|
||||
case IFLA_ADDRESS:
|
||||
case IFLA_BROADCAST:
|
||||
l_addrSize += NLMSG_ALIGN(calcAddrLen(AF_PACKET, l_rtaDataSize));
|
||||
break;
|
||||
case IFLA_IFNAME:
|
||||
l_nameSize += NLMSG_ALIGN(l_rtaSize + 1);
|
||||
break;
|
||||
case IFLA_STATS:
|
||||
l_dataSize += NLMSG_ALIGN(l_rtaSize);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
struct ifaddrs *l_entry = malloc(sizeof(struct ifaddrs) + l_nameSize + l_addrSize + l_dataSize);
|
||||
memset(l_entry, 0, sizeof(struct ifaddrs));
|
||||
l_entry->ifa_name = "";
|
||||
|
||||
char *l_name = ((char *)l_entry) + sizeof(struct ifaddrs);
|
||||
char *l_addr = l_name + l_nameSize;
|
||||
char *l_data = l_addr + l_addrSize;
|
||||
|
||||
l_entry->ifa_flags = l_info->ifi_flags;
|
||||
|
||||
l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifinfomsg));
|
||||
for(l_rta = (struct rtattr *)(((char *)l_info) + NLMSG_ALIGN(sizeof(struct ifinfomsg))); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize))
|
||||
{
|
||||
void *l_rtaData = RTA_DATA(l_rta);
|
||||
size_t l_rtaDataSize = RTA_PAYLOAD(l_rta);
|
||||
switch(l_rta->rta_type)
|
||||
{
|
||||
case IFLA_ADDRESS:
|
||||
case IFLA_BROADCAST:
|
||||
{
|
||||
size_t l_addrLen = calcAddrLen(AF_PACKET, l_rtaDataSize);
|
||||
makeSockaddr(AF_PACKET, (struct sockaddr *)l_addr, l_rtaData, l_rtaDataSize);
|
||||
((struct sockaddr_ll *)l_addr)->sll_ifindex = l_info->ifi_index;
|
||||
((struct sockaddr_ll *)l_addr)->sll_hatype = l_info->ifi_type;
|
||||
if(l_rta->rta_type == IFLA_ADDRESS)
|
||||
{
|
||||
l_entry->ifa_addr = (struct sockaddr *)l_addr;
|
||||
}
|
||||
else
|
||||
{
|
||||
l_entry->ifa_broadaddr = (struct sockaddr *)l_addr;
|
||||
}
|
||||
l_addr += NLMSG_ALIGN(l_addrLen);
|
||||
break;
|
||||
}
|
||||
case IFLA_IFNAME:
|
||||
strncpy(l_name, l_rtaData, l_rtaDataSize);
|
||||
l_name[l_rtaDataSize] = '\0';
|
||||
l_entry->ifa_name = l_name;
|
||||
break;
|
||||
case IFLA_STATS:
|
||||
memcpy(l_data, l_rtaData, l_rtaDataSize);
|
||||
l_entry->ifa_data = l_data;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
addToEnd(p_resultList, l_entry);
|
||||
p_links[l_info->ifi_index - 1] = l_entry;
|
||||
}
|
||||
|
||||
static void interpretAddr(struct nlmsghdr *p_hdr, struct ifaddrs **p_links, struct ifaddrs **p_resultList)
|
||||
{
|
||||
struct ifaddrmsg *l_info = (struct ifaddrmsg *)NLMSG_DATA(p_hdr);
|
||||
|
||||
size_t l_nameSize = 0;
|
||||
size_t l_addrSize = 0;
|
||||
|
||||
int l_addedNetmask = 0;
|
||||
|
||||
size_t l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifaddrmsg));
|
||||
struct rtattr *l_rta;
|
||||
for(l_rta = (struct rtattr *)(((char *)l_info) + NLMSG_ALIGN(sizeof(struct ifaddrmsg))); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize))
|
||||
{
|
||||
void *l_rtaData = RTA_DATA(l_rta);
|
||||
size_t l_rtaDataSize = RTA_PAYLOAD(l_rta);
|
||||
if(l_info->ifa_family == AF_PACKET)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
switch(l_rta->rta_type)
|
||||
{
|
||||
case IFA_ADDRESS:
|
||||
case IFA_LOCAL:
|
||||
if((l_info->ifa_family == AF_INET || l_info->ifa_family == AF_INET6) && !l_addedNetmask)
|
||||
{ // make room for netmask
|
||||
l_addrSize += NLMSG_ALIGN(calcAddrLen(l_info->ifa_family, l_rtaDataSize));
|
||||
l_addedNetmask = 1;
|
||||
}
|
||||
case IFA_BROADCAST:
|
||||
l_addrSize += NLMSG_ALIGN(calcAddrLen(l_info->ifa_family, l_rtaDataSize));
|
||||
break;
|
||||
case IFA_LABEL:
|
||||
l_nameSize += NLMSG_ALIGN(l_rtaSize + 1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
struct ifaddrs *l_entry = malloc(sizeof(struct ifaddrs) + l_nameSize + l_addrSize);
|
||||
memset(l_entry, 0, sizeof(struct ifaddrs));
|
||||
l_entry->ifa_name = p_links[l_info->ifa_index - 1]->ifa_name;
|
||||
|
||||
char *l_name = ((char *)l_entry) + sizeof(struct ifaddrs);
|
||||
char *l_addr = l_name + l_nameSize;
|
||||
|
||||
l_entry->ifa_flags = l_info->ifa_flags | p_links[l_info->ifa_index - 1]->ifa_flags;
|
||||
|
||||
l_rtaSize = NLMSG_PAYLOAD(p_hdr, sizeof(struct ifaddrmsg));
|
||||
for(l_rta = (struct rtattr *)(((char *)l_info) + NLMSG_ALIGN(sizeof(struct ifaddrmsg))); RTA_OK(l_rta, l_rtaSize); l_rta = RTA_NEXT(l_rta, l_rtaSize))
|
||||
{
|
||||
void *l_rtaData = RTA_DATA(l_rta);
|
||||
size_t l_rtaDataSize = RTA_PAYLOAD(l_rta);
|
||||
switch(l_rta->rta_type)
|
||||
{
|
||||
case IFA_ADDRESS:
|
||||
case IFA_BROADCAST:
|
||||
case IFA_LOCAL:
|
||||
{
|
||||
size_t l_addrLen = calcAddrLen(l_info->ifa_family, l_rtaDataSize);
|
||||
makeSockaddr(l_info->ifa_family, (struct sockaddr *)l_addr, l_rtaData, l_rtaDataSize);
|
||||
if(l_info->ifa_family == AF_INET6)
|
||||
{
|
||||
if(IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)l_rtaData) || IN6_IS_ADDR_MC_LINKLOCAL((struct in6_addr *)l_rtaData))
|
||||
{
|
||||
((struct sockaddr_in6 *)l_addr)->sin6_scope_id = l_info->ifa_index;
|
||||
}
|
||||
}
|
||||
|
||||
if(l_rta->rta_type == IFA_ADDRESS)
|
||||
{ // apparently in a point-to-point network IFA_ADDRESS contains the dest address and IFA_LOCAL contains the local address
|
||||
if(l_entry->ifa_addr)
|
||||
{
|
||||
l_entry->ifa_dstaddr = (struct sockaddr *)l_addr;
|
||||
}
|
||||
else
|
||||
{
|
||||
l_entry->ifa_addr = (struct sockaddr *)l_addr;
|
||||
}
|
||||
}
|
||||
else if(l_rta->rta_type == IFA_LOCAL)
|
||||
{
|
||||
if(l_entry->ifa_addr)
|
||||
{
|
||||
l_entry->ifa_dstaddr = l_entry->ifa_addr;
|
||||
}
|
||||
l_entry->ifa_addr = (struct sockaddr *)l_addr;
|
||||
}
|
||||
else
|
||||
{
|
||||
l_entry->ifa_broadaddr = (struct sockaddr *)l_addr;
|
||||
}
|
||||
l_addr += NLMSG_ALIGN(l_addrLen);
|
||||
break;
|
||||
}
|
||||
case IFA_LABEL:
|
||||
strncpy(l_name, l_rtaData, l_rtaDataSize);
|
||||
l_name[l_rtaDataSize] = '\0';
|
||||
l_entry->ifa_name = l_name;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(l_entry->ifa_addr && (l_entry->ifa_addr->sa_family == AF_INET || l_entry->ifa_addr->sa_family == AF_INET6))
|
||||
{
|
||||
unsigned l_maxPrefix = (l_entry->ifa_addr->sa_family == AF_INET ? 32 : 128);
|
||||
unsigned l_prefix = (l_info->ifa_prefixlen > l_maxPrefix ? l_maxPrefix : l_info->ifa_prefixlen);
|
||||
char l_mask[16] = {0};
|
||||
unsigned i;
|
||||
for(i=0; i<(l_prefix/8); ++i)
|
||||
{
|
||||
l_mask[i] = 0xff;
|
||||
}
|
||||
l_mask[i] = 0xff << (8 - (l_prefix % 8));
|
||||
|
||||
makeSockaddr(l_entry->ifa_addr->sa_family, (struct sockaddr *)l_addr, l_mask, l_maxPrefix / 8);
|
||||
l_entry->ifa_netmask = (struct sockaddr *)l_addr;
|
||||
}
|
||||
|
||||
addToEnd(p_resultList, l_entry);
|
||||
}
|
||||
|
||||
static void interpret(int p_socket, NetlinkList *p_netlinkList, struct ifaddrs **p_links, struct ifaddrs **p_resultList)
|
||||
{
|
||||
pid_t l_pid = getpid();
|
||||
for(; p_netlinkList; p_netlinkList = p_netlinkList->m_next)
|
||||
{
|
||||
unsigned int l_nlsize = p_netlinkList->m_size;
|
||||
struct nlmsghdr *l_hdr;
|
||||
for(l_hdr = p_netlinkList->m_data; NLMSG_OK(l_hdr, l_nlsize); l_hdr = NLMSG_NEXT(l_hdr, l_nlsize))
|
||||
{
|
||||
if((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(l_hdr->nlmsg_type == NLMSG_DONE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if(l_hdr->nlmsg_type == RTM_NEWLINK)
|
||||
{
|
||||
interpretLink(l_hdr, p_links, p_resultList);
|
||||
}
|
||||
else if(l_hdr->nlmsg_type == RTM_NEWADDR)
|
||||
{
|
||||
interpretAddr(l_hdr, p_links, p_resultList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned countLinks(int p_socket, NetlinkList *p_netlinkList)
|
||||
{
|
||||
unsigned l_links = 0;
|
||||
pid_t l_pid = getpid();
|
||||
for(; p_netlinkList; p_netlinkList = p_netlinkList->m_next)
|
||||
{
|
||||
unsigned int l_nlsize = p_netlinkList->m_size;
|
||||
struct nlmsghdr *l_hdr;
|
||||
for(l_hdr = p_netlinkList->m_data; NLMSG_OK(l_hdr, l_nlsize); l_hdr = NLMSG_NEXT(l_hdr, l_nlsize))
|
||||
{
|
||||
if((pid_t)l_hdr->nlmsg_pid != l_pid || (int)l_hdr->nlmsg_seq != p_socket)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(l_hdr->nlmsg_type == NLMSG_DONE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if(l_hdr->nlmsg_type == RTM_NEWLINK)
|
||||
{
|
||||
++l_links;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return l_links;
|
||||
}
|
||||
|
||||
int getifaddrs(struct ifaddrs **ifap)
|
||||
{
|
||||
if(!ifap)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
*ifap = NULL;
|
||||
|
||||
int l_socket = netlink_socket();
|
||||
if(l_socket < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
NetlinkList *l_linkResults = getResultList(l_socket, RTM_GETLINK);
|
||||
if(!l_linkResults)
|
||||
{
|
||||
close(l_socket);
|
||||
return -1;
|
||||
}
|
||||
|
||||
NetlinkList *l_addrResults = getResultList(l_socket, RTM_GETADDR);
|
||||
if(!l_addrResults)
|
||||
{
|
||||
close(l_socket);
|
||||
freeResultList(l_linkResults);
|
||||
return -1;
|
||||
}
|
||||
|
||||
unsigned l_numLinks = countLinks(l_socket, l_linkResults) + countLinks(l_socket, l_addrResults);
|
||||
struct ifaddrs *l_links[l_numLinks];
|
||||
memset(l_links, 0, l_numLinks * sizeof(struct ifaddrs *));
|
||||
|
||||
interpret(l_socket, l_linkResults, l_links, ifap);
|
||||
interpret(l_socket, l_addrResults, l_links, ifap);
|
||||
|
||||
freeResultList(l_linkResults);
|
||||
freeResultList(l_addrResults);
|
||||
close(l_socket);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void freeifaddrs(struct ifaddrs *ifa)
|
||||
{
|
||||
struct ifaddrs *l_cur;
|
||||
while(ifa)
|
||||
{
|
||||
l_cur = ifa;
|
||||
ifa = ifa->ifa_next;
|
||||
free(l_cur);
|
||||
}
|
||||
}
|
54
externals/android-ifaddrs/ifaddrs.h
vendored
54
externals/android-ifaddrs/ifaddrs.h
vendored
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1995, 1999
|
||||
* Berkeley Software Design, Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp
|
||||
*/
|
||||
|
||||
#ifndef _IFADDRS_H_
|
||||
#define _IFADDRS_H_
|
||||
|
||||
struct ifaddrs {
|
||||
struct ifaddrs *ifa_next;
|
||||
char *ifa_name;
|
||||
unsigned int ifa_flags;
|
||||
struct sockaddr *ifa_addr;
|
||||
struct sockaddr *ifa_netmask;
|
||||
struct sockaddr *ifa_dstaddr;
|
||||
void *ifa_data;
|
||||
};
|
||||
|
||||
/*
|
||||
* This may have been defined in <net/if.h>. Note that if <net/if.h> is
|
||||
* to be included it must be included before this header file.
|
||||
*/
|
||||
#ifndef ifa_broadaddr
|
||||
#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern int getifaddrs(struct ifaddrs **ifap);
|
||||
extern void freeifaddrs(struct ifaddrs *ifa);
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
2
externals/boost
vendored
2
externals/boost
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 32f5cd8ebb35b29ccb3860861bd285f80804bc85
|
||||
Subproject commit 3c27c785ad0f8a742af02e620dc225673f3a12d8
|
100
externals/cmake-modules/CitraHandleSystemLibs.cmake
vendored
Normal file
100
externals/cmake-modules/CitraHandleSystemLibs.cmake
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
option(USE_SYSTEM_LIBS "Use system libraries over bundled ones" OFF)
|
||||
|
||||
# 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)
|
||||
option(USE_SYSTEM_LIBUSB "Use the system libusb (instead of the bundled libusb)" OFF)
|
||||
option(USE_SYSTEM_CPP_JWT "Use the system cpp-jwt (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_SOUNDTOUCH "Use the system SoundTouch (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_CPP_HTTPLIB "Use the system cpp-httplib (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_JSON "Use the system JSON (nlohmann-json3) package (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_DYNARMIC "Use the system dynarmic (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_FMT "Use the system fmt (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_XBYAK "Use the system xbyak (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_INIH "Use the system inih (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_FFMPEG_HEADERS "Use the system FFmpeg headers (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_GLSLANG "Use the system glslang and SPIR-V libraries (instead of the bundled ones)" OFF)
|
||||
option(USE_SYSTEM_ZSTD "Use the system Zstandard library (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_ENET "Use the system libenet (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_CRYPTOPP "Use the system cryptopp (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_CUBEB "Use the system cubeb (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_LODEPNG "Use the system lodepng (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_OPENAL "Use the system OpenAL (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_VMA "Use the system VulkanMemoryAllocator (instead of the bundled one)" OFF)
|
||||
option(USE_SYSTEM_VULKAN_HEADERS "Use the system Vulkan headers (instead of the bundled ones)" OFF)
|
||||
option(USE_SYSTEM_CATCH2 "Use the system Catch2 (instead of the bundled one)" OFF)
|
||||
|
||||
# Qt and MoltenVK are handled separately
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_SDL2 "Disable system SDL2" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_BOOST "Disable system Boost" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_OPENSSL "Disable system OpenSSL" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_LIBUSB "Disable system LibUSB" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_CPP_JWT "Disable system cpp-jwt" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_SOUNDTOUCH "Disable system SoundTouch" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_CPP_HTTPLIB "Disable system cpp-httplib" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_JSON "Disable system JSON" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_DYNARMIC "Disable system Dynarmic" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_FMT "Disable system fmt" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_XBYAK "Disable system xbyak" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_INIH "Disable system inih" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_FFMPEG_HEADERS "Disable system ffmpeg" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_GLSLANG "Disable system glslang" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_ZSTD "Disable system Zstandard" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_ENET "Disable system libenet" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_CRYPTOPP "Disable system cryptopp" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_CUBEB "Disable system cubeb" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_LODEPNG "Disable system lodepng" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_OPENAL "Disable system OpenAL" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_VMA "Disable system VulkanMemoryAllocator" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_VULKAN_HEADERS "Disable system Vulkan headers" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(DISABLE_SYSTEM_CATCH2 "Disable system Catch2" OFF "USE_SYSTEM_LIBS" OFF)
|
||||
|
||||
set(LIB_VAR_LIST
|
||||
SDL2
|
||||
BOOST
|
||||
OPENSSL
|
||||
LIBUSB
|
||||
CPP_JWT
|
||||
SOUNDTOUCH
|
||||
CPP_HTTPLIB
|
||||
JSON
|
||||
DYNARMIC
|
||||
FMT
|
||||
XBYAK
|
||||
INIH
|
||||
FFMPEG_HEADERS
|
||||
GLSLANG
|
||||
ZSTD
|
||||
ENET
|
||||
CRYPTOPP
|
||||
CUBEB
|
||||
LODEPNG
|
||||
OPENAL
|
||||
VMA
|
||||
VULKAN_HEADERS
|
||||
CATCH2
|
||||
)
|
||||
|
||||
# First, check that USE_SYSTEM_XXX is not used with USE_SYSTEM_LIBS
|
||||
|
||||
if(USE_SYSTEM_LIBS)
|
||||
foreach(CURRENT_LIB IN LISTS LIB_VAR_LIST)
|
||||
if(USE_SYSTEM_${CURRENT_LIB})
|
||||
unset(USE_SYSTEM_${CURRENT_LIB})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Next, set which libraries to use
|
||||
|
||||
foreach(CURRENT_LIB IN LISTS LIB_VAR_LIST)
|
||||
if(NOT DISABLE_SYSTEM_${CURRENT_LIB})
|
||||
set(USE_SYSTEM_${CURRENT_LIB} ON CACHE BOOL "Using system ${CURRENT_LIB}" FORCE)
|
||||
else()
|
||||
# Explicitly disable this in case of multiple CMake invocations
|
||||
set(USE_SYSTEM_${CURRENT_LIB} OFF CACHE BOOL "Using system ${CURRENT_LIB}" FORCE)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
46
externals/cmake-modules/FindCppHttp.cmake
vendored
Normal file
46
externals/cmake-modules/FindCppHttp.cmake
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
if(NOT CppHttp_FOUND)
|
||||
pkg_check_modules(CPP_HTTPLIB cpp-httplib)
|
||||
|
||||
if (CPP_HTTPLIB_FOUND)
|
||||
find_path(HTTPLIB_INCLUDE_DIR NAMES httplib.h
|
||||
PATHS
|
||||
${CPP_HTTPLIB_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library(HTTPLIB_LIBRARY NAMES cpp-httplib
|
||||
PATHS
|
||||
${CPP_HTTPLIB_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
set(HTTPLIB_VERSION ${CPP_HTTPLIB_VERSION})
|
||||
|
||||
if (NOT TARGET cpp-httplib::cpp-httplib)
|
||||
add_library(cpp-httplib::cpp-httplib INTERFACE IMPORTED)
|
||||
set_target_properties(cpp-httplib::cpp-httplib PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${HTTPLIB_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${HTTPLIB_LIBRARY}"
|
||||
IMPORTED_LOCATION "${HTTPLIB_LIBRARY}"
|
||||
)
|
||||
add_library(httplib::httplib ALIAS cpp-httplib::cpp-httplib)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Cpp-httplib not found via pkg-config, trying CMake...")
|
||||
find_package(httplib)
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(CppHttp REQUIRED_VARS HTTPLIB_INCLUDE_DIR HTTPLIB_LIBRARY VERSION_VAR HTTPLIB_VERSION)
|
||||
|
||||
endif()
|
||||
|
||||
if(CppHttp_FOUND AND NOT TARGET cpp-httplib::cpp-httplib)
|
||||
add_library(cpp-httplib::cpp-httplib INTERFACE IMPORTED)
|
||||
set_target_properties(cpp-httplib::cpp-httplib PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${CPP-HTTP_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${CPP-HTTP_LIBRARIES}"
|
||||
IMPORTED_LOCATION "${CPP-HTTP_LIBRARIES}"
|
||||
)
|
||||
endif()
|
36
externals/cmake-modules/FindOpenAL.cmake
vendored
Normal file
36
externals/cmake-modules/FindOpenAL.cmake
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
if(NOT OPENAL_FOUND)
|
||||
pkg_check_modules(OPENAL_TMP openal)
|
||||
|
||||
find_path(OPENAL_INCLUDE_DIRS NAMES al.h
|
||||
PATHS
|
||||
${OPENAL_TMP_INCLUDE_DIRS}
|
||||
/usr/include/AL
|
||||
/usr/include
|
||||
/usr/local/include/AL
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library(OPENAL_LIBRARY_DIRS NAMES openal
|
||||
PATHS
|
||||
${OPENAL_TMP_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(OPENAL_INCLUDE_DIRS AND OPENAL_LIBRARY_DIRS)
|
||||
set(OPENAL_FOUND TRUE CACHE INTERNAL "OpenAL found")
|
||||
message(STATUS "Found OpenAL: ${OPENAL_LIBRARY_DIRS}, ${OPENAL_INCLUDE_DIRS}")
|
||||
else()
|
||||
set(OPENAL_FOUND FALSE CACHE INTERNAL "OpenAL found")
|
||||
message(STATUS "OpenAL not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(OPENAL_FOUND AND NOT TARGET OpenAL::OpenAL)
|
||||
add_library(OpenAL::OpenAL UNKNOWN IMPORTED)
|
||||
set_target_properties(OpenAL::OpenAL PROPERTIES
|
||||
INCLUDE_DIRECTORIES ${OPENAL_INCLUDE_DIRS}
|
||||
INTERFACE_LINK_LIBRARIES ${OPENAL_LIBRARY_DIRS}
|
||||
IMPORTED_LOCATION ${OPENAL_LIBRARY_DIRS}
|
||||
)
|
||||
endif()
|
27
externals/cmake-modules/FindSoundTouch.cmake
vendored
Normal file
27
externals/cmake-modules/FindSoundTouch.cmake
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
if(NOT SOUNDTOUCH_FOUND)
|
||||
pkg_check_modules(SOUNDTOUCH_TMP soundtouch)
|
||||
|
||||
find_path(SOUNDTOUCH_INCLUDE_DIRS NAMES SoundTouch.h
|
||||
PATHS
|
||||
${SOUNDTOUCH_TMP_INCLUDE_DIRS}
|
||||
/usr/include/soundtouch
|
||||
/usr/include
|
||||
/usr/local/include/soundtouch
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library(SOUNDTOUCH_LIBRARIES NAMES SoundTouch
|
||||
PATHS
|
||||
${SOUNDTOUCH_TMP_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(SOUNDTOUCH_INCLUDE_DIRS AND SOUNDTOUCH_LIBRARIES)
|
||||
set(SOUNDTOUCH_FOUND TRUE CACHE INTERNAL "SoundTouch found")
|
||||
message(STATUS "Found SoundTouch: ${SOUNDTOUCH_INCLUDE_DIRS}, ${SOUNDTOUCH_LIBRARIES}")
|
||||
else()
|
||||
set(SOUNDTOUCH_FOUND FALSE CACHE INTERNAL "SoundTouch found")
|
||||
message(STATUS "SoundTouch not found.")
|
||||
endif()
|
||||
endif()
|
35
externals/cmake-modules/Findcryptopp.cmake
vendored
Normal file
35
externals/cmake-modules/Findcryptopp.cmake
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
if(NOT CRYPTOPP_FOUND)
|
||||
pkg_search_module(CRYPTOPP_TMP crypto++ cryptopp)
|
||||
|
||||
find_path(CRYPTOPP_INCLUDE_DIRS NAMES cryptlib.h
|
||||
PATHS
|
||||
${CRYPTOPP_TMP_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
PATH_SUFFIXES crypto++ cryptopp
|
||||
)
|
||||
|
||||
find_library(CRYPTOPP_LIBRARY_DIRS NAMES crypto++ cryptopp
|
||||
PATHS
|
||||
${CRYPTOPP_TMP_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(CRYPTOPP_INCLUDE_DIRS AND CRYPTOPP_LIBRARY_DIRS)
|
||||
set(CRYPTOPP_FOUND TRUE CACHE INTERNAL "Found cryptopp")
|
||||
message(STATUS "Found cryptopp: ${CRYPTOPP_LIBRARY_DIRS}, ${CRYPTOPP_INCLUDE_DIRS}")
|
||||
else()
|
||||
set(CRYPTOPP_FOUND FALSE CACHE INTERNAL "Found cryptopp")
|
||||
message(STATUS "Cryptopp not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CRYPTOPP_FOUND AND NOT TARGET cryptopp::cryptopp)
|
||||
add_library(cryptopp::cryptopp UNKNOWN IMPORTED)
|
||||
set_target_properties(cryptopp::cryptopp PROPERTIES
|
||||
INCLUDE_DIRECTORIES ${CRYPTOPP_INCLUDE_DIRS}
|
||||
INTERFACE_LINK_LIBRARIES ${CRYPTOPP_LIBRARY_DIRS}
|
||||
IMPORTED_LOCATION ${CRYPTOPP_LIBRARY_DIRS}
|
||||
)
|
||||
endif()
|
63
externals/cmake-modules/Findinih.cmake
vendored
Normal file
63
externals/cmake-modules/Findinih.cmake
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
if(NOT inih_FOUND)
|
||||
# Inih includes both a base library and INIReader
|
||||
# We must link against both to avoid linker errors.
|
||||
|
||||
pkg_check_modules(INIR_TEMP INIReader)
|
||||
pkg_check_modules(INIH_TEMP inih)
|
||||
|
||||
|
||||
find_path(INIR_INCLUDE_DIR NAMES INIReader.h
|
||||
PATHS
|
||||
${INIR_TEMP_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_path(INIH_INCLUDE_DIR NAMES ini.h
|
||||
PATHS
|
||||
${INIH_TEMP_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/use/local/include
|
||||
)
|
||||
|
||||
find_library(INIR_LIBRARIES NAMES INIReader
|
||||
PATHS
|
||||
${INIR_TEMP_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
find_library(INIH_LIBRARIES NAMES inih
|
||||
PATHS
|
||||
${INIH_TEMP_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(INIR_INCLUDE_DIR AND INIH_INCLUDE_DIR AND INIR_LIBRARIES AND INIH_LIBRARIES)
|
||||
set(inih_FOUND TRUE CACHE INTERNAL "Found inih library")
|
||||
message(STATUS "Found inih ${INIR_INCLUDE_DIR} ${INIH_INCLUDE_DIR} ${INIR_LIBRARIES} ${INIH_LIBRARIES}")
|
||||
else()
|
||||
set(inih_FOUND FALSE CACHE INTERNAL "Found inih library")
|
||||
message(STATUS "Inih not found.")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(inih_FOUND AND NOT TARGET inih::inir OR NOT TARGET inih::inih)
|
||||
add_library(inih::inir INTERFACE IMPORTED)
|
||||
set_target_properties(inih::inir PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${INIR_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${INIR_LIBRARIES}"
|
||||
IMPORTED_LOCATION "${INIR_LIBRARIES}"
|
||||
)
|
||||
|
||||
add_library(inih::inih INTERFACE IMPORTED)
|
||||
set_target_properties(inih::inih PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${INIH_INCLUDE_DIR}"
|
||||
INTERFACE_LINK_LIBRARIES "${INIH_LIBRARES}"
|
||||
IMPORTED_LOCATION ${INIH_LIBRARIES}
|
||||
)
|
||||
|
||||
endif()
|
||||
|
34
externals/cmake-modules/Findlibenet.cmake
vendored
Normal file
34
externals/cmake-modules/Findlibenet.cmake
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
if(NOT libenet_FOUND)
|
||||
pkg_check_modules(ENET_TMP libenet)
|
||||
|
||||
find_path(libenet_INCLUDE_DIRS NAMES enet.h PATH_SUFFIXES enet
|
||||
PATHS
|
||||
${ENET_TMP_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library(libenet_LIBRARY_DIRS NAMES enet
|
||||
PATHS
|
||||
${ENET_TMP_LIBRARY_DIRS}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(libenet_INCLUDE_DIRS AND libenet_LIBRARY_DIRS)
|
||||
set(libenet_FOUND TRUE CACHE INTERNAL "Found libenet")
|
||||
message(STATUS "Found libenet ${libenet_LIBRARY_DIRS}, ${libenet_INCLUDE_DIRS}")
|
||||
else()
|
||||
set(libenet_FOUND FALSE CACHE INTERNAL "Found libenet")
|
||||
message(STATUS "Libenet not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(libenet_FOUND AND NOT TARGET libenet::libenet)
|
||||
add_library(libenet::libenet UNKNOWN IMPORTED)
|
||||
set_target_properties(libenet::libenet PROPERTIES
|
||||
INCLUDE_DIRECTORIES ${libenet_INCLUDE_DIRS}
|
||||
INTERFACE_LINK_LIBRARIES ${libenet_LIBRARY_DIRS}
|
||||
IMPORTED_LOCATION ${libenet_LIBRARY_DIRS}
|
||||
)
|
||||
endif()
|
31
externals/cmake-modules/Findlodepng.cmake
vendored
Normal file
31
externals/cmake-modules/Findlodepng.cmake
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
if(NOT LODEPNG_FOUND)
|
||||
find_path(LODEPNG_INCLUDE_DIRS NAMES lodepng.h
|
||||
PATHS
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library(LODEPNG_LIBRARY_DIRS NAMES lodepng
|
||||
PATHS
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
)
|
||||
|
||||
if(LODEPNG_INCLUDE_DIRS AND LODEPNG_LIBRARY_DIRS)
|
||||
set(LODEPNG_FOUND TRUE CACHE INTERNAL "Found lodepng")
|
||||
message(STATUS "Found lodepng: ${LODEPNG_LIBRARY_DIRS}, ${LODEPNG_INCLUDE_DIRS}")
|
||||
else()
|
||||
set(LODEPNG_FOUND FALSE CACHE INTERNAL "Found lodepng")
|
||||
message(STATUS "Lodepng not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LODEPNG_FOUND AND NOT TARGET lodepng::lodepng)
|
||||
add_library(lodepng::lodepng UNKNOWN IMPORTED)
|
||||
set_target_properties(lodepng::lodepng PROPERTIES
|
||||
INCLUDE_DIRECTORIES ${LODEPNG_INCLUDE_DIRS}
|
||||
INTERFACE_LINK_LIBRARIES ${LODEPNG_LIBRARY_DIRS}
|
||||
IMPORTED_LOCATION ${LODEPNG_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
endif()
|
2
externals/cryptopp
vendored
2
externals/cryptopp
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 511806c0eba8ba5b5cedd4b4a814e96df92864a6
|
||||
Subproject commit af7d1050bf2287072edd629be133da458a3cf978
|
2
externals/cryptopp-cmake
vendored
2
externals/cryptopp-cmake
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 15798ac9c2611d5c7f9ba832e2c9159bdd8945f2
|
||||
Subproject commit a99c80c26686e44eddf0432140ae397f3efbd0b3
|
2
externals/cubeb
vendored
2
externals/cubeb
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 48689ae7a73caeb747953f9ed664dc71d2f918d8
|
||||
Subproject commit 799e775484b8fce7e986ee7a4f4b651fec2bca07
|
2
externals/discord-rpc
vendored
2
externals/discord-rpc
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 963aa9f3e5ce81a4682c6ca3d136cddda614db33
|
||||
Subproject commit 20cc99aeffa08a4834f156b6ab49ed68618cf94a
|
2
externals/dynarmic
vendored
2
externals/dynarmic
vendored
|
@ -1 +1 @@
|
|||
Subproject commit d333a09b3b9152af3cb442902ae8ea18d8416470
|
||||
Subproject commit 30f1a3c6289075ef4af08f5ec502be2fc8627a0c
|
88
externals/faad2/CMakeLists.txt
vendored
Normal file
88
externals/faad2/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,88 @@
|
|||
# Sources cut down to just what we need for AAC-LC.
|
||||
set(FAAD2_SOURCE_DIR "faad2/libfaad")
|
||||
add_library(faad2 STATIC EXCLUDE_FROM_ALL
|
||||
"${FAAD2_SOURCE_DIR}/bits.c"
|
||||
"${FAAD2_SOURCE_DIR}/cfft.c"
|
||||
"${FAAD2_SOURCE_DIR}/common.c"
|
||||
"${FAAD2_SOURCE_DIR}/decoder.c"
|
||||
"${FAAD2_SOURCE_DIR}/drc.c"
|
||||
"${FAAD2_SOURCE_DIR}/error.c"
|
||||
"${FAAD2_SOURCE_DIR}/filtbank.c"
|
||||
"${FAAD2_SOURCE_DIR}/huffman.c"
|
||||
"${FAAD2_SOURCE_DIR}/is.c"
|
||||
"${FAAD2_SOURCE_DIR}/mdct.c"
|
||||
"${FAAD2_SOURCE_DIR}/mp4.c"
|
||||
"${FAAD2_SOURCE_DIR}/ms.c"
|
||||
"${FAAD2_SOURCE_DIR}/output.c"
|
||||
"${FAAD2_SOURCE_DIR}/pns.c"
|
||||
"${FAAD2_SOURCE_DIR}/pulse.c"
|
||||
"${FAAD2_SOURCE_DIR}/specrec.c"
|
||||
"${FAAD2_SOURCE_DIR}/syntax.c"
|
||||
"${FAAD2_SOURCE_DIR}/tns.c"
|
||||
)
|
||||
target_include_directories(faad2 PUBLIC faad2/include PRIVATE "${FAAD2_SOURCE_DIR}")
|
||||
|
||||
# Configure compile definitions.
|
||||
|
||||
# Read version from properties file for configuring constant.
|
||||
file(READ faad2/properties.json FAAD_PROPERTIES_JSON)
|
||||
string(JSON FAAD_VERSION GET ${FAAD_PROPERTIES_JSON} PACKAGE_VERSION)
|
||||
message(STATUS "Building faad2 version ${FAAD_VERSION}")
|
||||
|
||||
# Check for functions and headers.
|
||||
include(CheckFunctionExists)
|
||||
include(CheckIncludeFiles)
|
||||
check_function_exists(getpwuid HAVE_GETPWUID)
|
||||
check_function_exists(lrintf HAVE_LRINTF)
|
||||
check_function_exists(memcpy HAVE_MEMCPY)
|
||||
check_function_exists(strchr HAVE_STRCHR)
|
||||
check_function_exists(strsep HAVE_STRSEP)
|
||||
check_include_files(dlfcn.h HAVE_DLFCN_H)
|
||||
check_include_files(errno.h HAVE_ERRNO_H)
|
||||
check_include_files(float.h HAVE_FLOAT_H)
|
||||
check_include_files(inttypes.h HAVE_INTTYPES_H)
|
||||
check_include_files(IOKit/IOKitLib.h HAVE_IOKIT_IOKITLIB_H)
|
||||
check_include_files(limits.h HAVE_LIMITS_H)
|
||||
check_include_files(mathf.h HAVE_MATHF_H)
|
||||
check_include_files(stdint.h HAVE_STDINT_H)
|
||||
check_include_files(stdio.h HAVE_STDIO_H)
|
||||
check_include_files(stdlib.h HAVE_STDLIB_H)
|
||||
check_include_files(strings.h HAVE_STRINGS_H)
|
||||
check_include_files(string.h HAVE_STRING_H)
|
||||
check_include_files(sysfs/libsysfs.h HAVE_SYSFS_LIBSYSFS_H)
|
||||
check_include_files(sys/stat.h HAVE_SYS_STAT_H)
|
||||
check_include_files(sys/time.h HAVE_SYS_TIME_H)
|
||||
check_include_files(sys/types.h HAVE_SYS_TYPES_H)
|
||||
check_include_files(unistd.h HAVE_UNISTD_H)
|
||||
|
||||
# faad2 uses a relative include for its config.h which breaks under CMake.
|
||||
# We can use target_compile_definitions to pass on the configuration instead.
|
||||
target_compile_definitions(faad2 PRIVATE
|
||||
-DFAAD_VERSION=${FAAD_VERSION}
|
||||
-DPACKAGE_VERSION=\"${FAAD_VERSION}\"
|
||||
-DSTDC_HEADERS
|
||||
-DHAVE_GETPWUID=${HAVE_GETPWUID}
|
||||
-DHAVE_LRINTF=${HAVE_LRINTF}
|
||||
-DHAVE_MEMCPY=${HAVE_MEMCPY}
|
||||
-DHAVE_STRCHR=${HAVE_STRCHR}
|
||||
-DHAVE_STRSEP=${HAVE_STRSEP}
|
||||
-DHAVE_DLFCN_H=${HAVE_DLFCN_H}
|
||||
-DHAVE_ERRNO_H=${HAVE_ERRNO_H}
|
||||
-DHAVE_FLOAT_H=${HAVE_FLOAT_H}
|
||||
-DHAVE_INTTYPES_H=${HAVE_INTTYPES_H}
|
||||
-DHAVE_IOKIT_IOKITLIB_H=${HAVE_IOKIT_IOKITLIB_H}
|
||||
-DHAVE_LIMITS_H=${HAVE_LIMITS_H}
|
||||
-DHAVE_MATHF_H=${HAVE_MATHF_H}
|
||||
-DHAVE_STDINT_H=${HAVE_STDINT_H}
|
||||
-DHAVE_STDIO_H=${HAVE_STDIO_H}
|
||||
-DHAVE_STDLIB_H=${HAVE_STDLIB_H}
|
||||
-DHAVE_STRINGS_H=${HAVE_STRINGS_H}
|
||||
-DHAVE_STRING_H=${HAVE_STRING_H}
|
||||
-DHAVE_SYSFS_LIBSYSFS_H=${HAVE_SYSFS_LIBSYSFS_H}
|
||||
-DHAVE_SYS_STAT_H=${HAVE_SYS_STAT_H}
|
||||
-DHAVE_SYS_TIME_H=${HAVE_SYS_TIME_H}
|
||||
-DHAVE_SYS_TYPES_H=${HAVE_SYS_TYPES_H}
|
||||
-DHAVE_UNISTD_H=${HAVE_UNISTD_H}
|
||||
# Only compile for AAC-LC decoding.
|
||||
-DLC_ONLY_DECODER -DDISABLE_SBR
|
||||
)
|
1
externals/faad2/faad2
vendored
Submodule
1
externals/faad2/faad2
vendored
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 09b3c850c606e7fedd06597223e54344e8d23c8c
|
2
externals/fmt
vendored
2
externals/fmt
vendored
|
@ -1 +1 @@
|
|||
Subproject commit a33701196adfad74917046096bf5a2aa0ab0bb50
|
||||
Subproject commit 2dd4fa8742fdac36468f8d8ea3e06e78215551f8
|
9
externals/gamemode/CMakeLists.txt
vendored
Normal file
9
externals/gamemode/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
# SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
project(gamemode LANGUAGES CXX C)
|
||||
|
||||
add_library(gamemode include/gamemode_client.h)
|
||||
|
||||
target_include_directories(gamemode PUBLIC include)
|
||||
set_target_properties(gamemode PROPERTIES LINKER_LANGUAGE C)
|
379
externals/gamemode/include/gamemode_client.h
vendored
Normal file
379
externals/gamemode/include/gamemode_client.h
vendored
Normal file
|
@ -0,0 +1,379 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2017-2019 Feral Interactive
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
/*
|
||||
|
||||
Copyright (c) 2017-2019, Feral Interactive
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Feral Interactive nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
#ifndef CLIENT_GAMEMODE_H
|
||||
#define CLIENT_GAMEMODE_H
|
||||
/*
|
||||
* GameMode supports the following client functions
|
||||
* Requests are refcounted in the daemon
|
||||
*
|
||||
* int gamemode_request_start() - Request gamemode starts
|
||||
* 0 if the request was sent successfully
|
||||
* -1 if the request failed
|
||||
*
|
||||
* int gamemode_request_end() - Request gamemode ends
|
||||
* 0 if the request was sent successfully
|
||||
* -1 if the request failed
|
||||
*
|
||||
* GAMEMODE_AUTO can be defined to make the above two functions apply during static init and
|
||||
* destruction, as appropriate. In this configuration, errors will be printed to stderr
|
||||
*
|
||||
* int gamemode_query_status() - Query the current status of gamemode
|
||||
* 0 if gamemode is inactive
|
||||
* 1 if gamemode is active
|
||||
* 2 if gamemode is active and this client is registered
|
||||
* -1 if the query failed
|
||||
*
|
||||
* int gamemode_request_start_for(pid_t pid) - Request gamemode starts for another process
|
||||
* 0 if the request was sent successfully
|
||||
* -1 if the request failed
|
||||
* -2 if the request was rejected
|
||||
*
|
||||
* int gamemode_request_end_for(pid_t pid) - Request gamemode ends for another process
|
||||
* 0 if the request was sent successfully
|
||||
* -1 if the request failed
|
||||
* -2 if the request was rejected
|
||||
*
|
||||
* int gamemode_query_status_for(pid_t pid) - Query status of gamemode for another process
|
||||
* 0 if gamemode is inactive
|
||||
* 1 if gamemode is active
|
||||
* 2 if gamemode is active and this client is registered
|
||||
* -1 if the query failed
|
||||
*
|
||||
* const char* gamemode_error_string() - Get an error string
|
||||
* returns a string describing any of the above errors
|
||||
*
|
||||
* Note: All the above requests can be blocking - dbus requests can and will block while the daemon
|
||||
* handles the request. It is not recommended to make these calls in performance critical code
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
static char internal_gamemode_client_error_string[512] = { 0 };
|
||||
|
||||
/**
|
||||
* Load libgamemode dynamically to dislodge us from most dependencies.
|
||||
* This allows clients to link and/or use this regardless of runtime.
|
||||
* See SDL2 for an example of the reasoning behind this in terms of
|
||||
* dynamic versioning as well.
|
||||
*/
|
||||
static volatile int internal_libgamemode_loaded = 1;
|
||||
|
||||
/* Typedefs for the functions to load */
|
||||
typedef int (*api_call_return_int)(void);
|
||||
typedef const char *(*api_call_return_cstring)(void);
|
||||
typedef int (*api_call_pid_return_int)(pid_t);
|
||||
|
||||
/* Storage for functors */
|
||||
static api_call_return_int REAL_internal_gamemode_request_start = NULL;
|
||||
static api_call_return_int REAL_internal_gamemode_request_end = NULL;
|
||||
static api_call_return_int REAL_internal_gamemode_query_status = NULL;
|
||||
static api_call_return_cstring REAL_internal_gamemode_error_string = NULL;
|
||||
static api_call_pid_return_int REAL_internal_gamemode_request_start_for = NULL;
|
||||
static api_call_pid_return_int REAL_internal_gamemode_request_end_for = NULL;
|
||||
static api_call_pid_return_int REAL_internal_gamemode_query_status_for = NULL;
|
||||
|
||||
/**
|
||||
* Internal helper to perform the symbol binding safely.
|
||||
*
|
||||
* Returns 0 on success and -1 on failure
|
||||
*/
|
||||
__attribute__((always_inline)) static inline int internal_bind_libgamemode_symbol(
|
||||
void *handle, const char *name, void **out_func, size_t func_size, bool required)
|
||||
{
|
||||
void *symbol_lookup = NULL;
|
||||
char *dl_error = NULL;
|
||||
|
||||
/* Safely look up the symbol */
|
||||
symbol_lookup = dlsym(handle, name);
|
||||
dl_error = dlerror();
|
||||
if (required && (dl_error || !symbol_lookup)) {
|
||||
snprintf(internal_gamemode_client_error_string,
|
||||
sizeof(internal_gamemode_client_error_string),
|
||||
"dlsym failed - %s",
|
||||
dl_error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Have the symbol correctly, copy it to make it usable */
|
||||
memcpy(out_func, &symbol_lookup, func_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads libgamemode and needed functions
|
||||
*
|
||||
* Returns 0 on success and -1 on failure
|
||||
*/
|
||||
__attribute__((always_inline)) static inline int internal_load_libgamemode(void)
|
||||
{
|
||||
/* We start at 1, 0 is a success and -1 is a fail */
|
||||
if (internal_libgamemode_loaded != 1) {
|
||||
return internal_libgamemode_loaded;
|
||||
}
|
||||
|
||||
/* Anonymous struct type to define our bindings */
|
||||
struct binding {
|
||||
const char *name;
|
||||
void **functor;
|
||||
size_t func_size;
|
||||
bool required;
|
||||
} bindings[] = {
|
||||
{ "real_gamemode_request_start",
|
||||
(void **)&REAL_internal_gamemode_request_start,
|
||||
sizeof(REAL_internal_gamemode_request_start),
|
||||
true },
|
||||
{ "real_gamemode_request_end",
|
||||
(void **)&REAL_internal_gamemode_request_end,
|
||||
sizeof(REAL_internal_gamemode_request_end),
|
||||
true },
|
||||
{ "real_gamemode_query_status",
|
||||
(void **)&REAL_internal_gamemode_query_status,
|
||||
sizeof(REAL_internal_gamemode_query_status),
|
||||
false },
|
||||
{ "real_gamemode_error_string",
|
||||
(void **)&REAL_internal_gamemode_error_string,
|
||||
sizeof(REAL_internal_gamemode_error_string),
|
||||
true },
|
||||
{ "real_gamemode_request_start_for",
|
||||
(void **)&REAL_internal_gamemode_request_start_for,
|
||||
sizeof(REAL_internal_gamemode_request_start_for),
|
||||
false },
|
||||
{ "real_gamemode_request_end_for",
|
||||
(void **)&REAL_internal_gamemode_request_end_for,
|
||||
sizeof(REAL_internal_gamemode_request_end_for),
|
||||
false },
|
||||
{ "real_gamemode_query_status_for",
|
||||
(void **)&REAL_internal_gamemode_query_status_for,
|
||||
sizeof(REAL_internal_gamemode_query_status_for),
|
||||
false },
|
||||
};
|
||||
|
||||
void *libgamemode = NULL;
|
||||
|
||||
/* Try and load libgamemode */
|
||||
libgamemode = dlopen("libgamemode.so.0", RTLD_NOW);
|
||||
if (!libgamemode) {
|
||||
/* Attempt to load unversioned library for compatibility with older
|
||||
* versions (as of writing, there are no ABI changes between the two -
|
||||
* this may need to change if ever ABI-breaking changes are made) */
|
||||
libgamemode = dlopen("libgamemode.so", RTLD_NOW);
|
||||
if (!libgamemode) {
|
||||
snprintf(internal_gamemode_client_error_string,
|
||||
sizeof(internal_gamemode_client_error_string),
|
||||
"dlopen failed - %s",
|
||||
dlerror());
|
||||
internal_libgamemode_loaded = -1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Attempt to bind all symbols */
|
||||
for (size_t i = 0; i < sizeof(bindings) / sizeof(bindings[0]); i++) {
|
||||
struct binding *binder = &bindings[i];
|
||||
|
||||
if (internal_bind_libgamemode_symbol(libgamemode,
|
||||
binder->name,
|
||||
binder->functor,
|
||||
binder->func_size,
|
||||
binder->required)) {
|
||||
internal_libgamemode_loaded = -1;
|
||||
return -1;
|
||||
};
|
||||
}
|
||||
|
||||
/* Success */
|
||||
internal_libgamemode_loaded = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to the real libgamemode
|
||||
*/
|
||||
__attribute__((always_inline)) static inline const char *gamemode_error_string(void)
|
||||
{
|
||||
/* If we fail to load the system gamemode, or we have an error string already, return our error
|
||||
* string instead of diverting to the system version */
|
||||
if (internal_load_libgamemode() < 0 || internal_gamemode_client_error_string[0] != '\0') {
|
||||
return internal_gamemode_client_error_string;
|
||||
}
|
||||
|
||||
/* Assert for static analyser that the function is not NULL */
|
||||
assert(REAL_internal_gamemode_error_string != NULL);
|
||||
|
||||
return REAL_internal_gamemode_error_string();
|
||||
}
|
||||
|
||||
/**
|
||||
* Redirect to the real libgamemode
|
||||
* Allow automatically requesting game mode
|
||||
* Also prints errors as they happen.
|
||||
*/
|
||||
#ifdef GAMEMODE_AUTO
|
||||
__attribute__((constructor))
|
||||
#else
|
||||
__attribute__((always_inline)) static inline
|
||||
#endif
|
||||
int gamemode_request_start(void)
|
||||
{
|
||||
/* Need to load gamemode */
|
||||
if (internal_load_libgamemode() < 0) {
|
||||
#ifdef GAMEMODE_AUTO
|
||||
fprintf(stderr, "gamemodeauto: %s\n", gamemode_error_string());
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Assert for static analyser that the function is not NULL */
|
||||
assert(REAL_internal_gamemode_request_start != NULL);
|
||||
|
||||
if (REAL_internal_gamemode_request_start() < 0) {
|
||||
#ifdef GAMEMODE_AUTO
|
||||
fprintf(stderr, "gamemodeauto: %s\n", gamemode_error_string());
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Redirect to the real libgamemode */
|
||||
#ifdef GAMEMODE_AUTO
|
||||
__attribute__((destructor))
|
||||
#else
|
||||
__attribute__((always_inline)) static inline
|
||||
#endif
|
||||
int gamemode_request_end(void)
|
||||
{
|
||||
/* Need to load gamemode */
|
||||
if (internal_load_libgamemode() < 0) {
|
||||
#ifdef GAMEMODE_AUTO
|
||||
fprintf(stderr, "gamemodeauto: %s\n", gamemode_error_string());
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Assert for static analyser that the function is not NULL */
|
||||
assert(REAL_internal_gamemode_request_end != NULL);
|
||||
|
||||
if (REAL_internal_gamemode_request_end() < 0) {
|
||||
#ifdef GAMEMODE_AUTO
|
||||
fprintf(stderr, "gamemodeauto: %s\n", gamemode_error_string());
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Redirect to the real libgamemode */
|
||||
__attribute__((always_inline)) static inline int gamemode_query_status(void)
|
||||
{
|
||||
/* Need to load gamemode */
|
||||
if (internal_load_libgamemode() < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (REAL_internal_gamemode_query_status == NULL) {
|
||||
snprintf(internal_gamemode_client_error_string,
|
||||
sizeof(internal_gamemode_client_error_string),
|
||||
"gamemode_query_status missing (older host?)");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return REAL_internal_gamemode_query_status();
|
||||
}
|
||||
|
||||
/* Redirect to the real libgamemode */
|
||||
__attribute__((always_inline)) static inline int gamemode_request_start_for(pid_t pid)
|
||||
{
|
||||
/* Need to load gamemode */
|
||||
if (internal_load_libgamemode() < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (REAL_internal_gamemode_request_start_for == NULL) {
|
||||
snprintf(internal_gamemode_client_error_string,
|
||||
sizeof(internal_gamemode_client_error_string),
|
||||
"gamemode_request_start_for missing (older host?)");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return REAL_internal_gamemode_request_start_for(pid);
|
||||
}
|
||||
|
||||
/* Redirect to the real libgamemode */
|
||||
__attribute__((always_inline)) static inline int gamemode_request_end_for(pid_t pid)
|
||||
{
|
||||
/* Need to load gamemode */
|
||||
if (internal_load_libgamemode() < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (REAL_internal_gamemode_request_end_for == NULL) {
|
||||
snprintf(internal_gamemode_client_error_string,
|
||||
sizeof(internal_gamemode_client_error_string),
|
||||
"gamemode_request_end_for missing (older host?)");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return REAL_internal_gamemode_request_end_for(pid);
|
||||
}
|
||||
|
||||
/* Redirect to the real libgamemode */
|
||||
__attribute__((always_inline)) static inline int gamemode_query_status_for(pid_t pid)
|
||||
{
|
||||
/* Need to load gamemode */
|
||||
if (internal_load_libgamemode() < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (REAL_internal_gamemode_query_status_for == NULL) {
|
||||
snprintf(internal_gamemode_client_error_string,
|
||||
sizeof(internal_gamemode_client_error_string),
|
||||
"gamemode_query_status_for missing (older host?)");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return REAL_internal_gamemode_query_status_for(pid);
|
||||
}
|
||||
|
||||
#endif // CLIENT_GAMEMODE_H
|
6
externals/glad/Readme.md
vendored
6
externals/glad/Readme.md
vendored
|
@ -3,3 +3,9 @@ These files were generated by the [glad](https://github.com/Dav1dde/glad) OpenGL
|
|||
```
|
||||
python -m glad --profile core --out-path glad/ --api "gl=4.3,gles2=3.2" --generator=c
|
||||
```
|
||||
|
||||
You can also generate the source using [this site](https://glad.dav1d.de/):
|
||||
1. Select '4.3' for GL, '3.2' for GLES2, and 'Core' for Profile.
|
||||
2. Input the currently supported extensions from [here](https://github.com/citra-emu/citra/blob/master/externals/glad/include/glad/glad.h#L9), plus any new required extensions.
|
||||
3. Click Generate and download the generated source zip.
|
||||
4. Unzip the new source over the current glad source files.
|
60
externals/glad/include/glad/glad.h
vendored
60
externals/glad/include/glad/glad.h
vendored
|
@ -1,28 +1,35 @@
|
|||
/*
|
||||
|
||||
OpenGL, OpenGL ES loader generated by glad 0.1.36 on Sat Apr 1 20:34:42 2023.
|
||||
OpenGL, OpenGL ES loader generated by glad 0.1.36 on Fri Nov 10 04:24:01 2023.
|
||||
|
||||
Language/Generator: C/C++
|
||||
Specification: gl
|
||||
APIs: gl=4.3, gles2=3.2
|
||||
Profile: core
|
||||
Extensions:
|
||||
GL_AMD_blend_minmax_factor,
|
||||
GL_ARB_buffer_storage,
|
||||
GL_ARB_clear_texture,
|
||||
GL_ARB_fragment_shader_interlock,
|
||||
GL_ARB_get_texture_sub_image,
|
||||
GL_ARB_texture_compression_bptc,
|
||||
GL_ARM_shader_framebuffer_fetch,
|
||||
GL_EXT_buffer_storage,
|
||||
GL_EXT_clip_cull_distance,
|
||||
GL_EXT_texture_compression_s3tc
|
||||
GL_EXT_shader_framebuffer_fetch,
|
||||
GL_EXT_texture_compression_s3tc,
|
||||
GL_INTEL_fragment_shader_ordering,
|
||||
GL_NV_blend_minmax_factor,
|
||||
GL_NV_fragment_shader_interlock
|
||||
Loader: True
|
||||
Local files: False
|
||||
Omit khrplatform: False
|
||||
Reproducible: False
|
||||
|
||||
Commandline:
|
||||
--profile="core" --api="gl=4.3,gles2=3.2" --generator="c" --spec="gl" --extensions="GL_ARB_buffer_storage,GL_ARB_clear_texture,GL_ARB_get_texture_sub_image,GL_ARB_texture_compression_bptc,GL_EXT_buffer_storage,GL_EXT_clip_cull_distance,GL_EXT_texture_compression_s3tc"
|
||||
--profile="core" --api="gl=4.3,gles2=3.2" --generator="c" --spec="gl" --extensions="GL_AMD_blend_minmax_factor,GL_ARB_buffer_storage,GL_ARB_clear_texture,GL_ARB_fragment_shader_interlock,GL_ARB_get_texture_sub_image,GL_ARB_texture_compression_bptc,GL_ARM_shader_framebuffer_fetch,GL_EXT_buffer_storage,GL_EXT_clip_cull_distance,GL_EXT_shader_framebuffer_fetch,GL_EXT_texture_compression_s3tc,GL_INTEL_fragment_shader_ordering,GL_NV_blend_minmax_factor,GL_NV_fragment_shader_interlock"
|
||||
Online:
|
||||
https://glad.dav1d.de/#profile=core&language=c&specification=gl&loader=on&api=gl%3D4.3&api=gles2%3D3.2&extensions=GL_ARB_buffer_storage&extensions=GL_ARB_clear_texture&extensions=GL_ARB_get_texture_sub_image&extensions=GL_ARB_texture_compression_bptc&extensions=GL_EXT_buffer_storage&extensions=GL_EXT_clip_cull_distance&extensions=GL_EXT_texture_compression_s3tc
|
||||
https://glad.dav1d.de/#profile=core&language=c&specification=gl&loader=on&api=gl%3D4.3&api=gles2%3D3.2&extensions=GL_AMD_blend_minmax_factor&extensions=GL_ARB_buffer_storage&extensions=GL_ARB_clear_texture&extensions=GL_ARB_fragment_shader_interlock&extensions=GL_ARB_get_texture_sub_image&extensions=GL_ARB_texture_compression_bptc&extensions=GL_ARM_shader_framebuffer_fetch&extensions=GL_EXT_buffer_storage&extensions=GL_EXT_clip_cull_distance&extensions=GL_EXT_shader_framebuffer_fetch&extensions=GL_EXT_texture_compression_s3tc&extensions=GL_INTEL_fragment_shader_ordering&extensions=GL_NV_blend_minmax_factor&extensions=GL_NV_fragment_shader_interlock
|
||||
*/
|
||||
|
||||
|
||||
|
@ -3320,6 +3327,8 @@ typedef void (APIENTRYP PFNGLGETNUNIFORMUIVPROC)(GLuint program, GLint location,
|
|||
GLAPI PFNGLGETNUNIFORMUIVPROC glad_glGetnUniformuiv;
|
||||
#define glGetnUniformuiv glad_glGetnUniformuiv
|
||||
#endif
|
||||
#define GL_FACTOR_MIN_AMD 0x901C
|
||||
#define GL_FACTOR_MAX_AMD 0x901D
|
||||
#define GL_MAP_PERSISTENT_BIT 0x0040
|
||||
#define GL_MAP_COHERENT_BIT 0x0080
|
||||
#define GL_DYNAMIC_STORAGE_BIT 0x0100
|
||||
|
@ -3332,10 +3341,13 @@ GLAPI PFNGLGETNUNIFORMUIVPROC glad_glGetnUniformuiv;
|
|||
#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D
|
||||
#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E
|
||||
#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
|
||||
#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52
|
||||
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
|
||||
#define GL_FETCH_PER_SAMPLE_ARM 0x8F65
|
||||
#define GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM 0x8F66
|
||||
#define GL_MAP_PERSISTENT_BIT_EXT 0x0040
|
||||
#define GL_MAP_COHERENT_BIT_EXT 0x0080
|
||||
#define GL_DYNAMIC_STORAGE_BIT_EXT 0x0100
|
||||
|
@ -3354,6 +3366,10 @@ GLAPI PFNGLGETNUNIFORMUIVPROC glad_glGetnUniformuiv;
|
|||
#define GL_CLIP_DISTANCE5_EXT 0x3005
|
||||
#define GL_CLIP_DISTANCE6_EXT 0x3006
|
||||
#define GL_CLIP_DISTANCE7_EXT 0x3007
|
||||
#ifndef GL_AMD_blend_minmax_factor
|
||||
#define GL_AMD_blend_minmax_factor 1
|
||||
GLAPI int GLAD_GL_AMD_blend_minmax_factor;
|
||||
#endif
|
||||
#ifndef GL_ARB_buffer_storage
|
||||
#define GL_ARB_buffer_storage 1
|
||||
GLAPI int GLAD_GL_ARB_buffer_storage;
|
||||
|
@ -3371,6 +3387,10 @@ typedef void (APIENTRYP PFNGLCLEARTEXSUBIMAGEPROC)(GLuint texture, GLint level,
|
|||
GLAPI PFNGLCLEARTEXSUBIMAGEPROC glad_glClearTexSubImage;
|
||||
#define glClearTexSubImage glad_glClearTexSubImage
|
||||
#endif
|
||||
#ifndef GL_ARB_fragment_shader_interlock
|
||||
#define GL_ARB_fragment_shader_interlock 1
|
||||
GLAPI int GLAD_GL_ARB_fragment_shader_interlock;
|
||||
#endif
|
||||
#ifndef GL_ARB_get_texture_sub_image
|
||||
#define GL_ARB_get_texture_sub_image 1
|
||||
GLAPI int GLAD_GL_ARB_get_texture_sub_image;
|
||||
|
@ -3385,10 +3405,30 @@ GLAPI PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC glad_glGetCompressedTextureSubImage;
|
|||
#define GL_ARB_texture_compression_bptc 1
|
||||
GLAPI int GLAD_GL_ARB_texture_compression_bptc;
|
||||
#endif
|
||||
#ifndef GL_EXT_shader_framebuffer_fetch
|
||||
#define GL_EXT_shader_framebuffer_fetch 1
|
||||
GLAPI int GLAD_GL_EXT_shader_framebuffer_fetch;
|
||||
#endif
|
||||
#ifndef GL_EXT_texture_compression_s3tc
|
||||
#define GL_EXT_texture_compression_s3tc 1
|
||||
GLAPI int GLAD_GL_EXT_texture_compression_s3tc;
|
||||
#endif
|
||||
#ifndef GL_INTEL_fragment_shader_ordering
|
||||
#define GL_INTEL_fragment_shader_ordering 1
|
||||
GLAPI int GLAD_GL_INTEL_fragment_shader_ordering;
|
||||
#endif
|
||||
#ifndef GL_NV_blend_minmax_factor
|
||||
#define GL_NV_blend_minmax_factor 1
|
||||
GLAPI int GLAD_GL_NV_blend_minmax_factor;
|
||||
#endif
|
||||
#ifndef GL_NV_fragment_shader_interlock
|
||||
#define GL_NV_fragment_shader_interlock 1
|
||||
GLAPI int GLAD_GL_NV_fragment_shader_interlock;
|
||||
#endif
|
||||
#ifndef GL_ARM_shader_framebuffer_fetch
|
||||
#define GL_ARM_shader_framebuffer_fetch 1
|
||||
GLAPI int GLAD_GL_ARM_shader_framebuffer_fetch;
|
||||
#endif
|
||||
#ifndef GL_EXT_buffer_storage
|
||||
#define GL_EXT_buffer_storage 1
|
||||
GLAPI int GLAD_GL_EXT_buffer_storage;
|
||||
|
@ -3400,10 +3440,22 @@ GLAPI PFNGLBUFFERSTORAGEEXTPROC glad_glBufferStorageEXT;
|
|||
#define GL_EXT_clip_cull_distance 1
|
||||
GLAPI int GLAD_GL_EXT_clip_cull_distance;
|
||||
#endif
|
||||
#ifndef GL_EXT_shader_framebuffer_fetch
|
||||
#define GL_EXT_shader_framebuffer_fetch 1
|
||||
GLAPI int GLAD_GL_EXT_shader_framebuffer_fetch;
|
||||
#endif
|
||||
#ifndef GL_EXT_texture_compression_s3tc
|
||||
#define GL_EXT_texture_compression_s3tc 1
|
||||
GLAPI int GLAD_GL_EXT_texture_compression_s3tc;
|
||||
#endif
|
||||
#ifndef GL_NV_blend_minmax_factor
|
||||
#define GL_NV_blend_minmax_factor 1
|
||||
GLAPI int GLAD_GL_NV_blend_minmax_factor;
|
||||
#endif
|
||||
#ifndef GL_NV_fragment_shader_interlock
|
||||
#define GL_NV_fragment_shader_interlock 1
|
||||
GLAPI int GLAD_GL_NV_fragment_shader_interlock;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
32
externals/glad/src/glad.c
vendored
32
externals/glad/src/glad.c
vendored
|
@ -1,28 +1,35 @@
|
|||
/*
|
||||
|
||||
OpenGL, OpenGL ES loader generated by glad 0.1.36 on Sat Apr 1 20:34:42 2023.
|
||||
OpenGL, OpenGL ES loader generated by glad 0.1.36 on Fri Nov 10 04:24:01 2023.
|
||||
|
||||
Language/Generator: C/C++
|
||||
Specification: gl
|
||||
APIs: gl=4.3, gles2=3.2
|
||||
Profile: core
|
||||
Extensions:
|
||||
GL_AMD_blend_minmax_factor,
|
||||
GL_ARB_buffer_storage,
|
||||
GL_ARB_clear_texture,
|
||||
GL_ARB_fragment_shader_interlock,
|
||||
GL_ARB_get_texture_sub_image,
|
||||
GL_ARB_texture_compression_bptc,
|
||||
GL_ARM_shader_framebuffer_fetch,
|
||||
GL_EXT_buffer_storage,
|
||||
GL_EXT_clip_cull_distance,
|
||||
GL_EXT_texture_compression_s3tc
|
||||
GL_EXT_shader_framebuffer_fetch,
|
||||
GL_EXT_texture_compression_s3tc,
|
||||
GL_INTEL_fragment_shader_ordering,
|
||||
GL_NV_blend_minmax_factor,
|
||||
GL_NV_fragment_shader_interlock
|
||||
Loader: True
|
||||
Local files: False
|
||||
Omit khrplatform: False
|
||||
Reproducible: False
|
||||
|
||||
Commandline:
|
||||
--profile="core" --api="gl=4.3,gles2=3.2" --generator="c" --spec="gl" --extensions="GL_ARB_buffer_storage,GL_ARB_clear_texture,GL_ARB_get_texture_sub_image,GL_ARB_texture_compression_bptc,GL_EXT_buffer_storage,GL_EXT_clip_cull_distance,GL_EXT_texture_compression_s3tc"
|
||||
--profile="core" --api="gl=4.3,gles2=3.2" --generator="c" --spec="gl" --extensions="GL_AMD_blend_minmax_factor,GL_ARB_buffer_storage,GL_ARB_clear_texture,GL_ARB_fragment_shader_interlock,GL_ARB_get_texture_sub_image,GL_ARB_texture_compression_bptc,GL_ARM_shader_framebuffer_fetch,GL_EXT_buffer_storage,GL_EXT_clip_cull_distance,GL_EXT_shader_framebuffer_fetch,GL_EXT_texture_compression_s3tc,GL_INTEL_fragment_shader_ordering,GL_NV_blend_minmax_factor,GL_NV_fragment_shader_interlock"
|
||||
Online:
|
||||
https://glad.dav1d.de/#profile=core&language=c&specification=gl&loader=on&api=gl%3D4.3&api=gles2%3D3.2&extensions=GL_ARB_buffer_storage&extensions=GL_ARB_clear_texture&extensions=GL_ARB_get_texture_sub_image&extensions=GL_ARB_texture_compression_bptc&extensions=GL_EXT_buffer_storage&extensions=GL_EXT_clip_cull_distance&extensions=GL_EXT_texture_compression_s3tc
|
||||
https://glad.dav1d.de/#profile=core&language=c&specification=gl&loader=on&api=gl%3D4.3&api=gles2%3D3.2&extensions=GL_AMD_blend_minmax_factor&extensions=GL_ARB_buffer_storage&extensions=GL_ARB_clear_texture&extensions=GL_ARB_fragment_shader_interlock&extensions=GL_ARB_get_texture_sub_image&extensions=GL_ARB_texture_compression_bptc&extensions=GL_ARM_shader_framebuffer_fetch&extensions=GL_EXT_buffer_storage&extensions=GL_EXT_clip_cull_distance&extensions=GL_EXT_shader_framebuffer_fetch&extensions=GL_EXT_texture_compression_s3tc&extensions=GL_INTEL_fragment_shader_ordering&extensions=GL_NV_blend_minmax_factor&extensions=GL_NV_fragment_shader_interlock
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -853,13 +860,20 @@ PFNGLVIEWPORTARRAYVPROC glad_glViewportArrayv = NULL;
|
|||
PFNGLVIEWPORTINDEXEDFPROC glad_glViewportIndexedf = NULL;
|
||||
PFNGLVIEWPORTINDEXEDFVPROC glad_glViewportIndexedfv = NULL;
|
||||
PFNGLWAITSYNCPROC glad_glWaitSync = NULL;
|
||||
int GLAD_GL_AMD_blend_minmax_factor = 0;
|
||||
int GLAD_GL_ARB_buffer_storage = 0;
|
||||
int GLAD_GL_ARB_clear_texture = 0;
|
||||
int GLAD_GL_ARB_fragment_shader_interlock = 0;
|
||||
int GLAD_GL_ARB_get_texture_sub_image = 0;
|
||||
int GLAD_GL_ARB_texture_compression_bptc = 0;
|
||||
int GLAD_GL_ARM_shader_framebuffer_fetch = 0;
|
||||
int GLAD_GL_EXT_buffer_storage = 0;
|
||||
int GLAD_GL_EXT_clip_cull_distance = 0;
|
||||
int GLAD_GL_EXT_shader_framebuffer_fetch = 0;
|
||||
int GLAD_GL_EXT_texture_compression_s3tc = 0;
|
||||
int GLAD_GL_INTEL_fragment_shader_ordering = 0;
|
||||
int GLAD_GL_NV_blend_minmax_factor = 0;
|
||||
int GLAD_GL_NV_fragment_shader_interlock = 0;
|
||||
PFNGLBUFFERSTORAGEPROC glad_glBufferStorage = NULL;
|
||||
PFNGLCLEARTEXIMAGEPROC glad_glClearTexImage = NULL;
|
||||
PFNGLCLEARTEXSUBIMAGEPROC glad_glClearTexSubImage = NULL;
|
||||
|
@ -1498,11 +1512,17 @@ static void load_GL_ARB_get_texture_sub_image(GLADloadproc load) {
|
|||
}
|
||||
static int find_extensionsGL(void) {
|
||||
if (!get_exts()) return 0;
|
||||
GLAD_GL_AMD_blend_minmax_factor = has_ext("GL_AMD_blend_minmax_factor");
|
||||
GLAD_GL_ARB_buffer_storage = has_ext("GL_ARB_buffer_storage");
|
||||
GLAD_GL_ARB_clear_texture = has_ext("GL_ARB_clear_texture");
|
||||
GLAD_GL_ARB_fragment_shader_interlock = has_ext("GL_ARB_fragment_shader_interlock");
|
||||
GLAD_GL_ARB_get_texture_sub_image = has_ext("GL_ARB_get_texture_sub_image");
|
||||
GLAD_GL_ARB_texture_compression_bptc = has_ext("GL_ARB_texture_compression_bptc");
|
||||
GLAD_GL_EXT_shader_framebuffer_fetch = has_ext("GL_EXT_shader_framebuffer_fetch");
|
||||
GLAD_GL_EXT_texture_compression_s3tc = has_ext("GL_EXT_texture_compression_s3tc");
|
||||
GLAD_GL_INTEL_fragment_shader_ordering = has_ext("GL_INTEL_fragment_shader_ordering");
|
||||
GLAD_GL_NV_blend_minmax_factor = has_ext("GL_NV_blend_minmax_factor");
|
||||
GLAD_GL_NV_fragment_shader_interlock = has_ext("GL_NV_fragment_shader_interlock");
|
||||
free_exts();
|
||||
return 1;
|
||||
}
|
||||
|
@ -1971,9 +1991,13 @@ static void load_GL_EXT_buffer_storage(GLADloadproc load) {
|
|||
}
|
||||
static int find_extensionsGLES2(void) {
|
||||
if (!get_exts()) return 0;
|
||||
GLAD_GL_ARM_shader_framebuffer_fetch = has_ext("GL_ARM_shader_framebuffer_fetch");
|
||||
GLAD_GL_EXT_buffer_storage = has_ext("GL_EXT_buffer_storage");
|
||||
GLAD_GL_EXT_clip_cull_distance = has_ext("GL_EXT_clip_cull_distance");
|
||||
GLAD_GL_EXT_shader_framebuffer_fetch = has_ext("GL_EXT_shader_framebuffer_fetch");
|
||||
GLAD_GL_EXT_texture_compression_s3tc = has_ext("GL_EXT_texture_compression_s3tc");
|
||||
GLAD_GL_NV_blend_minmax_factor = has_ext("GL_NV_blend_minmax_factor");
|
||||
GLAD_GL_NV_fragment_shader_interlock = has_ext("GL_NV_fragment_shader_interlock");
|
||||
free_exts();
|
||||
return 1;
|
||||
}
|
||||
|
|
2
externals/httplib/README.md
vendored
2
externals/httplib/README.md
vendored
|
@ -1,4 +1,4 @@
|
|||
From https://github.com/yhirose/cpp-httplib/commit/8e10d4e8e7febafce0632810262e81e853b2065f
|
||||
From https://github.com/yhirose/cpp-httplib/commit/0a629d739127dcc5d828474a5aedae1f234687d3
|
||||
|
||||
MIT License
|
||||
|
||||
|
|
1850
externals/httplib/httplib.h
vendored
1850
externals/httplib/httplib.h
vendored
File diff suppressed because it is too large
Load diff
2
externals/inih/CMakeLists.txt
vendored
2
externals/inih/CMakeLists.txt
vendored
|
@ -6,4 +6,4 @@ add_library(inih
|
|||
)
|
||||
|
||||
create_target_directory_groups(inih)
|
||||
target_include_directories(inih INTERFACE .)
|
||||
target_include_directories(inih INTERFACE ./inih/cpp)
|
||||
|
|
1
externals/libadrenotools
vendored
Submodule
1
externals/libadrenotools
vendored
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit deec5f75ee1a8ccbe32c8780b1d17284fc87b0f1
|
1
externals/library-headers
vendored
Submodule
1
externals/library-headers
vendored
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 3b3e28dbe6d033395ce2967fa8030825e7b89de7
|
48
externals/library-headers/CMakeLists.txt
vendored
48
externals/library-headers/CMakeLists.txt
vendored
|
@ -1,48 +0,0 @@
|
|||
add_library(library-headers INTERFACE)
|
||||
|
||||
# libfdk-aac headers
|
||||
find_path(FDK_AAC_INCLUDES NAMES fdk-aac/aacdecoder_lib.h)
|
||||
if (FDK_AAC_INCLUDES STREQUAL "FDK_AAC_INCLUDES-NOTFOUND")
|
||||
message(STATUS "fdk_aac headers not found, using bundled headers.")
|
||||
target_include_directories(library-headers INTERFACE ./library-headers/fdk-aac/include)
|
||||
else()
|
||||
message(STATUS "Using headers from system fdk_aac")
|
||||
target_include_directories(library-headers SYSTEM INTERFACE ${FDK_AAC_INCLUDES})
|
||||
endif()
|
||||
|
||||
# FFmpeg headers
|
||||
find_path(AVUTIL_INCLUDES NAMES libavutil/avutil.h)
|
||||
find_path(AVCODEC_INCLUDES NAMES libavcodec/avcodec.h)
|
||||
find_path(AVFORMAT_INCLUDES NAMES libavformat/avformat.h)
|
||||
find_path(AVFILTER_INCLUDES NAMES libavfilter/avfilter.h)
|
||||
find_path(SWRESAMPLE_INCLUDES NAMES libswresample/swresample.h)
|
||||
# Make sure all the headers are found and from the same place, so we don't
|
||||
# have missing or mismatched components.
|
||||
if (AVUTIL_INCLUDES STREQUAL "AVUTIL_INCLUDES-NOTFOUND"
|
||||
OR NOT AVCODEC_INCLUDES STREQUAL AVUTIL_INCLUDES
|
||||
OR NOT AVFORMAT_INCLUDES STREQUAL AVUTIL_INCLUDES
|
||||
OR NOT AVFILTER_INCLUDES STREQUAL AVUTIL_INCLUDES
|
||||
OR NOT SWRESAMPLE_INCLUDES STREQUAL AVUTIL_INCLUDES)
|
||||
message(STATUS "Complete FFmpeg headers not found, using bundled headers.")
|
||||
target_include_directories(library-headers INTERFACE ./library-headers/ffmpeg/include)
|
||||
else()
|
||||
# Extract libavutil version from header.
|
||||
file(STRINGS "${AVUTIL_INCLUDES}/libavutil/version.h" AVUTIL_VERSION_DATA
|
||||
REGEX "#define LIBAVUTIL_VERSION_(MAJOR|MINOR|MICRO) ")
|
||||
set(AVUTIL_VERSION_REGEX "([0-9]+)")
|
||||
foreach(v MAJOR MINOR MICRO)
|
||||
if("${AVUTIL_VERSION_DATA}" MATCHES "#define LIBAVUTIL_VERSION_${v}[\\t ]+${AVUTIL_VERSION_REGEX}")
|
||||
set(AVUTIL_VERSION_${v} "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endforeach()
|
||||
set(AVUTIL_VERSION "${AVUTIL_VERSION_MAJOR}.${AVUTIL_VERSION_MINOR}.${AVUTIL_VERSION_MICRO}")
|
||||
|
||||
message(STATUS "Detected FFmpeg libavutil version is ${AVUTIL_VERSION}")
|
||||
if ("${AVUTIL_VERSION}" VERSION_LESS "56.30.100")
|
||||
message(WARNING "System FFmpeg version is too low (< 4.2), using bundled headers.")
|
||||
target_include_directories(library-headers INTERFACE ./library-headers/ffmpeg/include)
|
||||
else()
|
||||
message(STATUS "Using headers from system FFmpeg")
|
||||
target_include_directories(library-headers SYSTEM INTERFACE ${AVUTIL_INCLUDES})
|
||||
endif()
|
||||
endif()
|
1
externals/library-headers/library-headers
vendored
1
externals/library-headers/library-headers
vendored
|
@ -1 +0,0 @@
|
|||
Subproject commit 071bc4282ca29ec255ab2dae32c978481ca5dfea
|
2
externals/libressl
vendored
2
externals/libressl
vendored
|
@ -1 +1 @@
|
|||
Subproject commit dcf9a84aba598f827f65d946d31c3c93af62790a
|
||||
Subproject commit d4fc7348a3fbe9c659a373e28a3b50f052f7c50a
|
1
externals/oaknut
vendored
Submodule
1
externals/oaknut
vendored
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 6b1d57ea7ed4882d32a91eeaa6557b0ecb4da152
|
2
externals/vulkan-headers
vendored
2
externals/vulkan-headers
vendored
|
@ -1 +1 @@
|
|||
Subproject commit bae9700cd9425541a0f6029957f005e5ad3ef660
|
||||
Subproject commit 217e93c664ec6704ec2d8c36fa116c1a4a1e2d40
|
BIN
keys.tar.enc
BIN
keys.tar.enc
Binary file not shown.
|
@ -5,6 +5,10 @@ include_directories(.)
|
|||
set_property(DIRECTORY APPEND PROPERTY
|
||||
COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_DEBUG> $<$<NOT:$<CONFIG:Debug>>:NDEBUG>)
|
||||
|
||||
if (ENABLE_LTO)
|
||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
endif()
|
||||
|
||||
# Set compilation flags
|
||||
if (MSVC)
|
||||
set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "" FORCE)
|
||||
|
@ -40,7 +44,6 @@ if (MSVC)
|
|||
/Zo
|
||||
/permissive-
|
||||
/EHsc
|
||||
/std:c++latest
|
||||
/utf-8
|
||||
/volatile:iso
|
||||
/Zc:externConstexpr
|
||||
|
@ -48,6 +51,10 @@ if (MSVC)
|
|||
/Zc:throwingNew
|
||||
/GT
|
||||
|
||||
# Some flags for more deterministic builds, to aid caching.
|
||||
/experimental:deterministic
|
||||
/d1trimfile:"${CMAKE_SOURCE_DIR}"
|
||||
|
||||
# External headers diagnostics
|
||||
/experimental:external # Enables the external headers options. This option isn't required in Visual Studio 2019 version 16.10 and later
|
||||
/external:anglebrackets # Treats all headers included by #include <header>, where the header file is enclosed in angle brackets (< >), as external headers
|
||||
|
@ -84,7 +91,8 @@ 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)
|
||||
if (CMAKE_C_COMPILER_LAUNCHER STREQUAL "ccache" OR CMAKE_CXX_COMPILER_LAUNCHER STREQUAL "ccache"
|
||||
OR CITRA_USE_PRECOMPILED_HEADERS)
|
||||
# Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21
|
||||
add_compile_options(/Z7)
|
||||
else()
|
||||
|
@ -95,13 +103,23 @@ if (MSVC)
|
|||
add_compile_options("$<$<CONFIG:Release>:/GS->")
|
||||
|
||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG /MANIFEST:NO" CACHE STRING "" FORCE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /MANIFEST:NO /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE)
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /MANIFEST:NO /INCREMENTAL:NO /OPT:REF,ICF /PDBALTPATH:%_PDB%" CACHE STRING "" FORCE)
|
||||
else()
|
||||
add_compile_options(
|
||||
-Wall
|
||||
-Wno-attributes
|
||||
# In case a flag isn't supported on e.g. a certain architecture, don't error.
|
||||
-Wno-unused-command-line-argument
|
||||
# Build fortification options
|
||||
-Wp,-D_GLIBCXX_ASSERTIONS
|
||||
-fstack-protector-strong
|
||||
-fstack-clash-protection
|
||||
)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
# _FORTIFY_SOURCE can't be used without optimizations.
|
||||
add_compile_options(-Wp,-D_FORTIFY_SOURCE=2)
|
||||
endif()
|
||||
|
||||
if (CITRA_WARNINGS_AS_ERRORS)
|
||||
add_compile_options(-Werror)
|
||||
endif()
|
||||
|
@ -110,6 +128,13 @@ else()
|
|||
add_compile_options("-stdlib=libc++")
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
|
||||
# GCC may warn when it ignores attributes like maybe_unused,
|
||||
# which is a problem for older versions (e.g. GCC 11).
|
||||
add_compile_options("-Wno-attributes")
|
||||
add_compile_options("-Wno-interference-size")
|
||||
endif()
|
||||
|
||||
if (MINGW)
|
||||
add_definitions(-DMINGW_HAS_SECURE_API)
|
||||
if (COMPILE_WITH_DWARF)
|
||||
|
@ -134,6 +159,16 @@ else()
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(ENABLE_SOFTWARE_RENDERER)
|
||||
add_compile_definitions(ENABLE_SOFTWARE_RENDERER)
|
||||
endif()
|
||||
if(ENABLE_OPENGL)
|
||||
add_compile_definitions(ENABLE_OPENGL)
|
||||
endif()
|
||||
if(ENABLE_VULKAN)
|
||||
add_compile_definitions(ENABLE_VULKAN)
|
||||
endif()
|
||||
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(video_core)
|
||||
|
|
|
@ -1,192 +0,0 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
/**
|
||||
* Use the number of seconds/10 since Jan 1 2016 as the versionCode.
|
||||
* This lets us upload a new build at most every 10 seconds for the
|
||||
* next 680 years.
|
||||
*/
|
||||
def autoVersion = (int) (((new Date().getTime() / 1000) - 1451606400) / 10)
|
||||
def buildType
|
||||
def abiFilter = "arm64-v8a" //, "x86"
|
||||
|
||||
android {
|
||||
compileSdkVersion 33
|
||||
ndkVersion "25.1.8937393"
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
// This is important as it will run lint but not abort on error
|
||||
// Lint has some overly obnoxious "errors" that should really be warnings
|
||||
abortOnError false
|
||||
|
||||
//Uncomment disable lines for test builds...
|
||||
//disable 'MissingTranslation'bin
|
||||
//disable 'ExtraTranslation'
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO If this is ever modified, change application_id in strings.xml
|
||||
applicationId "org.citra.citra_emu"
|
||||
minSdkVersion 28
|
||||
targetSdkVersion 31
|
||||
versionCode autoVersion
|
||||
versionName getVersion()
|
||||
ndk.abiFilters abiFilter
|
||||
}
|
||||
|
||||
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 ->
|
||||
buildType = variant.buildType.name // sets the current build type
|
||||
}
|
||||
|
||||
// Define build types, which are orthogonal to product flavors.
|
||||
buildTypes {
|
||||
|
||||
// Signed by release key, allowing for upload to Play Store.
|
||||
release {
|
||||
signingConfig keystoreFile != null ? signingConfigs.release : signingConfigs.debug
|
||||
}
|
||||
|
||||
// builds a release build that doesn't need signing
|
||||
// Attaches 'debug' suffix to version and package name, allowing installation alongside the release build.
|
||||
relWithDebInfo {
|
||||
initWith release
|
||||
applicationIdSuffix ".debug"
|
||||
versionNameSuffix '-debug'
|
||||
signingConfig signingConfigs.debug
|
||||
minifyEnabled false
|
||||
testCoverageEnabled false
|
||||
debuggable true
|
||||
jniDebuggable true
|
||||
}
|
||||
|
||||
// Signed by debug key disallowing distribution on Play Store.
|
||||
// Attaches 'debug' suffix to version and package name, allowing installation alongside the release build.
|
||||
debug {
|
||||
// TODO If this is ever modified, change application_id in debug/strings.xml
|
||||
applicationIdSuffix ".debug"
|
||||
versionNameSuffix '-debug'
|
||||
debuggable true
|
||||
jniDebuggable true
|
||||
}
|
||||
}
|
||||
|
||||
flavorDimensions "version"
|
||||
productFlavors {
|
||||
canary {
|
||||
dimension "version"
|
||||
applicationIdSuffix ".canary"
|
||||
}
|
||||
nightly {
|
||||
dimension "version"
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version "3.22.1"
|
||||
path "../../../CMakeLists.txt"
|
||||
}
|
||||
}
|
||||
namespace 'org.citra.citra_emu'
|
||||
|
||||
defaultConfig {
|
||||
externalNativeBuild {
|
||||
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
|
||||
|
||||
abiFilters abiFilter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "androidx.activity:activity:1.5.1"
|
||||
implementation "androidx.fragment:fragment:1.5.5"
|
||||
implementation 'androidx.appcompat:appcompat:1.5.1'
|
||||
implementation 'androidx.exifinterface:exifinterface:1.3.4'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||
implementation "androidx.documentfile:documentfile:1.0.1"
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.5.1'
|
||||
implementation 'androidx.fragment:fragment:1.5.3'
|
||||
implementation "androidx.slidingpanelayout:slidingpanelayout:1.2.0"
|
||||
implementation 'com.google.android.material:material:1.6.1'
|
||||
implementation 'androidx.core:core-splashscreen:1.0.0'
|
||||
implementation "androidx.work:work-runtime:2.8.1"
|
||||
|
||||
// For loading huge screenshots from the disk.
|
||||
implementation 'com.squareup.picasso:picasso:2.71828'
|
||||
|
||||
// Allows FRP-style asynchronous operations in Android.
|
||||
implementation 'io.reactivex:rxandroid:1.2.1'
|
||||
implementation 'org.ini4j:ini4j:0.5.4'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||
|
||||
// Please don't upgrade the billing library as the newer version is not GPL-compatible
|
||||
implementation 'com.android.billingclient:billing:2.0.3'
|
||||
|
||||
// To use the androidx.test.core APIs
|
||||
androidTestImplementation "androidx.test:core:1.5.0"
|
||||
androidTestImplementation "androidx.test.ext:junit:1.1.5"
|
||||
}
|
||||
|
||||
def getVersion() {
|
||||
def versionName = '0.0'
|
||||
|
||||
try {
|
||||
versionName = 'git describe --always --long'.execute([], project.rootDir).text
|
||||
.trim()
|
||||
.replaceAll(/(-0)?-[^-]+$/, "")
|
||||
} catch (Exception) {
|
||||
logger.error('Cannot find git, defaulting to dummy version number')
|
||||
}
|
||||
|
||||
if (System.getenv("GITHUB_ACTIONS") != null) {
|
||||
def gitTag = System.getenv("GIT_TAG_NAME")
|
||||
versionName = gitTag ?: versionName
|
||||
}
|
||||
|
||||
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 }
|
||||
}
|
289
src/android/app/build.gradle.kts
Normal file
289
src/android/app/build.gradle.kts
Normal file
|
@ -0,0 +1,289 @@
|
|||
// Copyright 2023 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
import android.databinding.tool.ext.capitalizeUS
|
||||
import de.undercouch.gradle.tasks.download.Download
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("de.undercouch.download") version "5.5.0"
|
||||
id("kotlin-parcelize")
|
||||
kotlin("plugin.serialization") version "1.9.22"
|
||||
id("androidx.navigation.safeargs.kotlin")
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the number of seconds/10 since Jan 1 2016 as the versionCode.
|
||||
* This lets us upload a new build at most every 10 seconds for the
|
||||
* next 680 years.
|
||||
*/
|
||||
val autoVersion = (((System.currentTimeMillis() / 1000) - 1451606400) / 10).toInt()
|
||||
val abiFilter = listOf("arm64-v8a", "x86_64")
|
||||
|
||||
val downloadedJniLibsPath = "${buildDir}/downloadedJniLibs"
|
||||
|
||||
@Suppress("UnstableApiUsage")
|
||||
android {
|
||||
namespace = "org.citra.citra_emu"
|
||||
|
||||
compileSdkVersion = "android-34"
|
||||
ndkVersion = "26.1.10909125"
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
|
||||
androidResources {
|
||||
generateLocaleConfig = true
|
||||
}
|
||||
|
||||
packaging {
|
||||
// This is necessary for libadrenotools custom driver loading
|
||||
jniLibs.useLegacyPackaging = true
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
}
|
||||
|
||||
lint {
|
||||
// This is important as it will run lint but not abort on error
|
||||
// Lint has some overly obnoxious "errors" that should really be warnings
|
||||
abortOnError = false
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO If this is ever modified, change application_id in strings.xml
|
||||
applicationId = "org.citra.citra_emu"
|
||||
minSdk = 28
|
||||
targetSdk = 34
|
||||
versionCode = autoVersion
|
||||
versionName = getGitVersion()
|
||||
|
||||
ndk {
|
||||
//noinspection ChromeOsAbiSupport
|
||||
abiFilters += abiFilter
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
buildConfigField("String", "GIT_HASH", "\"${getGitHash()}\"")
|
||||
buildConfigField("String", "BRANCH", "\"${getBranch()}\"")
|
||||
}
|
||||
|
||||
val keystoreFile = System.getenv("ANDROID_KEYSTORE_FILE")
|
||||
if (keystoreFile != null) {
|
||||
signingConfigs {
|
||||
create("release") {
|
||||
storeFile = file(keystoreFile)
|
||||
storePassword = System.getenv("ANDROID_KEYSTORE_PASS")
|
||||
keyAlias = System.getenv("ANDROID_KEY_ALIAS")
|
||||
keyPassword = System.getenv("ANDROID_KEYSTORE_PASS")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Define build types, which are orthogonal to product flavors.
|
||||
buildTypes {
|
||||
// Signed by release key, allowing for upload to Play Store.
|
||||
release {
|
||||
signingConfig = if (keystoreFile != null) {
|
||||
signingConfigs.getByName("release")
|
||||
} else {
|
||||
signingConfigs.getByName("debug")
|
||||
}
|
||||
isMinifyEnabled = true
|
||||
isShrinkResources = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
|
||||
// builds a release build that doesn't need signing
|
||||
// Attaches 'debug' suffix to version and package name, allowing installation alongside the release build.
|
||||
register("relWithDebInfo") {
|
||||
initWith(getByName("release"))
|
||||
applicationIdSuffix = ".debug"
|
||||
versionNameSuffix = "-debug"
|
||||
signingConfig = signingConfigs.getByName("debug")
|
||||
isMinifyEnabled = true
|
||||
isShrinkResources = true
|
||||
isDebuggable = true
|
||||
isJniDebuggable = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
isDefault = true
|
||||
}
|
||||
|
||||
// Signed by debug key disallowing distribution on Play Store.
|
||||
// Attaches 'debug' suffix to version and package name, allowing installation alongside the release build.
|
||||
debug {
|
||||
// TODO If this is ever modified, change application_id in debug/strings.xml
|
||||
applicationIdSuffix = ".debug"
|
||||
versionNameSuffix = "-debug"
|
||||
isDebuggable = true
|
||||
isJniDebuggable = true
|
||||
}
|
||||
}
|
||||
|
||||
flavorDimensions.add("version")
|
||||
productFlavors {
|
||||
create("canary") {
|
||||
dimension = "version"
|
||||
applicationIdSuffix = ".canary"
|
||||
}
|
||||
|
||||
create("nightly") {
|
||||
dimension = "version"
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version = "3.22.1"
|
||||
path = file("../../../CMakeLists.txt")
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
named("main") {
|
||||
// Set up path for downloaded native libraries
|
||||
jniLibs.srcDir(downloadedJniLibsPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("androidx.recyclerview:recyclerview:1.3.2")
|
||||
implementation("androidx.activity:activity-ktx:1.8.2")
|
||||
implementation("androidx.fragment:fragment-ktx:1.6.2")
|
||||
implementation("androidx.appcompat:appcompat:1.6.1")
|
||||
implementation("androidx.documentfile:documentfile:1.0.1")
|
||||
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
|
||||
implementation("androidx.slidingpanelayout:slidingpanelayout:1.2.0")
|
||||
implementation("com.google.android.material:material:1.9.0")
|
||||
implementation("androidx.core:core-splashscreen:1.0.1")
|
||||
implementation("androidx.work:work-runtime:2.9.0")
|
||||
implementation("org.ini4j:ini4j:0.5.4")
|
||||
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
||||
implementation("androidx.navigation:navigation-fragment-ktx:2.7.6")
|
||||
implementation("androidx.navigation:navigation-ui-ktx:2.7.6")
|
||||
implementation("info.debatty:java-string-similarity:2.0.0")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2")
|
||||
implementation("androidx.preference:preference-ktx:1.2.1")
|
||||
implementation("io.coil-kt:coil:2.5.0")
|
||||
}
|
||||
|
||||
// Download Vulkan Validation Layers from the KhronosGroup GitHub.
|
||||
val downloadVulkanValidationLayers = tasks.register<Download>("downloadVulkanValidationLayers") {
|
||||
src("https://github.com/KhronosGroup/Vulkan-ValidationLayers/releases/download/sdk-1.3.261.1/android-binaries-sdk-1.3.261.1-android.zip")
|
||||
dest(file("${buildDir}/tmp/Vulkan-ValidationLayers.zip"))
|
||||
onlyIfModified(true)
|
||||
}
|
||||
|
||||
// Extract Vulkan Validation Layers into the downloaded native libraries directory.
|
||||
val unzipVulkanValidationLayers = tasks.register<Copy>("unzipVulkanValidationLayers") {
|
||||
dependsOn(downloadVulkanValidationLayers)
|
||||
from(zipTree(downloadVulkanValidationLayers.get().dest)) {
|
||||
// Exclude the top level directory in the zip as it violates the expected jniLibs directory structure.
|
||||
eachFile {
|
||||
relativePath = RelativePath(true, *relativePath.segments.drop(1).toTypedArray())
|
||||
}
|
||||
includeEmptyDirs = false
|
||||
}
|
||||
into(downloadedJniLibsPath)
|
||||
}
|
||||
|
||||
tasks.named("preBuild") {
|
||||
dependsOn(unzipVulkanValidationLayers)
|
||||
}
|
||||
|
||||
fun getGitVersion(): String {
|
||||
var versionName = "0.0"
|
||||
|
||||
try {
|
||||
versionName = ProcessBuilder("git", "describe", "--always", "--long")
|
||||
.directory(project.rootDir)
|
||||
.redirectOutput(ProcessBuilder.Redirect.PIPE)
|
||||
.redirectError(ProcessBuilder.Redirect.PIPE)
|
||||
.start().inputStream.bufferedReader().use { it.readText() }
|
||||
.trim()
|
||||
.replace(Regex("(-0)?-[^-]+$"), "")
|
||||
} catch (e: Exception) {
|
||||
logger.error("Cannot find git, defaulting to dummy version number")
|
||||
}
|
||||
|
||||
if (System.getenv("GITHUB_ACTIONS") != null) {
|
||||
val gitTag = System.getenv("GIT_TAG_NAME")
|
||||
versionName = gitTag ?: versionName
|
||||
}
|
||||
|
||||
return versionName
|
||||
}
|
||||
|
||||
fun getGitHash(): String =
|
||||
runGitCommand(ProcessBuilder("git", "rev-parse", "--short", "HEAD")) ?: "dummy-hash"
|
||||
|
||||
fun getBranch(): String =
|
||||
runGitCommand(ProcessBuilder("git", "rev-parse", "--abbrev-ref", "HEAD")) ?: "dummy-branch"
|
||||
|
||||
fun runGitCommand(command: ProcessBuilder) : String? {
|
||||
try {
|
||||
command.directory(project.rootDir)
|
||||
val process = command.start()
|
||||
val inputStream = process.inputStream
|
||||
val errorStream = process.errorStream
|
||||
process.waitFor()
|
||||
|
||||
return if (process.exitValue() == 0) {
|
||||
inputStream.bufferedReader()
|
||||
.use { it.readText().trim() } // return the value of gitHash
|
||||
} else {
|
||||
val errorMessage = errorStream.bufferedReader().use { it.readText().trim() }
|
||||
logger.error("Error running git command: $errorMessage")
|
||||
return null
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
logger.error("$e: Cannot find git")
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
android.applicationVariants.configureEach {
|
||||
val variant = this
|
||||
val capitalizedName = variant.name.capitalizeUS()
|
||||
|
||||
val copyTask = tasks.register("copyBundle${capitalizedName}") {
|
||||
doLast {
|
||||
project.copy {
|
||||
from(variant.outputs.first().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}").configure { finalizedBy(copyTask) }
|
||||
}
|
40
src/android/app/proguard-rules.pro
vendored
40
src/android/app/proguard-rules.pro
vendored
|
@ -1,21 +1,25 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
# Copyright 2023 Citra Emulator Project
|
||||
# Licensed under GPLv2 or any later version
|
||||
# Refer to the license.txt file included.
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
# To get usable stack traces
|
||||
-dontobfuscate
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
# Prevents crashing when using Wini
|
||||
-keep class org.ini4j.spi.IniParser
|
||||
-keep class org.ini4j.spi.IniBuilder
|
||||
-keep class org.ini4j.spi.IniFormatter
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
# Suppress warnings for R8
|
||||
-dontwarn org.bouncycastle.jsse.BCSSLParameters
|
||||
-dontwarn org.bouncycastle.jsse.BCSSLSocket
|
||||
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
|
||||
-dontwarn org.conscrypt.Conscrypt$Version
|
||||
-dontwarn org.conscrypt.Conscrypt
|
||||
-dontwarn org.conscrypt.ConscryptHostnameVerifier
|
||||
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
|
||||
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
|
||||
-dontwarn org.openjsse.net.ssl.OpenJSSE
|
||||
-dontwarn java.beans.Introspector
|
||||
-dontwarn java.beans.VetoableChangeListener
|
||||
-dontwarn java.beans.VetoableChangeSupport
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
package org.citra.citra_emu;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = ApplicationProvider.getApplicationContext();
|
||||
|
||||
assertEquals("org.citra.citra_emu", appContext.getPackageName());
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.citra.citra_emu">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-feature
|
||||
android:name="android.hardware.touchscreen"
|
||||
android:required="false"/>
|
||||
|
@ -30,6 +29,8 @@
|
|||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
|
||||
<application
|
||||
android:name="org.citra.citra_emu.CitraApplication"
|
||||
|
@ -41,11 +42,13 @@
|
|||
android:banner="@mipmap/ic_launcher"
|
||||
android:requestLegacyExternalStorage="true">
|
||||
|
||||
<meta-data android:name="android.game_mode_config"
|
||||
android:resource="@xml/game_mode_config" />
|
||||
|
||||
<activity
|
||||
android:name="org.citra.citra_emu.ui.main.MainActivity"
|
||||
android:theme="@style/Theme.Citra.Splash.Main"
|
||||
android:exported="true"
|
||||
android:resizeableActivity="false">
|
||||
android:exported="true">
|
||||
|
||||
<!-- This intentfilter marks this Activity as the one that gets launched from Home screen. -->
|
||||
<intent-filter>
|
||||
|
@ -63,25 +66,29 @@
|
|||
|
||||
<activity
|
||||
android:name="org.citra.citra_emu.activities.EmulationActivity"
|
||||
android:resizeableActivity="false"
|
||||
android:exported="true"
|
||||
android:theme="@style/Theme.Citra.Main"
|
||||
android:launchMode="singleTop"/>
|
||||
android:launchMode="singleTop">
|
||||
|
||||
<service android:name="org.citra.citra_emu.utils.ForegroundService"/>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data
|
||||
android:mimeType="application/octet-stream"
|
||||
android:scheme="content" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<service android:name="org.citra.citra_emu.utils.ForegroundService" android:foregroundServiceType="specialUse">
|
||||
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE" android:value="Keep emulation running in background"/>
|
||||
</service>
|
||||
|
||||
<activity
|
||||
android:name="org.citra.citra_emu.features.cheats.ui.CheatsActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/Theme.Citra.Main"
|
||||
android:label="@string/cheats"/>
|
||||
|
||||
|
||||
<provider
|
||||
android:name="org.citra.citra_emu.model.GameProvider"
|
||||
android:authorities="${applicationId}.provider"
|
||||
android:enabled="true"
|
||||
android:exported="false">
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
// Copyright 2019 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
package org.citra.citra_emu;
|
||||
|
||||
import android.app.Application;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
|
||||
import org.citra.citra_emu.model.GameDatabase;
|
||||
import org.citra.citra_emu.utils.DirectoryInitialization;
|
||||
import org.citra.citra_emu.utils.DocumentsTree;
|
||||
import org.citra.citra_emu.utils.PermissionsHandler;
|
||||
|
||||
public class CitraApplication extends Application {
|
||||
public static GameDatabase databaseHelper;
|
||||
public static DocumentsTree documentsTree;
|
||||
private static CitraApplication application;
|
||||
|
||||
private void createNotificationChannel() {
|
||||
// Create the NotificationChannel, but only on API 26+ because
|
||||
// the NotificationChannel class is new and not in the support library
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
return;
|
||||
}
|
||||
NotificationManager notificationManager = getSystemService(NotificationManager.class);
|
||||
{
|
||||
// General notification
|
||||
CharSequence name = getString(R.string.app_notification_channel_name);
|
||||
String description = getString(R.string.app_notification_channel_description);
|
||||
NotificationChannel channel = new NotificationChannel(
|
||||
getString(R.string.app_notification_channel_id), name,
|
||||
NotificationManager.IMPORTANCE_LOW);
|
||||
channel.setDescription(description);
|
||||
channel.setSound(null, null);
|
||||
channel.setVibrationPattern(null);
|
||||
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
{
|
||||
// CIA Install notifications
|
||||
NotificationChannel channel = new NotificationChannel(
|
||||
getString(R.string.cia_install_notification_channel_id),
|
||||
getString(R.string.cia_install_notification_channel_name),
|
||||
NotificationManager.IMPORTANCE_DEFAULT);
|
||||
channel.setDescription(getString(R.string.cia_install_notification_channel_description));
|
||||
channel.setSound(null, null);
|
||||
channel.setVibrationPattern(null);
|
||||
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
application = this;
|
||||
documentsTree = new DocumentsTree();
|
||||
|
||||
if (PermissionsHandler.hasWriteAccess(getApplicationContext())) {
|
||||
DirectoryInitialization.start(getApplicationContext());
|
||||
}
|
||||
|
||||
NativeLibrary.LogDeviceInfo();
|
||||
createNotificationChannel();
|
||||
|
||||
databaseHelper = new GameDatabase(this);
|
||||
}
|
||||
|
||||
public static Context getAppContext() {
|
||||
return application.getApplicationContext();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
// Copyright 2023 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
package org.citra.citra_emu
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Application
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import org.citra.citra_emu.utils.DirectoryInitialization
|
||||
import org.citra.citra_emu.utils.DocumentsTree
|
||||
import org.citra.citra_emu.utils.GpuDriverHelper
|
||||
import org.citra.citra_emu.utils.PermissionsHandler
|
||||
import org.citra.citra_emu.utils.Log
|
||||
import org.citra.citra_emu.utils.MemoryUtil
|
||||
|
||||
class CitraApplication : Application() {
|
||||
private fun createNotificationChannel() {
|
||||
with(getSystemService(NotificationManager::class.java)) {
|
||||
// General notification
|
||||
val name: CharSequence = getString(R.string.app_notification_channel_name)
|
||||
val description = getString(R.string.app_notification_channel_description)
|
||||
val generalChannel = NotificationChannel(
|
||||
getString(R.string.app_notification_channel_id),
|
||||
name,
|
||||
NotificationManager.IMPORTANCE_LOW
|
||||
)
|
||||
generalChannel.description = description
|
||||
generalChannel.setSound(null, null)
|
||||
generalChannel.vibrationPattern = null
|
||||
createNotificationChannel(generalChannel)
|
||||
|
||||
// CIA Install notifications
|
||||
val ciaChannel = NotificationChannel(
|
||||
getString(R.string.cia_install_notification_channel_id),
|
||||
getString(R.string.cia_install_notification_channel_name),
|
||||
NotificationManager.IMPORTANCE_DEFAULT
|
||||
)
|
||||
ciaChannel.description =
|
||||
getString(R.string.cia_install_notification_channel_description)
|
||||
ciaChannel.setSound(null, null)
|
||||
ciaChannel.vibrationPattern = null
|
||||
createNotificationChannel(ciaChannel)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
application = this
|
||||
documentsTree = DocumentsTree()
|
||||
if (PermissionsHandler.hasWriteAccess(applicationContext)) {
|
||||
DirectoryInitialization.start()
|
||||
}
|
||||
|
||||
NativeLibrary.logDeviceInfo()
|
||||
logDeviceInfo()
|
||||
createNotificationChannel()
|
||||
}
|
||||
|
||||
fun logDeviceInfo() {
|
||||
Log.info("Device Manufacturer - ${Build.MANUFACTURER}")
|
||||
Log.info("Device Model - ${Build.MODEL}")
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) {
|
||||
Log.info("SoC Manufacturer - ${Build.SOC_MANUFACTURER}")
|
||||
Log.info("SoC Model - ${Build.SOC_MODEL}")
|
||||
}
|
||||
Log.info("Total System Memory - ${MemoryUtil.getDeviceRAM()}")
|
||||
}
|
||||
|
||||
companion object {
|
||||
private var application: CitraApplication? = null
|
||||
|
||||
val appContext: Context get() = application!!.applicationContext
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
lateinit var documentsTree: DocumentsTree
|
||||
}
|
||||
}
|
|
@ -1,720 +0,0 @@
|
|||
/*
|
||||
* Copyright 2013 Dolphin Emulator Project
|
||||
* Licensed under GPLv2+
|
||||
* Refer to the license.txt file included.
|
||||
*/
|
||||
|
||||
package org.citra.citra_emu;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.Surface;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import org.citra.citra_emu.activities.EmulationActivity;
|
||||
import org.citra.citra_emu.applets.SoftwareKeyboard;
|
||||
import org.citra.citra_emu.utils.EmulationMenuSettings;
|
||||
import org.citra.citra_emu.utils.FileUtil;
|
||||
import org.citra.citra_emu.utils.Log;
|
||||
import org.citra.citra_emu.utils.PermissionsHandler;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
import static android.Manifest.permission.CAMERA;
|
||||
import static android.Manifest.permission.RECORD_AUDIO;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
/**
|
||||
* Class which contains methods that interact
|
||||
* with the native side of the Citra code.
|
||||
*/
|
||||
public final class NativeLibrary {
|
||||
/**
|
||||
* Default touchscreen device
|
||||
*/
|
||||
public static final String TouchScreenDevice = "Touchscreen";
|
||||
public static WeakReference<EmulationActivity> sEmulationActivity = new WeakReference<>(null);
|
||||
|
||||
private static boolean alertResult = false;
|
||||
private static String alertPromptResult = "";
|
||||
private static int alertPromptButton = 0;
|
||||
private static final Object alertPromptLock = new Object();
|
||||
private static boolean alertPromptInProgress = false;
|
||||
private static String alertPromptCaption = "";
|
||||
private static int alertPromptButtonConfig = 0;
|
||||
private static EditText alertPromptEditText = null;
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("citra-android");
|
||||
} catch (UnsatisfiedLinkError ex) {
|
||||
Log.error("[NativeLibrary] " + ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private NativeLibrary() {
|
||||
// Disallows instantiation.
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles button press events for a gamepad.
|
||||
*
|
||||
* @param Device The input descriptor of the gamepad.
|
||||
* @param Button Key code identifying which button was pressed.
|
||||
* @param Action Mask identifying which action is happening (button pressed down, or button released).
|
||||
* @return If we handled the button press.
|
||||
*/
|
||||
public static native boolean onGamePadEvent(String Device, int Button, int Action);
|
||||
|
||||
/**
|
||||
* Handles gamepad movement events.
|
||||
*
|
||||
* @param Device The device ID of the gamepad.
|
||||
* @param Axis The axis ID
|
||||
* @param x_axis The value of the x-axis represented by the given ID.
|
||||
* @param y_axis The value of the y-axis represented by the given ID
|
||||
*/
|
||||
public static native boolean onGamePadMoveEvent(String Device, int Axis, float x_axis, float y_axis);
|
||||
|
||||
/**
|
||||
* Handles gamepad movement events.
|
||||
*
|
||||
* @param Device The device ID of the gamepad.
|
||||
* @param Axis_id The axis ID
|
||||
* @param axis_val The value of the axis represented by the given ID.
|
||||
*/
|
||||
public static native boolean onGamePadAxisEvent(String Device, int Axis_id, float axis_val);
|
||||
|
||||
/**
|
||||
* Handles touch events.
|
||||
*
|
||||
* @param x_axis The value of the x-axis.
|
||||
* @param y_axis The value of the y-axis
|
||||
* @param pressed To identify if the touch held down or released.
|
||||
* @return true if the pointer is within the touchscreen
|
||||
*/
|
||||
public static native boolean onTouchEvent(float x_axis, float y_axis, boolean pressed);
|
||||
|
||||
/**
|
||||
* Handles touch movement.
|
||||
*
|
||||
* @param x_axis The value of the instantaneous x-axis.
|
||||
* @param y_axis The value of the instantaneous y-axis.
|
||||
*/
|
||||
public static native void onTouchMoved(float x_axis, float y_axis);
|
||||
|
||||
public static native void ReloadSettings();
|
||||
|
||||
public static native String GetUserSetting(String gameID, String Section, String Key);
|
||||
|
||||
public static native void SetUserSetting(String gameID, String Section, String Key, String Value);
|
||||
|
||||
public static native void InitGameIni(String gameID);
|
||||
|
||||
public static native long GetTitleId(String filename);
|
||||
|
||||
public static native String GetGitRevision();
|
||||
|
||||
/**
|
||||
* Sets the current working user directory
|
||||
* If not set, it auto-detects a location
|
||||
*/
|
||||
public static native void SetUserDirectory(String directory);
|
||||
|
||||
public static native String[] GetInstalledGamePaths();
|
||||
|
||||
// Create the config.ini file.
|
||||
public static native void CreateConfigFile();
|
||||
|
||||
public static native void CreateLogFile();
|
||||
|
||||
public static native void LogUserDirectory(String directory);
|
||||
|
||||
public static native int DefaultCPUCore();
|
||||
|
||||
/**
|
||||
* Begins emulation.
|
||||
*/
|
||||
public static native void Run(String path);
|
||||
|
||||
public static native String[] GetTextureFilterNames();
|
||||
|
||||
/**
|
||||
* Begins emulation from the specified savestate.
|
||||
*/
|
||||
public static native void Run(String path, String savestatePath, boolean deleteSavestate);
|
||||
|
||||
// Surface Handling
|
||||
public static native void SurfaceChanged(Surface surf);
|
||||
|
||||
public static native void SurfaceDestroyed();
|
||||
|
||||
public static native void DoFrame();
|
||||
|
||||
/**
|
||||
* Unpauses emulation from a paused state.
|
||||
*/
|
||||
public static native void UnPauseEmulation();
|
||||
|
||||
/**
|
||||
* Pauses emulation.
|
||||
*/
|
||||
public static native void PauseEmulation();
|
||||
|
||||
/**
|
||||
* Stops emulation.
|
||||
*/
|
||||
public static native void StopEmulation();
|
||||
|
||||
/**
|
||||
* Returns true if emulation is running (or is paused).
|
||||
*/
|
||||
public static native boolean IsRunning();
|
||||
|
||||
/**
|
||||
* Returns the title ID of the currently running title, or 0 on failure.
|
||||
*/
|
||||
public static native long GetRunningTitleId();
|
||||
|
||||
/**
|
||||
* Returns the performance stats for the current game
|
||||
**/
|
||||
public static native double[] GetPerfStats();
|
||||
|
||||
/**
|
||||
* Notifies the core emulation that the orientation has changed.
|
||||
*/
|
||||
public static native void NotifyOrientationChange(int layout_option, int rotation);
|
||||
|
||||
/**
|
||||
* Swaps the top and bottom screens.
|
||||
*/
|
||||
public static native void SwapScreens(boolean swap_screens, int rotation);
|
||||
|
||||
public enum CoreError {
|
||||
ErrorSystemFiles,
|
||||
ErrorSavestate,
|
||||
ErrorUnknown,
|
||||
}
|
||||
|
||||
private static boolean coreErrorAlertResult = false;
|
||||
private static final Object coreErrorAlertLock = new Object();
|
||||
|
||||
public static class CoreErrorDialogFragment extends DialogFragment {
|
||||
static CoreErrorDialogFragment newInstance(String title, String message) {
|
||||
CoreErrorDialogFragment frag = new CoreErrorDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("title", title);
|
||||
args.putString("message", message);
|
||||
frag.setArguments(args);
|
||||
return frag;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
final Activity emulationActivity = Objects.requireNonNull(getActivity());
|
||||
|
||||
final String title = Objects.requireNonNull(Objects.requireNonNull(getArguments()).getString("title"));
|
||||
final String message = Objects.requireNonNull(Objects.requireNonNull(getArguments()).getString("message"));
|
||||
|
||||
return new MaterialAlertDialogBuilder(emulationActivity)
|
||||
.setTitle(title)
|
||||
.setMessage(message)
|
||||
.setPositiveButton(R.string.continue_button, (dialog, which) -> {
|
||||
coreErrorAlertResult = true;
|
||||
synchronized (coreErrorAlertLock) {
|
||||
coreErrorAlertLock.notify();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.abort_button, (dialog, which) -> {
|
||||
coreErrorAlertResult = false;
|
||||
synchronized (coreErrorAlertLock) {
|
||||
coreErrorAlertLock.notify();
|
||||
}
|
||||
}).setOnDismissListener(dialog -> {
|
||||
coreErrorAlertResult = true;
|
||||
synchronized (coreErrorAlertLock) {
|
||||
coreErrorAlertLock.notify();
|
||||
}
|
||||
}).create();
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnCoreErrorImpl(String title, String message) {
|
||||
final EmulationActivity emulationActivity = sEmulationActivity.get();
|
||||
if (emulationActivity == null) {
|
||||
Log.error("[NativeLibrary] EmulationActivity not present");
|
||||
return;
|
||||
}
|
||||
|
||||
CoreErrorDialogFragment fragment = CoreErrorDialogFragment.newInstance(title, message);
|
||||
fragment.show(emulationActivity.getSupportFragmentManager(), "coreError");
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a core error.
|
||||
* @return true: continue; false: abort
|
||||
*/
|
||||
public static boolean OnCoreError(CoreError error, String details) {
|
||||
final EmulationActivity emulationActivity = sEmulationActivity.get();
|
||||
if (emulationActivity == null) {
|
||||
Log.error("[NativeLibrary] EmulationActivity not present");
|
||||
return false;
|
||||
}
|
||||
|
||||
String title, message;
|
||||
switch (error) {
|
||||
case ErrorSystemFiles: {
|
||||
title = emulationActivity.getString(R.string.system_archive_not_found);
|
||||
message = emulationActivity.getString(R.string.system_archive_not_found_message, details.isEmpty() ? emulationActivity.getString(R.string.system_archive_general) : details);
|
||||
break;
|
||||
}
|
||||
case ErrorSavestate: {
|
||||
title = emulationActivity.getString(R.string.save_load_error);
|
||||
message = details;
|
||||
break;
|
||||
}
|
||||
case ErrorUnknown: {
|
||||
title = emulationActivity.getString(R.string.fatal_error);
|
||||
message = emulationActivity.getString(R.string.fatal_error_message);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Show the AlertDialog on the main thread.
|
||||
emulationActivity.runOnUiThread(() -> OnCoreErrorImpl(title, message));
|
||||
|
||||
// Wait for the lock to notify that it is complete.
|
||||
synchronized (coreErrorAlertLock) {
|
||||
try {
|
||||
coreErrorAlertLock.wait();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
return coreErrorAlertResult;
|
||||
}
|
||||
|
||||
public static boolean isPortraitMode() {
|
||||
return CitraApplication.getAppContext().getResources().getConfiguration().orientation ==
|
||||
Configuration.ORIENTATION_PORTRAIT;
|
||||
}
|
||||
|
||||
public static int landscapeScreenLayout() {
|
||||
return EmulationMenuSettings.getLandscapeScreenLayout();
|
||||
}
|
||||
|
||||
public static boolean displayAlertMsg(final String caption, final String text,
|
||||
final boolean yesNo) {
|
||||
Log.error("[NativeLibrary] Alert: " + text);
|
||||
final EmulationActivity emulationActivity = sEmulationActivity.get();
|
||||
boolean result = false;
|
||||
if (emulationActivity == null) {
|
||||
Log.warning("[NativeLibrary] EmulationActivity is null, can't do panic alert.");
|
||||
} else {
|
||||
// Create object used for waiting.
|
||||
final Object lock = new Object();
|
||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(emulationActivity)
|
||||
.setTitle(caption)
|
||||
.setMessage(text);
|
||||
|
||||
// If not yes/no dialog just have one button that dismisses modal,
|
||||
// otherwise have a yes and no button that sets alertResult accordingly.
|
||||
if (!yesNo) {
|
||||
builder
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, whichButton) ->
|
||||
{
|
||||
dialog.dismiss();
|
||||
synchronized (lock) {
|
||||
lock.notify();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alertResult = false;
|
||||
|
||||
builder
|
||||
.setPositiveButton(android.R.string.yes, (dialog, whichButton) ->
|
||||
{
|
||||
alertResult = true;
|
||||
dialog.dismiss();
|
||||
synchronized (lock) {
|
||||
lock.notify();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.no, (dialog, whichButton) ->
|
||||
{
|
||||
alertResult = false;
|
||||
dialog.dismiss();
|
||||
synchronized (lock) {
|
||||
lock.notify();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Show the AlertDialog on the main thread.
|
||||
emulationActivity.runOnUiThread(builder::show);
|
||||
|
||||
// Wait for the lock to notify that it is complete.
|
||||
synchronized (lock) {
|
||||
try {
|
||||
lock.wait();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
if (yesNo)
|
||||
result = alertResult;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void retryDisplayAlertPrompt() {
|
||||
if (!alertPromptInProgress) {
|
||||
return;
|
||||
}
|
||||
displayAlertPromptImpl(alertPromptCaption, alertPromptEditText.getText().toString(), alertPromptButtonConfig).show();
|
||||
}
|
||||
|
||||
public static String displayAlertPrompt(String caption, String text, int buttonConfig) {
|
||||
alertPromptCaption = caption;
|
||||
alertPromptButtonConfig = buttonConfig;
|
||||
alertPromptInProgress = true;
|
||||
|
||||
// Show the AlertDialog on the main thread
|
||||
sEmulationActivity.get().runOnUiThread(() -> displayAlertPromptImpl(alertPromptCaption, text, alertPromptButtonConfig).show());
|
||||
|
||||
// Wait for the lock to notify that it is complete
|
||||
synchronized (alertPromptLock) {
|
||||
try {
|
||||
alertPromptLock.wait();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
alertPromptInProgress = false;
|
||||
|
||||
return alertPromptResult;
|
||||
}
|
||||
|
||||
public static MaterialAlertDialogBuilder displayAlertPromptImpl(String caption, String text, int buttonConfig) {
|
||||
final EmulationActivity emulationActivity = sEmulationActivity.get();
|
||||
alertPromptResult = "";
|
||||
alertPromptButton = 0;
|
||||
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.leftMargin = params.rightMargin = CitraApplication.getAppContext().getResources().getDimensionPixelSize(R.dimen.dialog_margin);
|
||||
|
||||
// Set up the input
|
||||
alertPromptEditText = new EditText(CitraApplication.getAppContext());
|
||||
alertPromptEditText.setText(text);
|
||||
alertPromptEditText.setSingleLine();
|
||||
alertPromptEditText.setLayoutParams(params);
|
||||
|
||||
FrameLayout container = new FrameLayout(emulationActivity);
|
||||
container.addView(alertPromptEditText);
|
||||
|
||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(emulationActivity)
|
||||
.setTitle(caption)
|
||||
.setView(container)
|
||||
.setPositiveButton(android.R.string.ok, (dialogInterface, i) ->
|
||||
{
|
||||
alertPromptButton = buttonConfig;
|
||||
alertPromptResult = alertPromptEditText.getText().toString();
|
||||
synchronized (alertPromptLock) {
|
||||
alertPromptLock.notifyAll();
|
||||
}
|
||||
})
|
||||
.setOnDismissListener(dialogInterface ->
|
||||
{
|
||||
alertPromptResult = "";
|
||||
synchronized (alertPromptLock) {
|
||||
alertPromptLock.notifyAll();
|
||||
}
|
||||
});
|
||||
|
||||
if (buttonConfig > 0) {
|
||||
builder.setNegativeButton(android.R.string.cancel, (dialogInterface, i) ->
|
||||
{
|
||||
alertPromptResult = "";
|
||||
synchronized (alertPromptLock) {
|
||||
alertPromptLock.notifyAll();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
public static int alertPromptButton() {
|
||||
return alertPromptButton;
|
||||
}
|
||||
|
||||
public static void exitEmulationActivity(int resultCode) {
|
||||
final int Success = 0;
|
||||
final int ErrorNotInitialized = 1;
|
||||
final int ErrorGetLoader = 2;
|
||||
final int ErrorSystemMode = 3;
|
||||
final int ErrorLoader = 4;
|
||||
final int ErrorLoader_ErrorEncrypted = 5;
|
||||
final int ErrorLoader_ErrorInvalidFormat = 6;
|
||||
final int ErrorSystemFiles = 7;
|
||||
final int ShutdownRequested = 11;
|
||||
final int ErrorUnknown = 12;
|
||||
|
||||
final EmulationActivity emulationActivity = sEmulationActivity.get();
|
||||
if (emulationActivity == null) {
|
||||
Log.warning("[NativeLibrary] EmulationActivity is null, can't exit.");
|
||||
return;
|
||||
}
|
||||
|
||||
int captionId = R.string.loader_error_invalid_format;
|
||||
if (resultCode == ErrorLoader_ErrorEncrypted) {
|
||||
captionId = R.string.loader_error_encrypted;
|
||||
}
|
||||
|
||||
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(emulationActivity)
|
||||
.setTitle(captionId)
|
||||
.setMessage(Html.fromHtml("Please follow the guides to redump your <a href=\"https://citra-emu.org/wiki/dumping-game-cartridges/\">game cartidges</a> or <a href=\"https://citra-emu.org/wiki/dumping-installed-titles/\">installed titles</a>.", Html.FROM_HTML_MODE_LEGACY))
|
||||
.setPositiveButton(android.R.string.ok, (dialog, whichButton) -> emulationActivity.finish())
|
||||
.setOnDismissListener(dialogInterface -> emulationActivity.finish());
|
||||
emulationActivity.runOnUiThread(() -> {
|
||||
AlertDialog alert = builder.create();
|
||||
alert.show();
|
||||
((TextView) alert.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
|
||||
});
|
||||
}
|
||||
|
||||
public static void setEmulationActivity(EmulationActivity emulationActivity) {
|
||||
Log.verbose("[NativeLibrary] Registering EmulationActivity.");
|
||||
sEmulationActivity = new WeakReference<>(emulationActivity);
|
||||
}
|
||||
|
||||
public static void clearEmulationActivity() {
|
||||
Log.verbose("[NativeLibrary] Unregistering EmulationActivity.");
|
||||
|
||||
sEmulationActivity.clear();
|
||||
}
|
||||
|
||||
private static final Object cameraPermissionLock = new Object();
|
||||
private static boolean cameraPermissionGranted = false;
|
||||
public static final int REQUEST_CODE_NATIVE_CAMERA = 800;
|
||||
|
||||
public static boolean RequestCameraPermission() {
|
||||
final EmulationActivity emulationActivity = sEmulationActivity.get();
|
||||
if (emulationActivity == null) {
|
||||
Log.error("[NativeLibrary] EmulationActivity not present");
|
||||
return false;
|
||||
}
|
||||
if (ContextCompat.checkSelfPermission(emulationActivity, CAMERA) == PackageManager.PERMISSION_GRANTED) {
|
||||
// Permission already granted
|
||||
return true;
|
||||
}
|
||||
emulationActivity.requestPermissions(new String[]{CAMERA}, REQUEST_CODE_NATIVE_CAMERA);
|
||||
|
||||
// Wait until result is returned
|
||||
synchronized (cameraPermissionLock) {
|
||||
try {
|
||||
cameraPermissionLock.wait();
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
}
|
||||
return cameraPermissionGranted;
|
||||
}
|
||||
|
||||
public static void CameraPermissionResult(boolean granted) {
|
||||
cameraPermissionGranted = granted;
|
||||
synchronized (cameraPermissionLock) {
|
||||
cameraPermissionLock.notify();
|
||||
}
|
||||
}
|
||||
|
||||
private static final Object micPermissionLock = new Object();
|
||||
private static boolean micPermissionGranted = false;
|
||||
public static final int REQUEST_CODE_NATIVE_MIC = 900;
|
||||
|
||||
public static boolean RequestMicPermission() {
|
||||
final EmulationActivity emulationActivity = sEmulationActivity.get();
|
||||
if (emulationActivity == null) {
|
||||
Log.error("[NativeLibrary] EmulationActivity not present");
|
||||
return false;
|
||||
}
|
||||
if (ContextCompat.checkSelfPermission(emulationActivity, RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED) {
|
||||
// Permission already granted
|
||||
return true;
|
||||
}
|
||||
emulationActivity.requestPermissions(new String[]{RECORD_AUDIO}, REQUEST_CODE_NATIVE_MIC);
|
||||
|
||||
// Wait until result is returned
|
||||
synchronized (micPermissionLock) {
|
||||
try {
|
||||
micPermissionLock.wait();
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
}
|
||||
return micPermissionGranted;
|
||||
}
|
||||
|
||||
public static void MicPermissionResult(boolean granted) {
|
||||
micPermissionGranted = granted;
|
||||
synchronized (micPermissionLock) {
|
||||
micPermissionLock.notify();
|
||||
}
|
||||
}
|
||||
|
||||
/// Notifies that the activity is now in foreground and camera devices can now be reloaded
|
||||
public static native void ReloadCameraDevices();
|
||||
|
||||
public static native boolean LoadAmiibo(byte[] bytes);
|
||||
|
||||
public static native void RemoveAmiibo();
|
||||
|
||||
public static final int SAVESTATE_SLOT_COUNT = 10;
|
||||
|
||||
public static final class SavestateInfo {
|
||||
public int slot;
|
||||
public Date time;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static native SavestateInfo[] GetSavestateInfo();
|
||||
|
||||
public static native void SaveState(int slot);
|
||||
public static native void LoadState(int slot);
|
||||
|
||||
/**
|
||||
* Logs the Citra version, Android version and, CPU.
|
||||
*/
|
||||
public static native void LogDeviceInfo();
|
||||
|
||||
/**
|
||||
* Button type for use in onTouchEvent
|
||||
*/
|
||||
public static final class ButtonType {
|
||||
public static final int BUTTON_A = 700;
|
||||
public static final int BUTTON_B = 701;
|
||||
public static final int BUTTON_X = 702;
|
||||
public static final int BUTTON_Y = 703;
|
||||
public static final int BUTTON_START = 704;
|
||||
public static final int BUTTON_SELECT = 705;
|
||||
public static final int BUTTON_HOME = 706;
|
||||
public static final int BUTTON_ZL = 707;
|
||||
public static final int BUTTON_ZR = 708;
|
||||
public static final int DPAD_UP = 709;
|
||||
public static final int DPAD_DOWN = 710;
|
||||
public static final int DPAD_LEFT = 711;
|
||||
public static final int DPAD_RIGHT = 712;
|
||||
public static final int STICK_LEFT = 713;
|
||||
public static final int STICK_LEFT_UP = 714;
|
||||
public static final int STICK_LEFT_DOWN = 715;
|
||||
public static final int STICK_LEFT_LEFT = 716;
|
||||
public static final int STICK_LEFT_RIGHT = 717;
|
||||
public static final int STICK_C = 718;
|
||||
public static final int STICK_C_UP = 719;
|
||||
public static final int STICK_C_DOWN = 720;
|
||||
public static final int STICK_C_LEFT = 771;
|
||||
public static final int STICK_C_RIGHT = 772;
|
||||
public static final int TRIGGER_L = 773;
|
||||
public static final int TRIGGER_R = 774;
|
||||
public static final int DPAD = 780;
|
||||
public static final int BUTTON_DEBUG = 781;
|
||||
public static final int BUTTON_GPIO14 = 782;
|
||||
}
|
||||
|
||||
/**
|
||||
* Button states
|
||||
*/
|
||||
public static final class ButtonState {
|
||||
public static final int RELEASED = 0;
|
||||
public static final int PRESSED = 1;
|
||||
}
|
||||
public static boolean createFile(String directory, String filename) {
|
||||
if (FileUtil.isNativePath(directory)) {
|
||||
return CitraApplication.documentsTree.createFile(directory, filename);
|
||||
}
|
||||
return FileUtil.createFile(CitraApplication.getAppContext(), directory, filename) != null;
|
||||
}
|
||||
|
||||
public static boolean createDir(String directory, String directoryName) {
|
||||
if (FileUtil.isNativePath(directory)) {
|
||||
return CitraApplication.documentsTree.createDir(directory, directoryName);
|
||||
}
|
||||
return FileUtil.createDir(CitraApplication.getAppContext(), directory, directoryName) != null;
|
||||
}
|
||||
|
||||
public static int openContentUri(String path, String openMode) {
|
||||
if (FileUtil.isNativePath(path)) {
|
||||
return CitraApplication.documentsTree.openContentUri(path, openMode);
|
||||
}
|
||||
return FileUtil.openContentUri(CitraApplication.getAppContext(), path, openMode);
|
||||
}
|
||||
|
||||
public static String[] getFilesName(String path) {
|
||||
if (FileUtil.isNativePath(path)) {
|
||||
return CitraApplication.documentsTree.getFilesName(path);
|
||||
}
|
||||
return FileUtil.getFilesName(CitraApplication.getAppContext(), path);
|
||||
}
|
||||
|
||||
public static long getSize(String path) {
|
||||
if (FileUtil.isNativePath(path)) {
|
||||
return CitraApplication.documentsTree.getFileSize(path);
|
||||
}
|
||||
return FileUtil.getFileSize(CitraApplication.getAppContext(), path);
|
||||
}
|
||||
|
||||
public static boolean fileExists(String path) {
|
||||
if (FileUtil.isNativePath(path)) {
|
||||
return CitraApplication.documentsTree.Exists(path);
|
||||
}
|
||||
return FileUtil.Exists(CitraApplication.getAppContext(), path);
|
||||
}
|
||||
|
||||
public static boolean isDirectory(String path) {
|
||||
if (FileUtil.isNativePath(path)) {
|
||||
return CitraApplication.documentsTree.isDirectory(path);
|
||||
}
|
||||
return FileUtil.isDirectory(CitraApplication.getAppContext(), path);
|
||||
}
|
||||
|
||||
public static boolean copyFile(String sourcePath, String destinationParentPath, String destinationFilename) {
|
||||
if (FileUtil.isNativePath(sourcePath) && FileUtil.isNativePath(destinationParentPath)) {
|
||||
return CitraApplication.documentsTree.copyFile(sourcePath, destinationParentPath, destinationFilename);
|
||||
}
|
||||
return FileUtil.copyFile(CitraApplication.getAppContext(), sourcePath, destinationParentPath, destinationFilename);
|
||||
}
|
||||
|
||||
public static boolean renameFile(String path, String destinationFilename) {
|
||||
if (FileUtil.isNativePath(path)) {
|
||||
return CitraApplication.documentsTree.renameFile(path, destinationFilename);
|
||||
}
|
||||
return FileUtil.renameFile(CitraApplication.getAppContext(), path, destinationFilename);
|
||||
}
|
||||
|
||||
public static boolean deleteDocument(String path) {
|
||||
if (FileUtil.isNativePath(path)) {
|
||||
return CitraApplication.documentsTree.deleteDocument(path);
|
||||
}
|
||||
return FileUtil.deleteDocument(CitraApplication.getAppContext(), path);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue