-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### What problem were solved in this pull request? Problem: 当前所有单元测试都放在一个目录下,看起来很混乱,还会额外链接一些多余的库 ### What is changed and how it works? 拆分observer、deps/common和deps/memtracer目录
- Loading branch information
Showing
35 changed files
with
51 additions
and
26 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
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
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,25 +1,13 @@ | ||
# 可以获取父cmake的变量 | ||
MESSAGE("${CMAKE_COMMON_FLAGS}") | ||
|
||
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/observer) | ||
|
||
find_package(GTest CONFIG REQUIRED) | ||
|
||
include(GoogleTest) | ||
|
||
#get_filename_component(<VAR> FileName | ||
# PATH|ABSOLUTE|NAME|EXT|NAME_WE|REALPATH | ||
# [CACHE]) | ||
FILE(GLOB_RECURSE ALL_SRC *.cpp) | ||
# AUX_SOURCE_DIRECTORY 类似功能 | ||
FOREACH (F ${ALL_SRC}) | ||
get_filename_component(prjName ${F} NAME_WE) | ||
MESSAGE("Build ${prjName} according to ${F}") | ||
ADD_EXECUTABLE(${prjName} ${F}) | ||
# TODO: 不是所有的单测都需要链接observer_static | ||
TARGET_LINK_LIBRARIES(${prjName} common pthread dl gtest gtest_main observer_static) | ||
add_test(NAME ${prjName} COMMAND ${prjName}) | ||
if (${prjName} STREQUAL "memtracer_test") | ||
TARGET_LINK_LIBRARIES(${prjName} memtracer) | ||
endif() | ||
ENDFOREACH (F) | ||
ADD_SUBDIRECTORY(common) | ||
IF (WITH_MEMTRACER) | ||
ADD_SUBDIRECTORY(memtracer) | ||
ENDIF (WITH_MEMTRACER) | ||
|
||
ADD_SUBDIRECTORY(observer) |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#get_filename_component(<VAR> FileName | ||
# PATH|ABSOLUTE|NAME|EXT|NAME_WE|REALPATH | ||
# [CACHE]) | ||
FILE(GLOB_RECURSE ALL_SRC *.cpp) | ||
# AUX_SOURCE_DIRECTORY 类似功能 | ||
FOREACH (F ${ALL_SRC}) | ||
get_filename_component(prjName ${F} NAME_WE) | ||
MESSAGE("Build ${prjName} according to ${F}") | ||
ADD_EXECUTABLE(${prjName} ${F}) | ||
TARGET_LINK_LIBRARIES(${prjName} common pthread dl gtest gtest_main) | ||
add_test(NAME ${prjName} COMMAND ${prjName}) | ||
ENDFOREACH (F) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#get_filename_component(<VAR> FileName | ||
# PATH|ABSOLUTE|NAME|EXT|NAME_WE|REALPATH | ||
# [CACHE]) | ||
FILE(GLOB_RECURSE ALL_SRC *.cpp) | ||
# AUX_SOURCE_DIRECTORY 类似功能 | ||
FOREACH (F ${ALL_SRC}) | ||
get_filename_component(prjName ${F} NAME_WE) | ||
MESSAGE("Build ${prjName} according to ${F}") | ||
ADD_EXECUTABLE(${prjName} ${F}) | ||
TARGET_LINK_LIBRARIES(${prjName} pthread dl gtest gtest_main memtracer) | ||
add_test(NAME ${prjName} COMMAND ${prjName}) | ||
ENDFOREACH (F) |
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/observer) | ||
|
||
#get_filename_component(<VAR> FileName | ||
# PATH|ABSOLUTE|NAME|EXT|NAME_WE|REALPATH | ||
# [CACHE]) | ||
FILE(GLOB_RECURSE ALL_SRC *.cpp) | ||
# AUX_SOURCE_DIRECTORY 类似功能 | ||
FOREACH (F ${ALL_SRC}) | ||
get_filename_component(prjName ${F} NAME_WE) | ||
MESSAGE("Build ${prjName} according to ${F}") | ||
ADD_EXECUTABLE(${prjName} ${F}) | ||
TARGET_LINK_LIBRARIES(${prjName} common pthread dl gtest gtest_main observer_static) | ||
add_test(NAME ${prjName} COMMAND ${prjName}) | ||
ENDFOREACH (F) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.