Skip to content

Commit 9146545

Browse files
committed
vcpkg fixes
vcpkg manigest: - Add vcpkg-cmake as dependency of this project - Don't support bcrypt as vcpkg feature. Nobody using vcpkg wants bcrypt, so this is just a trap. Local/test overlay port: - Fix how we are setting SOURCE_PATH - Add symlink to out vcpkg.json manifest, since a port needs one Chat example built using vcpkg: - Add GNS_LINK_STATIC option to vcpkg_example_chat project so I can test an app linking against static or dynamic lib.
1 parent 4950945 commit 9146545

4 files changed

Lines changed: 24 additions & 7 deletions

File tree

examples/vcpkg_example_chat/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,11 @@ add_executable(
1414
example_chat
1515
../example_chat.cpp)
1616

17-
# This example links GameNetworkingSockets as a shared lib.
18-
target_link_libraries(example_chat GameNetworkingSockets::shared)
17+
# Link against shared or static depending on how vcpkg built the library.
18+
# Pass -DGNS_LINK_STATIC=ON to link statically (e.g. with x64-windows-static triplet).
19+
option(GNS_LINK_STATIC "Link GameNetworkingSockets statically" OFF)
20+
if(GNS_LINK_STATIC)
21+
target_link_libraries(example_chat GameNetworkingSockets::static)
22+
else()
23+
target_link_libraries(example_chat GameNetworkingSockets::shared)
24+
endif()

vcpkg.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
"description": "A basic transport layer for games.",
66
"homepage": "https://github.com/ValveSoftware/GameNetworkingSockets",
77
"builtin-baseline": "522253caf47268c1724f486a035e927a42a90092",
8-
"dependencies": [ "protobuf", "openssl" ],
8+
"dependencies": [
9+
"protobuf",
10+
"openssl",
11+
{ "name": "vcpkg-cmake", "host": true },
12+
{ "name": "vcpkg-cmake-config", "host": true }
13+
],
914
"default-features": [ "openssl" ],
1015
"features": {
1116
"openssl": {

vcpkg_ports/gamenetworkingsockets/portfile.cmake

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
set(SOURCE_PATH ".")
1+
# For local testing only -- points at the repo root instead of downloading a release.
2+
# The official vcpkg portfile replaces this line with vcpkg_from_github(...).
3+
get_filename_component(SOURCE_PATH "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
24

35
# Select crypto backend based on the selected crypto "feature"
46
# WE ARE NOT SUPPOSED TO BE DOING THIS.
57
# I'd be super happy if somebody wants to fix this up properly.
68
if ("libsodium" IN_LIST FEATURES)
79
set(CRYPTO_BACKEND "libsodium")
810
endif()
9-
if ("bcrypt" IN_LIST FEATURES)
10-
set(CRYPTO_BACKEND "BCrypt")
11-
endif()
11+
# BCrypt is not supported as a vcpkg feature because it is only used for Xbox,
12+
# which does not use vcpkg. If you want to use this for some reason, you'll
13+
# need to configure and build yourself.
14+
#if ("bcrypt" IN_LIST FEATURES)
15+
# set(CRYPTO_BACKEND "BCrypt")
16+
#endif()
1217
if ( ( "${CRYPTO_BACKEND}" STREQUAL "" ) OR ( "openssl" IN_LIST FEATURES ) )
1318
set(CRYPTO_BACKEND "OpenSSL")
1419
endif()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../vcpkg.json

0 commit comments

Comments
 (0)