mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-30 09:33:41 +00:00
225 lines
7.7 KiB
Diff
225 lines
7.7 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 8217cba..a6c1d70 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -32,7 +32,7 @@ else(APPLE)
|
|
endif(${BUILD_FOR_ARM})
|
|
endif(APPLE)
|
|
|
|
-set(CMAKE_CXX_FLAGS "--std=c++0x -Wall -Wextra -Werror -Wno-unknown-warning-option -Wno-unused-parameter -Wno-null-dereference -Wno-unused-local-typedefs -DGTEST_USE_OWN_TR1_TUPLE=1 ${BUILD_PIC_COMPILER_FLAGS}")
|
|
+set(CMAKE_CXX_FLAGS "--std=c++11 -DGTEST_USE_OWN_TR1_TUPLE=1 ${BUILD_PIC_COMPILER_FLAGS}")
|
|
|
|
set(TEST_BINARY "kinetic_client_test")
|
|
set(TEST_BINARY_PATH ${kinetic_cpp_client_BINARY_DIR}/${TEST_BINARY})
|
|
@@ -50,103 +50,16 @@ set(GENERATED_SOURCES_PATH ${kinetic_cpp_client_SOURCE_DIR}/src/main/generated)
|
|
set(PREFIX "${CMAKE_BINARY_DIR}/vendor")
|
|
set(EXTERNAL_PREFIX "${kinetic_cpp_client_BINARY_DIR}/vendor")
|
|
|
|
-include(ExternalProject)
|
|
-
|
|
-set(KINETIC_PROTO_VERSION "3.0.0")
|
|
-set(KINETIC_PROTO_MD5 "85ca027b870811a297c1f6d792498934")
|
|
-
|
|
-ExternalProject_add(
|
|
- kinetic-proto
|
|
- PREFIX ${PREFIX}
|
|
- DOWNLOAD_COMMAND curl -L https://github.com/Seagate/kinetic-protocol/archive/${KINETIC_PROTO_VERSION}.tar.gz -o kinetic-proto.tar.gz && openssl md5 kinetic-proto.tar.gz | grep -q ${KINETIC_PROTO_MD5} && rm -rf kinetic-proto && mkdir -p kinetic-proto && tar -xz --strip-components 1 -C kinetic-proto -f kinetic-proto.tar.gz
|
|
- BUILD_IN_SOURCE 1
|
|
- CONFIGURE_COMMAND ""
|
|
- BUILD_COMMAND ""
|
|
- INSTALL_COMMAND ""
|
|
-)
|
|
-
|
|
-ExternalProject_add(
|
|
- gflags
|
|
- PREFIX ${EXTERNAL_PREFIX}
|
|
- URL "${kinetic_cpp_client_SOURCE_DIR}/tarballs/gflags-2.0-no-svn-files.tar.gz"
|
|
- URL_MD5 "9084829124e02a7e6be0f0f824523423"
|
|
- CONFIGURE_COMMAND ../gflags/configure --prefix=${EXTERNAL_PREFIX} --enable-static ${CONFIG_HOST_FLAG} ${CHILD_MAKE_FLAGS} ${PIC_MAKE_FLAGS}
|
|
-)
|
|
-
|
|
-ExternalProject_add(
|
|
- glog
|
|
- PREFIX ${EXTERNAL_PREFIX}
|
|
- URL "${kinetic_cpp_client_SOURCE_DIR}/tarballs/glog-0.3.3.tar.gz"
|
|
- URL_MD5 "a6fd2c22f8996846e34c763422717c18"
|
|
- PATCH_COMMAND sh ${kinetic_cpp_client_SOURCE_DIR}/patches/apply-glog-patches.sh ${kinetic_cpp_client_SOURCE_DIR}
|
|
- CONFIGURE_COMMAND ../glog/configure --prefix=${EXTERNAL_PREFIX} --with-gflags=${EXTERNAL_PREFIX} --enable-static ${CONFIG_HOST_FLAG} ${CHILD_MAKE_FLAGS} ${PIC_MAKE_FLAGS}
|
|
- DEPENDS gflags
|
|
-)
|
|
-
|
|
-ExternalProject_add(
|
|
- gtest
|
|
- PREFIX ${EXTERNAL_PREFIX}
|
|
- URL "${kinetic_cpp_client_SOURCE_DIR}/tarballs/gtest-1.6.0.zip"
|
|
- URL_MD5 "4577b49f2973c90bf9ba69aa8166b786"
|
|
- BUILD_IN_SOURCE 1
|
|
- CONFIGURE_COMMAND ""
|
|
- BUILD_COMMAND ${CMAKE_CXX_COMPILER} -DGTEST_USE_OWN_TR1_TUPLE=1 -I../gtest -I../gtest/include -c ../gtest/src/gtest-all.cc && ar -rv libgtest.a gtest-all.o && ranlib libgtest.a
|
|
- INSTALL_COMMAND ""
|
|
-)
|
|
-
|
|
-ExternalProject_add(
|
|
- gmock
|
|
- PREFIX ${EXTERNAL_PREFIX}
|
|
- URL "${kinetic_cpp_client_SOURCE_DIR}/tarballs/gmock-1.6.0.zip"
|
|
- URL_MD5 "f547f47321ca88d3965ca2efdcc2a3c1"
|
|
- BUILD_IN_SOURCE 1
|
|
- CONFIGURE_COMMAND ""
|
|
- BUILD_COMMAND ${CMAKE_CXX_COMPILER} -DGTEST_USE_OWN_TR1_TUPLE=1 -I../gmock -I../gmock/include -I../gtest -I../gtest/include -c ../gmock/src/gmock-all.cc && ar -rv libgmock.a gmock-all.o && ranlib libgmock.a
|
|
- INSTALL_COMMAND ""
|
|
- DEPENDS gtest
|
|
-)
|
|
-
|
|
-ExternalProject_add(
|
|
- openssl
|
|
- PREFIX ${EXTERNAL_PREFIX}
|
|
- URL "${kinetic_cpp_client_SOURCE_DIR}/tarballs/openssl-1.0.1g.tar.gz"
|
|
- URL_MD5 "de62b43dfcd858e66a74bee1c834e959"
|
|
- BUILD_IN_SOURCE 1
|
|
- CONFIGURE_COMMAND ${OPENSSL_CONFIGURE_COMMAND} --prefix=${EXTERNAL_PREFIX} ${BUILD_PIC_COMPILER_FLAG}
|
|
- BUILD_COMMAND touch apps/openssl && touch openssl.pc && make ${CHILD_MAKE_FLAGS} build_libs libssl.pc libcrypto.pc
|
|
- INSTALL_COMMAND make install_sw
|
|
-)
|
|
-
|
|
-# The protobuf build requires the existence of a protoc binary that can be
|
|
-# executed on the host machine. To handle cross compilation, we always build
|
|
-# protobuf once for the host so that we have a suitable copy of protoc.
|
|
-ExternalProject_add(
|
|
- protoc
|
|
- PREFIX ${EXTERNAL_PREFIX}/host
|
|
- URL "${kinetic_cpp_client_SOURCE_DIR}/tarballs/protobuf-2.5.0.tar.bz2"
|
|
- URL_MD5 "a72001a9067a4c2c4e0e836d0f92ece4"
|
|
- CONFIGURE_COMMAND ../protoc/configure --prefix=${EXTERNAL_PREFIX}/host --enable-static
|
|
-)
|
|
-
|
|
# Protobuf code generation rules
|
|
-set(PROTOC_PATH "${PREFIX}/host/bin/protoc")
|
|
-set(PROTO_DIR "${CMAKE_BINARY_DIR}/vendor/src/kinetic-proto")
|
|
+set(PROTOC_PATH "protoc")
|
|
+set(PROTO_DIR "${CMAKE_BINARY_DIR}/kinetic-proto")
|
|
set(PROTO_ORIG_PATH "${PROTO_DIR}/kinetic.proto")
|
|
set(PROTO_MODIFIED_PATH "${PROTO_DIR}/kinetic_client.proto")
|
|
-ExternalProject_add(
|
|
- protobuf
|
|
- PREFIX ${EXTERNAL_PREFIX}
|
|
- URL "${kinetic_cpp_client_SOURCE_DIR}/tarballs/protobuf-2.5.0.tar.bz2"
|
|
- URL_MD5 "a72001a9067a4c2c4e0e836d0f92ece4"
|
|
- CONFIGURE_COMMAND ../protobuf/configure --prefix=${EXTERNAL_PREFIX} --enable-static --with-protoc=${PROTOC_PATH} ${CONFIG_HOST_FLAG} ${CHILD_MAKE_FLAGS} ${PIC_MAKE_FLAGS}
|
|
- DEPENDS protoc
|
|
-)
|
|
|
|
add_custom_command(
|
|
COMMENT "Compiling protobuf"
|
|
OUTPUT ${GENERATED_SOURCES_PATH}/kinetic_client.pb.h ${GENERATED_SOURCES_PATH}/kinetic_client.pb.cc
|
|
COMMAND mkdir -p ${GENERATED_SOURCES_PATH} && sed 's/com\\.seagate\\.kinetic\\.proto/com.seagate.kinetic.client.proto/' ${PROTO_ORIG_PATH} > ${PROTO_MODIFIED_PATH} && ${PROTOC_PATH} -I=${PROTO_DIR} --cpp_out=${GENERATED_SOURCES_PATH} ${PROTO_MODIFIED_PATH}
|
|
- DEPENDS kinetic-proto protoc protobuf
|
|
)
|
|
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${GENERATED_SOURCES_PATH})
|
|
|
|
@@ -157,21 +70,10 @@ include_directories(
|
|
|
|
src/test/mock
|
|
src/test
|
|
-
|
|
- ${EXTERNAL_PREFIX}/include
|
|
- ${EXTERNAL_PREFIX}/src/gmock/include
|
|
- ${EXTERNAL_PREFIX}/src/gtest/include
|
|
)
|
|
|
|
set(LIBRARY_DEPENDENCIES
|
|
kinetic_client
|
|
- ${CMAKE_BINARY_DIR}/vendor/lib/libglog.a
|
|
- ${CMAKE_BINARY_DIR}/vendor/lib/libgflags.a
|
|
- ${CMAKE_BINARY_DIR}/vendor/lib/libssl.a
|
|
- ${CMAKE_BINARY_DIR}/vendor/lib/libcrypto.a
|
|
- ${CMAKE_BINARY_DIR}/vendor/lib/libprotobuf.a
|
|
- ${CMAKE_BINARY_DIR}/vendor/src/gtest/libgtest.a
|
|
- ${CMAKE_BINARY_DIR}/vendor/src/gmock/libgmock.a
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
dl
|
|
)
|
|
@@ -180,12 +82,68 @@ set(LIBRARY_DEPENDENCIES
|
|
# Otherwise glog uses the standard glibc unwinder and there is no dependency.
|
|
find_library(LIBUNWIND "unwind")
|
|
if(LIBUNWIND)
|
|
- set(LIBRARY_DEPENDENCIES
|
|
- ${LIBRARY_DEPENDENCIES}
|
|
+ set(LIBRARY_DEPENDENCIES
|
|
+ ${LIBRARY_DEPENDENCIES}
|
|
${LIBUNWIND}
|
|
)
|
|
endif()
|
|
|
|
+find_library(LIBSSL "ssl")
|
|
+if(LIBSSL)
|
|
+ set(LIBRARY_DEPENDENCIES
|
|
+ ${LIBRARY_DEPENDENCIES}
|
|
+ ${LIBSSL}
|
|
+ )
|
|
+endif()
|
|
+
|
|
+find_library(LIBCRYPTO "crypto")
|
|
+if(LIBCRYPTO)
|
|
+ set(LIBRARY_DEPENDENCIES
|
|
+ ${LIBRARY_DEPENDENCIES}
|
|
+ ${LIBCRYPTO}
|
|
+ )
|
|
+endif()
|
|
+
|
|
+find_library(LIBPROTOBUF "protobuf")
|
|
+if(LIBPROTOBUF)
|
|
+ set(LIBRARY_DEPENDENCIES
|
|
+ ${LIBRARY_DEPENDENCIES}
|
|
+ ${LIBPROTOBUF}
|
|
+ )
|
|
+endif()
|
|
+
|
|
+find_library(LIBGLOG "glog")
|
|
+if(LIBGLOG)
|
|
+ set(LIBRARY_DEPENDENCIES
|
|
+ ${LIBRARY_DEPENDENCIES}
|
|
+ ${LIBGLOG}
|
|
+ )
|
|
+endif()
|
|
+
|
|
+find_library(LIBGFLAGS "gflags")
|
|
+if(LIBGFLAGS)
|
|
+ set(LIBRARY_DEPENDENCIES
|
|
+ ${LIBRARY_DEPENDENCIES}
|
|
+ ${LIBGFLAGS}
|
|
+ )
|
|
+endif()
|
|
+
|
|
+find_library(LIBGMOCK "gmock")
|
|
+if(LIBGMOCK)
|
|
+ set(LIBRARY_DEPENDENCIES
|
|
+ ${LIBRARY_DEPENDENCIES}
|
|
+ ${LIBGMOCK}
|
|
+ )
|
|
+endif()
|
|
+
|
|
+find_library(LIBGTEST "gtest")
|
|
+if(LIBGTEST)
|
|
+ set(LIBRARY_DEPENDENCIES
|
|
+ ${LIBRARY_DEPENDENCIES}
|
|
+ ${LIBGTEST}
|
|
+ )
|
|
+endif()
|
|
+
|
|
add_library(kinetic_client
|
|
src/main/generated/kinetic_client.pb.cc
|
|
src/main/hmac_provider.cc
|
|
diff --git a/src/test/kinetic_cpp_client_test.cc b/src/test/kinetic_cpp_client_test.cc
|
|
index 2079fab..c5004a2 100644
|
|
--- a/src/test/kinetic_cpp_client_test.cc
|
|
+++ b/src/test/kinetic_cpp_client_test.cc
|
|
@@ -22,6 +22,7 @@
|
|
|
|
#include <iostream>
|
|
|
|
+#include "gflags/gflags.h"
|
|
#include "gtest/gtest.h"
|
|
#include "glog/logging.h"
|
|
|