Unverified Commit 024c9698 authored by Ge Jun's avatar Ge Jun Committed by GitHub

Merge pull request #878 from mesalock-linux/mesalink_1.0

Use prebuilt MesaLink package in travis CI
parents 16ef5886 91e0afee
...@@ -11,8 +11,10 @@ env: ...@@ -11,8 +11,10 @@ env:
- PURPOSE=unittest - PURPOSE=unittest
- PURPOSE=compile-with-cmake - PURPOSE=compile-with-cmake
- PURPOSE=compile-with-bazel - PURPOSE=compile-with-bazel
#- PURPOSE=compile USE_MESALINK=yes - PURPOSE=compile USE_MESALINK=true
#- PURPOSE=unittest USE_MESALINK=yes - PURPOSE=unittest USE_MESALINK=true
- PURPOSE=compile-with-cmake USE_MESALINK=true
- PURPOSE=compile-with-bazel USE_MESALINK=true
before_script: before_script:
- ulimit -c unlimited -S # enable core dumps - ulimit -c unlimited -S # enable core dumps
...@@ -27,7 +29,7 @@ install: ...@@ -27,7 +29,7 @@ install:
- sudo apt-get install -qq realpath libgflags-dev libprotobuf-dev libprotoc-dev protobuf-compiler libleveldb-dev libgoogle-perftools-dev libboost-dev libssl-dev libevent-dev libboost-test-dev - sudo apt-get install -qq realpath libgflags-dev libprotobuf-dev libprotoc-dev protobuf-compiler libleveldb-dev libgoogle-perftools-dev libboost-dev libssl-dev libevent-dev libboost-test-dev
- sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo env "PATH=$PATH" cmake . && sudo make && sudo mv libgtest* /usr/lib/ && cd - - sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo env "PATH=$PATH" cmake . && sudo make && sudo mv libgtest* /usr/lib/ && cd -
- sudo apt-get install -y gdb # install gdb - sudo apt-get install -y gdb # install gdb
- if [[ "$USE_MESALINK" == "yes" ]]; then curl https://sh.rustup.rs -sSf | sh -s -- -y && source $HOME/.cargo/env && wget https://github.com/mesalock-linux/mesalink/archive/v0.8.0.tar.gz && tar -xf v0.8.0.tar.gz && cd mesalink-0.8.0 && ./autogen.sh --prefix=/usr/ && make && sudo make install && cd - ; fi - if [[ "$USE_MESALINK" == "true" ]]; then wget https://mesalink.s3-us-west-1.amazonaws.com/MesaLink-1.0.0-x86_64_trusty.deb && sudo dpkg -i MesaLink-1.0.0-x86_64_trusty.deb ; fi # install MesaLink for trusty
script: script:
- sh build_in_travis_ci.sh - sh build_in_travis_ci.sh
...@@ -10,6 +10,12 @@ config_setting( ...@@ -10,6 +10,12 @@ config_setting(
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
config_setting(
name = "with_mesalink",
define_values = {"with_mesalink": "true"},
visibility = ["//visibility:public"],
)
config_setting( config_setting(
name = "with_thrift", name = "with_thrift",
define_values = {"with_thrift": "true"}, define_values = {"with_thrift": "true"},
...@@ -46,6 +52,9 @@ COPTS = [ ...@@ -46,6 +52,9 @@ COPTS = [
] + select({ ] + select({
":with_glog": ["-DBRPC_WITH_GLOG=1"], ":with_glog": ["-DBRPC_WITH_GLOG=1"],
"//conditions:default": ["-DBRPC_WITH_GLOG=0"], "//conditions:default": ["-DBRPC_WITH_GLOG=0"],
}) + select({
":with_mesalink": ["-DUSE_MESALINK"],
"//conditions:default": [""],
}) + select({ }) + select({
":with_thrift": ["-DENABLE_THRIFT_FRAMED_PROTOCOL=1"], ":with_thrift": ["-DENABLE_THRIFT_FRAMED_PROTOCOL=1"],
"//conditions:default": [""], "//conditions:default": [""],
...@@ -73,6 +82,11 @@ LINKOPTS = [ ...@@ -73,6 +82,11 @@ LINKOPTS = [
"//conditions:default": [ "//conditions:default": [
"-lrt", "-lrt",
], ],
}) + select({
":with_mesalink": [
"-lmesalink",
],
"//conditions:default": [],
}) + select({ }) + select({
":with_thrift": [ ":with_thrift": [
"-lthriftnb", "-lthriftnb",
......
...@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.8.10) ...@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.8.10)
project(brpc C CXX) project(brpc C CXX)
option(WITH_GLOG "With glog" OFF) option(WITH_GLOG "With glog" OFF)
option(WITH_MESALINK "With MesaLink" OFF)
option(DEBUG "Print debug logs" OFF) option(DEBUG "Print debug logs" OFF)
option(WITH_DEBUG_SYMBOLS "With debug symbols" ON) option(WITH_DEBUG_SYMBOLS "With debug symbols" ON)
option(WITH_THRIFT "With thrift framed protocol supported" OFF) option(WITH_THRIFT "With thrift framed protocol supported" OFF)
...@@ -87,6 +88,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") ...@@ -87,6 +88,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
endif() endif()
set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}") set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DBRPC_WITH_GLOG=${WITH_GLOG_VAL} -DGFLAGS_NS=${GFLAGS_NS}")
if(WITH_MESALINK)
set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -DUSE_MESALINK")
endif()
set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -DBTHREAD_USE_FAST_PTHREAD_MUTEX -D__const__= -D_GNU_SOURCE -DUSE_SYMBOLIZE -DNO_TCMALLOC -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DBRPC_REVISION=\\\"${BRPC_REVISION}\\\" -D__STRICT_ANSI__") set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -DBTHREAD_USE_FAST_PTHREAD_MUTEX -D__const__= -D_GNU_SOURCE -DUSE_SYMBOLIZE -DNO_TCMALLOC -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DBRPC_REVISION=\\\"${BRPC_REVISION}\\\" -D__STRICT_ANSI__")
set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} ${DEBUG_SYMBOL} ${THRIFT_CPP_FLAG}") set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} ${DEBUG_SYMBOL} ${THRIFT_CPP_FLAG}")
set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -O2 -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-invalid-offsetof -Wno-unused-parameter -fno-omit-frame-pointer") set(CMAKE_CXX_FLAGS "${CMAKE_CPP_FLAGS} -O2 -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-invalid-offsetof -Wno-unused-parameter -fno-omit-frame-pointer")
...@@ -136,6 +140,17 @@ if(WITH_GLOG) ...@@ -136,6 +140,17 @@ if(WITH_GLOG)
include_directories(${GLOG_INCLUDE_PATH}) include_directories(${GLOG_INCLUDE_PATH})
endif() endif()
if(WITH_MESALINK)
find_path(MESALINK_INCLUDE_PATH NAMES mesalink/openssl/ssl.h)
find_library(MESALINK_LIB NAMES mesalink)
if((NOT MESALINK_INCLUDE_PATH) OR (NOT MESALINK_LIB))
message(FATAL_ERROR "Fail to find MesaLink")
else()
message(STATUS "Found MesaLink: ${MESALINK_LIB}")
endif()
include_directories(${MESALINK_INCLUDE_PATH})
endif()
find_library(PROTOC_LIB NAMES protoc) find_library(PROTOC_LIB NAMES protoc)
if(NOT PROTOC_LIB) if(NOT PROTOC_LIB)
message(FATAL_ERROR "Fail to find protoc lib") message(FATAL_ERROR "Fail to find protoc lib")
...@@ -164,10 +179,16 @@ set(DYNAMIC_LIB ...@@ -164,10 +179,16 @@ set(DYNAMIC_LIB
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${THRIFT_LIB} ${THRIFT_LIB}
${THRIFTNB_LIB} ${THRIFTNB_LIB}
${OPENSSL_LIBRARIES}
${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY}
dl dl
z) z)
if(WITH_MESALINK)
list(APPEND DYNAMIC_LIB ${MESALINK_LIB})
else()
list(APPEND DYNAMIC_LIB ${OPENSSL_SSL_LIBRARY})
endif()
set(BRPC_PRIVATE_LIBS "-lgflags -lprotobuf -lleveldb -lprotoc -lssl -lcrypto -ldl -lz") set(BRPC_PRIVATE_LIBS "-lgflags -lprotobuf -lleveldb -lprotoc -lssl -lcrypto -ldl -lz")
if(WITH_GLOG) if(WITH_GLOG)
......
...@@ -23,7 +23,7 @@ echo "build combination: PURPOSE=$PURPOSE CXX=$CXX CC=$CC" ...@@ -23,7 +23,7 @@ echo "build combination: PURPOSE=$PURPOSE CXX=$CXX CC=$CC"
init_make_config() { init_make_config() {
EXTRA_BUILD_OPTS="" EXTRA_BUILD_OPTS=""
if [ "$USE_MESALINK" = "yes" ]; then if [ "$USE_MESALINK" = "true" ]; then
EXTRA_BUILD_OPTS="$EXTRA_BUILD_OPTS --with-mesalink" EXTRA_BUILD_OPTS="$EXTRA_BUILD_OPTS --with-mesalink"
fi fi
...@@ -40,9 +40,9 @@ if [ "$PURPOSE" = "compile" ]; then ...@@ -40,9 +40,9 @@ if [ "$PURPOSE" = "compile" ]; then
elif [ "$PURPOSE" = "unittest" ]; then elif [ "$PURPOSE" = "unittest" ]; then
init_make_config && cd test && make -j4 && sh ./run_tests.sh init_make_config && cd test && make -j4 && sh ./run_tests.sh
elif [ "$PURPOSE" = "compile-with-cmake" ]; then elif [ "$PURPOSE" = "compile-with-cmake" ]; then
rm -rf bld && mkdir bld && cd bld && cmake .. && make -j4 rm -rf bld && mkdir bld && cd bld && cmake -DWITH_MESALINK="$USE_MESALINK" .. && make -j4
elif [ "$PURPOSE" = "compile-with-bazel" ]; then elif [ "$PURPOSE" = "compile-with-bazel" ]; then
bazel build -j 12 -c opt --copt -DHAVE_ZLIB=1 //... bazel build -j 12 -c opt --define with_mesalink="$USE_MESALINK" --copt -DHAVE_ZLIB=1 //...
else else
echo "Unknown purpose=\"$PURPOSE\"" echo "Unknown purpose=\"$PURPOSE\""
fi fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment