blob: f466733439dd76dbd7f1a27203a02ae1d8a7fde8 [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(
Phil Burk8f495712020-01-27 14:30:10 -080028 testOboe
Don Turner94fe4852018-07-03 08:42:09 +010029 testUtilities.cpp
Phil Burk8f495712020-01-27 14:30:10 -080030# testFlowgraph.cpp
Phil Burkf67a97f2019-05-30 12:48:17 -070031 testStreamClosedMethods.cpp
Phil Burkf67a97f2019-05-30 12:48:17 -070032 testStreamWaitState.cpp
Phil Burkf67a97f2019-05-30 12:48:17 -070033 testXRunBehaviour.cpp
Phil Burk8f495712020-01-27 14:30:10 -080034 testStreamOpen.cpp
35 testStreamStates.cpp
Don Turner94fe4852018-07-03 08:42:09 +010036 )
Don Turnerba5a01b2018-07-10 18:40:20 +010037target_link_libraries(testOboe gtest oboe)