1#
2# Copyright 2017 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17cmake_minimum_required(VERSION 3.4.1)
18
19### INCLUDE OBOE LIBRARY ###
20
21# Set the path to the Oboe library directory
22set (OBOE_DIR ../../../../../)
23
24# Add the Oboe library as a subproject. Since Oboe is an out-of-tree source library we must also
25# specify a binary directory
26add_subdirectory(${OBOE_DIR} ./oboe-bin)
27
28# Include the Oboe headers and shared sample code
29include_directories(${OBOE_DIR}/include ${OBOE_DIR}/samples/shared)
30
31# Debug utilities
32set (DEBUG_UTILS_PATH "${OBOE_DIR}/samples/debug-utils")
33set (DEBUG_UTILS_SOURCES ${DEBUG_UTILS_PATH}/trace.cpp)
34include_directories(${DEBUG_UTILS_PATH})
35
36
37### END OBOE INCLUDE SECTION ###
38
39
40# App specific sources
41set (APP_SOURCES
42    jni_bridge.cpp
43    HelloOboeEngine.cpp
44    SoundGenerator.cpp
45    LatencyTuningCallback.cpp
46)
47
48# Build the libhello-oboe library
49add_library(hello-oboe SHARED
50            ${DEBUG_UTILS_SOURCES}
51            ${APP_SOURCES}
52            )
53
54# Specify the libraries needed for hello-oboe
55target_link_libraries(hello-oboe android log oboe)
56
57# Enable optimization flags: if having problems with source level debugging,
58# disable -Ofast ( and debug ), re-enable after done debugging.
59target_compile_options(hello-oboe PRIVATE -Wall -Werror "$<$<CONFIG:RELEASE>:-Ofast>")
60