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.
This commit is contained in:
Fletcher Dunn
2026-05-28 09:43:54 -07:00
parent 495094583f
commit 91465451d0
4 changed files with 24 additions and 7 deletions
+8 -2
View File
@@ -14,5 +14,11 @@ add_executable(
example_chat
../example_chat.cpp)
# This example links GameNetworkingSockets as a shared lib.
target_link_libraries(example_chat GameNetworkingSockets::shared)
# Link against shared or static depending on how vcpkg built the library.
# Pass -DGNS_LINK_STATIC=ON to link statically (e.g. with x64-windows-static triplet).
option(GNS_LINK_STATIC "Link GameNetworkingSockets statically" OFF)
if(GNS_LINK_STATIC)
target_link_libraries(example_chat GameNetworkingSockets::static)
else()
target_link_libraries(example_chat GameNetworkingSockets::shared)
endif()
+6 -1
View File
@@ -5,7 +5,12 @@
"description": "A basic transport layer for games.",
"homepage": "https://github.com/ValveSoftware/GameNetworkingSockets",
"builtin-baseline": "522253caf47268c1724f486a035e927a42a90092",
"dependencies": [ "protobuf", "openssl" ],
"dependencies": [
"protobuf",
"openssl",
{ "name": "vcpkg-cmake", "host": true },
{ "name": "vcpkg-cmake-config", "host": true }
],
"default-features": [ "openssl" ],
"features": {
"openssl": {
@@ -1,4 +1,6 @@
set(SOURCE_PATH ".")
# For local testing only -- points at the repo root instead of downloading a release.
# The official vcpkg portfile replaces this line with vcpkg_from_github(...).
get_filename_component(SOURCE_PATH "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
# Select crypto backend based on the selected crypto "feature"
# WE ARE NOT SUPPOSED TO BE DOING THIS.
@@ -6,9 +8,12 @@ set(SOURCE_PATH ".")
if ("libsodium" IN_LIST FEATURES)
set(CRYPTO_BACKEND "libsodium")
endif()
if ("bcrypt" IN_LIST FEATURES)
set(CRYPTO_BACKEND "BCrypt")
endif()
# BCrypt is not supported as a vcpkg feature because it is only used for Xbox,
# which does not use vcpkg. If you want to use this for some reason, you'll
# need to configure and build yourself.
#if ("bcrypt" IN_LIST FEATURES)
# set(CRYPTO_BACKEND "BCrypt")
#endif()
if ( ( "${CRYPTO_BACKEND}" STREQUAL "" ) OR ( "openssl" IN_LIST FEATURES ) )
set(CRYPTO_BACKEND "OpenSSL")
endif()
+1
View File
@@ -0,0 +1 @@
../../vcpkg.json