diff --git a/.clang-format b/.clang-format index a050582..02dc5a1 100644 --- a/.clang-format +++ b/.clang-format @@ -1,2 +1,3 @@ BasedOnStyle: LLVM BreakBeforeBraces: Stroustrup +AllowShortIfStatementsOnASingleLine: true \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d436b69..4b2ffc5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,6 +39,7 @@ jobs: - uses: actions/setup-python@master with: python-version: '3.10' + - name: actions/cache qt uses: actions/cache@master id: cache @@ -49,8 +50,16 @@ jobs: - name: Add msbuild to PATH if: matrix.platform == 'msvc2019' uses: microsoft/setup-msbuild@master - - - uses: stonedDiscord/action-setup-qt@master + + - name: Downgrade Android NDK + if: matrix.platform == 'android' + run: | + ANDROID_ROOT=/usr/local/lib/android + ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk + ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk-bundle + ln -sfn $ANDROID_SDK_ROOT/ndk/21.4.7075529 $ANDROID_NDK_ROOT + + - uses: Skycoder42/action-setup-qt@master id: qt with: version: 5.15.1 @@ -60,6 +69,10 @@ jobs: run: | git clone https://github.com/Skycoder42/QtApng.git cd QtApng + cd src/3rdparty + chmod +x get_libs.sh + ./get_libs.sh 1.2.12 1.6.37 + cd ../.. qmake CONFIG+=install_ok QT_PLATFORM=${{matrix.platform}} ${{steps.qt.outputs.make}} qmake_all ${{steps.qt.outputs.make}} @@ -76,6 +89,7 @@ jobs: unzip discord_rpc.zip cp ./discord-rpc/win32-dynamic/lib/discord-rpc.lib ./lib/ cp ./discord-rpc/win32-dynamic/bin/discord-rpc.dll ./bin/ + cp ./discord-rpc/win32-dynamic/include/discord*.h ./include/ - name: Install Linux Discord RPC if: matrix.platform == 'gcc_64' @@ -84,6 +98,7 @@ jobs: unzip discord_rpc.zip cp ./discord-rpc/linux-dynamic/lib/libdiscord-rpc.so ./lib/ cp ./discord-rpc/linux-dynamic/lib/libdiscord-rpc.so ./bin/ + cp ./discord-rpc/linux-dynamic/include/discord*.h ./include/ - name: Install Mac Discord RPC if: matrix.os == 'macos-latest' @@ -92,6 +107,7 @@ jobs: unzip discord_rpc.zip cp ./discord-rpc/osx-dynamic/lib/libdiscord-rpc.dylib ./lib/ cp ./discord-rpc/osx-dynamic/lib/libdiscord-rpc.dylib ./bin/ + cp ./discord-rpc/osx-dynamic/include/discord*.h ./include/ - name: Install Windows BASS if: contains(matrix.os, 'windows') @@ -169,7 +185,7 @@ jobs: - name: qmake run: | - qmake CONFIG+=install_ok QT_PLATFORM=${{matrix.platform}} ANDROID_ABIS="armeabi-v7a" + qmake DEFINES+=DISCORD CONFIG+=install_ok QT_PLATFORM=${{matrix.platform}} ANDROID_ABIS="armeabi-v7a" - name: build run: | @@ -180,8 +196,19 @@ jobs: working-directory: ${{github.workspace}}/bin/ shell: bash run: | - windeployqt . + windeployqt --no-quick-import --no-translations --no-virtualkeyboard --no-compiler-runtime --no-webkit2 --no-opengl-sw . cp ../QtApng/plugins/imageformats/qapng.dll ./imageformats/ + rm ./imageformats/qtiff.dll + rm ./imageformats/qjpeg.dll + rm ./imageformats/qicns.dll + rm ./imageformats/qico.dll + rm ./imageformats/qsvg.dll + rm ./imageformats/qtga.dll + rm ./imageformats/qwbmp.dll + rm ./Qt5Svg.dll + rm -r iconengines + rm -r bearer + rm -r styles - name: Deploy Mac if: matrix.os == 'macos-latest' @@ -196,6 +223,8 @@ jobs: install_name_tool -change @loader_path/libbassmidi.dylib @rpath/libbassmidi.dylib ./Attorney_Online.app/Contents/MacOS/Attorney_Online install_name_tool -change @loader_path/libdiscord-rpc.dylib @rpath/libdiscord-rpc.dylib ./Attorney_Online.app/Contents/MacOS/Attorney_Online install_name_tool -change @loader_path/libqapng.dylib @rpath/libqapng.dylib ./Attorney_Online.app/Contents/MacOS/Attorney_Online + hdiutil create -volname "Attorney_Online" -srcfolder "./Attorney_Online.app" -ov -format UDZO "Attorney_Online.dmg" + rm -r ./Attorney_Online.app/ - name: Deploy Android if: matrix.platform == 'android' diff --git a/.github/workflows/clang-tidy-review.yml b/.github/workflows/clang-tidy-review.yml index 8fa0f04..673aa4a 100644 --- a/.github/workflows/clang-tidy-review.yml +++ b/.github/workflows/clang-tidy-review.yml @@ -63,7 +63,7 @@ jobs: id: review with: build_dir: 'build' - clang_tidy_checks: '-*,performance-*,readability-*,bugprone-*,clang-analyzer-*,cppcoreguidelines-*,mpi-*,misc-*,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-init-variables,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-avoid-magic-numbers' + clang_tidy_checks: '-*,performance-*,readability-*,bugprone-*,clang-analyzer-*,cppcoreguidelines-*,mpi-*,misc-*,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-init-variables,-cppcoreguidelines-pro-type-member-init,-*-magic-numbers' apt_packages: 'pkg-config,libzip-dev,libglu1-mesa-dev,libpulse-dev' max_comments: 10 # If there are any comments, fail the check diff --git a/Attorney_Online.pro b/Attorney_Online.pro index 95e3945..a7815d0 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -29,7 +29,9 @@ QMAKE_LFLAGS += -Wl,-rpath,"'\$$ORIGIN/lib'" # DEFINES += DISCORD contains(DEFINES, DISCORD) { - LIBS += -ldiscord-rpc + win32:LIBS += -ldiscord-rpc + linux:!android:LIBS += -ldiscord-rpc + mac:LIBS += -ldiscord-rpc } # As of 2.8.5, BASS and BASSOPUS are required for all platforms. Qt Multimedia diff --git a/src/discord_rich_presence.cpp b/src/discord_rich_presence.cpp index 7306655..cd3a475 100644 --- a/src/discord_rich_presence.cpp +++ b/src/discord_rich_presence.cpp @@ -2,7 +2,7 @@ namespace AttorneyOnline { -#ifdef DISCORD +#if defined(DISCORD) && !defined(ANDROID) Discord::Discord() { DiscordEventHandlers handlers;