Skip to content

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
flier committed Mar 17, 2017
2 parents 794ae62 + 7e3b0f6 commit e628091
Show file tree
Hide file tree
Showing 64 changed files with 3,812 additions and 1,503 deletions.
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ build
dist
gen-cpp

.sconsign.dblite
.conan*
SConscript_conan
conan*info.*
config.log
tags

*.o
Expand Down
73 changes: 46 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,80 @@
sudo: required

dist: trusty

services:
- docker

os:
- linux
- osx
osx_image: xcode8.2

addons:
apt:
packages:
packages: &default_packages
- automake
- autoconf
- bison
- flex
- libtool
- libc++-dev
- build-essential
- clang
- cmake
- g++
- libboost-dev
- libboost-filesystem-dev
- libboost-program-options-dev
- libboost-system-dev
- libboost-test-dev
- libboost-all-dev
- libevent-dev
- libssl-dev
- libtool
- libcurl4-openssl-dev
- libdouble-conversion-dev
- thrift-compiler
- make
- pkg-config
- curl
- tree

language: cpp

compiler:
- clang
- gcc
cache: ccache

python:
- "2.7"

env:
global:
- THRIFT_VERSION=0.10.0
- RDKAFKA_VERSION=0.9.4
- CMAKE_VERSION=3.7.2

install:
- pip install --upgrade pip
- pip install --user conan
matrix:
include:
- os: osx
- os: linux
env: COMPILER_NAME=gcc CXX=g++-5 CC=gcc-5
addons:
apt:
packages:
- *default_packages
- g++-5
sources: &sources
- llvm-toolchain-precise-3.8
- ubuntu-toolchain-r-test
- os: linux
env: COMPILER_NAME=clang CXX=clang++-3.8 CC=clang-3.8
addons:
apt:
packages:
- *default_packages
- clang-3.8
sources: *sources

before_script:
- .travis/install-dependencies.sh

script:
- scons
- mkdir build && cd build && rm -rf *
- echo travis_fold:start:cmake CMake configure
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ../cmake-$CMAKE_VERSION-Linux-x86_64/bin/cmake .. ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cmake .. -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl ;fi
- echo travis_fold:end:cmake
- make && make test

after_failure:
- echo `pwd`
- tree -h
- cat externals/src/Folly/folly/config.log
- cat externals/src/Thrift/config.log
- tree -h

cache:
ccache: true
directories:
- cmake-$CMAKE_VERSION-Linux-x86_64
34 changes: 5 additions & 29 deletions .travis/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,11 @@ set -e

if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
brew update
brew install thrift librdkafka

$HOME/.local/bin/conan install --build missing
brew install ccache curl double-conversion gflags glog google-benchmark gperftools rapidjson folly thrift librdkafka grpc doxygen
else
curl -sSL "http://apache.mirrors.spacedump.net/thrift/$THRIFT_VERSION/thrift-$THRIFT_VERSION.tar.gz" -o thrift.tar.gz
mkdir -p thrift-$THRIFT_VERSION
tar zxf thrift.tar.gz -C thrift-$THRIFT_VERSION --strip-components=1
rm thrift.tar.gz
cd thrift-$THRIFT_VERSION
./configure --without-python --without-java --without-ruby --without-php --without-erlang --without-go --without-nodejs --without-qt4
make
sudo make install
cd ..
rm -rf thrift-$THRIFT_VERSION

curl -sSL "https://github.com/edenhill/librdkafka/archive/v$RDKAFKA_VERSION.tar.gz" -o librdkafka.tar.gz
mkdir -p librdkafka-$RDKAFKA_VERSION
tar zxf librdkafka.tar.gz -C librdkafka-$RDKAFKA_VERSION --strip-components=1
rm librdkafka.tar.gz
cd librdkafka-$RDKAFKA_VERSION
./configure
make
sudo make install
cd ..
rm -rf librdkafka-$RDKAFKA_VERSION

if [ "$CXX" == "g++" ]; then
$HOME/.local/bin/conan install --build missing -s compiler=gcc -s compiler.libcxx=libstdc++11
else
$HOME/.local/bin/conan install --build missing -s compiler=clang -s compiler.libcxx=libstdc++11
if [[ ! -f "cmake-$CMAKE_VERSION-Linux-x86_64/bin/cmake" ]]
then
wget --no-check-certificate https://cmake.org/files/v3.7/cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz
tar -xvf cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz
fi
fi
174 changes: 148 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
cmake_minimum_required (VERSION 2.8.12)
cmake_minimum_required (VERSION 3.0.0)

project(zipkin C CXX)
project(zipkin-cpp
VERSION 0.3.0
LANGUAGES C CXX)

set (zipkin_VERSION_MAJOR 0)
set (zipkin_VERSION_MINOR 2)
set (zipkin_VERSION_PATCH 0)
set (zipkin_VERSION ${zipkin_VERSION_MAJOR}.${zipkin_VERSION_MINOR}.${zipkin_VERSION_PATCH})
include(CTest)
enable_testing()

set (CMAKE_C_STANDARD 99)
set (CMAKE_C_STANDARD_REQUIRED ON)
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_EXTENSIONS OFF)
set (CMAKE_COLOR_MAKEFILE ON)

include(${PROJECT_SOURCE_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
if (APPLE)
set (CMAKE_MACOSX_RPATH ON)
endif ()

if (NOT CMAKE_BUILD_TYPE)
message(STATUS "Default build type 'Release with debug info'")
Expand All @@ -30,29 +38,84 @@ set(Boost_USE_STATIC_LIBS ON) # only find static libs
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)

find_package(Boost REQUIRED COMPONENTS regex system)
find_package(Boost REQUIRED COMPONENTS regex system thread)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
endif()

find_package(Thrift REQUIRED)
find_package(LibRDKafka REQUIRED)
find_package(Doxygen QUIET)
find_package(Threads REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(ZLIB)
find_package(Thrift)
find_package(LibRDKafka)
find_package(Folly)
find_package(RapidJSON)
find_package(DoubleConversion)
find_package(GFlags)
find_package(GLog)
find_package(GTest)
find_package(GBench)
find_package(CURL)
find_package(Protobuf)
find_package(GRPC)
find_package(Gperftools)
find_package(Doxygen)

if (OPENSSL_FOUND)
list(GET OPENSSL_LIBRARIES 0 openssl_libname)
get_filename_component(OPENSSL_LIBRARY_DIR ${openssl_libname} DIRECTORY)
get_filename_component(OPENSSL_ROOT_DIR ${OPENSSL_LIBRARY_DIR} DIRECTORY)

if (APPLE)
set (WITH_OPENSSL "--with-openssl=${OPENSSL_ROOT_DIR}")
endif ()

message(STATUS "Found OpenSSL ${OPENSSL_VERSION}, inc=${OPENSSL_INCLUDE_DIR}, libs=${OPENSSL_LIBRARIES} root=${OPENSSL_ROOT_DIR}")
endif ()

include(InstallExternalProjects)

if (CURL_FOUND AND ZLIB_FOUND)
set (WITH_CURL ON)
else ()
set (WITH_CURL OFF)
endif ()

if (GRPC_FOUND)
set (WITH_GRPC ON)
else ()
set (WITH_GRPC OFF)
endif ()

if (${DOXYGEN_FOUND} AND ${RELEASE_BUILD})
# gperftools - Google Performance Tool
#
# https://github.com/gperftools/gperftools
if (GPERFTOOLS_FOUND)
set (WITH_TCMALLOC ON)
if (RELEASE_BUILD)
set (WITH_PROFILER OFF)
else ()
set (WITH_PROFILER ON)
endif ()
else ()
set (WITH_TCMALLOC OFF)
set (WITH_PROFILER OFF)
endif ()

if (DOXYGEN_FOUND AND RELEASE_BUILD)
set (BUILD_DOCS ON)
else()
else ()
set (BUILD_DOCS OFF)
endif()
endif ()

option (WITH_CURL "Build with cURL propagation" WITH_CURL)
option (WITH_GRPC "Build with gRPC propagation" WITH_GRPC)
option (WITH_FPIC "Build with -fPIC for shared library" OFF)
option (WITH_TCMALLOC "Build with tcmalloc library" WITH_TCMALLOC)
option (WITH_PROFILER "Build with CPU profiler" WITH_PROFILER)
option (SHARED_LIB "Build shared library" OFF)
option (BUILD_DOCS "Build API documentation (requires Doxygen)" BUILD_DOCS)

if (APPLE)
set (CMAKE_MACOSX_RPATH ON)
endif ()

if (RELEASE_BUILD)
add_compile_options(-O2)
else()
Expand All @@ -75,21 +138,80 @@ endif()

include_directories(${PROJECT_SOURCE_DIR}/src)
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_SOURCE_DIR}/gen-cpp)
include_directories(${PROJECT_BINARY_DIR})
include_directories(${PROJECT_BINARY_DIR}/gen-cpp)
include_directories(${PROJECT_BINARY_DIR}/src)
include_directories(SYSTEM include)

set(zipkin_DEPENDENCIES
${CONAN_LIBS_GLOG}
${CONAN_LIBS_GFLAGS}
set (zipkin_DEPENDENCIES
${GLOG_LIBRARY}
${GFLAGS_LIBRARIES}
${THRIFT_LIBRARIES}
${LibRDKafka_LIBRARIES}
${ZLIB_LIBRARIES}
${OPENSSL_LIBRARIES}
${FOLLY_STATIC_LIBRARY}
${DOUBLE_CONVERSION_LIBRARY}
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)

message (STATUS "Link with ${zipkin_DEPENDENCIES}")
if (WITH_CURL)
if (NOT CURL_FOUND)
message(SEND_ERROR "cURL not found")
endif()

enable_testing()
if (NOT ZLIB_FOUND)
message(SEND_ERROR "zlib not found")
endif()

message(STATUS "Build with cURL propagation")

list (APPEND zipkin_DEPENDENCIES ${CURL_LIBRARIES})

set (CURL_ENABLED 1)
else()
message(STATUS "cURL supports disabled")
endif()

if (WITH_GRPC)
if (NOT GRPC_FOUND)
message(SEND_ERROR "gRPC not found")
endif()

message(STATUS "Build with gRPC propagation")

list(APPEND zipkin_DEPENDENCIES ${GRPC_LIBRARIES})

set (GRPC_ENABLED 1)
else()
message(STATUS "gRPC supports disabled")
endif()

if (WITH_TCMALLOC OR WITH_PROFILER)
if (NOT GPERFTOOLS_FOUND)
message(SEND_ERROR "gperftools not found")
endif()

if (WITH_TCMALLOC)
add_compile_options(-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free)
endif ()

if (WITH_TCMALLOC AND WITH_PROFILER)
message(STATUS "Build with tcmalloc and profiler library")

list(APPEND zipkin_DEPENDENCIES ${GPERFTOOLS_LIBRARIES})
elseif (WITH_TCMALLOC)
message(STATUS "Build with tcmalloc library")

list(APPEND zipkin_DEPENDENCIES ${GPERFTOOLS_TCMALLOC})
elseif (WITH_PROFILER)
message(STATUS "Build with profiler library")

list(APPEND zipkin_DEPENDENCIES ${GPERFTOOLS_PROFILER})
endif ()
endif ()

message (STATUS "Link with ${zipkin_DEPENDENCIES}")

add_subdirectory(docs)
add_subdirectory(src)
Expand Down
2 changes: 1 addition & 1 deletion bench/BenchSpan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

void bench_span_reuse(benchmark::State &state)
{
std::unique_ptr<zipkin::Tracer> tracer(zipkin::Tracer::create(nullptr, "bench"));
std::unique_ptr<zipkin::Tracer> tracer(zipkin::Tracer::create(nullptr));
std::vector<zipkin::Span *> spans(state.range(0));

while (state.KeepRunning())
Expand Down
2 changes: 1 addition & 1 deletion bench/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ add_executable(bench ${zipkin_bench_SRCS})
target_link_libraries(bench
zipkin
${zipkin_DEPENDENCIES}
${CONAN_LIBS_GOOGLE-BENCHMARK}
${GBENCH_LIBRARY}
)
Loading

0 comments on commit e628091

Please sign in to comment.