blob: bdfd61876d608125c8ebdd8fec95c8d69f5f6cc1 [file] [log] [blame]
Don Turnerfda67012018-01-19 18:10:25 +00001cmake_minimum_required(VERSION 3.4.1)
2
Don Turnerf9d26052019-03-27 16:05:50 +00003# 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.
Phil Burk25c87152019-03-26 14:16:51 -07005# 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)
Don Turner6ee9cf32018-07-12 18:09:59 +01009
Phil Burk83ceba12019-05-29 09:49:38 -070010set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -std=c++14")
11
Don Turner94fe4852018-07-03 08:42:09 +010012# Include GoogleTest library
Don Turnereb236cc2018-07-03 08:33:05 +010013set(GOOGLETEST_ROOT ${ANDROID_NDK}/sources/third_party/googletest)
Don Turnerfda67012018-01-19 18:10:25 +000014add_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
Don Turner94fe4852018-07-03 08:42:09 +010018# Include Oboe sources
19set (OBOE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
20add_subdirectory(${OBOE_DIR} ./oboe-bin)
Phil Burk83ceba12019-05-29 09:49:38 -070021include_directories(
22 ${OBOE_DIR}/include
23 ${OBOE_DIR}/src
24 )
Don Turner94fe4852018-07-03 08:42:09 +010025
26# Build the test binary
Phil Burk83ceba12019-05-29 09:49:38 -070027add_executable(
28 testOboe
Don Turner94fe4852018-07-03 08:42:09 +010029 testUtilities.cpp
Phil Burka007fb32019-06-05 12:43:21 -070030# testFlowgraph.cpp
Phil Burkf67a97f2019-05-30 12:48:17 -070031 testStreamClosedMethods.cpp
32 testStreamStates.cpp
33 testStreamWaitState.cpp
34 testStreamOpen.cpp
35 testXRunBehaviour.cpp
Don Turner94fe4852018-07-03 08:42:09 +010036 )
Don Turnerba5a01b2018-07-10 18:40:20 +010037target_link_libraries(testOboe gtest oboe)