From f4a3b54fb9b14d90e711d568a380e56ccbee0e4a Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Mon, 16 Jan 2023 18:00:12 +0000 Subject: [PATCH] Update Discord SDK --- .github/workflows/Windows_MinGW_x64.yml | 2 +- .github/workflows/Windows_MinGW_x86.yml | 2 +- 3rdParty/discord/CMakeLists.txt | 28 ++++++++++------------ 3rdParty/discord/discord_game_sdk_fake.cpp | 4 ---- 4 files changed, 15 insertions(+), 21 deletions(-) delete mode 100644 3rdParty/discord/discord_game_sdk_fake.cpp diff --git a/.github/workflows/Windows_MinGW_x64.yml b/.github/workflows/Windows_MinGW_x64.yml index fb6d6bea636..2f9c3e05a23 100644 --- a/.github/workflows/Windows_MinGW_x64.yml +++ b/.github/workflows/Windows_MinGW_x64.yml @@ -30,7 +30,7 @@ jobs: - name: Configure CMake shell: bash working-directory: ${{github.workspace}} - run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=OFF -DCPACK=ON -DCMAKE_TOOLCHAIN_FILE=../CMake/platforms/mingwcc64.toolchain.cmake -DDEVILUTIONX_SYSTEM_BZIP2=OFF -DDEVILUTIONX_STATIC_LIBSODIUM=ON -DDISCORD_INTEGRATION=ON + run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=OFF -DCPACK=ON -DCMAKE_TOOLCHAIN_FILE=../CMake/platforms/mingwcc64.toolchain.cmake -DDEVILUTIONX_SYSTEM_BZIP2=OFF -DDEVILUTIONX_STATIC_LIBSODIUM=ON - name: Build working-directory: ${{github.workspace}} diff --git a/.github/workflows/Windows_MinGW_x86.yml b/.github/workflows/Windows_MinGW_x86.yml index 5da402e0f90..c206b45be84 100644 --- a/.github/workflows/Windows_MinGW_x86.yml +++ b/.github/workflows/Windows_MinGW_x86.yml @@ -30,7 +30,7 @@ jobs: - name: Configure CMake shell: bash working-directory: ${{github.workspace}} - run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=OFF -DCPACK=ON -DCMAKE_TOOLCHAIN_FILE=../CMake/platforms/mingwcc.toolchain.cmake -DDEVILUTIONX_SYSTEM_BZIP2=OFF -DDEVILUTIONX_STATIC_LIBSODIUM=ON -DDISCORD_INTEGRATION=ON + run: cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=OFF -DCPACK=ON -DCMAKE_TOOLCHAIN_FILE=../CMake/platforms/mingwcc.toolchain.cmake -DDEVILUTIONX_SYSTEM_BZIP2=OFF -DDEVILUTIONX_STATIC_LIBSODIUM=ON - name: Build working-directory: ${{github.workspace}} diff --git a/3rdParty/discord/CMakeLists.txt b/3rdParty/discord/CMakeLists.txt index 917543384e6..dcbca0149ef 100644 --- a/3rdParty/discord/CMakeLists.txt +++ b/3rdParty/discord/CMakeLists.txt @@ -4,8 +4,8 @@ include(FetchContent) find_package(Patch REQUIRED) FetchContent_Declare(discordsrc - URL https://dl-game-sdk.discordapp.net/2.5.6/discord_game_sdk.zip - URL_HASH MD5=f86f15957cc9fbf04e3db10462027d58 + URL https://dl-game-sdk.discordapp.net/3.2.1/discord_game_sdk.zip + URL_HASH MD5=73e5e1b3f8413a2c7184ef17476822f2 PATCH_COMMAND "${Patch_EXECUTABLE}" -p0 -N < "${CMAKE_CURRENT_LIST_DIR}/fix-types-h.patch" || true ) FetchContent_MakeAvailableExcludeFromAll(discordsrc) @@ -14,23 +14,21 @@ file(GLOB discord_SRCS ${discordsrc_SOURCE_DIR}/cpp/*.cpp) add_library(discord STATIC ${discord_SRCS}) target_include_directories(discord INTERFACE "${discordsrc_SOURCE_DIR}/..") -if (CMAKE_SIZEOF_VOID_P EQUAL 4) +if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") + set(DISCORD_LIB_DIR "${discordsrc_SOURCE_DIR}/lib/aarch64") +elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) set(DISCORD_LIB_DIR "${discordsrc_SOURCE_DIR}/lib/x86") else() set(DISCORD_LIB_DIR "${discordsrc_SOURCE_DIR}/lib/x86_64") endif() -set(DISCORD_SHARED_LIB "${DISCORD_LIB_DIR}/discord_game_sdk${CMAKE_SHARED_LIBRARY_SUFFIX}") +set(DISCORD_SHARED_LIB_FILENAME "discord_game_sdk${CMAKE_SHARED_LIBRARY_SUFFIX}") -if(WIN32 AND NOT MSVC) - add_library(discord_game_sdk SHARED "discord_game_sdk_fake.cpp") - set_target_properties(discord_game_sdk PROPERTIES PREFIX "") -else() - find_library(DISCORD_LIB discord_game_sdk${CMAKE_SHARED_LIBRARY_SUFFIX} ${DISCORD_LIB_DIR}) +file(COPY "${DISCORD_LIB_DIR}/${DISCORD_SHARED_LIB_FILENAME}" DESTINATION "${CMAKE_BINARY_DIR}") +set(DISCORD_SHARED_LIB "${CMAKE_BINARY_DIR}/${DISCORD_SHARED_LIB_FILENAME}") +set(DISCORD_SHARED_LIB ${DISCORD_SHARED_LIB} PARENT_SCOPE) - add_library(discord_game_sdk SHARED IMPORTED GLOBAL) - set_property(TARGET discord_game_sdk PROPERTY IMPORTED_IMPLIB ${DISCORD_LIB}) - set_property(TARGET discord_game_sdk PROPERTY IMPORTED_LOCATION ${DISCORD_SHARED_LIB}) -endif() +find_library(DISCORD_LIB ${DISCORD_SHARED_LIB_FILENAME} ${CMAKE_BINARY_DIR}) -set(DISCORD_SHARED_LIB ${DISCORD_SHARED_LIB} PARENT_SCOPE) -file(COPY ${DISCORD_SHARED_LIB} DESTINATION "${CMAKE_BINARY_DIR}") +add_library(discord_game_sdk SHARED IMPORTED GLOBAL) +set_property(TARGET discord_game_sdk PROPERTY IMPORTED_IMPLIB ${DISCORD_LIB}) +set_property(TARGET discord_game_sdk PROPERTY IMPORTED_LOCATION ${DISCORD_SHARED_LIB}) diff --git a/3rdParty/discord/discord_game_sdk_fake.cpp b/3rdParty/discord/discord_game_sdk_fake.cpp deleted file mode 100644 index f496b480b91..00000000000 --- a/3rdParty/discord/discord_game_sdk_fake.cpp +++ /dev/null @@ -1,4 +0,0 @@ -extern "C" { -__declspec(dllexport) int DiscordCreate(int, void *, void *) { return 0; } -__declspec(dllexport) int DiscordVersion(int, void *) { return 0; } -}