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:
- PURPOSE=unittest
- PURPOSE=compile-with-cmake
- PURPOSE=compile-with-bazel
#- PURPOSE=compile USE_MESALINK=yes
#- PURPOSE=unittest USE_MESALINK=yes
- PURPOSE=compile USE_MESALINK=true
- PURPOSE=unittest USE_MESALINK=true
- PURPOSE=compile-with-cmake USE_MESALINK=true
- PURPOSE=compile-with-bazel USE_MESALINK=true
before_script:
- ulimit -c unlimited -S # enable core dumps
......@@ -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 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
- 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:
- sh build_in_travis_ci.sh
......@@ -10,6 +10,12 @@ config_setting(
visibility = ["//visibility:public"],
)
config_setting(
name = "with_mesalink",
define_values = {"with_mesalink": "true"},
visibility = ["//visibility:public"],
)
config_setting(
name = "with_thrift",
define_values = {"with_thrift": "true"},
......@@ -46,6 +52,9 @@ COPTS = [
] + select({
":with_glog": ["-DBRPC_WITH_GLOG=1"],
"//conditions:default": ["-DBRPC_WITH_GLOG=0"],
}) + select({
":with_mesalink": ["-DUSE_MESALINK"],
"//conditions:default": [""],
}) + select({
":with_thrift": ["-DENABLE_THRIFT_FRAMED_PROTOCOL=1"],
"//conditions:default": [""],
......@@ -54,7 +63,7 @@ COPTS = [
LINKOPTS = [
"-lpthread",
"-ldl",
"-lz",
"-lz",
"-lssl",
"-lcrypto",
] + select({
......@@ -73,6 +82,11 @@ LINKOPTS = [
"//conditions:default": [
"-lrt",
],
}) + select({
":with_mesalink": [
"-lmesalink",
],
"//conditions:default": [],
}) + select({
":with_thrift": [
"-lthriftnb",
......@@ -236,7 +250,7 @@ objc_library(
"src/butil/atomicops.h",
"src/butil/atomicops_internals_atomicword_compat.h",
"src/butil/atomicops_internals_mac.h",
"src/butil/base_export.h",
"src/butil/base_export.h",
"src/butil/basictypes.h",
"src/butil/build_config.h",
"src/butil/compat.h",
......@@ -270,7 +284,7 @@ objc_library(
"src/butil/strings/sys_string_conversions.h",
"src/butil/synchronization/lock.h",
"src/butil/time/time.h",
"src/butil/time.h",
"src/butil/time.h",
"src/butil/third_party/dynamic_annotations/dynamic_annotations.h",
"src/butil/threading/platform_thread.h",
"src/butil/threading/thread_restrictions.h",
......
......@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 2.8.10)
project(brpc C CXX)
option(WITH_GLOG "With glog" OFF)
option(WITH_MESALINK "With MesaLink" OFF)
option(DEBUG "Print debug logs" OFF)
option(WITH_DEBUG_SYMBOLS "With debug symbols" ON)
option(WITH_THRIFT "With thrift framed protocol supported" OFF)
......@@ -87,6 +88,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
endif()
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} ${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")
......@@ -136,6 +140,17 @@ if(WITH_GLOG)
include_directories(${GLOG_INCLUDE_PATH})
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)
if(NOT PROTOC_LIB)
message(FATAL_ERROR "Fail to find protoc lib")
......@@ -164,10 +179,16 @@ set(DYNAMIC_LIB
${CMAKE_THREAD_LIBS_INIT}
${THRIFT_LIB}
${THRIFTNB_LIB}
${OPENSSL_LIBRARIES}
${OPENSSL_CRYPTO_LIBRARY}
dl
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")
if(WITH_GLOG)
......
......@@ -23,7 +23,7 @@ echo "build combination: PURPOSE=$PURPOSE CXX=$CXX CC=$CC"
init_make_config() {
EXTRA_BUILD_OPTS=""
if [ "$USE_MESALINK" = "yes" ]; then
if [ "$USE_MESALINK" = "true" ]; then
EXTRA_BUILD_OPTS="$EXTRA_BUILD_OPTS --with-mesalink"
fi
......@@ -40,9 +40,9 @@ if [ "$PURPOSE" = "compile" ]; then
elif [ "$PURPOSE" = "unittest" ]; then
init_make_config && cd test && make -j4 && sh ./run_tests.sh
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
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
echo "Unknown purpose=\"$PURPOSE\""
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