Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cppserver: add v1.0.4.1, add missing transitive_headers=True #25379

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions recipes/cppserver/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"1.0.4.1":
url: "https://github.com/chronoxor/CppServer/archive/1.0.4.1.tar.gz"
sha256: "252f66d6c245641b9ed73eae77324513e597debd0615523d16b83b043d31035f"
"1.0.2.0":
url: "https://github.com/chronoxor/CppServer/archive/1.0.2.0.tar.gz"
sha256: "512b2ada2ddebcedcfac814e3d0784ccef410506dab5dcf64c56302b40e042d4"
Expand All @@ -9,6 +12,16 @@ sources:
url: "https://github.com/chronoxor/CppServer/archive/1.0.0.0.tar.gz"
sha256: "dc70fb24231ac4c06e813a0489ff911dd5c48f844b75856b1e753ac8dbd64772"
patches:
"1.0.4.1":
- patch_file: "patches/0001-cmake-clean-up-1-0-4-1.patch"
patch_description: "use cci packages, disable test/example builds"
patch_type: "conan"
- patch_file: "patches/0002-define-win32-winnt-1-0-2-0.patch"
patch_description: "add win32/winnt defines"
patch_type: "portability"
- patch_file: "patches/0003-remove-asio-defines-1-0-0-0.patch"
patch_description: "remove asio defines"
patch_type: "portability"
"1.0.2.0":
- patch_file: "patches/0001-cmake-clean-up-1-0-2-0.patch"
patch_description: "use cci packages, disable test/example builds"
Expand Down
22 changes: 12 additions & 10 deletions recipes/cppserver/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.env.virtualbuildenv import VirtualBuildEnv
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, collect_libs
from conan.tools.build import check_min_cppstd
from conan.tools.scm import Version
Expand All @@ -8,7 +9,7 @@

required_conan_version = ">=1.53.0"

class CppServer(ConanFile):
class CppServerPackage(ConanFile):
name = "cppserver"
description = "Ultra fast and low latency asynchronous socket server and" \
" client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket" \
Expand Down Expand Up @@ -57,17 +58,18 @@ def layout(self):
cmake_layout(self, src_folder="src")

def requirements(self):
self.requires("asio/1.27.0")
self.requires("openssl/[>=1.1 <4]")
self.requires("cppcommon/1.0.3.0")
# Used in asio/asio.h public header
self.requires("asio/1.27.0", transitive_headers=True, transitive_libs=True)
# Used in transitive asio/ssl.hpp header from asio
self.requires("openssl/[>=1.1 <4]", transitive_headers=True, transitive_libs=True)
# threads/thread.h used in asio/service.h public header
self.requires("cppcommon/1.0.4.0", transitive_headers=True, transitive_libs=True)

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._min_cppstd)
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if not minimum_version:
self.output.warn(f"{self.ref} requires C++17. Your compiler is unknown. Assuming it supports C++17.")
elif Version(self.settings.compiler.version) < minimum_version:
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(f"{self.ref} requires a compiler that supports at least C++17")

def build_requirements(self):
Expand All @@ -78,13 +80,13 @@ def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
VirtualBuildEnv(self).generate()
tc = CMakeToolchain(self)
tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True
tc.variables["CPPSERVER_MODULE"] = False
tc.generate()

dpes = CMakeDeps(self)
dpes.generate()
deps = CMakeDeps(self)
deps.generate()

def build(self):
apply_conandata_patches(self)
Expand Down
113 changes: 113 additions & 0 deletions recipes/cppserver/all/patches/0001-cmake-clean-up-1-0-4-1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,53 +17,24 @@
endif()
endif()

-# CMake module path
-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
-
-# Compiler features
-include(SetCompilerFeatures)
-include(SetCompilerWarnings)
-include(SetPlatformFeatures)
-include(SystemInformation)
-
# External packages
-if(APPLE)
- set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl@1.1")
-elseif(CYGWIN)
- set(OPENSSL_ROOT_DIR "/usr/lib")
- set(OPENSSL_INCLUDE_DIR "/usr/include")
- set(OPENSSL_CRYPTO_LIBRARY "/usr/lib/libcrypto.dll.a")
- set(OPENSSL_SSL_LIBRARY "/usr/lib/libssl.dll.a")
-elseif(MINGW)
- set(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/modules/OpenSSL/MinGW")
- set(OPENSSL_USE_STATIC_LIBS TRUE)
-elseif(MSVC)
- set(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/modules/OpenSSL/VS")
- set(OPENSSL_USE_STATIC_LIBS TRUE)
- set(OPENSSL_MSVC_STATIC_RT TRUE)
-endif()
find_package(OpenSSL REQUIRED)
-if(WIN32)
+if(0)
find_package(Crypt)
find_package(WinSock)
endif()

-# Modules
-add_subdirectory("modules")
-
# Link libraries
-list(APPEND LINKLIBS ${OPENSSL_LIBRARIES})
+list(APPEND LINKLIBS OpenSSL::SSL)
if(WIN32)
- list(APPEND LINKLIBS ${CRYPT_LIBRARIES})
- list(APPEND LINKLIBS ${WINSOCK_LIBRARIES})
+ list(APPEND LINKLIBS crypt32)
+ list(APPEND LINKLIBS ws2_32)
endif()
-list(APPEND LINKLIBS cppcommon)
+find_package(cppcommon REQUIRED)
+list(APPEND LINKLIBS cppcommon::cppcommon)

# OpenSSL libraries
message(STATUS "OpenSSL version: ${OPENSSL_VERSION} ${OPENSSL_INCLUDE_DIR} ${OPENSSL_LIBRARIES}")
-
-# System directories
-include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/modules")

# Library
file(GLOB_RECURSE LIB_HEADER_FILES "include/*.h" "source/*.h")
@@ -72,7 +43,9 @@
add_library(cppserver ${LIB_HEADER_FILES} ${LIB_INLINE_FILES} ${LIB_SOURCE_FILES})
set_target_properties(cppserver PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}" FOLDER "libraries")
target_include_directories(cppserver PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
-target_link_libraries(cppserver ${LINKLIBS} asio)
+find_package(asio REQUIRED)
+target_link_libraries(cppserver ${LINKLIBS} asio::asio)
+target_compile_features(cppserver PUBLIC cxx_std_17)
list(APPEND INSTALL_TARGETS cppserver)
list(APPEND LINKLIBS cppserver)

@@ -91,6 +64,7 @@
list(APPEND LINKLIBS proto)

# Examples
+ if(0)
file(GLOB EXAMPLE_HEADER_FILES "examples/*.h")
file(GLOB EXAMPLE_INLINE_FILES "examples/*.inl")
file(GLOB EXAMPLE_SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/examples" "examples/*.cpp")
@@ -117,8 +91,10 @@
list(APPEND INSTALL_TARGETS ${BENCHMARK_TARGET})
list(APPEND INSTALL_TARGETS_PDB ${BENCHMARK_TARGET})
endforeach()
+ endif()

# Tests
+ if(0)
file(GLOB TESTS_HEADER_FILES "tests/*.h")
file(GLOB TESTS_INLINE_FILES "tests/*.inl")
file(GLOB TESTS_SOURCE_FILES "tests/*.cpp")
@@ -132,15 +108,16 @@
# CTest
enable_testing()
add_test(cppserver-tests cppserver-tests --durations yes --order lex)
+ endif()

# Install
install(TARGETS ${INSTALL_TARGETS}
- RUNTIME DESTINATION "${PROJECT_SOURCE_DIR}/bin"
- LIBRARY DESTINATION "${PROJECT_SOURCE_DIR}/bin"
- ARCHIVE DESTINATION "${PROJECT_SOURCE_DIR}/bin")
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)

# Install *.pdb files
- if(MSVC)
+ if(0)
foreach(INSTALL_TARGET_PDB ${INSTALL_TARGETS_PDB})
install(FILES $<TARGET_PDB_FILE:${INSTALL_TARGET_PDB}> DESTINATION "${PROJECT_SOURCE_DIR}/bin")
endforeach()
2 changes: 2 additions & 0 deletions recipes/cppserver/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"1.0.4.1":
folder: all
"1.0.2.0":
folder: all
"1.0.1.0":
Expand Down
Loading