Skip to content

Commit

Permalink
Update Discord SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
glebm committed Jan 16, 2023
1 parent ff4be22 commit f4a3b54
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Windows_MinGW_x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Windows_MinGW_x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
28 changes: 13 additions & 15 deletions 3rdParty/discord/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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})
4 changes: 0 additions & 4 deletions 3rdParty/discord/discord_game_sdk_fake.cpp

This file was deleted.

0 comments on commit f4a3b54

Please sign in to comment.