Don Turner | e3e55e6 | 2018-03-27 15:50:03 +0100 | [diff] [blame] | 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 | |
| 17 | cmake_minimum_required(VERSION 3.4.1) |
| 18 | |
| 19 | set(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 |
| 24 | set (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 |
| 28 | add_subdirectory(${OBOE_DIR} ./oboe-bin) |
| 29 | |
| 30 | # Include the Oboe headers |
| 31 | include_directories(${OBOE_DIR}/include) |
| 32 | |
| 33 | ### END OBOE INCLUDE SECTION ### |
| 34 | |
| 35 | # Debug utilities |
| 36 | set (DEBUG_UTILS_PATH "../debug-utils") |
| 37 | set (DEBUG_UTILS_SOURCES ${DEBUG_UTILS_PATH}/trace.cpp) |
| 38 | include_directories(${DEBUG_UTILS_PATH}) |
| 39 | |
| 40 | # App specific sources |
| 41 | set (APP_DIR src/main/cpp) |
| 42 | file (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 |
| 49 | add_library(hello-oboe SHARED |
| 50 | ${DEBUG_UTILS_SOURCES} |
| 51 | ${APP_SOURCES} |
| 52 | ) |
| 53 | |
| 54 | # Specify the libraries needed for hello-oboe |
| 55 | target_link_libraries(hello-oboe android log oboe) |
gfan | 2778e88 | 2018-07-18 17:02:24 -0700 | [diff] [blame] | 56 | |
gfan | 9fd786a | 2018-07-30 12:49:39 -0700 | [diff] [blame^] | 57 | # Enable optimization flags: if having problems with source level debugging, |
| 58 | # disable -Ofast ( and debug ), re-enable after done debugging. |
| 59 | target_compile_options(hello-oboe PRIVATE -std=c++14 -Wall -Werror -Ofast) |