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

Reorganize / simplify cmakefiles.txt #13

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
c6cde3b
Reorganize / simplify cmakefiles.txt
basiliscos Jan 29, 2018
0767bde
Use conan as package manager
basiliscos Jan 30, 2018
069dab6
conanfile.txt -> conanfile.py
basiliscos Jan 31, 2018
d6738b4
Minor fixes
basiliscos Jan 31, 2018
6b8b255
Try to build on travis with conan
basiliscos Feb 1, 2018
0f31c1c
Another attempt
basiliscos Feb 1, 2018
b6deda0
update
basiliscos Feb 1, 2018
a5db555
update
basiliscos Feb 1, 2018
884e4db
--build missing
basiliscos Feb 1, 2018
2ad7b89
add actual building
basiliscos Feb 1, 2018
205acff
Updat
basiliscos Feb 1, 2018
f1ff2ef
Update
basiliscos Feb 1, 2018
6288950
Update
basiliscos Feb 1, 2018
239d8fb
Try to support coverage
basiliscos Feb 1, 2018
19c9e67
Fix
basiliscos Feb 1, 2018
d1a88de
Fix
basiliscos Feb 1, 2018
cf460bb
Fix
basiliscos Feb 1, 2018
2a27ad9
Fix
basiliscos Feb 1, 2018
281a9f3
Fix
basiliscos Feb 1, 2018
3ca6dd3
Fix
basiliscos Feb 1, 2018
d0b794d
Fix
basiliscos Feb 1, 2018
2e2de3a
Fix
basiliscos Feb 4, 2018
0239963
Fix
basiliscos Feb 4, 2018
b1065da
Fix
basiliscos Feb 4, 2018
2d54108
Fix
basiliscos Feb 4, 2018
7ac9514
Enable conan for app-veyor
basiliscos Feb 4, 2018
fe2105e
Enable conan for app-veyor
basiliscos Feb 4, 2018
c380e74
Enable conan for app-veyor
basiliscos Feb 4, 2018
67930aa
Enable conan for app-veyor
basiliscos Feb 4, 2018
447b86d
Enable conan for app-veyor
basiliscos Feb 4, 2018
7d4e86c
Enable conan for app-veyor
basiliscos Feb 4, 2018
caed88f
Enable conan for app-veyor
basiliscos Feb 4, 2018
70904d4
Enable conan for app-veyor
basiliscos Feb 4, 2018
0efff5a
Enable conan for app-veyor
basiliscos Feb 4, 2018
2804e25
Enable conan for app-veyor
basiliscos Feb 4, 2018
20ea14b
Enable conan for app-veyor
basiliscos Feb 4, 2018
075df73
Enable conan for app-veyor
basiliscos Feb 4, 2018
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
30 changes: 14 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ compiler:
os:
- linux

before_script:
- wget -q -O - http://sourceforge.net/projects/boost/files/boost/1.64.0/boost_1_64_0.tar.gz | tar -xz
- cd boost_1_64_0 && ./bootstrap.sh --with-libraries=coroutine,context,chrono,system,thread,regex,filesystem
- ./b2 --ignore-site-config && cd ..
- mkdir build
- cd build
- cmake -DBOOST_ROOT=`pwd`/../boost_1_64_0 ..

addons:
apt:
sources:
Expand All @@ -26,13 +18,19 @@ addons:
- lcov

script:
- $CXX --version
- make
- make test
- if [ "$CXX" == "g++-5" ]; then whereis gcov-5; fi
- if [ "$CXX" == "g++-5" ]; then make coverage VERBOSE=1; bash <(curl -s https://codecov.io/bash) -X gcov; fi

- mkdir build && cd build
- conan install .. --build missing
- cmake .. && make VERBOSE=1 && ctest
- if [ "$CXX" == "g++-5" ]; then lcov --directory . --capture --output-file coverage.info --gcov-tool gcov-5; fi
- if [ "$CXX" == "g++-5" ]; then lcov --remove coverage.info '/*.conan/*' '/usr/*' '/*/t/*' --output-file coverage.info.cleaned; fi
- if [ "$CXX" == "g++-5" ]; then rm coverage.info; fi
- if [ "$CXX" == "g++-5" ]; then bash <(curl -s https://codecov.io/bash) -X gcov ; fi

install:
- if [ "$CXX" = "g++" ]; then export CXX="g++-5"; export CC="gcc-5"; fi
- if [ "$CXX" = "clang++" ]; then export CXX="clang++"; fi
- if [ "$CXX" == "g++" ]; then export CXX="g++-5"; export CC="gcc-5"; export CFLAGS="-g -O0 -fprofile-arcs -ftest-coverage"; export CXXFLAGS="-g -O0 -fprofile-arcs -ftest-coverage"; fi
- if [ "$CXX" == "clang++" ]; then export CXX="clang++"; fi
- sudo apt-get update -qq
- pip install --user conan
- conan remote add conan-community https://api.bintray.com/conan/conan-community/conan
- conan user

102 changes: 12 additions & 90 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.0)
project (bredis)

find_package (Threads)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Expand All @@ -10,18 +12,8 @@ enable_testing()
add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
#add_definitions(-DBREDIS_DEBUG)

find_package(
Boost
COMPONENTS
chrono
coroutine
context
filesystem
regex
system
thread
REQUIRED
)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
Expand Down Expand Up @@ -58,85 +50,15 @@ if(CMAKE_COMPILER_IS_GNUCXX)
)
endif()

include_directories(${bredis_SOURCE_DIR}/include ${Boost_INCLUDE_DIRS})
MESSAGE(STATUS "boost inc: " ${Boost_INCLUDE_DIRS})
MESSAGE(STATUS "boost libs: " ${Boost_LIBRARIES})

add_library(catch_lib t/tests-main.cpp)

if(WIN32)
set(Boost_USE_MULTITHREADED ON)
set(LINK_DEPENDENCIES ${Boost_LIBRARIES} catch_lib)
add_definitions(-DBOOST_ALL_DYN_LINK -DBOOST_THREAD_USE_LIB -D_WIN32_WINNT=0x0501)
else()
set(LINK_DEPENDENCIES pthread ${Boost_LIBRARIES} catch_lib)
endif()
include_directories(${bredis_SOURCE_DIR}/include)
#include_directories(${bredis_SOURCE_DIR}/include ${Boost_INCLUDE_DIRS})
#MESSAGE(STATUS "boost inc: " ${Boost_INCLUDE_DIRS})
#MESSAGE(STATUS "boost libs: " ${Boost_LIBRARIES})

# ASIO maintenance is lagging behind the rest of boost, see
# https://github.com/chriskohlhoff/asio/pull/200 for one of the proposed patches.
set(DISABLE_COROUTINES true)
add_subdirectory(t)
add_subdirectory(examples)

add_executable(t-05-protocol t/05-protocol.cpp)
target_link_libraries(t-05-protocol ${LINK_DEPENDENCIES})
add_test("t-05-protocol" t-05-protocol)

add_executable(t-06-fragmented-buffer t/06-fragmented-buffer.cpp)
target_link_libraries(t-06-fragmented-buffer ${LINK_DEPENDENCIES})
add_test("t-06-fragmented-buffer" t-06-fragmented-buffer)

add_executable(t-07-extract t/07-extract.cpp)
target_link_libraries(t-07-extract ${LINK_DEPENDENCIES})
add_test("t-07-extract" t-07-extract)

add_executable(t-08-markers t/08-markers.cpp)
target_link_libraries(t-08-markers ${LINK_DEPENDENCIES})
add_test("t-07-extract" t-08-markers)

add_executable(t-10-ping t/10-ping.cpp)
target_link_libraries(t-10-ping ${LINK_DEPENDENCIES})
add_test("t-10-ping" t-10-ping)

add_executable(t-11-multi-ping t/11-multi-ping.cpp)
target_link_libraries(t-11-multi-ping ${LINK_DEPENDENCIES})
add_test("t-11-multi-ping" t-11-multi-ping)

add_executable(t-12-basic-types t/12-basic-types.cpp)
target_link_libraries(t-12-basic-types ${LINK_DEPENDENCIES})
add_test("t-12-basic-types" t-12-basic-types)

add_executable(t-13-protol-error t/13-protol-error.cpp)
target_link_libraries(t-13-protol-error ${LINK_DEPENDENCIES})
add_test("t-13-protol-error" t-13-protol-error)

if(NOT WIN32)
add_executable(t-14-uds t/14-uds.cpp)
target_link_libraries(t-14-uds ${LINK_DEPENDENCIES})
add_test("t-14-uds" t-14-uds)
endif()

add_executable(t-15-cancellation t/15-cancellation.cpp)
target_link_libraries(t-15-cancellation ${LINK_DEPENDENCIES})
add_test("t-15-cancellation" t-15-cancellation)

add_executable(t-16-close-connection t/16-close-connection.cpp)
target_link_libraries(t-16-close-connection ${LINK_DEPENDENCIES})
add_test("t-16-close-connection" t-16-close-connection)

add_executable(t-17-sync t/17-sync.cpp)
target_link_libraries(t-17-sync ${LINK_DEPENDENCIES})
add_test("t-17-sync" t-17-sync)

add_executable(t-18-subscription t/18-subscription.cpp)
target_link_libraries(t-18-subscription ${LINK_DEPENDENCIES})
add_test("t-18-subscription" t-18-subscription)

add_executable(t-19-transaction t/19-transaction.cpp)
target_link_libraries(t-19-transaction ${LINK_DEPENDENCIES})
add_test("t-19-transaction" t-19-transaction)

add_executable(t-20-promise t/20-promise.cpp)
target_link_libraries(t-20-promise ${LINK_DEPENDENCIES})
add_test("t-20-promise" t-20-promise)

add_executable(t-21-coroutine t/21-coroutine.cpp)
target_link_libraries(t-21-coroutine ${LINK_DEPENDENCIES})
add_test("t-21-coroutine" t-21-coroutine)

36 changes: 22 additions & 14 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,23 @@ platform:

# enable rdp
#init:
# - ps: iex ((new-object net.webclient).DownloadString('https://github.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

# - ps: "iex ((new-object net.webclient).DownloadString('https://github.com/appveyor/ci/master/scripts/enable-rdp.ps1'))"
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://github.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# - ps: "$blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://github.com/appveyor/ci/master/scripts/enable-rdp.ps1'))"

environment:
BOOST_ROOT: "C:\\Libraries\\boost_1_64_0"
#environment:
# BOOST_ROOT: "C:\\Libraries\\boost_1_64_0"
# BOOST_LIBRARYDIR: "C:\\Libraries\\boost_1_64_0\\lib32-msvc-15.0"


before_build:
- cmake --version
- echo %BOOST_ROOT%
- dir "C:\Libraries"
- dir "%BOOST_ROOT%"
#- echo %BOOST_ROOT%
#- dir "C:\Libraries"
#- dir "%BOOST_ROOT%"
- cmd: set PATH=%PATH%;%PYTHON%/Scripts/
- cmd: pip.exe install conan
- cmd: conan --version
- ps: wget 'https://github.com/MSOpenTech/redis/releases/download/win-3.0.504/Redis-x64-3.0.504.zip' -OutFile "Redis-x64-3.0.504.zip"
- '@ECHO redis downloaded deployed'
- dir
Expand All @@ -31,15 +33,21 @@ before_build:
# redis
- set PATH=%APPVEYOR_BUILD_FOLDER%;%PATH%
# boost
- set PATH=%BOOST_ROOT%\lib64-msvc-14.1;%PATH%
# - set PATH=%BOOST_ROOT%\lib64-msvc-14.1;%PATH%
- echo %PATH%

build_script:
- cmake -G "Visual Studio 15 2017 Win64" -H. -B_builds -DBOOST_ROOT="%BOOST_ROOT%"
# -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%"
- cmake --build _builds
- cmd: mkdir build
- cmd: cd build
- cmd: conan install .. --build missing -o boost:shared=True -o boost:without_filesystem=False
- cmd: cmake ../ -G "Visual Studio 15 2017 Win64"
- cmd: cmake --build . --config Release

test_script:
- ps: cd _builds
- ctest -VV -C "%CONFIG%"
# - ps: cd builds
- dir
# copy boost dlls into bin folder
- conan imports ..
- cmd: cp ../redis-server.exe bin
- ctest -VV -C "%CONFIG%"

70 changes: 70 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
from conans import ConanFile, CMake, tools


class BredisConan(ConanFile):
name = "bredis"
version = "0.05"
license = "<Put the package license here>"
url = "https://github.com/basiliscos/cpp-bredis"
description = "MIT"
settings = "os", "compiler", "build_type", "arch"

requires = "boost/1.66.0@conan/stable"
default_options = (
"boost:shared=True",
"boost:header_only=False",
"boost:without_math=True",
"boost:without_wave=True",
"boost:without_container=True",
"boost:without_exception=True",
"boost:without_graph=True",
"boost:without_iostreams=True",
"boost:without_locale=True",
"boost:without_log=True",
"boost:without_program_options=True",
"boost:without_random=True",
"boost:without_regex=True",
"boost:without_mpi=True",
"boost:without_serialization=True",
"boost:without_signals=True",
"boost:without_coroutine=False",
"boost:without_fiber=True",
"boost:without_context=False",
"boost:without_timer=True",
"boost:without_thread=False",
"boost:without_chrono=True",
"boost:without_date_time=True",
"boost:without_atomic=True",
"boost:without_filesystem=True",
"boost:without_system=True",
"boost:without_graph_parallel=True",
"boost:without_python=True",
"boost:without_stacktrace=True",
"boost:without_test=True",
"boost:without_type_erasure=True",
)

exports_sources = "include/*", "CMakeLists.txt", "examples/speed_test_async_multi.cpp"
no_copy_source = True

generators = "cmake"
exports = "CMakeLists.txt", "include*", "examples*", "t*"

# this is not building a library, just tests
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
cmake.test()
def package(self):
self.copy("*.hpp", dst="include", src="include")
self.copy("*.ipp", dst="include", src="include")

def package_id(self):
self.info.header_only()

def imports(self):
self.copy("*.dll", src="bin", dst="bin", ignore_case=True)

#def package_info(self):
# self.cpp_info.libs = ["cpp-bredis"]
16 changes: 12 additions & 4 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
add_executable(stream-parse stream-parse.cpp)
target_link_libraries(stream-parse ${Boost_LIBRARIES})
if(WIN32)
set(Boost_USE_MULTITHREADED ON)
set(LINK_DEPENDENCIES ${Boost_LIBRARIES} catch_lib)
add_definitions(-DBOOST_ALL_DYN_LINK -DBOOST_THREAD_USE_LIB -D_WIN32_WINNT=0x0501)
endif()

if(NOT DISABLE_COROUTINES)
add_executable(stream-parse stream-parse.cpp)
target_link_libraries(stream-parse ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
endif()

add_executable(synch-subscription synch-subscription.cpp)
target_link_libraries(synch-subscription ${Boost_LIBRARIES})
target_link_libraries(synch-subscription ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})

add_executable(speed_test_async_multi speed_test_async_multi.cpp)
target_link_libraries(speed_test_async_multi ${Boost_LIBRARIES})
target_link_libraries(speed_test_async_multi ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
Loading