From 1a41e74cd60362199c21e9188fcd796bcdab5683 Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Tue, 24 Aug 2021 19:37:09 -0400 Subject: [PATCH 01/35] Try GameNetworkingSockets --- .../all/CMakeLists.txt | 7 ++ .../game-networking-sockets/all/conandata.yml | 4 + .../game-networking-sockets/all/conanfile.py | 83 +++++++++++++++++++ recipes/game-networking-sockets/config.yml | 3 + 4 files changed, 97 insertions(+) create mode 100644 recipes/game-networking-sockets/all/CMakeLists.txt create mode 100644 recipes/game-networking-sockets/all/conandata.yml create mode 100644 recipes/game-networking-sockets/all/conanfile.py create mode 100644 recipes/game-networking-sockets/config.yml diff --git a/recipes/game-networking-sockets/all/CMakeLists.txt b/recipes/game-networking-sockets/all/CMakeLists.txt new file mode 100644 index 0000000000000..217b9530b904d --- /dev/null +++ b/recipes/game-networking-sockets/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.11) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory("source_subfolder") diff --git a/recipes/game-networking-sockets/all/conandata.yml b/recipes/game-networking-sockets/all/conandata.yml new file mode 100644 index 0000000000000..d44a487bea0e9 --- /dev/null +++ b/recipes/game-networking-sockets/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.3.0": + url: "https://github.com/ValveSoftware/GameNetworkingSockets/archive/refs/tags/v1.3.0.zip" + sha256: "22e409546babc449c44f492b253b547a2f5f11abe11a100686a10a990b5091cd" diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py new file mode 100644 index 0000000000000..53c779680d1bf --- /dev/null +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -0,0 +1,83 @@ +from conans import ConanFile, CMake, tools +import os + +required_conan_version = ">=1.33.0" + + +class GameNetworkingSocketsConan(ConanFile): + name = "game-networking-sockets" + description = "GameNetworkingSockets is a basic transport layer for games." + topics = ("networking", "game-development") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ValveSoftware/GameNetworkingSockets" + license = "BSD 3-Clause" + exports_sources = ["CMakeLists.txt"] + generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + + options = { + "shared": [True, False], + "fPIC": [True, False], + "encryption": ["openssl", "libsodium", "bcrypt"] + } + + default_options = { + "shared": False, + "fPIC": True, + "encryption": "openssl" + } + + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _build_subfolder(self): + return "build_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + if self.options.encryption == "bcrypt" and self.settings.os != "Windows": + raise Invalid() + + def requirements(self): + self.requires("protobuf/3.17.1") + if self.options.encryption == "openssl": + self.requires("openssl/1.1.1k") + elif self.options.encryption == "libsodium": + self.requires("libsodium/1.0.18") + elif self.options.encryption == "bcrypt": + # self.requires("libxcrypt/4.4.25") + pass + + def source(self): + tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + + + def build(self): + cmake = self._configure_cmake() + cmake.build() + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.definitions["GAMENETWORKINGSOCKETS_BUILD_EXAMPLES"] = "OFF" + self._cmake.definitions["GAMENETWORKINGSOCKETS_BUILD_TESTS"] = "OFF" + crypto = {"openssl": "OpenSSL", "libsodium": "libsodium", "bcrypt": "BCrypt"} + self._cmake.definitions["USE_CRYPTO"] = crypto[str(self.options.encryption)] + self._cmake.configure(build_folder=self._build_subfolder) + return self._cmake + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) diff --git a/recipes/game-networking-sockets/config.yml b/recipes/game-networking-sockets/config.yml new file mode 100644 index 0000000000000..426a0e4c79e9b --- /dev/null +++ b/recipes/game-networking-sockets/config.yml @@ -0,0 +1,3 @@ +versions: + "1.3.0": + folder: all From 2de2cabd3b4e8c48b3ff0ec0958750b93bd0071e Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Thu, 26 Aug 2021 14:01:10 -0400 Subject: [PATCH 02/35] bcrypt only on windows --- recipes/game-networking-sockets/all/conanfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index 53c779680d1bf..0d34bb8ae76e1 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -1,4 +1,5 @@ from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration import os required_conan_version = ">=1.33.0" @@ -44,8 +45,10 @@ def config_options(self): def configure(self): if self.options.shared: del self.options.fPIC + + def validate(self): if self.options.encryption == "bcrypt" and self.settings.os != "Windows": - raise Invalid() + raise ConanInvalidConfiguration("bcrypt is only valid on Windows") def requirements(self): self.requires("protobuf/3.17.1") From 1450f1557b30722033dd901759ed78211e70ab7e Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Thu, 26 Aug 2021 14:26:21 -0400 Subject: [PATCH 03/35] Add test_package --- .../all/test_package/CMakeLists.txt | 10 ++++ .../all/test_package/conanfile.py | 17 ++++++ .../all/test_package/test_package.cpp | 54 +++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 recipes/game-networking-sockets/all/test_package/CMakeLists.txt create mode 100644 recipes/game-networking-sockets/all/test_package/conanfile.py create mode 100644 recipes/game-networking-sockets/all/test_package/test_package.cpp diff --git a/recipes/game-networking-sockets/all/test_package/CMakeLists.txt b/recipes/game-networking-sockets/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..1a20f158e2ede --- /dev/null +++ b/recipes/game-networking-sockets/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(GameNetworkingSockets REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} GameNetworkingSockets::GameNetworkingSockets) diff --git a/recipes/game-networking-sockets/all/test_package/conanfile.py b/recipes/game-networking-sockets/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9f777f7680ff --- /dev/null +++ b/recipes/game-networking-sockets/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/game-networking-sockets/all/test_package/test_package.cpp b/recipes/game-networking-sockets/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..0964315ea5752 --- /dev/null +++ b/recipes/game-networking-sockets/all/test_package/test_package.cpp @@ -0,0 +1,54 @@ +#include +#include +#include +#include +#include + +static std::FILE* g_fpLog = nullptr; +static SteamNetworkingMicroseconds g_logTimeZero; + +static void DebugOutput(ESteamNetworkingSocketsDebugOutputType eType, char const* pszMsg) +{ + SteamNetworkingMicroseconds time = SteamNetworkingUtils()->GetLocalTimestamp() - g_logTimeZero; + if (g_fpLog) { + std::fprintf(g_fpLog, "%10.6f %s\n", time * 1e-6, pszMsg); + } + + if (eType <= k_ESteamNetworkingSocketsDebugOutputType_Msg) { + std::printf("%10.6f %s\n", time * 1e-6, pszMsg); + std::fflush(stdout); + } + + if (eType == k_ESteamNetworkingSocketsDebugOutputType_Bug) { + std::fflush(stdout); + std::fflush(stderr); + if (g_fpLog) { + std::fflush(g_fpLog); + } + + if (std::strstr(pszMsg, "SteamNetworkingGlobalLock held for")) { + return; + } + + assert(!"TEST FAILED"); + } +} + +int main() +{ + g_fpLog = stderr; + g_logTimeZero = SteamNetworkingUtils()->GetLocalTimestamp(); + + SteamNetworkingUtils()->SetDebugOutputFunction(k_ESteamNetworkingSocketsDebugOutputType_Debug, DebugOutput); + SteamNetworkingUtils()->SetDebugOutputFunction(k_ESteamNetworkingSocketsDebugOutputType_Verbose, DebugOutput); + SteamNetworkingUtils()->SetDebugOutputFunction(k_ESteamNetworkingSocketsDebugOutputType_Msg, DebugOutput); + + SteamDatagramErrMsg errMsg; + if (!GameNetworkingSockets_Init(nullptr, errMsg)) { + std::fprintf(stderr, "GameNetworkingSockets_Init failed. %s", errMsg); + return 1; + } + + GameNetworkingSockets_Kill(); + return 0; +} From 76dfb6fb64949ad400dd38d9b05301b81c5a40ee Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Thu, 26 Aug 2021 14:50:07 -0400 Subject: [PATCH 04/35] Add package_info --- recipes/game-networking-sockets/all/conanfile.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index 0d34bb8ae76e1..a1b2e0c8750d3 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -84,3 +84,18 @@ def package(self): cmake = self._configure_cmake() cmake.install() tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "GameNetworkingSockets" + self.cpp_info.names["cmake_find_package_multi"] = "GameNetworkingSockets" + self.cpp_info.names["pkg_config"] = "GameNetworkingSockets" + self.cpp_info.includedirs.append(os.path.join("include", "GameNetworkingSockets")) + self.cpp_info.libs = ["GameNetworkingSockets"] + self.cpp_info.requires = ["protobuf::libprotobuf"] + if self.options.encryption == "openssl": + self.cpp_info.requires += ["openssl::crypto"] + elif self.options.encryption == "libsodium": + self.cpp_info.requires += ["libsodium::libsodium"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread"] + From 25d624711b8a7f1edfaf82a4ea96dd816f28938d Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Thu, 26 Aug 2021 15:42:56 -0400 Subject: [PATCH 05/35] Properly set USE_CRYPTO25519 --- recipes/game-networking-sockets/all/conanfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index a1b2e0c8750d3..7c66cee4e35df 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -76,6 +76,8 @@ def _configure_cmake(self): self._cmake.definitions["GAMENETWORKINGSOCKETS_BUILD_TESTS"] = "OFF" crypto = {"openssl": "OpenSSL", "libsodium": "libsodium", "bcrypt": "BCrypt"} self._cmake.definitions["USE_CRYPTO"] = crypto[str(self.options.encryption)] + crypto25519 = {"openssl": "OpenSSL", "libsodium": "libsodium", "bcrypt": "Reference"} + self._cmake.definitions["USE_CRYPTO25519"] = crypto25519[str(self.options.encryption)] self._cmake.configure(build_folder=self._build_subfolder) return self._cmake From 4860ca55032d3c918222a6a59f36a6c3a05fee4b Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Thu, 26 Aug 2021 16:03:32 -0400 Subject: [PATCH 06/35] Static build has a '_s' suffix --- recipes/game-networking-sockets/all/conanfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index 7c66cee4e35df..ad15aa8e76895 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -92,7 +92,10 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "GameNetworkingSockets" self.cpp_info.names["pkg_config"] = "GameNetworkingSockets" self.cpp_info.includedirs.append(os.path.join("include", "GameNetworkingSockets")) - self.cpp_info.libs = ["GameNetworkingSockets"] + if self.options.shared: + self.cpp_info.libs = ["GameNetworkingSockets"] + else: + self.cpp_info.libs = ["GameNetworkingSockets_s"] self.cpp_info.requires = ["protobuf::libprotobuf"] if self.options.encryption == "openssl": self.cpp_info.requires += ["openssl::crypto"] From da90445e086f173ca445b5c6a1dae63b9518834b Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Thu, 26 Aug 2021 16:06:57 -0400 Subject: [PATCH 07/35] We indeed use openssl>=1.1.1 --- recipes/game-networking-sockets/all/conanfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index ad15aa8e76895..8afc802be58f8 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -53,7 +53,7 @@ def validate(self): def requirements(self): self.requires("protobuf/3.17.1") if self.options.encryption == "openssl": - self.requires("openssl/1.1.1k") + self.requires("openssl/1.1.1k") # >=1.1.1 elif self.options.encryption == "libsodium": self.requires("libsodium/1.0.18") elif self.options.encryption == "bcrypt": @@ -78,6 +78,9 @@ def _configure_cmake(self): self._cmake.definitions["USE_CRYPTO"] = crypto[str(self.options.encryption)] crypto25519 = {"openssl": "OpenSSL", "libsodium": "libsodium", "bcrypt": "Reference"} self._cmake.definitions["USE_CRYPTO25519"] = crypto25519[str(self.options.encryption)] + if self.options.encryption == "openssl": + self._cmake.definitions["OPENSSL_NEW_ENOUGH"] = True + self._cmake.definitions["OPENSSL_HAS_25519_RAW"] = True self._cmake.configure(build_folder=self._build_subfolder) return self._cmake From 1af27dc67a397f857a93fc008b6c2320dec8b6cd Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Thu, 26 Aug 2021 17:16:39 -0400 Subject: [PATCH 08/35] Disable runtime override --- recipes/game-networking-sockets/all/conanfile.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index 8afc802be58f8..ff906c55ec540 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -63,8 +63,12 @@ def requirements(self): def source(self): tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - def build(self): + tools.replace_in_file( + os.path.join(self._source_subfolder, "CMakeLists.txt"), + "configure_msvc_runtime()", + "# configure_msvc_runtime()" + ) cmake = self._configure_cmake() cmake.build() From 4df5929d03086b931c552c03a094b1990383b159 Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Sun, 29 Aug 2021 20:03:51 -0400 Subject: [PATCH 09/35] Correctly set Protobuf_USE_STATIC_LIBS --- recipes/game-networking-sockets/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index ff906c55ec540..3f07ef8558cdb 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -78,6 +78,7 @@ def _configure_cmake(self): self._cmake = CMake(self) self._cmake.definitions["GAMENETWORKINGSOCKETS_BUILD_EXAMPLES"] = "OFF" self._cmake.definitions["GAMENETWORKINGSOCKETS_BUILD_TESTS"] = "OFF" + self._cmake.definitions["Protobuf_USE_STATIC_LIBS"] = not self.options["protobuf"].shared crypto = {"openssl": "OpenSSL", "libsodium": "libsodium", "bcrypt": "BCrypt"} self._cmake.definitions["USE_CRYPTO"] = crypto[str(self.options.encryption)] crypto25519 = {"openssl": "OpenSSL", "libsodium": "libsodium", "bcrypt": "Reference"} From c7c6246e3952778ad06948681c614f7157f3529c Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Sun, 29 Aug 2021 20:05:49 -0400 Subject: [PATCH 10/35] Make test less modern It's basically C at this point! --- .../all/test_package/test_package.cpp | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/recipes/game-networking-sockets/all/test_package/test_package.cpp b/recipes/game-networking-sockets/all/test_package/test_package.cpp index 0964315ea5752..558f03d11e7d6 100644 --- a/recipes/game-networking-sockets/all/test_package/test_package.cpp +++ b/recipes/game-networking-sockets/all/test_package/test_package.cpp @@ -1,32 +1,33 @@ -#include -#include -#include +#include +#include +#include + #include #include -static std::FILE* g_fpLog = nullptr; +static FILE* g_fpLog = NULL; static SteamNetworkingMicroseconds g_logTimeZero; static void DebugOutput(ESteamNetworkingSocketsDebugOutputType eType, char const* pszMsg) { SteamNetworkingMicroseconds time = SteamNetworkingUtils()->GetLocalTimestamp() - g_logTimeZero; if (g_fpLog) { - std::fprintf(g_fpLog, "%10.6f %s\n", time * 1e-6, pszMsg); + fprintf(g_fpLog, "%10.6f %s\n", time * 1e-6, pszMsg); } if (eType <= k_ESteamNetworkingSocketsDebugOutputType_Msg) { - std::printf("%10.6f %s\n", time * 1e-6, pszMsg); - std::fflush(stdout); + printf("%10.6f %s\n", time * 1e-6, pszMsg); + fflush(stdout); } if (eType == k_ESteamNetworkingSocketsDebugOutputType_Bug) { - std::fflush(stdout); - std::fflush(stderr); + fflush(stdout); + fflush(stderr); if (g_fpLog) { - std::fflush(g_fpLog); + fflush(g_fpLog); } - if (std::strstr(pszMsg, "SteamNetworkingGlobalLock held for")) { + if (strstr(pszMsg, "SteamNetworkingGlobalLock held for")) { return; } @@ -44,8 +45,8 @@ int main() SteamNetworkingUtils()->SetDebugOutputFunction(k_ESteamNetworkingSocketsDebugOutputType_Msg, DebugOutput); SteamDatagramErrMsg errMsg; - if (!GameNetworkingSockets_Init(nullptr, errMsg)) { - std::fprintf(stderr, "GameNetworkingSockets_Init failed. %s", errMsg); + if (!GameNetworkingSockets_Init(NULL, errMsg)) { + fprintf(stderr, "GameNetworkingSockets_Init failed. %s", errMsg); return 1; } From afa18ca0af5c5c49b3600281104cf94f0f0d72e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9?= <33236893+TheClonerx@users.noreply.github.com> Date: Sun, 29 Aug 2021 22:01:53 -0400 Subject: [PATCH 11/35] Use SPDX identifier Co-authored-by: Michael Keck --- recipes/game-networking-sockets/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index 3f07ef8558cdb..61f23bb50acaa 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -11,7 +11,7 @@ class GameNetworkingSocketsConan(ConanFile): topics = ("networking", "game-development") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ValveSoftware/GameNetworkingSockets" - license = "BSD 3-Clause" + license = "BSD-3-Clause" exports_sources = ["CMakeLists.txt"] generators = "cmake" settings = "os", "arch", "compiler", "build_type" From 815fdf1ad7e33e688cfa74d0308e8a8feb74f14d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9?= <33236893+TheClonerx@users.noreply.github.com> Date: Sun, 29 Aug 2021 22:02:10 -0400 Subject: [PATCH 12/35] Bump openssl version Co-authored-by: Michael Keck --- recipes/game-networking-sockets/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index 61f23bb50acaa..787a58ba42cf9 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -53,7 +53,7 @@ def validate(self): def requirements(self): self.requires("protobuf/3.17.1") if self.options.encryption == "openssl": - self.requires("openssl/1.1.1k") # >=1.1.1 + self.requires("openssl/1.1.1l") # >=1.1.1 elif self.options.encryption == "libsodium": self.requires("libsodium/1.0.18") elif self.options.encryption == "bcrypt": From 6d9271b6ad2dc1d20eeb4624fd1c809c23f7a4cd Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Tue, 7 Sep 2021 16:41:15 -0300 Subject: [PATCH 13/35] Add TARGETS --- recipes/game-networking-sockets/all/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/game-networking-sockets/all/CMakeLists.txt b/recipes/game-networking-sockets/all/CMakeLists.txt index 217b9530b904d..7a80c0b2c26dc 100644 --- a/recipes/game-networking-sockets/all/CMakeLists.txt +++ b/recipes/game-networking-sockets/all/CMakeLists.txt @@ -2,6 +2,6 @@ cmake_minimum_required(VERSION 2.8.11) project(cmake_wrapper) include(conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) add_subdirectory("source_subfolder") From 60741a2f11169cc1959ee3302c8cf646ca59094f Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Tue, 7 Sep 2021 16:42:20 -0300 Subject: [PATCH 14/35] Define STEAMNETWORKINGSOCKETS_STATIC_LINK on static builds --- recipes/game-networking-sockets/all/conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index 787a58ba42cf9..03eed30019ac5 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -104,11 +104,14 @@ def package_info(self): self.cpp_info.libs = ["GameNetworkingSockets"] else: self.cpp_info.libs = ["GameNetworkingSockets_s"] + self.cpp_info.defines = ["STEAMNETWORKINGSOCKETS_STATIC_LINK"] + self.cpp_info.requires = ["protobuf::libprotobuf"] if self.options.encryption == "openssl": self.cpp_info.requires += ["openssl::crypto"] elif self.options.encryption == "libsodium": self.cpp_info.requires += ["libsodium::libsodium"] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] From a7eb3b6cb81da6f72825d45d66a7be1712dff6f4 Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Tue, 7 Sep 2021 16:42:58 -0300 Subject: [PATCH 15/35] Link to socket and crypt libraries on windows --- recipes/game-networking-sockets/all/conanfile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index 03eed30019ac5..c3d34b5b80980 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -114,4 +114,8 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] + elif self.settings.os == "Windows": + self.cpp_info.system_libs = ["ws2_32", "crypt32"] + if self.options.encryption == "bcrypt": + self.cpp_info.system_libs += ["bcrypt"] From 04237942d894dde934c195d2b35307194cdca0df Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Tue, 5 Oct 2021 00:00:10 -0300 Subject: [PATCH 16/35] Add compiler version & cppstd checks --- .../game-networking-sockets/all/conanfile.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index c3d34b5b80980..037720ae12614 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -46,7 +46,35 @@ def configure(self): if self.options.shared: del self.options.fPIC + @property + def _compilers_minimum_version(self): + return { + "gcc": "6", + # "Visual Studio": "16", + # "clang": "11", + # "apple-clang": "11" + } + + @property + def _minimum_cpp_standard(self): + return 11 + def validate(self): + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler)) + + if minimum_version is None: + self.output.warn("{} recipe lacks information about the {} compiler support.".format( + self.name, self.settings.compiler)) + elif tools.Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration("{}/{} requires C++{} with {}, " + "which is not supported by {} {}.".format( + self.name, self.version, self._minimum_cpp_standard, + self.settings.compiler, self.settings.compiler, + self.settings.compiler.version)) + + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, self._minimum_cpp_standard) + if self.options.encryption == "bcrypt" and self.settings.os != "Windows": raise ConanInvalidConfiguration("bcrypt is only valid on Windows") From 06bfbe195f3775da0a531355ffa9ca5fa47bcb1c Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Tue, 5 Oct 2021 00:58:05 -0300 Subject: [PATCH 17/35] Add protobuf as a build requirement --- recipes/game-networking-sockets/all/conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index 037720ae12614..d595103b025b6 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -78,6 +78,9 @@ def validate(self): if self.options.encryption == "bcrypt" and self.settings.os != "Windows": raise ConanInvalidConfiguration("bcrypt is only valid on Windows") + def build_requirements(self): + self.build_requires("protobuf/3.17.1") + def requirements(self): self.requires("protobuf/3.17.1") if self.options.encryption == "openssl": From ac36d90001b54bb84403bf984d2b5fbae14320d5 Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Tue, 5 Oct 2021 02:21:15 -0300 Subject: [PATCH 18/35] Build and install either static or shared --- .../game-networking-sockets/all/conandata.yml | 10 ++++ .../game-networking-sockets/all/conanfile.py | 15 +++--- .../001-disable-runtime-override.patch | 13 +++++ .../002-add-static_assert-feature.patch | 14 +++++ .../patches/003-either-static-or-shared.patch | 51 +++++++++++++++++++ .../patches/004-disable-install-export.patch | 21 ++++++++ 6 files changed, 118 insertions(+), 6 deletions(-) create mode 100644 recipes/game-networking-sockets/all/patches/001-disable-runtime-override.patch create mode 100644 recipes/game-networking-sockets/all/patches/002-add-static_assert-feature.patch create mode 100644 recipes/game-networking-sockets/all/patches/003-either-static-or-shared.patch create mode 100644 recipes/game-networking-sockets/all/patches/004-disable-install-export.patch diff --git a/recipes/game-networking-sockets/all/conandata.yml b/recipes/game-networking-sockets/all/conandata.yml index d44a487bea0e9..11393eddfde45 100644 --- a/recipes/game-networking-sockets/all/conandata.yml +++ b/recipes/game-networking-sockets/all/conandata.yml @@ -2,3 +2,13 @@ sources: "1.3.0": url: "https://github.com/ValveSoftware/GameNetworkingSockets/archive/refs/tags/v1.3.0.zip" sha256: "22e409546babc449c44f492b253b547a2f5f11abe11a100686a10a990b5091cd" +patches: + "1.3.0": + - patch_file: "patches/001-disable-runtime-override.patch" + base_path: "source_subfolder" + - patch_file: "patches/002-add-static_assert-feature.patch" + base_path: "source_subfolder" + - patch_file: "patches/003-either-static-or-shared.patch" + base_path: "source_subfolder" + - patch_file: "patches/004-disable-install-export.patch" + base_path: "source_subfolder" diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index d595103b025b6..ed6fd79f04599 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -15,6 +15,7 @@ class GameNetworkingSocketsConan(ConanFile): exports_sources = ["CMakeLists.txt"] generators = "cmake" settings = "os", "arch", "compiler", "build_type" + exports_sources = ["CMakeLists.txt", "patches/**"] options = { "shared": [True, False], @@ -90,16 +91,16 @@ def requirements(self): elif self.options.encryption == "bcrypt": # self.requires("libxcrypt/4.4.25") pass - + def source(self): tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + def _patch_sources(self): + for patch in self.conan_data["patches"][self.version]: + tools.patch(**patch) + def build(self): - tools.replace_in_file( - os.path.join(self._source_subfolder, "CMakeLists.txt"), - "configure_msvc_runtime()", - "# configure_msvc_runtime()" - ) + self._patch_sources() cmake = self._configure_cmake() cmake.build() @@ -107,6 +108,8 @@ def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) + self._cmake.definitions["BUILD_STATIC"] = not self.options.shared + self._cmake.definitions["BUILD_SHARED"] = self.options.shared self._cmake.definitions["GAMENETWORKINGSOCKETS_BUILD_EXAMPLES"] = "OFF" self._cmake.definitions["GAMENETWORKINGSOCKETS_BUILD_TESTS"] = "OFF" self._cmake.definitions["Protobuf_USE_STATIC_LIBS"] = not self.options["protobuf"].shared diff --git a/recipes/game-networking-sockets/all/patches/001-disable-runtime-override.patch b/recipes/game-networking-sockets/all/patches/001-disable-runtime-override.patch new file mode 100644 index 0000000000000..652aea2685bb8 --- /dev/null +++ b/recipes/game-networking-sockets/all/patches/001-disable-runtime-override.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/tmp/CMakeLists.txt +index 3471701..49efee3 100644 +--- a/CMakeLists.txt ++++ b/tmp/CMakeLists.txt +@@ -35,7 +35,7 @@ endif() + + include(FlagsMSVC) + set(MSVC_RUNTIME "dynamic") +-configure_msvc_runtime() ++# configure_msvc_runtime() + print_default_msvc_flags() + + add_definitions( -DVALVE_CRYPTO_ENABLE_25519 ) diff --git a/recipes/game-networking-sockets/all/patches/002-add-static_assert-feature.patch b/recipes/game-networking-sockets/all/patches/002-add-static_assert-feature.patch new file mode 100644 index 0000000000000..b12885bff748f --- /dev/null +++ b/recipes/game-networking-sockets/all/patches/002-add-static_assert-feature.patch @@ -0,0 +1,14 @@ +diff --git a/src/CMakeLists.txt b/tmp/CMakeLists.txt +index 7040ab3..8847df6 100644 +--- a/src/CMakeLists.txt ++++ b/tmp/CMakeLists.txt +@@ -100,7 +100,8 @@ set(C99_FEATURES + + set(CXX11_FEATURES + cxx_constexpr +- cxx_auto_type) ++ cxx_auto_type ++ cxx_static_assert) + + set(GNS_COMMON_FLAGS + -fvisibility=hidden diff --git a/recipes/game-networking-sockets/all/patches/003-either-static-or-shared.patch b/recipes/game-networking-sockets/all/patches/003-either-static-or-shared.patch new file mode 100644 index 0000000000000..49578559bcf5b --- /dev/null +++ b/recipes/game-networking-sockets/all/patches/003-either-static-or-shared.patch @@ -0,0 +1,51 @@ +diff --git a/src/CMakeLists.txt b/tmp/src/CMakeLists.txt +index 8847df6..2106722 100644 +--- a/src/CMakeLists.txt ++++ b/tmp/src/CMakeLists.txt +@@ -283,28 +283,40 @@ macro(gamenetworkingsockets_common GNS_TARGET) + + endmacro() + ++if (BUILD_SHARED) + add_library(GameNetworkingSockets SHARED "") + add_library(GameNetworkingSockets::GameNetworkingSockets ALIAS GameNetworkingSockets) + add_library(GameNetworkingSockets::shared ALIAS GameNetworkingSockets) + gamenetworkingsockets_common(GameNetworkingSockets) + ++install( ++ TARGETS GameNetworkingSockets ++ EXPORT GameNetworkingSockets ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++) ++endif() ++ ++ ++if (BUILD_STATIC) + add_library(GameNetworkingSockets_s STATIC "") + add_library(GameNetworkingSockets::GameNetworkingSockets_s ALIAS GameNetworkingSockets_s) + add_library(GameNetworkingSockets::static ALIAS GameNetworkingSockets_s) + target_compile_definitions(GameNetworkingSockets_s INTERFACE STEAMNETWORKINGSOCKETS_STATIC_LINK) + gamenetworkingsockets_common(GameNetworkingSockets_s) + +-# Install rules +- + install( +- TARGETS +- GameNetworkingSockets +- GameNetworkingSockets_s ++ TARGETS GameNetworkingSockets_s + EXPORT GameNetworkingSockets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +- ) ++) ++endif() ++ ++# Install rules ++ + + install(DIRECTORY ../include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GameNetworkingSockets) + diff --git a/recipes/game-networking-sockets/all/patches/004-disable-install-export.patch b/recipes/game-networking-sockets/all/patches/004-disable-install-export.patch new file mode 100644 index 0000000000000..f24f0bf39f0a2 --- /dev/null +++ b/recipes/game-networking-sockets/all/patches/004-disable-install-export.patch @@ -0,0 +1,21 @@ +diff --git a/src/CMakeLists.txt b/tmp/src/CMakeLists.txt +index 2106722..7f9d834 100644 +--- a/src/CMakeLists.txt ++++ b/tmp/src/CMakeLists.txt +@@ -322,11 +322,11 @@ install(DIRECTORY ../include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GameNetwor + + # Export doesn't work if we're using WebRTC and the Abseil dependency came from the submodule + if(NOT (USE_STEAMWEBRTC AND STEAMWEBRTC_ABSL_SOURCE STREQUAL submodule)) +- install( +- EXPORT GameNetworkingSockets +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GameNetworkingSockets +- NAMESPACE GameNetworkingSockets:: +- ) ++ # install( ++ # EXPORT GameNetworkingSockets ++ # DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GameNetworkingSockets ++ # NAMESPACE GameNetworkingSockets:: ++ # ) + + include(CMakePackageConfigHelpers) + From 9f310fdf679d7cccd3e6cd3dc745de91a53faf21 Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Fri, 8 Oct 2021 14:55:29 -0300 Subject: [PATCH 19/35] Add extra generators Co-authored-by: Chris Mc --- recipes/game-networking-sockets/all/conanfile.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index ed6fd79f04599..0380836ce9ade 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -12,8 +12,7 @@ class GameNetworkingSocketsConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ValveSoftware/GameNetworkingSockets" license = "BSD-3-Clause" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" + generators = "cmake", "cmake_find_package_multi", "pkg_config" settings = "os", "arch", "compiler", "build_type" exports_sources = ["CMakeLists.txt", "patches/**"] From 7cee1dfd3a288ea7bceb39caed6ae629360fceaf Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Fri, 8 Oct 2021 15:01:00 -0300 Subject: [PATCH 20/35] Require C++11 on test package Co-authored-by: Chris Mc --- recipes/game-networking-sockets/all/test_package/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/game-networking-sockets/all/test_package/CMakeLists.txt b/recipes/game-networking-sockets/all/test_package/CMakeLists.txt index 1a20f158e2ede..cb6bc1b893324 100644 --- a/recipes/game-networking-sockets/all/test_package/CMakeLists.txt +++ b/recipes/game-networking-sockets/all/test_package/CMakeLists.txt @@ -7,4 +7,5 @@ conan_basic_setup(TARGETS) find_package(GameNetworkingSockets REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) target_link_libraries(${PROJECT_NAME} GameNetworkingSockets::GameNetworkingSockets) From 32dcc079f212a1be83d9e3759e6b418c1a66d61d Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Fri, 8 Oct 2021 15:02:58 -0300 Subject: [PATCH 21/35] Remove unnecessary patch Co-authored-by: Chris Mc --- .../game-networking-sockets/all/conandata.yml | 2 -- .../patches/004-disable-install-export.patch | 21 ------------------- 2 files changed, 23 deletions(-) delete mode 100644 recipes/game-networking-sockets/all/patches/004-disable-install-export.patch diff --git a/recipes/game-networking-sockets/all/conandata.yml b/recipes/game-networking-sockets/all/conandata.yml index 11393eddfde45..46a463153eee9 100644 --- a/recipes/game-networking-sockets/all/conandata.yml +++ b/recipes/game-networking-sockets/all/conandata.yml @@ -10,5 +10,3 @@ patches: base_path: "source_subfolder" - patch_file: "patches/003-either-static-or-shared.patch" base_path: "source_subfolder" - - patch_file: "patches/004-disable-install-export.patch" - base_path: "source_subfolder" diff --git a/recipes/game-networking-sockets/all/patches/004-disable-install-export.patch b/recipes/game-networking-sockets/all/patches/004-disable-install-export.patch deleted file mode 100644 index f24f0bf39f0a2..0000000000000 --- a/recipes/game-networking-sockets/all/patches/004-disable-install-export.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/src/CMakeLists.txt b/tmp/src/CMakeLists.txt -index 2106722..7f9d834 100644 ---- a/src/CMakeLists.txt -+++ b/tmp/src/CMakeLists.txt -@@ -322,11 +322,11 @@ install(DIRECTORY ../include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GameNetwor - - # Export doesn't work if we're using WebRTC and the Abseil dependency came from the submodule - if(NOT (USE_STEAMWEBRTC AND STEAMWEBRTC_ABSL_SOURCE STREQUAL submodule)) -- install( -- EXPORT GameNetworkingSockets -- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GameNetworkingSockets -- NAMESPACE GameNetworkingSockets:: -- ) -+ # install( -+ # EXPORT GameNetworkingSockets -+ # DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/GameNetworkingSockets -+ # NAMESPACE GameNetworkingSockets:: -+ # ) - - include(CMakePackageConfigHelpers) - From 3868093f5206eac4bd7023ca429fcb9f02ad4a27 Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Fri, 8 Oct 2021 15:04:28 -0300 Subject: [PATCH 22/35] Remove unnecessary if Co-authored-by: Chris Mc --- recipes/game-networking-sockets/all/conanfile.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index 0380836ce9ade..1be1cbd6171c9 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -87,9 +87,6 @@ def requirements(self): self.requires("openssl/1.1.1l") # >=1.1.1 elif self.options.encryption == "libsodium": self.requires("libsodium/1.0.18") - elif self.options.encryption == "bcrypt": - # self.requires("libxcrypt/4.4.25") - pass def source(self): tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) From a224bd10fb501f1da38be3b0d345cf5a82f25f8c Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Fri, 8 Oct 2021 15:05:57 -0300 Subject: [PATCH 23/35] Safer patch access Co-authored-by: Chris Mc --- recipes/game-networking-sockets/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index 1be1cbd6171c9..7959590f3c649 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -92,7 +92,7 @@ def source(self): tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: + for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) def build(self): From 5ca7979a56dc4291cde4dea95da2cfd932872846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9?= <33236893+TheClonerx@users.noreply.github.com> Date: Fri, 8 Oct 2021 15:14:01 -0300 Subject: [PATCH 24/35] Pass `self` to tools.cross_building Co-authored-by: Chris Mc --- recipes/game-networking-sockets/all/test_package/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/game-networking-sockets/all/test_package/conanfile.py b/recipes/game-networking-sockets/all/test_package/conanfile.py index a9f777f7680ff..38f4483872d47 100644 --- a/recipes/game-networking-sockets/all/test_package/conanfile.py +++ b/recipes/game-networking-sockets/all/test_package/conanfile.py @@ -12,6 +12,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): + if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) From 86f430a853ad6903214e9c2455fcbd03b06d156d Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Fri, 8 Oct 2021 16:13:09 -0300 Subject: [PATCH 25/35] Lower minimun gcc version required --- recipes/game-networking-sockets/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index 7959590f3c649..54faf195b7bac 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -49,7 +49,7 @@ def configure(self): @property def _compilers_minimum_version(self): return { - "gcc": "6", + "gcc": "5", # "Visual Studio": "16", # "clang": "11", # "apple-clang": "11" From 774367bef0b2b2c1e8907401376912f116c4e1a9 Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Fri, 8 Oct 2021 16:32:05 -0300 Subject: [PATCH 26/35] Remove unnecessary patch --- recipes/game-networking-sockets/all/conandata.yml | 4 +--- .../patches/002-add-static_assert-feature.patch | 14 -------------- ...red.patch => 002-either-static-or-shared.patch} | 10 ++++------ 3 files changed, 5 insertions(+), 23 deletions(-) delete mode 100644 recipes/game-networking-sockets/all/patches/002-add-static_assert-feature.patch rename recipes/game-networking-sockets/all/patches/{003-either-static-or-shared.patch => 002-either-static-or-shared.patch} (88%) diff --git a/recipes/game-networking-sockets/all/conandata.yml b/recipes/game-networking-sockets/all/conandata.yml index 46a463153eee9..882c3ee20c6d7 100644 --- a/recipes/game-networking-sockets/all/conandata.yml +++ b/recipes/game-networking-sockets/all/conandata.yml @@ -6,7 +6,5 @@ patches: "1.3.0": - patch_file: "patches/001-disable-runtime-override.patch" base_path: "source_subfolder" - - patch_file: "patches/002-add-static_assert-feature.patch" - base_path: "source_subfolder" - - patch_file: "patches/003-either-static-or-shared.patch" + - patch_file: "patches/002-either-static-or-shared.patch" base_path: "source_subfolder" diff --git a/recipes/game-networking-sockets/all/patches/002-add-static_assert-feature.patch b/recipes/game-networking-sockets/all/patches/002-add-static_assert-feature.patch deleted file mode 100644 index b12885bff748f..0000000000000 --- a/recipes/game-networking-sockets/all/patches/002-add-static_assert-feature.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/src/CMakeLists.txt b/tmp/CMakeLists.txt -index 7040ab3..8847df6 100644 ---- a/src/CMakeLists.txt -+++ b/tmp/CMakeLists.txt -@@ -100,7 +100,8 @@ set(C99_FEATURES - - set(CXX11_FEATURES - cxx_constexpr -- cxx_auto_type) -+ cxx_auto_type -+ cxx_static_assert) - - set(GNS_COMMON_FLAGS - -fvisibility=hidden diff --git a/recipes/game-networking-sockets/all/patches/003-either-static-or-shared.patch b/recipes/game-networking-sockets/all/patches/002-either-static-or-shared.patch similarity index 88% rename from recipes/game-networking-sockets/all/patches/003-either-static-or-shared.patch rename to recipes/game-networking-sockets/all/patches/002-either-static-or-shared.patch index 49578559bcf5b..47b3eec1ee41e 100644 --- a/recipes/game-networking-sockets/all/patches/003-either-static-or-shared.patch +++ b/recipes/game-networking-sockets/all/patches/002-either-static-or-shared.patch @@ -1,8 +1,8 @@ -diff --git a/src/CMakeLists.txt b/tmp/src/CMakeLists.txt -index 8847df6..2106722 100644 +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 7040ab3..c75897e 100644 --- a/src/CMakeLists.txt -+++ b/tmp/src/CMakeLists.txt -@@ -283,28 +283,40 @@ macro(gamenetworkingsockets_common GNS_TARGET) ++++ b/src/CMakeLists.txt +@@ -282,28 +282,38 @@ macro(gamenetworkingsockets_common GNS_TARGET) endmacro() @@ -21,7 +21,6 @@ index 8847df6..2106722 100644 +) +endif() + -+ +if (BUILD_STATIC) add_library(GameNetworkingSockets_s STATIC "") add_library(GameNetworkingSockets::GameNetworkingSockets_s ALIAS GameNetworkingSockets_s) @@ -45,7 +44,6 @@ index 8847df6..2106722 100644 +endif() + +# Install rules -+ install(DIRECTORY ../include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GameNetworkingSockets) From 3a3830a0cb10cde4f8a7f8e3249f6bbae04f2ca3 Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Fri, 8 Oct 2021 18:22:19 -0300 Subject: [PATCH 27/35] Check openssl version Co-authored-by: Chris Mc --- recipes/game-networking-sockets/all/conanfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index 54faf195b7bac..90f66d2d1eec1 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -77,6 +77,9 @@ def validate(self): if self.options.encryption == "bcrypt" and self.settings.os != "Windows": raise ConanInvalidConfiguration("bcrypt is only valid on Windows") + + if self.options.encryption == "openssl" and "openssl" in self.deps_cpp_info.deps and tools.Version(self.deps_cpp_info["openssl"].version) < "1.1.1": + raise ConanInvalidConfiguration("{} requires OpenSSL 1.1.1 or newer".format(self.name)) def build_requirements(self): self.build_requires("protobuf/3.17.1") @@ -84,7 +87,7 @@ def build_requirements(self): def requirements(self): self.requires("protobuf/3.17.1") if self.options.encryption == "openssl": - self.requires("openssl/1.1.1l") # >=1.1.1 + self.requires("openssl/1.1.1l") elif self.options.encryption == "libsodium": self.requires("libsodium/1.0.18") From f46a753d4932e97064cf1b178552d2d87122756a Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Fri, 8 Oct 2021 18:55:01 -0300 Subject: [PATCH 28/35] Add missing system lib --- recipes/game-networking-sockets/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/game-networking-sockets/all/conanfile.py index 90f66d2d1eec1..2b84e9be046c1 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/game-networking-sockets/all/conanfile.py @@ -148,7 +148,7 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] elif self.settings.os == "Windows": - self.cpp_info.system_libs = ["ws2_32", "crypt32"] + self.cpp_info.system_libs = ["ws2_32", "crypt32", "winmm"] if self.options.encryption == "bcrypt": self.cpp_info.system_libs += ["bcrypt"] From 7a405479547057171a71b19f5bda8f733b7ebb6d Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Mon, 11 Oct 2021 17:16:29 -0300 Subject: [PATCH 29/35] Rename to gamenetworkingsockets --- .../all/CMakeLists.txt | 0 .../all/conandata.yml | 0 .../all/conanfile.py | 2 +- .../all/patches/001-disable-runtime-override.patch | 0 .../all/patches/002-either-static-or-shared.patch | 0 .../all/test_package/CMakeLists.txt | 0 .../all/test_package/conanfile.py | 0 .../all/test_package/test_package.cpp | 0 .../config.yml | 0 9 files changed, 1 insertion(+), 1 deletion(-) rename recipes/{game-networking-sockets => gamenetworkingsockets}/all/CMakeLists.txt (100%) rename recipes/{game-networking-sockets => gamenetworkingsockets}/all/conandata.yml (100%) rename recipes/{game-networking-sockets => gamenetworkingsockets}/all/conanfile.py (99%) rename recipes/{game-networking-sockets => gamenetworkingsockets}/all/patches/001-disable-runtime-override.patch (100%) rename recipes/{game-networking-sockets => gamenetworkingsockets}/all/patches/002-either-static-or-shared.patch (100%) rename recipes/{game-networking-sockets => gamenetworkingsockets}/all/test_package/CMakeLists.txt (100%) rename recipes/{game-networking-sockets => gamenetworkingsockets}/all/test_package/conanfile.py (100%) rename recipes/{game-networking-sockets => gamenetworkingsockets}/all/test_package/test_package.cpp (100%) rename recipes/{game-networking-sockets => gamenetworkingsockets}/config.yml (100%) diff --git a/recipes/game-networking-sockets/all/CMakeLists.txt b/recipes/gamenetworkingsockets/all/CMakeLists.txt similarity index 100% rename from recipes/game-networking-sockets/all/CMakeLists.txt rename to recipes/gamenetworkingsockets/all/CMakeLists.txt diff --git a/recipes/game-networking-sockets/all/conandata.yml b/recipes/gamenetworkingsockets/all/conandata.yml similarity index 100% rename from recipes/game-networking-sockets/all/conandata.yml rename to recipes/gamenetworkingsockets/all/conandata.yml diff --git a/recipes/game-networking-sockets/all/conanfile.py b/recipes/gamenetworkingsockets/all/conanfile.py similarity index 99% rename from recipes/game-networking-sockets/all/conanfile.py rename to recipes/gamenetworkingsockets/all/conanfile.py index 2b84e9be046c1..51faa03e98837 100644 --- a/recipes/game-networking-sockets/all/conanfile.py +++ b/recipes/gamenetworkingsockets/all/conanfile.py @@ -6,7 +6,7 @@ class GameNetworkingSocketsConan(ConanFile): - name = "game-networking-sockets" + name = "gamenetworkingsockets" description = "GameNetworkingSockets is a basic transport layer for games." topics = ("networking", "game-development") url = "https://github.com/conan-io/conan-center-index" diff --git a/recipes/game-networking-sockets/all/patches/001-disable-runtime-override.patch b/recipes/gamenetworkingsockets/all/patches/001-disable-runtime-override.patch similarity index 100% rename from recipes/game-networking-sockets/all/patches/001-disable-runtime-override.patch rename to recipes/gamenetworkingsockets/all/patches/001-disable-runtime-override.patch diff --git a/recipes/game-networking-sockets/all/patches/002-either-static-or-shared.patch b/recipes/gamenetworkingsockets/all/patches/002-either-static-or-shared.patch similarity index 100% rename from recipes/game-networking-sockets/all/patches/002-either-static-or-shared.patch rename to recipes/gamenetworkingsockets/all/patches/002-either-static-or-shared.patch diff --git a/recipes/game-networking-sockets/all/test_package/CMakeLists.txt b/recipes/gamenetworkingsockets/all/test_package/CMakeLists.txt similarity index 100% rename from recipes/game-networking-sockets/all/test_package/CMakeLists.txt rename to recipes/gamenetworkingsockets/all/test_package/CMakeLists.txt diff --git a/recipes/game-networking-sockets/all/test_package/conanfile.py b/recipes/gamenetworkingsockets/all/test_package/conanfile.py similarity index 100% rename from recipes/game-networking-sockets/all/test_package/conanfile.py rename to recipes/gamenetworkingsockets/all/test_package/conanfile.py diff --git a/recipes/game-networking-sockets/all/test_package/test_package.cpp b/recipes/gamenetworkingsockets/all/test_package/test_package.cpp similarity index 100% rename from recipes/game-networking-sockets/all/test_package/test_package.cpp rename to recipes/gamenetworkingsockets/all/test_package/test_package.cpp diff --git a/recipes/game-networking-sockets/config.yml b/recipes/gamenetworkingsockets/config.yml similarity index 100% rename from recipes/game-networking-sockets/config.yml rename to recipes/gamenetworkingsockets/config.yml From 97d1e2cacb589ce458462a6c66914fe2ca47fb61 Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Mon, 11 Oct 2021 17:19:59 -0300 Subject: [PATCH 30/35] Be more soft with cppstd validation Co-authored-by: Uilian Ries --- .../gamenetworkingsockets/all/conanfile.py | 27 +------------------ 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/recipes/gamenetworkingsockets/all/conanfile.py b/recipes/gamenetworkingsockets/all/conanfile.py index 51faa03e98837..76f0e5bd697b5 100644 --- a/recipes/gamenetworkingsockets/all/conanfile.py +++ b/recipes/gamenetworkingsockets/all/conanfile.py @@ -46,34 +46,9 @@ def configure(self): if self.options.shared: del self.options.fPIC - @property - def _compilers_minimum_version(self): - return { - "gcc": "5", - # "Visual Studio": "16", - # "clang": "11", - # "apple-clang": "11" - } - - @property - def _minimum_cpp_standard(self): - return 11 - def validate(self): - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler)) - - if minimum_version is None: - self.output.warn("{} recipe lacks information about the {} compiler support.".format( - self.name, self.settings.compiler)) - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{}/{} requires C++{} with {}, " - "which is not supported by {} {}.".format( - self.name, self.version, self._minimum_cpp_standard, - self.settings.compiler, self.settings.compiler, - self.settings.compiler.version)) - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._minimum_cpp_standard) + tools.check_min_cppstd(self, 11) if self.options.encryption == "bcrypt" and self.settings.os != "Windows": raise ConanInvalidConfiguration("bcrypt is only valid on Windows") From 8956fc803d10bf846f61a277e143792bd3dfb8fa Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Mon, 11 Oct 2021 17:25:22 -0300 Subject: [PATCH 31/35] Remove unused generators Co-authored-by: Uilian Ries --- recipes/gamenetworkingsockets/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/gamenetworkingsockets/all/conanfile.py b/recipes/gamenetworkingsockets/all/conanfile.py index 76f0e5bd697b5..8b50e8f73e452 100644 --- a/recipes/gamenetworkingsockets/all/conanfile.py +++ b/recipes/gamenetworkingsockets/all/conanfile.py @@ -12,7 +12,7 @@ class GameNetworkingSocketsConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ValveSoftware/GameNetworkingSockets" license = "BSD-3-Clause" - generators = "cmake", "cmake_find_package_multi", "pkg_config" + generators = "cmake" settings = "os", "arch", "compiler", "build_type" exports_sources = ["CMakeLists.txt", "patches/**"] From 2e2bbd6b81d552dd4e5753317f949e4a245ceced Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Mon, 11 Oct 2021 17:29:06 -0300 Subject: [PATCH 32/35] Be consistent with cmake definitions Co-authored-by: Uilian Ries --- recipes/gamenetworkingsockets/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/gamenetworkingsockets/all/conanfile.py b/recipes/gamenetworkingsockets/all/conanfile.py index 8b50e8f73e452..38ad426c21180 100644 --- a/recipes/gamenetworkingsockets/all/conanfile.py +++ b/recipes/gamenetworkingsockets/all/conanfile.py @@ -84,8 +84,8 @@ def _configure_cmake(self): self._cmake = CMake(self) self._cmake.definitions["BUILD_STATIC"] = not self.options.shared self._cmake.definitions["BUILD_SHARED"] = self.options.shared - self._cmake.definitions["GAMENETWORKINGSOCKETS_BUILD_EXAMPLES"] = "OFF" - self._cmake.definitions["GAMENETWORKINGSOCKETS_BUILD_TESTS"] = "OFF" + self._cmake.definitions["GAMENETWORKINGSOCKETS_BUILD_EXAMPLES"] = False + self._cmake.definitions["GAMENETWORKINGSOCKETS_BUILD_TESTS"] = False self._cmake.definitions["Protobuf_USE_STATIC_LIBS"] = not self.options["protobuf"].shared crypto = {"openssl": "OpenSSL", "libsodium": "libsodium", "bcrypt": "BCrypt"} self._cmake.definitions["USE_CRYPTO"] = crypto[str(self.options.encryption)] From f13f0539e19d1a969a27f7ff2359b681a7305bd8 Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Mon, 11 Oct 2021 19:58:57 -0300 Subject: [PATCH 33/35] Add back the pkg_config generator (needed by libsodium) --- recipes/gamenetworkingsockets/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/gamenetworkingsockets/all/conanfile.py b/recipes/gamenetworkingsockets/all/conanfile.py index 38ad426c21180..e70b030c4cbfb 100644 --- a/recipes/gamenetworkingsockets/all/conanfile.py +++ b/recipes/gamenetworkingsockets/all/conanfile.py @@ -12,7 +12,7 @@ class GameNetworkingSocketsConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ValveSoftware/GameNetworkingSockets" license = "BSD-3-Clause" - generators = "cmake" + generators = "cmake", "pkg_config" settings = "os", "arch", "compiler", "build_type" exports_sources = ["CMakeLists.txt", "patches/**"] From 5d1c88af6e6f82457a44b274ee70fd1a47a63aaa Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Mon, 11 Oct 2021 20:01:10 -0300 Subject: [PATCH 34/35] deps_cpp_info is only avaible in the build method Co-authored-by: Uilian Ries --- recipes/gamenetworkingsockets/all/conanfile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/recipes/gamenetworkingsockets/all/conanfile.py b/recipes/gamenetworkingsockets/all/conanfile.py index e70b030c4cbfb..0cba90d4e437f 100644 --- a/recipes/gamenetworkingsockets/all/conanfile.py +++ b/recipes/gamenetworkingsockets/all/conanfile.py @@ -53,8 +53,6 @@ def validate(self): if self.options.encryption == "bcrypt" and self.settings.os != "Windows": raise ConanInvalidConfiguration("bcrypt is only valid on Windows") - if self.options.encryption == "openssl" and "openssl" in self.deps_cpp_info.deps and tools.Version(self.deps_cpp_info["openssl"].version) < "1.1.1": - raise ConanInvalidConfiguration("{} requires OpenSSL 1.1.1 or newer".format(self.name)) def build_requirements(self): self.build_requires("protobuf/3.17.1") @@ -74,6 +72,9 @@ def _patch_sources(self): tools.patch(**patch) def build(self): + if self.options.encryption == "openssl" and "openssl" in self.deps_cpp_info.deps and tools.Version(self.deps_cpp_info["openssl"].version) < "1.1.1": + raise ConanInvalidConfiguration("{} requires OpenSSL 1.1.1 or newer".format(self.name)) + self._patch_sources() cmake = self._configure_cmake() cmake.build() From 58c76d45d36a92b952ee8094274df67ca0a773c4 Mon Sep 17 00:00:00 2001 From: TheClonerx Date: Mon, 11 Oct 2021 20:32:47 -0300 Subject: [PATCH 35/35] Remove openssl version check --- recipes/gamenetworkingsockets/all/conanfile.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/recipes/gamenetworkingsockets/all/conanfile.py b/recipes/gamenetworkingsockets/all/conanfile.py index 0cba90d4e437f..cb91ff14df39f 100644 --- a/recipes/gamenetworkingsockets/all/conanfile.py +++ b/recipes/gamenetworkingsockets/all/conanfile.py @@ -52,7 +52,6 @@ def validate(self): if self.options.encryption == "bcrypt" and self.settings.os != "Windows": raise ConanInvalidConfiguration("bcrypt is only valid on Windows") - def build_requirements(self): self.build_requires("protobuf/3.17.1") @@ -72,9 +71,6 @@ def _patch_sources(self): tools.patch(**patch) def build(self): - if self.options.encryption == "openssl" and "openssl" in self.deps_cpp_info.deps and tools.Version(self.deps_cpp_info["openssl"].version) < "1.1.1": - raise ConanInvalidConfiguration("{} requires OpenSSL 1.1.1 or newer".format(self.name)) - self._patch_sources() cmake = self._configure_cmake() cmake.build()