1#
2# Copyright 2019 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# Pull in parselib
20set (PARSELIB_DIR ../../../../parselib)
21#message("PARSELIB_DIR = " + ${PARSELIB_DIR})
22
23# Pull in iolib
24set (IOLIB_DIR ../../../../iolib)
25#message("IOLIB_DIR = " + ${IOLIB_DIR})
26
27# Set the path to the Oboe library directory
28set (OBOE_DIR ../../../../../)
29#message("OBOE_DIR = " + ${OBOE_DIR})
30
31add_subdirectory(${OBOE_DIR} ./oboe-bin)
32
33# include folders
34include_directories(
35        ${OBOE_DIR}/include
36        ${CMAKE_CURRENT_LIST_DIR}
37)
38
39include(${PARSELIB_DIR}/src/main/cpp/CMakeLists.txt)
40include(${IOLIB_DIR}/src/main/cpp/CMakeLists.txt)
41
42# Include the WavLib headers and shared sample code
43include_directories(
44        ${PARSELIB_DIR}/src/main/cpp
45        ${IOLIB_DIR}/src/main/cpp)
46
47# App specific sources
48set (APP_SOURCES
49        DrumPlayerJNI.cpp
50        )
51
52# Build the drumthumper (native) library
53add_library(drumthumper SHARED
54        ${APP_SOURCES}
55        )
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(drumthumper PRIVATE -Wall -Werror "$<$<CONFIG:RELEASE>:-Ofast>")
60
61target_link_libraries( # Specifies the target library.
62        drumthumper
63
64        -Wl,--whole-archive
65        iolib
66        parselib
67        -Wl,--no-whole-archive
68
69        oboe
70
71        # Links the target library to the log library
72        # included in the NDK.
73        log)