1#
2# Copyright (C) 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)
18project(loopback LANGUAGES C CXX)
19
20# set up common compile options
21add_library(${PROJECT_NAME} SHARED
22    sles.cpp
23    byte_buffer.c
24    jni_native.c
25    loopback.c
26    audio_utils/atomic.c
27    audio_utils/fifo.c
28    audio_utils/roundup.c
29    lb2/loopback_test.cpp
30    lb2/sound_system_echo.cpp
31    lb2/test_context.cpp
32    lb2/loopback2.cpp
33    lb2/sound_system_aaudio.cpp
34    lb2/oboe/src/aaudio/AAudioLoader.cpp )
35
36target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR} frameworks/wilhelm/include)
37
38set_target_properties(${PROJECT_NAME}
39  PROPERTIES
40    CXX_STANDARD 11
41    CXX_STANDARD_REQUIRED YES
42    CXX_EXTENSIONS NO
43)
44
45target_compile_options(${PROJECT_NAME} PRIVATE -fexceptions -Wall)
46#target_compile_options(${PROJECT_NAME} -DSTDC_HEADERS)
47
48set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
49
50# set(CMAKE_SHARED_LINKER_FLAGS, "${CMAKE_SHARED_LINKER_FLAGS} --hash-style=sysv")
51# Export ANativeActivity_onCreate(),
52# Refer to: https://github.com/android-ndk/ndk/issues/381.
53# set_target_properties(${PROJECT_NAME}
54#   PROPERTIES  LINK_FLAGS "-u ANativeActivity_onCreate")
55
56# add lib dependencies
57target_link_libraries(${PROJECT_NAME} PRIVATE  OpenSLES dl log android)
58