From 5c793b9f1a507aa9670c8634817bde48b744428b Mon Sep 17 00:00:00 2001 From: Fletcher Dunn Date: Tue, 23 Nov 2021 17:26:15 -0800 Subject: [PATCH] Got cert tool building This is progress towards fixing #186. However, I need some help publishing/installing (or whatever it's called) properly, and there is probably a better way to integrate with picojson than using a git submodule. --- .gitmodules | 3 +++ CMakeLists.txt | 1 + src/CMakeLists.txt | 13 +++++++++++++ src/external/picojson | 1 + vcpkg_ports/gamenetworkingsockets/portfile.cmake | 4 +++- vcpkg_ports/gamenetworkingsockets/vcpkg.json | 5 ++++- 6 files changed, 25 insertions(+), 2 deletions(-) create mode 160000 src/external/picojson diff --git a/.gitmodules b/.gitmodules index 553aedab..a96652ae 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,3 +5,6 @@ [submodule "src/external/webrtc"] path = src/external/webrtc url = https://webrtc.googlesource.com/src +[submodule "src/external/picojson"] + path = src/external/picojson + url = https://github.com/kazuho/picojson.git diff --git a/CMakeLists.txt b/CMakeLists.txt index bbcf98fb..5adda753 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,7 @@ option(BUILD_STATIC_LIB "Build the static link version of the client library" ON option(BUILD_SHARED_LIB "Build the shared library version of the client library" ON) option(BUILD_EXAMPLES "Build the included examples" OFF) option(BUILD_TESTS "Build crypto, pki and network connection tests" OFF) +option(BUILD_TOOLS "Build cert management tool" OFF) option(LTO "Enable Link-Time Optimization" OFF) option(USE_STEAMWEBRTC "Build Google's WebRTC library to get ICE support for P2P" OFF) option(Protobuf_USE_STATIC_LIBS "Link with protobuf statically" OFF) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 81fe3374..b99b9034 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -334,7 +334,19 @@ if (BUILD_STATIC_LIB) set_clientlib_target_properties(GameNetworkingSockets_s) endif() +# +# Cert tool +# if (BUILD_TOOLS) + + # The cert tool requires picojson + # FIXME - somebody might be able to help figure this out + #find_package( picojson ) + set(picojson_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/picojson) + if(NOT EXISTS ${picojson_SOURCE_DIR}/picojson.h) + message(FATAL_ERROR "picojson submodule not initialized.\n(Try: 'git submodule update src/external/picojson')" ) + endif() + add_executable(steamnetworkingsockets_certtool "steamnetworkingsockets/certtool/steamnetworkingsockets_certtool.cpp" ) @@ -347,6 +359,7 @@ if (BUILD_TOOLS) target_include_directories(steamnetworkingsockets_certtool PUBLIC "$" "$/${CMAKE_INSTALL_INCLUDEDIR}/GameNetworkingSockets>" + ${picojson_SOURCE_DIR} ) target_include_directories(steamnetworkingsockets_certtool PRIVATE diff --git a/src/external/picojson b/src/external/picojson new file mode 160000 index 00000000..111c9be5 --- /dev/null +++ b/src/external/picojson @@ -0,0 +1 @@ +Subproject commit 111c9be5188f7350c2eac9ddaedd8cca3d7bf394 diff --git a/vcpkg_ports/gamenetworkingsockets/portfile.cmake b/vcpkg_ports/gamenetworkingsockets/portfile.cmake index e7c18e94..56998c77 100644 --- a/vcpkg_ports/gamenetworkingsockets/portfile.cmake +++ b/vcpkg_ports/gamenetworkingsockets/portfile.cmake @@ -13,13 +13,15 @@ if ( ( "${CRYPTO_BACKEND}" STREQUAL "" ) OR ( "openssl" IN_LIST FEATURES ) ) set(CRYPTO_BACKEND "OpenSSL") endif() -# +# Handle some simple options that we can just +# pass straight through to cmake vcpkg_check_features( OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES webrtc USE_STEAMWEBRTC examples BUILD_EXAMPLES tests BUILD_TESTS + tools BUILD_TOOLS ) # Check static versus dynamic in the triple. Our cmakefile can build both diff --git a/vcpkg_ports/gamenetworkingsockets/vcpkg.json b/vcpkg_ports/gamenetworkingsockets/vcpkg.json index fd45fd19..438c61f4 100644 --- a/vcpkg_ports/gamenetworkingsockets/vcpkg.json +++ b/vcpkg_ports/gamenetworkingsockets/vcpkg.json @@ -24,6 +24,9 @@ }, "tests": { "description": "Build the tests." + }, + "tools": { + "description": "Build cert management tool." } } -} \ No newline at end of file +}