1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- # ---[ gtest
- if(NOT build_gtest_already) # set by parent
- add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/googletest ${PROJECT_BINARY_DIR}/googletest)
- set(build_gtest_already ON)
- endif()
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/googletest/googletest/include)
- # ---[ gflags
- include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/FindGFlags.cmake)
- include_directories(${GFLAGS_INCLUDE_DIRS})
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
- set(test_srcs "")
- list(APPEND test_srcs ${CMAKE_CURRENT_SOURCE_DIR}/test_base.cpp)
- list(APPEND test_srcs ${CMAKE_CURRENT_SOURCE_DIR}/test_main.cpp)
- list(APPEND test_srcs ${CMAKE_CURRENT_SOURCE_DIR}/test_frame.cpp)
- if(build_encode)
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../encode/src)
- file(GLOB_RECURSE test_encode_srcs ${CMAKE_CURRENT_SOURCE_DIR}/encode/*.cpp)
- list(APPEND test_srcs ${test_encode_srcs})
- endif()
- if(build_inference)
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../inference/src)
- file(GLOB_RECURSE test_infer_srcs ${CMAKE_CURRENT_SOURCE_DIR}/inference/*.cpp)
- file(GLOB_RECURSE preproc ${CMAKE_CURRENT_SOURCE_DIR}/../../samples/common/preprocess/*.cpp)
- file(GLOB_RECURSE postproc ${CMAKE_CURRENT_SOURCE_DIR}/../../samples/common/postprocess/*.cpp)
- list(APPEND test_srcs ${test_infer_srcs} ${preproc} ${postproc})
- endif()
- if(build_inference2)
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../inference2/src)
- file(GLOB_RECURSE test_infer2_srcs ${CMAKE_CURRENT_SOURCE_DIR}/inference2/*.cpp)
- file(GLOB_RECURSE preproc_infer2 ${CMAKE_CURRENT_SOURCE_DIR}/../../samples/common/preprocess/*.cpp)
- file(GLOB_RECURSE postproc_infer2 ${CMAKE_CURRENT_SOURCE_DIR}/../../samples/common/postprocess/*.cpp)
- list(APPEND test_srcs ${test_infer2_srcs} ${preproc_infer2} ${postproc_infer2})
- endif()
- if(build_osd)
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../osd/src)
- file(GLOB_RECURSE test_osd_srcs ${CMAKE_CURRENT_SOURCE_DIR}/osd/*.cpp)
- list(APPEND test_srcs ${test_osd_srcs})
- endif()
- if(build_source)
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../source/src)
- file(GLOB_RECURSE test_source_srcs ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp)
- list(APPEND test_srcs ${test_source_srcs})
- endif()
- if(build_track)
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../track/src)
- file(GLOB_RECURSE test_track_srcs ${CMAKE_CURRENT_SOURCE_DIR}/track/*.cpp)
- list(APPEND test_srcs ${test_track_srcs})
- endif()
- if(build_rtsp_sink)
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../rtsp_sink/src)
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../rtsp_sink/src/rtsp_server)
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../encode/src/video)
- file(GLOB_RECURSE test_rtsp_sink_srcs ${CMAKE_CURRENT_SOURCE_DIR}/rtsp_sink/*.cpp)
- list(APPEND test_srcs ${test_rtsp_sink_srcs})
- endif()
- if(build_display)
- include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../display/src)
- file(GLOB_RECURSE test_display_srcs ${CMAKE_CURRENT_SOURCE_DIR}/display/*.cpp)
- list(APPEND test_srcs ${test_display_srcs})
- endif()
- add_executable(cnstream_test ${test_srcs})
- add_dependencies(cnstream_test cnstream_va gtest)
- target_link_libraries(cnstream_test gtest dl cnstream_va pthread rt ${GFLAGS_LIBRARIES})
- add_test(cnstream_test ${EXECUTABLE_OUTPUT_PATH}/cnstream_test)
|