fluidsynth/.azure/cmake-android.yml
Tom M cd393d863a
Fix broken SF3 support for Android binaries (#890)
Libsndfile was unintentionally compiled without OGG/Vorbis support. That's because libopus was missing. When compiling libsndfile with autotools [you get a nice warning](9349a566e2/configure.ac (L381-L386)). When using CMake you don't...

Solution: Compile libopus before compiling libsndfile. Now it reports

```
-- The following features have been enabled:

 * ENABLE_EXTERNAL_LIBS, enable FLAC, Vorbis, and Opus codecs
```
2021-05-12 17:43:35 +02:00

58 lines
1.9 KiB
YAML

parameters:
- name: cmakeArgs
type: string
default: ''
- name: sourceDir
type: string
default: ''
- name: workDir
type: string
default: $(DEV)
- name: condition
type: string
default: ne(variables.CACHE_RESTORED, 'true')
- name: installCommand
type: string
default: 'make install'
steps:
- script: |
set -ex
pushd ${{ parameters.sourceDir }}
mkdir -p build
pushd build
# Invoke cmake in the most correctest way I've could find while try and erroring:
#
# The biggest pain point is that CMake does not seem to respect our existing cross compilation CFLAGS and LDFLAGS.
# Hence we are passing them manually, once via Android flags and once for "Required" flags. The latter is necessary
# to let cmake correctly probe for any existing header, function, library, etc.
# Watch out: Sometimes the flags are passed as ;-limited list!
cmake -G "Unix Makefiles" \
-DCMAKE_MAKE_PROGRAM=make \
-DCMAKE_TOOLCHAIN_FILE=${NDK}/build/cmake/android.toolchain.cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DANDROID_NATIVE_API_LEVEL=${ANDROID_API} \
-DANDROID_ABI=${ANDROID_ABI_CMAKE} \
-DANDROID_TOOLCHAIN=${CC} \
-DANDROID_NDK=${NDK} \
-DANDROID_COMPILER_FLAGS="${CFLAGS// /;}" \
-DANDROID_LINKER_FLAGS="${LDFLAGS// /;}" \
-DANDROID_STL="c++_shared" \
-DCMAKE_REQUIRED_FLAGS="${CFLAGS}" \
-DCMAKE_REQUIRED_LINK_OPTIONS="${LDFLAGS// /;}" \
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DCMAKE_STAGING_PREFIX=${PREFIX} \
-DCMAKE_VERBOSE_MAKEFILE=1 \
-DBUILD_SHARED_LIBS=1 \
-DLIB_SUFFIX="" \
${{ parameters.cmakeArgs }} ..
make -j$((`nproc`+1))
${{ parameters.installCommand }}
popd
popd
displayName: 'Compile ${{ parameters.sourceDir }}'
workingDirectory: ${{ parameters.workDir }}
condition: ${{ parameters.condition }}