xref: /aosp_15_r20/external/oboe/tests/CMakeLists.txt (revision 05767d913155b055644481607e6fa1e35e2fe72c)
1cmake_minimum_required(VERSION 3.4.1)
2
3# Usually this file is called from run_tests.sh which requires the $ANDROID_NDK variable to be set so there's no need
4# to set it here. Comments below are left in intentionally in case they're useful in future.
5# This may work on Mac OS.
6# set(ANDROID_NDK $ENV{HOME}/Library/Android/sdk/ndk-bundle)
7# This may work on Linux.
8# set(ANDROID_NDK $ENV{HOME}/Android/sdk/ndk-bundle)
9
10set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -std=c++17")
11
12# Include GoogleTest library
13set(GOOGLETEST_ROOT ${ANDROID_NDK}/sources/third_party/googletest)
14add_library(gtest STATIC ${GOOGLETEST_ROOT}/src/gtest_main.cc ${GOOGLETEST_ROOT}/src/gtest-all.cc)
15target_include_directories(gtest PRIVATE ${GOOGLETEST_ROOT})
16target_include_directories(gtest PUBLIC ${GOOGLETEST_ROOT}/include)
17
18# Include Oboe sources
19set (OBOE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
20add_subdirectory(${OBOE_DIR} ./oboe-bin)
21include_directories(
22		${OBOE_DIR}/include
23		${OBOE_DIR}/src
24		)
25
26# Build the test binary
27add_executable(
28		testOboe
29		testAAudio.cpp
30		testFlowgraph.cpp
31		testFullDuplexStream.cpp
32		testResampler.cpp
33		testReturnStop.cpp
34		testStreamClosedMethods.cpp
35		testStreamFramesProcessed.cpp
36		testStreamOpen.cpp
37		testStreamStates.cpp
38		testStreamStop.cpp
39		testStreamWaitState.cpp
40		testXRunBehaviour.cpp
41		testUtilities.cpp
42        )
43
44target_link_libraries(testOboe gtest oboe)
45