Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions test/utests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ find_package(PkgConfig REQUIRED)
pkg_check_modules(OPENSSL REQUIRED openssl)
include_directories(${OPENSSL_INCLUDE_DIRS})

pkg_check_modules(GTEST REQUIRED gtest)
pkg_check_modules(GMOCK REQUIRED gmock)
# Note: We call pkg_check_modules above to satisfy any legacy checks, but we'll override
# the variables below after FetchContent provides the actual googletest targets
# Try to find gtest/gmock via pkg-config (for systems with pre-installed googletest)
# but don't require it - FetchContent will provide it if not found
pkg_check_modules(GTEST gtest)
pkg_check_modules(GMOCK gmock)
# Note: If pkg-config finds gtest/gmock, we'll still override with FetchContent below
# to ensure consistent versions and avoid ABI mismatches

# Middleware headers are now provided via:
# - External middleware-player-interface pkg-config (for CI builds)
Expand Down Expand Up @@ -95,6 +97,8 @@ FetchContent_MakeAvailable(googletest)
# Now that googletest targets exist, set up include dirs and link libraries
set(GTEST_INCLUDE_DIRS "${CMAKE_CURRENT_BINARY_DIR}/_deps/googletest-src/googletest/include")
set(GMOCK_INCLUDE_DIRS "${CMAKE_CURRENT_BINARY_DIR}/_deps/googletest-src/googlemock/include")
# FetchContent creates CMake targets: gtest, gmock
# These are proper CMake targets that will be resolved during linking
set(GTEST_LINK_LIBRARIES gtest)
set(GMOCK_LINK_LIBRARIES gmock gtest)
# Add FetchContent gtest/gmock include dirs globally
Expand Down
5 changes: 4 additions & 1 deletion test/utests/fakes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ set(UTESTS_ROOT "..")

# Middleware headers - use external middleware-player-interface if available via pkg-config
# Otherwise fall back to middleware-player-interface repo (GitHub Actions) or internal aamp/middleware
# Note: .libs/include is NOT used because it contains gtest headers that conflict with FetchContent
if(PLAYERFBINTERFACE_INCLUDE_DIRS)
# External middleware via pkg-config (preferred for installed middleware)
message(STATUS "Using external middleware-player-interface via pkg-config")
# Add FetchContent gtest/gmock FIRST with BEFORE SYSTEM to ensure they take precedence
# over any gmock/gtest subdirectories in .libs/include
include_directories(BEFORE SYSTEM ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS})
# Now add middleware include dirs (which may include .libs/include with middleware headers)
include_directories(${PLAYERFBINTERFACE_INCLUDE_DIRS})
include_directories(${BASECONVERSION_INCLUDE_DIRS})
include_directories(${PLAYERLOGMANAGER_INCLUDE_DIRS})
Expand Down
4 changes: 3 additions & 1 deletion test/utests/tests/AampDRMLicManagerTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ include_directories(${DRM_ROOT})
include_directories(${DRM_ROOT}/mocks)
include_directories(${AAMP_ROOT}/drm)
include_directories(${AAMP_ROOT}/test/utests/drm/ocdm)
include_directories(${AAMP_ROOT}/.libs/include)
# Note: .libs/include is NOT used because it contains old gtest/gmock headers
# that conflict with FetchContent googletest. Middleware headers are provided
# via conditional logic in fakes/CMakeLists.txt and tests/CommonTestIncludes.cmake

set(TEST_SOURCES
AampDRMLicManagerTestCases.cpp
Expand Down
5 changes: 3 additions & 2 deletions test/utests/tests/AampLogManagerTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ include_directories(${LibXml2_INCLUDE_DIRS})
include_directories(SYSTEM ${UTESTS_ROOT}/mocks)
include_directories(${LIBCJSON_INCLUDE_DIRS})
include_directories(${AAMP_ROOT}/tsb/api)
# Use external middleware headers instead of deprecated aamp/middleware
include_directories(${AAMP_ROOT}/.libs/include)
# Note: .libs/include is NOT used because it contains old gtest/gmock headers
# that conflict with FetchContent googletest. Middleware headers are provided
# via conditional logic in fakes/CMakeLists.txt and tests/CommonTestIncludes.cmake


set(TEST_SOURCES AampLogManagerTests.cpp
Expand Down
4 changes: 4 additions & 0 deletions test/utests/tests/CommonTestIncludes.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ include_directories(SYSTEM ${UTESTS_ROOT}/mocks)
# For legacy builds without external middleware, fall back to middleware-player-interface repo or internal paths
if(PLAYERFBINTERFACE_INCLUDE_DIRS)
# External middleware (preferred)
# Add FetchContent gtest/gmock FIRST with BEFORE SYSTEM to ensure they take precedence
# over any gmock/gtest subdirectories in .libs/include
include_directories(BEFORE SYSTEM ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS})
# Now add middleware include dirs (which may include .libs/include with middleware headers)
include_directories(${PLAYERFBINTERFACE_INCLUDE_DIRS})
include_directories(${BASECONVERSION_INCLUDE_DIRS})
include_directories(${PLAYERLOGMANAGER_INCLUDE_DIRS})
Expand Down
5 changes: 3 additions & 2 deletions test/utests/tests/FragmentCollectorMpdTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ include_directories(${LibXml2_INCLUDE_DIRS})
include_directories(SYSTEM ${UTESTS_ROOT}/mocks)
include_directories(${LIBCJSON_INCLUDE_DIRS})
include_directories(${AAMP_ROOT}/tsb/api)
# Use external middleware headers instead of deprecated aamp/middleware
include_directories(${AAMP_ROOT}/.libs/include)
# Note: .libs/include is NOT used because it contains old gtest/gmock headers
# that conflict with FetchContent googletest. Middleware headers are provided
# via conditional logic in fakes/CMakeLists.txt and tests/CommonTestIncludes.cmake


set(TEST_SOURCES FragmentCollectorMpdTests.cpp
Expand Down
6 changes: 3 additions & 3 deletions test/utests/tests/Scte35Tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ set(EXEC_NAME Scte35Tests)
include(${CMAKE_CURRENT_LIST_DIR}/../CommonTestIncludes.cmake)
include_directories(${AAMP_ROOT}/test/aampcli)

if(CMAKE_SYSTEM_NAME STREQUAL Linux)
include_directories(${AAMP_ROOT}/.libs/include)
endif(CMAKE_SYSTEM_NAME STREQUAL Linux)
# Note: .libs/include is NOT used because it contains old gtest/gmock headers
# that conflict with FetchContent googletest. Middleware headers are provided
# via conditional logic in fakes/CMakeLists.txt and tests/CommonTestIncludes.cmake

set(TEST_SOURCES Scte35Tests.cpp
Scte35SectionTests.cpp
Expand Down
Loading