Commit 817a3530 authored by zhujiashun's avatar zhujiashun

revise WITH_GLOG TO BRPC_WITH_GLOG in CMakeLists.txt

parent c9c901b8
...@@ -22,14 +22,14 @@ else() ...@@ -22,14 +22,14 @@ else()
message(WARNING "You are using an unsupported compiler! Compilation has only been tested with Clang and GCC.") message(WARNING "You are using an unsupported compiler! Compilation has only been tested with Clang and GCC.")
endif() endif()
option(WITH_GLOG "With glog" OFF) option(BRPC_WITH_GLOG "With glog" 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)
option(BUILD_UNIT_TESTS "Whether to build unit tests" OFF) option(BUILD_UNIT_TESTS "Whether to build unit tests" OFF)
set(WITH_GLOG_VAL "0") set(WITH_GLOG_VAL "0")
if(WITH_GLOG) if(BRPC_WITH_GLOG)
set(WITH_GLOG_VAL "1") set(WITH_GLOG_VAL "1")
endif() endif()
...@@ -80,7 +80,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") ...@@ -80,7 +80,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
endif() endif()
endif() endif()
set(CMAKE_CPP_FLAGS "${DEFINE_CLOCK_GETTIME} -DWITH_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}")
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")
...@@ -121,7 +121,7 @@ if ((NOT LEVELDB_INCLUDE_PATH) OR (NOT LEVELDB_LIB)) ...@@ -121,7 +121,7 @@ if ((NOT LEVELDB_INCLUDE_PATH) OR (NOT LEVELDB_LIB))
message(FATAL_ERROR "Fail to find leveldb") message(FATAL_ERROR "Fail to find leveldb")
endif() endif()
if(WITH_GLOG) if(BRPC_WITH_GLOG)
find_path(GLOG_INCLUDE_PATH NAMES glog/logging.h) find_path(GLOG_INCLUDE_PATH NAMES glog/logging.h)
find_library(GLOG_LIB NAMES glog) find_library(GLOG_LIB NAMES glog)
if((NOT GLOG_INCLUDE_PATH) OR (NOT GLOG_LIB)) if((NOT GLOG_INCLUDE_PATH) OR (NOT GLOG_LIB))
...@@ -165,7 +165,7 @@ set(DYNAMIC_LIB ...@@ -165,7 +165,7 @@ set(DYNAMIC_LIB
) )
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(BRPC_WITH_GLOG)
set(DYNAMIC_LIB ${DYNAMIC_LIB} ${GLOG_LIB}) set(DYNAMIC_LIB ${DYNAMIC_LIB} ${GLOG_LIB})
set(BRPC_PRIVATE_LIBS "${BRPC_PRIVATE_LIBS} -lglog") set(BRPC_PRIVATE_LIBS "${BRPC_PRIVATE_LIBS} -lglog")
endif() endif()
......
#ifndef BUTIL_CONFIG_H #ifndef BUTIL_CONFIG_H
#define BUTIL_CONFIG_H #define BUTIL_CONFIG_H
#cmakedefine WITH_GLOG @WITH_GLOG_VAL@ #cmakedefine BRPC_WITH_GLOG @WITH_GLOG_VAL@
#endif // BUTIL_CONFIG_H #endif // BUTIL_CONFIG_H
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
// Authors: Ge,Jun (gejun@baidu.com) // Authors: Ge,Jun (gejun@baidu.com)
#if !WITH_GLOG #if !BRPC_WITH_GLOG
#include "brpc/log.h" #include "brpc/log.h"
#include "brpc/controller.h" // Controller #include "brpc/controller.h" // Controller
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#ifndef BRPC_VLOG_SERVICE_H #ifndef BRPC_VLOG_SERVICE_H
#define BRPC_VLOG_SERVICE_H #define BRPC_VLOG_SERVICE_H
#if !WITH_GLOG #if !BRPC_WITH_GLOG
#include <ostream> #include <ostream>
#include "brpc/builtin_service.pb.h" #include "brpc/builtin_service.pb.h"
...@@ -35,6 +35,6 @@ public: ...@@ -35,6 +35,6 @@ public:
} // namespace brpc } // namespace brpc
#endif // WITH_GLOG #endif // BRPC_WITH_GLOG
#endif //BRPC_VLOG_SERVICE_H #endif //BRPC_VLOG_SERVICE_H
...@@ -497,7 +497,7 @@ int Server::AddBuiltinServices() { ...@@ -497,7 +497,7 @@ int Server::AddBuiltinServices() {
return -1; return -1;
} }
#if !WITH_GLOG #if !BRPC_WITH_GLOG
if (AddBuiltinService(new (std::nothrow) VLogService)) { if (AddBuiltinService(new (std::nothrow) VLogService)) {
LOG(ERROR) << "Fail to add VLogService"; LOG(ERROR) << "Fail to add VLogService";
return -1; return -1;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "butil/logging.h" #include "butil/logging.h"
#if !WITH_GLOG #if !BRPC_WITH_GLOG
#if defined(OS_WIN) #if defined(OS_WIN)
#include <io.h> #include <io.h>
...@@ -1440,4 +1440,4 @@ std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { ...@@ -1440,4 +1440,4 @@ std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) {
return out << butil::WideToUTF8(std::wstring(wstr)); return out << butil::WideToUTF8(std::wstring(wstr));
} }
#endif // WITH_GLOG #endif // BRPC_WITH_GLOG
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#ifndef BUTIL_LOGGING_H_ #ifndef BUTIL_LOGGING_H_
#define BUTIL_LOGGING_H_ #define BUTIL_LOGGING_H_
#include "butil/config.h" // WITH_GLOG #include "butil/config.h" // BRPC_WITH_GLOG
#include <inttypes.h> #include <inttypes.h>
#include <string> #include <string>
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "butil/atomicops.h" // Used by LOG_EVERY_N, LOG_FIRST_N etc #include "butil/atomicops.h" // Used by LOG_EVERY_N, LOG_FIRST_N etc
#include "butil/time.h" // gettimeofday_us() #include "butil/time.h" // gettimeofday_us()
#if WITH_GLOG #if BRPC_WITH_GLOG
# include <glog/logging.h> # include <glog/logging.h>
# include <glog/raw_logging.h> # include <glog/raw_logging.h>
// define macros that not implemented in glog // define macros that not implemented in glog
...@@ -1096,7 +1096,7 @@ inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) { ...@@ -1096,7 +1096,7 @@ inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) {
// 4 -- [default] LOG(ERROR) at runtime // 4 -- [default] LOG(ERROR) at runtime
// 5 -- LOG(ERROR) at runtime, only once per call-site // 5 -- LOG(ERROR) at runtime, only once per call-site
#endif // WITH_GLOG #endif // BRPC_WITH_GLOG
#ifndef NOTIMPLEMENTED_POLICY #ifndef NOTIMPLEMENTED_POLICY
#if defined(OS_ANDROID) && defined(OFFICIAL_BUILD) #if defined(OS_ANDROID) && defined(OFFICIAL_BUILD)
......
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