xref: /aosp_15_r20/external/oboe/CMakeLists.txt (revision 05767d913155b055644481607e6fa1e35e2fe72c)
1cmake_minimum_required(VERSION 3.4.1)
2
3# Set the name of the project and store it in PROJECT_NAME. Also set the following variables:
4# PROJECT_SOURCE_DIR (usually the root directory where Oboe has been cloned e.g.)
5# PROJECT_BINARY_DIR (usually the containing project's binary directory,
6# e.g. ${OBOE_HOME}/samples/RhythmGame/.externalNativeBuild/cmake/ndkExtractorDebug/x86/oboe-bin)
7project(oboe)
8
9set (oboe_sources
10    src/aaudio/AAudioLoader.cpp
11    src/aaudio/AudioStreamAAudio.cpp
12    src/common/AdpfWrapper.cpp
13    src/common/AudioSourceCaller.cpp
14    src/common/AudioStream.cpp
15    src/common/AudioStreamBuilder.cpp
16    src/common/DataConversionFlowGraph.cpp
17    src/common/FilterAudioStream.cpp
18    src/common/FixedBlockAdapter.cpp
19    src/common/FixedBlockReader.cpp
20    src/common/FixedBlockWriter.cpp
21    src/common/LatencyTuner.cpp
22    src/common/OboeExtensions.cpp
23    src/common/SourceFloatCaller.cpp
24    src/common/SourceI16Caller.cpp
25    src/common/SourceI24Caller.cpp
26    src/common/SourceI32Caller.cpp
27    src/common/Utilities.cpp
28    src/common/QuirksManager.cpp
29    src/fifo/FifoBuffer.cpp
30    src/fifo/FifoController.cpp
31    src/fifo/FifoControllerBase.cpp
32    src/fifo/FifoControllerIndirect.cpp
33    src/flowgraph/FlowGraphNode.cpp
34    src/flowgraph/ChannelCountConverter.cpp
35    src/flowgraph/ClipToRange.cpp
36    src/flowgraph/Limiter.cpp
37    src/flowgraph/ManyToMultiConverter.cpp
38    src/flowgraph/MonoBlend.cpp
39    src/flowgraph/MonoToMultiConverter.cpp
40    src/flowgraph/MultiToManyConverter.cpp
41    src/flowgraph/MultiToMonoConverter.cpp
42    src/flowgraph/RampLinear.cpp
43    src/flowgraph/SampleRateConverter.cpp
44    src/flowgraph/SinkFloat.cpp
45    src/flowgraph/SinkI16.cpp
46    src/flowgraph/SinkI24.cpp
47    src/flowgraph/SinkI32.cpp
48    src/flowgraph/SinkI8_24.cpp
49    src/flowgraph/SourceFloat.cpp
50    src/flowgraph/SourceI16.cpp
51    src/flowgraph/SourceI24.cpp
52    src/flowgraph/SourceI32.cpp
53    src/flowgraph/SourceI8_24.cpp
54    src/flowgraph/resampler/IntegerRatio.cpp
55    src/flowgraph/resampler/LinearResampler.cpp
56    src/flowgraph/resampler/MultiChannelResampler.cpp
57    src/flowgraph/resampler/PolyphaseResampler.cpp
58    src/flowgraph/resampler/PolyphaseResamplerMono.cpp
59    src/flowgraph/resampler/PolyphaseResamplerStereo.cpp
60    src/flowgraph/resampler/SincResampler.cpp
61    src/flowgraph/resampler/SincResamplerStereo.cpp
62    src/opensles/AudioInputStreamOpenSLES.cpp
63    src/opensles/AudioOutputStreamOpenSLES.cpp
64    src/opensles/AudioStreamBuffered.cpp
65    src/opensles/AudioStreamOpenSLES.cpp
66    src/opensles/EngineOpenSLES.cpp
67    src/opensles/OpenSLESUtilities.cpp
68    src/opensles/OutputMixerOpenSLES.cpp
69    src/common/StabilizedCallback.cpp
70    src/common/Trace.cpp
71    src/common/Version.cpp
72    )
73
74add_library(oboe ${oboe_sources})
75
76# Specify directories which the compiler should look for headers
77target_include_directories(oboe
78        PRIVATE src
79        PUBLIC include)
80
81# Compile Flags:
82#     Enable -Werror when building debug config
83#     Enable -Ofast
84target_compile_options(oboe
85        PRIVATE
86        -std=c++17
87        -Wall
88        -Wextra-semi
89        -Wshadow
90        -Wshadow-field
91        "$<$<CONFIG:RELEASE>:-Ofast>"
92        "$<$<CONFIG:DEBUG>:-O3>"
93        "$<$<CONFIG:DEBUG>:-Werror>")
94
95# Enable logging of D,V for debug builds
96target_compile_definitions(oboe PUBLIC $<$<CONFIG:DEBUG>:OBOE_ENABLE_LOGGING=1>)
97
98target_link_libraries(oboe PRIVATE log OpenSLES)
99
100# When installing oboe put the libraries in the lib/<ABI> folder e.g. lib/arm64-v8a
101install(TARGETS oboe
102        LIBRARY DESTINATION lib/${ANDROID_ABI}
103        ARCHIVE DESTINATION lib/${ANDROID_ABI})
104
105# Also install the headers
106install(DIRECTORY include/oboe DESTINATION include)
107