From 39650b83f884e75b60d47267a330a7b9340783d8 Mon Sep 17 00:00:00 2001 From: Greg Russell Date: Thu, 17 Nov 2016 19:49:26 -0500 Subject: [PATCH 1/2] fix install-protobuf script to reject old version --- install-protobuf.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install-protobuf.sh b/install-protobuf.sh index 277c169..8f64a09 100755 --- a/install-protobuf.sh +++ b/install-protobuf.sh @@ -4,7 +4,8 @@ # check to see if protobuf tools already exist. LIBS=`/usr/bin/pkg-config --libs protobuf` -if [ $? -ne 0 ] ; then +PB_VER=`protoc --version` +if [[ ($? -ne 0) || ("${PB_VER}" < "libprotoc 3.1.0") || (-z "${LIBS}")]]; then if [ -r protobuf/configure ] ; then echo "Using cached protobuf." cd protobuf From 1d9b3120061692b1cc78f3fa18924cab4cd2c6fa Mon Sep 17 00:00:00 2001 From: Greg Russell Date: Mon, 21 Nov 2016 10:21:36 -0500 Subject: [PATCH 2/2] decouple tcpinfo_lib from gtest_prod --- CMakeLists.txt | 2 +- src/gtest_prod.h | 9 +++++++++ src/tcpinfo_lib.h | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 src/gtest_prod.h diff --git a/CMakeLists.txt b/CMakeLists.txt index fc6b610..88400ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,7 @@ PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS add_library(tcpinfo_lib ${SRC_DIR}/tcpinfo_lib.cc ${SRC_DIR}/tcpinfo_lib.h ${SRC_DIR}/tcpinfo_c_adapter.h ${SRC_DIR}/tcpinfo_c_adapter.c - ${PROTO_HDRS} ${PROTO_SRCS}) + ${SRC_DIR}/gtest_prod.h ${PROTO_HDRS} ${PROTO_SRCS}) add_dependencies(tcpinfo_lib iproute2) target_link_libraries(tcpinfo_lib diff --git a/src/gtest_prod.h b/src/gtest_prod.h new file mode 100644 index 0000000..0dcaaa1 --- /dev/null +++ b/src/gtest_prod.h @@ -0,0 +1,9 @@ +// This is just a local copy of googletest gtest_prod.h, to avoid +// the dependency on the gtest library for production only sources. + +#ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_ +#define GTEST_INCLUDE_GTEST_GTEST_PROD_H_ +#define FRIEND_TEST(test_case_name, test_name)\ +friend class test_case_name##_##test_name##_Test +#endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_ + diff --git a/src/tcpinfo_lib.h b/src/tcpinfo_lib.h index 4698215..8442f2e 100644 --- a/src/tcpinfo_lib.h +++ b/src/tcpinfo_lib.h @@ -24,7 +24,7 @@ #include "connection_cache.h" #include "tcpinfo.pb.h" -#include "gtest/gtest_prod.h" +#include "gtest_prod.h" // Using local copy instead of library include. extern "C" { #include // Should come from iproute2 submodule.