-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2.不再单独维护windows_dev分支,多个系统Linux/Windows/macOS等都使用master分支 3.增加logcallback功能,特别在Windows系统下,可以设置日志回调打印日志到自定义日志文件 4.优化日志,日志中打印上传下载速率,方便问题定位 5.优化Makefile,多个系统共用同一套Makefile,支持Linux/Windows/macOS系统,增加编译选项,可以支持编译动态库/编译demo/编译unittest 6.优化UT 7.去掉不必要的库依赖,例如Jsoncpp,OpenSSL,boost等,目前只依赖Poco库,并把相关头文件以及库文件添加到工程目录中,不需要再领先下载下载库 8.tools目录中增加测速工具,方便问题定位 9.libs目录中添加已编译好的库文件,包括Linux/Win32/Win64/macOS等不同版本,不需要编译代码即可使用sdk
- Loading branch information
jackyding
committed
Jul 16, 2021
1 parent
41f7644
commit 578bdbb
Showing
758 changed files
with
141,271 additions
and
5,562 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,71 @@ | ||
cmake_minimum_required(VERSION 2.8) | ||
CMAKE_policy(SET CMP0015 NEW) | ||
|
||
project(cos-cpp-sdk) | ||
#SET(BOOST_HEADER_DIR "/root/boost_1_68_0/") | ||
#SET(CMAKE_CXX_STANDARD 11) cmake 3.x才支持 | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | ||
SET(CMAKE_VERBOSE_MAKEFILE ON) | ||
# find_package自动查找,或者通过SET(OPENSSL_VERSION 1.0.0)人工设置 | ||
find_package(OpenSSL REQUIRED) | ||
#SET(OPENSSL_VERSION 1.0.1e) | ||
message(${OPENSSL_VERSION}) | ||
|
||
# 单元测试与覆盖率统计 | ||
OPTION (ENABLE_UNITTEST "Unittest" OFF) | ||
|
||
# coverage option | ||
IF(ENABLE_UNITTEST) | ||
find_package(GTest REQUIRED) | ||
if (NOT GTest_FOUND) | ||
message(FATAL_ERROR "GTest Not Found!") | ||
endif (NOT GTest_FOUND) | ||
MESSAGE(STATUS ENABLE_UNITTEST=${ENABLE_UNITTEST}) | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") | ||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage") | ||
ENDIF() | ||
|
||
add_definitions(-D__COS_DEBUG__) | ||
|
||
# include directories | ||
INCLUDE_DIRECTORIES(./include) | ||
INCLUDE_DIRECTORIES(/usr/local/ssl/include) | ||
# include_directories(${BOOST_HEADER_DIR}) | ||
|
||
# lib directories | ||
link_directories(/usr/local/lib) | ||
link_directories(./lib) | ||
|
||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) | ||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) | ||
|
||
IF(ENABLE_UNITTEST) | ||
FILE(COPY unittest/testdata/config.json DESTINATION ${EXECUTABLE_OUTPUT_PATH}/) | ||
FILE(COPY unittest/testdata/config_bucket_test.json DESTINATION ${EXECUTABLE_OUTPUT_PATH}/) | ||
FILE(COPY unittest/testdata/sevenyou.txt DESTINATION ${EXECUTABLE_OUTPUT_PATH}/) | ||
FILE(COPY unittest/merge_xml_results.py DESTINATION ${EXECUTABLE_OUTPUT_PATH}/) | ||
INCLUDE_DIRECTORIES(./include/googletest/include/) | ||
ADD_SUBDIRECTORY(unittest) | ||
ENDIF() | ||
|
||
ADD_SUBDIRECTORY(src) | ||
ADD_SUBDIRECTORY(demo) | ||
set(CMAKE_VERBOSE_MAKEFILE ON) | ||
|
||
option(BUILD_UNITTEST "Build unittest" OFF) | ||
option(BUILD_DEMO "Build demo" ON) | ||
option(BUILD_SHARED_LIB "Build shared library" OFF) | ||
|
||
if(APPLE) | ||
set(OS_TYPE "APPLE") | ||
elseif(UNIX) | ||
set(OS_TYPE "LINUX") | ||
elseif(WIN32) | ||
set(OS_TYPE "WINDOWS") | ||
else() | ||
message(FATAL_ERROR "unkonwn os type") | ||
endif() | ||
message(STATUS "OS type: ${OS_TYPE}") | ||
|
||
if (${OS_TYPE} STREQUAL "WINDOWS") | ||
set(BUILD_TARGET "Win32") | ||
if (CMAKE_CL_64) | ||
set(BUILD_TARGET "x64") | ||
endif() | ||
message(STATUS "Build target: ${BUILD_TARGET}") | ||
if (NOT DEFINED ${CMAKE_BUILD_TYPE}) | ||
set(CMAKE_BUILD_TYPE "Release") | ||
endif() | ||
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") | ||
|
||
set(POCO_LINK_DIR ${CMAKE_SOURCE_DIR}/third_party/lib/${BUILD_TARGET}/poco) | ||
set(POCO_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/third_party/include/) | ||
set(POCO_LIBS PocoNetSSL PocoNet PocoCrypto PocoUtil PocoJSON PocoFoundation PocoXML) | ||
|
||
set(SYSTEM_LIBS "") | ||
#需要加该参数,不然VS会报错 | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8") | ||
else() | ||
set(POCO_LINK_DIR ${CMAKE_SOURCE_DIR}/third_party/lib/linux/poco/) | ||
if (${OS_TYPE} STREQUAL "APPLE") | ||
set(POCO_LINK_DIR ${CMAKE_SOURCE_DIR}/third_party/lib/macOS/poco/) | ||
endif() | ||
set(POCO_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/third_party/include/) | ||
set(POCO_LIBS PocoNetSSL PocoNet PocoCrypto PocoUtil PocoJSON PocoFoundation PocoXML) | ||
|
||
set(SYSTEM_LIBS stdc++ pthread) | ||
endif() | ||
|
||
add_subdirectory(src) | ||
|
||
if(BUILD_UNITTEST) | ||
message(STATUS "Build unittest") | ||
|
||
set(GTEST_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/third_party/include/gtest/) | ||
set(GTEST_LINK_DIR ${CMAKE_SOURCE_DIR}/third_party/lib/linux/gtest/) | ||
if (${OS_TYPE} STREQUAL "WINDOWS") | ||
set(GTEST_LINK_DIR ${CMAKE_SOURCE_DIR}/third_party/lib/${BUILD_TARGET}/gtest) | ||
endif() | ||
set(GTEST_LIBS gtest gtest_main) | ||
|
||
set(UT_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/unittest/include/) | ||
|
||
add_subdirectory(unittest) | ||
endif() | ||
|
||
if(BUILD_DEMO) | ||
message(STATUS "Build demo") | ||
add_subdirectory(demo) | ||
endif() |
Oops, something went wrong.