65 lines
1.8 KiB
CMake
65 lines
1.8 KiB
CMake
include(FetchContent)
|
|
|
|
# Fetch Google Test
|
|
FetchContent_Declare(
|
|
googletest
|
|
GIT_REPOSITORY https://github.com/google/googletest.git
|
|
GIT_TAG v1.14.0
|
|
)
|
|
# Prevent overriding the parent project's compiler/linker settings on Windows
|
|
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
|
FetchContent_MakeAvailable(googletest)
|
|
|
|
# Legacy simple tests (keep for backward compatibility)
|
|
add_executable(rk3588_tests_legacy
|
|
test_main.cpp
|
|
${CMAKE_SOURCE_DIR}/src/utils/config_expand.cpp
|
|
)
|
|
|
|
target_include_directories(rk3588_tests_legacy PRIVATE
|
|
${CMAKE_SOURCE_DIR}/include
|
|
${CMAKE_SOURCE_DIR}/third_party
|
|
)
|
|
|
|
target_link_libraries(rk3588_tests_legacy PRIVATE project_options Threads::Threads)
|
|
|
|
add_test(NAME rk3588_tests_legacy COMMAND rk3588_tests_legacy)
|
|
set_tests_properties(rk3588_tests_legacy PROPERTIES WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
|
if(WIN32)
|
|
set_tests_properties(rk3588_tests_legacy PROPERTIES DISABLED TRUE)
|
|
endif()
|
|
|
|
# New Google Test based tests
|
|
add_executable(rk3588_gtests
|
|
test_result.cpp
|
|
test_spsc_queue.cpp
|
|
test_simple_json.cpp
|
|
test_config_expand.cpp
|
|
test_hw_factory.cpp
|
|
test_frame_buffer.cpp
|
|
test_behavior_event_model.cpp
|
|
test_infer_backend.cpp
|
|
test_image_processor.cpp
|
|
test_codec_backend.cpp
|
|
${CMAKE_SOURCE_DIR}/src/hw_factory.cpp
|
|
${CMAKE_SOURCE_DIR}/src/hw_codec.cpp
|
|
${CMAKE_SOURCE_DIR}/src/hw_image_processor.cpp
|
|
${CMAKE_SOURCE_DIR}/src/ai_scheduler.cpp
|
|
${CMAKE_SOURCE_DIR}/src/utils/config_expand.cpp
|
|
${CMAKE_SOURCE_DIR}/src/utils/dma_alloc.cpp
|
|
)
|
|
|
|
target_include_directories(rk3588_gtests PRIVATE
|
|
${CMAKE_SOURCE_DIR}/include
|
|
${CMAKE_SOURCE_DIR}/third_party
|
|
)
|
|
|
|
target_link_libraries(rk3588_gtests PRIVATE
|
|
project_options
|
|
Threads::Threads
|
|
GTest::gtest_main
|
|
)
|
|
|
|
include(GoogleTest)
|
|
gtest_discover_tests(rk3588_gtests)
|