Files
ANSCORE/tests/ANSCV-UnitTest/CMakeLists.txt
T
nghianguyenandClaude Opus 4.8 eb29945cb7 ANSCV tests: add ans_imshow include + headless ConsoleTest
Add ConsoleTest.cpp, a headless (no-GUI) smoke test for ANSOPENCV image
ops plus an optional RTSP capture path, built as its own executable
(ANSCV-ConsoleTest) so it does not collide with ANSCV-UnitTest's GUI main.

Make the ans_imshow.hpp include (shipped with ANSMIND, outside the repo)
configurable via the ANSMIND_INCLUDE_DIR cache variable, defaulting to
C:/ProgramData/ANSCENTER/ANSMIND. Warn rather than fail configure when the
header is absent so unrelated targets still build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 05:51:01 +10:00

67 lines
2.5 KiB
CMake

# ANSCV Unit Test
add_executable(ANSCV-UnitTest
ANSCV-UnitTest.cpp
OpenCVTest.cpp
)
# ANSCV Console Test — headless smoke test (no GUI/camera/disk), prints
# PASS/FAIL per check and exits with the failure count. Built as its own
# executable so it does not collide with ANSCV-UnitTest's GUI main().
add_executable(ANSCV-ConsoleTest
ConsoleTest.cpp
)
# ans_imshow.hpp lives outside the repo (shipped with ANSMIND). Default to the
# standard install location but allow overriding on other machines/CI via
# -DANSMIND_INCLUDE_DIR=<path>. Warn (don't fail configure) if it's missing, so
# unrelated targets still build; ConsoleTest will then fail to compile clearly.
set(ANSMIND_INCLUDE_DIR "C:/ProgramData/ANSCENTER/ANSMIND"
CACHE PATH "Directory containing ans_imshow.hpp (shipped with ANSMIND)")
if(NOT EXISTS "${ANSMIND_INCLUDE_DIR}/ans_imshow.hpp")
message(WARNING
"ans_imshow.hpp not found in ANSMIND_INCLUDE_DIR='${ANSMIND_INCLUDE_DIR}'. "
"ANSCV-ConsoleTest will fail to compile. "
"Set -DANSMIND_INCLUDE_DIR=<path> to the directory containing ans_imshow.hpp.")
endif()
foreach(_anscv_test ANSCV-UnitTest ANSCV-ConsoleTest)
target_include_directories(${_anscv_test} PRIVATE
${CMAKE_SOURCE_DIR}/modules/ANSCV
${CMAKE_SOURCE_DIR}/MediaClient
${CMAKE_SOURCE_DIR}/MediaClient/media
${CMAKE_SOURCE_DIR}/MediaClient/rtsp
${CMAKE_SOURCE_DIR}/MediaClient/rtp
${CMAKE_SOURCE_DIR}/MediaClient/bm
${CMAKE_SOURCE_DIR}/MediaClient/http
${CMAKE_SOURCE_DIR}/MediaClient/directx
${CMAKE_SOURCE_DIR}/MediaClient/rtmp
${CMAKE_SOURCE_DIR}/MediaClient/librtmp
${CMAKE_SOURCE_DIR}/MediaClient/srt
${FFMPEG_INCLUDE_DIR} # FFmpeg 8.1 (n8.1); was vendored MediaClient/ffmpeg/include 4.0.2
${CMAKE_SOURCE_DIR}/MediaClient/openssl/include
${CMAKE_SOURCE_DIR}/MediaClient/libsrt/include
${SHARED_INCLUDE_DIR}
${ANSLIBS_DIR}/TurboJpeg
${ANSLIBS_DIR}/QRCode
${ANSMIND_INCLUDE_DIR} # ans_imshow.hpp (ConsoleTest.cpp)
)
target_link_libraries(${_anscv_test}
PRIVATE ANSCV
PRIVATE ANSLicensingSystem
PRIVATE anslicensing
PRIVATE labview
PRIVATE opencv
PRIVATE turbojpeg
PRIVATE zxing
PRIVATE CUDA::cudart
PRIVATE CUDA::nvjpeg
)
if(WIN32)
target_link_libraries(${_anscv_test} PRIVATE ${WIN_COMMON_LIBS})
endif()
target_compile_definitions(${_anscv_test} PRIVATE UNICODE _UNICODE)
endforeach()