From fa6e8763bb9e4d8dd2bf5718079765667b2b17d6 Mon Sep 17 00:00:00 2001 From: zcy <290198252@qq.com> Date: Fri, 25 Mar 2022 00:07:03 +0800 Subject: [PATCH] no message --- CMakeLists.txt | 6 ++++++ general/CMakeLists.txt | 4 ++++ general/src/function/cpu_usage.cpp | 3 ++- test/CmakeTemplate.txt | 13 ++++++------- test/src/gtest_demo/CMakeLists.txt | 3 ++- test/src/gtest_demo/gtest_demo.cpp | 9 +++++++++ 6 files changed, 29 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 12654c5..02c1f76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,14 @@ project(generallib) add_subdirectory(general) SET(SRC_SDK sdk_main.c )#生成动态库需要至少包含一个源文件 + + add_library(generallib STATIC $ ${SRC_SDK}) +set_property(TARGET generallib PROPERTY + MSVC_RUNTIME_LIBRARY MultiThreadedDebug) + + message("current path is" ${CMAKE_CURRENT_SOURCE_DIR}) IF (WIN32) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") diff --git a/general/CMakeLists.txt b/general/CMakeLists.txt index 007fd73..e18693a 100644 --- a/general/CMakeLists.txt +++ b/general/CMakeLists.txt @@ -38,4 +38,8 @@ aux_source_directory(src/encrypt EncryptSrc) message("source file is " ${DIRSRCS} ${PaternSrc} ${EncryptSrc} ${FunctionSrc} ${AlgorithmSrc}) + add_library(General OBJECT ${DIRSRCS} ${PaternSrc} ${EncryptSrc} ${FunctionSrc} ${AlgorithmSrc} ) + +set_property(TARGET General PROPERTY + MSVC_RUNTIME_LIBRARY MultiThreadedDebug) diff --git a/general/src/function/cpu_usage.cpp b/general/src/function/cpu_usage.cpp index 2a00024..76311b3 100644 --- a/general/src/function/cpu_usage.cpp +++ b/general/src/function/cpu_usage.cpp @@ -1,5 +1,5 @@ - #include "cpu_usage.h" +#include float CPUusage::get_cpu_usage() { @@ -30,6 +30,7 @@ float CPUusage::get_cpu_usage() clear(); return -1; } + std::cout<<"systime "< int add(int a,int b){ return a+b; @@ -17,6 +18,14 @@ TEST(testCase,test0){ EXPECT_EQ(add(2,3),5); } +TEST(testCase,test1){ + CPUusage ussage1(21132); + while (1) + { + std::cout<