build.sh (976B)
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 mkdir -p "$DIR"/build 10 cd "$DIR"/build 11 12 # set CXX to clang++ if not set in the environment 13 CXX="${CXX-clang++}" 14 if ! command -v "$CXX" >/dev/null ; then 15 printf >&2 '%s: C++ compiler not found\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. -g lodepng.o \ 25 -I"$DIR"/../../ \ 26 "$DIR"/../../lib/jxl/enc_fast_lossless.cc "$DIR"/fast_lossless_main.cc \ 27 -lpthread \ 28 -o fast_lossless