Commit 4adb6894 authored by Yiming Jing's avatar Yiming Jing

Link MesaLink in CMake if enabled

parent cec08d43
......@@ -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)
......@@ -88,6 +89,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")
......@@ -137,6 +141,15 @@ 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")
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")
......@@ -167,6 +180,7 @@ set(DYNAMIC_LIB
${THRIFTNB_LIB}
${OPENSSL_LIBRARIES}
${OPENSSL_CRYPTO_LIBRARY}
${MESALINK_LIB}
dl
z)
set(BRPC_PRIVATE_LIBS "-lgflags -lprotobuf -lleveldb -lprotoc -lssl -lcrypto -ldl -lz")
......
......@@ -40,7 +40,7 @@ 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 //...
else
......
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