mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 18:31:15 +08:00
[discord-game-sdk] new port (#10763)
* [discord-game-sdk] new port * [discord-game-sdk] Invert Supports field * [discord-game-sdk] Fix Supports field * [discord-game-sdk] Fix Supports field again * [discord-game-sdk] Update find_library * [discord-game-sdk] Rename LICENSE.md, remove include(vcpkg_common_functions) * [discord-game-sdk] Fix Linux build, add usage file * [discord-game-sdk] Add missing file(INSTALL) * [discord-game-sdk] Update baseline and fix macOS build * [discord-game-sdk] Specify C++ standard version * [discord-game-sdk] Remove vcpkg_copy_pdbs * [discord-game-sdk] Replace ToS text by link to online version
This commit is contained in:
parent
07f7b67186
commit
411929e664
19
ports/discord-game-sdk/CMakeLists.txt
Normal file
19
ports/discord-game-sdk/CMakeLists.txt
Normal file
@ -0,0 +1,19 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(discord_game_sdk_cpp)
|
||||
|
||||
find_library(SDK_LIB
|
||||
"discord_game_sdk"
|
||||
PATHS "${SDK_LIB_FOLDER}"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
file(GLOB SRC_FILES "${PROJECT_SOURCE_DIR}/cpp/*.cpp")
|
||||
file(GLOB_RECURSE HDR_FILES "${PROJECT_SOURCE_DIR}/*.h")
|
||||
|
||||
add_library(discord_game_sdk_cpp STATIC ${SRC_FILES})
|
||||
target_link_libraries(discord_game_sdk_cpp PUBLIC ${SDK_LIB})
|
||||
set_property(TARGET discord_game_sdk_cpp PROPERTY CXX_STANDARD 11)
|
||||
|
||||
install(TARGETS discord_game_sdk_cpp ARCHIVE)
|
||||
install(FILES ${HDR_FILES} DESTINATION "include/discord-game-sdk")
|
5
ports/discord-game-sdk/CONTROL
Normal file
5
ports/discord-game-sdk/CONTROL
Normal file
@ -0,0 +1,5 @@
|
||||
Source: discord-game-sdk
|
||||
Version: 2.5.6
|
||||
Homepage: https://discordapp.com/developers/docs/game-sdk/sdk-starter-guide
|
||||
Description: The Discord GameSDK is an easy drop-in SDK to help you manage all the hard things that come with making a game.
|
||||
Supports: ((x64 && (windows || osx || linux)) || (x86 && windows)) && !uwp && !static
|
1
ports/discord-game-sdk/copyright
Normal file
1
ports/discord-game-sdk/copyright
Normal file
@ -0,0 +1 @@
|
||||
Your use of the GameSDK is bound by the Discord Developer Terms of Service, whose text is available online at https://discordapp.com/developers/docs/legal.
|
51
ports/discord-game-sdk/portfile.cmake
Normal file
51
ports/discord-game-sdk/portfile.cmake
Normal file
@ -0,0 +1,51 @@
|
||||
vcpkg_fail_port_install(ON_ARCH "arm" "arm64" ON_TARGET "android" "uwp")
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" AND NOT VCPKG_TARGET_IS_WINDOWS)
|
||||
vcpkg_fail_port_install(MESSAGE "The GameSDK only supports x86 on Windows." ALWAYS)
|
||||
endif()
|
||||
|
||||
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
|
||||
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS https://dl-game-sdk.discordapp.net/2.5.6/discord_game_sdk.zip
|
||||
FILENAME discord_game_sdk.zip
|
||||
SHA512 4c8f72c7bdf92bc969fb86b96ea0d835e01b9bab1a2cc27ae00bdac1b9733a1303ceadfe138c24a7609b76d61d49999a335dd596cf3f335d894702e2aa23406f
|
||||
)
|
||||
|
||||
vcpkg_extract_source_archive_ex(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
ARCHIVE ${ARCHIVE}
|
||||
NO_REMOVE_ONE_LEVEL
|
||||
)
|
||||
|
||||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION ${SOURCE_PATH})
|
||||
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
|
||||
set(ARCH_FOLDER "x86")
|
||||
else(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
|
||||
set(ARCH_FOLDER "x86_64")
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
file(INSTALL "${SOURCE_PATH}/lib/${ARCH_FOLDER}/discord_game_sdk.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
|
||||
file(INSTALL "${SOURCE_PATH}/lib/${ARCH_FOLDER}/discord_game_sdk.dll" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
|
||||
file(INSTALL "${SOURCE_PATH}/lib/${ARCH_FOLDER}/discord_game_sdk.dll.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib" RENAME "discord_game_sdk.lib")
|
||||
file(INSTALL "${SOURCE_PATH}/lib/${ARCH_FOLDER}/discord_game_sdk.dll.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib" RENAME "discord_game_sdk.lib")
|
||||
elseif(VCPKG_TARGET_IS_OSX)
|
||||
file(INSTALL "${SOURCE_PATH}/lib/${ARCH_FOLDER}/discord_game_sdk.dylib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib" RENAME "libdiscord_game_sdk.dylib")
|
||||
file(INSTALL "${SOURCE_PATH}/lib/${ARCH_FOLDER}/discord_game_sdk.dylib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib" RENAME "libdiscord_game_sdk.dylib")
|
||||
elseif(VCPKG_TARGET_IS_LINUX)
|
||||
file(INSTALL "${SOURCE_PATH}/lib/${ARCH_FOLDER}/discord_game_sdk.so" DESTINATION "${CURRENT_PACKAGES_DIR}/lib" RENAME "libdiscord_game_sdk.so")
|
||||
file(INSTALL "${SOURCE_PATH}/lib/${ARCH_FOLDER}/discord_game_sdk.so" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib" RENAME "libdiscord_game_sdk.so")
|
||||
endif()
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS
|
||||
"-DSDK_LIB_FOLDER=${CURRENT_PACKAGES_DIR}/lib"
|
||||
)
|
||||
vcpkg_install_cmake()
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/copyright" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
12
ports/discord-game-sdk/usage
Normal file
12
ports/discord-game-sdk/usage
Normal file
@ -0,0 +1,12 @@
|
||||
The package discord-game-sdk does not provides CMake integration:
|
||||
|
||||
find_library(GAME_SDK discord_game_sdk)
|
||||
target_link_libraries(<my_target> PRIVATE ${GAME_SDK})
|
||||
|
||||
find_path(GAME_SDK_INCLUDE discord-game-sdk/discord.h)
|
||||
target_include_directories(<my_target> PRIVATE ${GAME_SDK_INCLUDE})
|
||||
|
||||
The C++ SDK source code is compiled in a static library:
|
||||
|
||||
find_library(CPP_GAME_SDK discord_game_sdk_cpp)
|
||||
target_link_libraries(<my_target> PRIVATE ${CPP_GAME_SDK})
|
@ -329,6 +329,7 @@ directxtk:x64-windows-static=fail
|
||||
directxtk12:x64-linux=fail
|
||||
directxtk12:x64-osx=fail
|
||||
directxtk12:x64-windows-static=fail
|
||||
discord-game-sdk:x64-windows-static=fail
|
||||
discord-rpc:arm-uwp=fail
|
||||
discord-rpc:x64-uwp=fail
|
||||
dlfcn-win32:arm-uwp=fail
|
||||
|
Loading…
x
Reference in New Issue
Block a user