blob: e198b38caceb26c9d5f2edc8d26f93a7c2ab63a3 [file] [log] [blame]
Don Turnere3e55e62018-03-27 15:50:03 +01001#
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
19set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Werror")
20
21### INCLUDE OBOE LIBRARY ###
22
23# Set the path to the Oboe library directory
24set (OBOE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
25
26# Add the Oboe library as a subproject. Since Oboe is an out-of-tree source library we must also
27# specify a binary directory
28add_subdirectory(${OBOE_DIR} ./oboe-bin)
29
30# Include the Oboe headers
31include_directories(${OBOE_DIR}/include)
32
33### END OBOE INCLUDE SECTION ###
34
35# Debug utilities
36set (DEBUG_UTILS_PATH "../debug-utils")
37set (DEBUG_UTILS_SOURCES ${DEBUG_UTILS_PATH}/trace.cpp)
38include_directories(${DEBUG_UTILS_PATH})
39
40# App specific sources
41set (APP_DIR src/main/cpp)
42file (GLOB_RECURSE APP_SOURCES
43 ${APP_DIR}/jni_bridge.cpp
44 ${APP_DIR}/PlayAudioEngine.cpp
45 ${APP_DIR}/SineGenerator.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)
gfan2778e882018-07-18 17:02:24 -070056
57# Enable optimization for release build; it could be enabled for debug build
58# if performance is of interest.
59target_compile_options(hello-oboe
ggfan32c67432018-07-27 16:09:09 -070060 PRIVATE -std=c++14 -Wall -Werror $<$<CONFIG:RELEASE>:-Ofast>)