Skip to content

Commit

Permalink
Merge pull request #40 from topfreegames/fix_etcd_exponential_retry
Browse files Browse the repository at this point in the history
Fix etcd exponential retry
  • Loading branch information
rsafonseca authored Mar 23, 2022
2 parents 5920f80 + 8367181 commit 969b18e
Show file tree
Hide file tree
Showing 823 changed files with 75,748 additions and 97,508 deletions.
20 changes: 12 additions & 8 deletions cpp-lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.7)
cmake_minimum_required(VERSION 3.13)

project(PitayaCpp)

Expand All @@ -8,10 +8,9 @@ if(UNIX AND NOT APPLE)
# FIXME: this is an ugly solution, avoid setting global variables
# by adding properties to the targets.
set(CMAKE_CXX_FLAGS "-fPIC")
set(CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/cpprestsdk_install/linux")
set(CMAKE_C_FLAGS "-fPIC")
elseif(APPLE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ".lib" ".dylib" ".so" ".dll")
set(CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/cpprestsdk_install/mac")
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ".lib" ".dylib" ".so" ".dll")
endif()
Expand All @@ -34,12 +33,12 @@ set(gRPC_BUILD_CSHARP_EXT OFF CACHE BOOL "")
if(UNIX AND NOT APPLE)
set(gRPC_ZLIB_PROVIDER "package")
endif()
add_subdirectory(deps/grpc EXCLUDE_FROM_ALL)

add_subdirectory(deps/etcd-cpp-api EXCLUDE_FROM_ALL)

set(NATS_BUILD_STREAMING OFF CACHE BOOL "")
add_subdirectory(deps/nats.c-2.5.0 EXCLUDE_FROM_ALL)
set(NATS_BUILD_TLS_USE_OPENSSL_1_1_API ON CACHE BOOL "" FORCE)
add_subdirectory(deps/nats.c-3.3.0 EXCLUDE_FROM_ALL)

option(BUILD_MACOSX_BUNDLE "Should build a bundle for Macosx" OFF)

Expand Down Expand Up @@ -123,14 +122,16 @@ endif()

set_target_properties(pitaya_cpp
PROPERTIES
CXX_STANDARD 11
CXX_STANDARD 17
POSITION_INDEPENDENT_CODE ON)

target_include_directories(pitaya_cpp
PUBLIC
$<BUILD_INTERFACE:
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/deps/spdlog/include>
${PROTOBUF_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
$<INSTALL_INTERFACE:include>
PRIVATE
src)
Expand All @@ -140,8 +141,11 @@ target_link_libraries(pitaya_cpp
nats_static
etcd-cpp-api
Boost::boost
CONAN_PKG::cpprestsdk
CONAN_PKG::protobuf
CONAN_PKG::grpc
PRIVATE
libprotobuf)
CONAN_PKG::protobuf)

include(CTest)
if(BUILD_TESTING AND NOT BUILD_MACOSX_BUNDLE)
Expand All @@ -152,7 +156,7 @@ if(BUILD_TESTING AND NOT BUILD_MACOSX_BUNDLE)

target_link_libraries(main PRIVATE pitaya_cpp)

set_target_properties(main PROPERTIES CXX_STANDARD 11)
set_target_properties(main PROPERTIES CXX_STANDARD 17)

#==============================
# Enable tests
Expand Down
3 changes: 1 addition & 2 deletions cpp-lib/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
FROM conanio/clang11
FROM conanio/clang13-ubuntu16.04

RUN sudo apt-get update && sudo apt-get --assume-yes install golang-go ninja-build

14 changes: 7 additions & 7 deletions cpp-lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,31 @@ clean-mac-debug:
clean-all: clean-mac-debug clean-mac-release clean-mac-unity clean-xcode clean-linux-release

generate-xcode:
@conan install -if _builds/xcode . --build=missing
@conan install -if _builds/xcode . --build=missing -s cppstd=gnu17
@cmake -H. -B_builds/xcode -GXcode -DBUILD_TESTING=ON -DBUILD_SHARED_LIBS=OFF

build-linux-release:
@conan install -if _builds/linux . --build=missing
@cmake -H. -B_builds/linux -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -GNinja
@conan install -if _builds/linux . --build=missing -s cppstd=gnu17
@cmake -H. -B_builds/linux -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -GNinja -DCMAKE_C_COMPILER="/usr/local/bin/clang" -DCMAKE_CXX_COMPILER="/usr/local/bin/clang++"
@cmake --build _builds/linux

build-mac-release:
@conan install . -if _builds/mac
@conan install . -if _builds/mac --build=missing -s cppstd=gnu17
@cmake -H. -B_builds/mac -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF
@cmake --build _builds/mac

build-mac-debug:
@conan install . -if _builds/mac-debug --build=missing
@conan install . -if _builds/mac-debug --build=missing -s cppstd=gnu17
@cmake -H. -B_builds/mac-debug -GNinja -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -DBUILD_SHARED_LIBS=OFF
@cmake --build _builds/mac-debug

build-mac-unity:
@conan install -if _builds/mac-unity .
@conan install -if _builds/mac-unity . --build=missing -s cppstd=gnu17
@cmake -H. -B_builds/mac-unity -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_MACOSX_BUNDLE=ON -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF
@cmake --build _builds/mac-unity

build-mac-unity-debug:
@conan install -if _builds/mac-unity-debug .
@conan install -if _builds/mac-unity-debug . --build=missing -s cppstd=gnu17
@cmake -H. -B_builds/mac-unity-debug -GNinja -DCMAKE_BUILD_TYPE=Debug -DBUILD_MACOSX_BUNDLE=ON -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF
@cmake --build _builds/mac-unity-debug

Expand Down
16 changes: 8 additions & 8 deletions cpp-lib/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PitayaCpp(ConanFile):
version = get_version()
url = 'https://github.com/topfreegames.com/libpitaya-cluster'
description = 'C++ library that allows the creation of Pitaya servers.'
settings = 'os', 'compiler', 'build_type', 'arch'
settings = 'cppstd', 'os', 'compiler', 'build_type', 'arch'
options = {
'macosx_bundle': [False, True],
}
Expand All @@ -23,12 +23,14 @@ class PitayaCpp(ConanFile):
}
requires = (
'zlib/1.2.11',
'openssl/1.1.1k',
'boost/1.75.0',
'protobuf/3.15.5',
'openssl/1.1.1m',
'boost/1.78.0',
'protobuf/3.19.2',
'cpprestsdk/2.10.18',
'grpc/1.44.0',
)
build_requires = (
'gtest/1.8.1@bincrafters/stable'
'gtest/1.8.1'
)
generators = 'cmake_paths', 'cmake'
exports = 'version.txt'
Expand Down Expand Up @@ -67,6 +69,4 @@ def package(self):
def package_info(self):
self.cpp_info.libs = ['pitaya_cpp']
self.cpp_info.libdirs = ['lib/PitayaCpp']
self.cpp_info.cxxflags = ['-std=c++11']


self.cpp_info.cxxflags = ['-std=c++17']
26 changes: 0 additions & 26 deletions cpp-lib/cpprestsdk_install/LICENSE.txt

This file was deleted.

Loading

0 comments on commit 969b18e

Please sign in to comment.