# Native build for the Oboe (AAudio) low-latency output backend.
cmake_minimum_required(VERSION 3.22.1)
project(sizzle_native)

# Oboe ships as a prefab package inside the com.google.oboe:oboe AAR; AGP exposes
# it here when `buildFeatures { prefab = true }` is set in build.gradle.kts.
find_package(oboe REQUIRED CONFIG)

add_library(sizzle_native SHARED native_audio.cpp)

target_link_libraries(sizzle_native
    oboe::oboe
    log)

# Align ELF load segments to 16 KB so the library works on Android 15+ devices
# using 16 KB memory pages (and passes Google Play's requirement). NDK r27+ does
# this by default; on r26 we set it explicitly. -Bsymbolic is unrelated; the key
# flag is max-page-size.
target_link_options(sizzle_native PRIVATE
    "-Wl,-z,max-page-size=16384")
