Imported Upstream version 0.9.0
[platform/upstream/libjxl.git] / tools / fast_lossless / build-android.sh
1 #!/usr/bin/env bash
2 # Copyright (c) the JPEG XL Project Authors. All rights reserved.
3 #
4 # Use of this source code is governed by a BSD-style
5 # license that can be found in the LICENSE file.
6 set -e
7
8 DIR=$(realpath "$(dirname "$0")")
9
10 mkdir -p /tmp/build-android
11 cd /tmp/build-android
12
13 CXX="$ANDROID_NDK"/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang++
14 if ! command -v "$CXX" >/dev/null ; then
15   printf >&2 '%s: Android C++ compiler not found, is ANDROID_NDK set properly?\n' "${0##*/}"
16   exit 1
17 fi
18
19 [ -f lodepng.cpp ] || curl -o lodepng.cpp --url 'https://raw.githubusercontent.com/lvandeve/lodepng/8c6a9e30576f07bf470ad6f09458a2dcd7a6a84a/lodepng.cpp'
20 [ -f lodepng.h ] || curl -o lodepng.h --url 'https://raw.githubusercontent.com/lvandeve/lodepng/8c6a9e30576f07bf470ad6f09458a2dcd7a6a84a/lodepng.h'
21 [ -f lodepng.o ] || "$CXX" lodepng.cpp -O3 -o lodepng.o -c
22
23 "$CXX" -O3 \
24   -I. lodepng.o \
25   -I"${DIR}"/../../ \
26   "${DIR}"/../../lib/jxl/enc_fast_lossless.cc "${DIR}"/fast_lossless_main.cc \
27   -o fast_lossless