From b59fa8e4e6b870457c00777e91aff85770e25047 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Wed, 3 Feb 2021 13:24:34 +0100 Subject: [PATCH] Build libvips against Highway --- CHANGELOG.md | 4 ++++ build.sh | 18 +++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd8770630..dec489d2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Uses libvips v8.15.0, compiled with Emscripten v3.1.47. +### Added + +- Enable optimized SIMD paths in libvips (using Highway). + ### Changed - Update methods/enums for libvips 8.15. diff --git a/build.sh b/build.sh index 3ed3a0b54..1e4570b41 100755 --- a/build.sh +++ b/build.sh @@ -280,7 +280,7 @@ node --version meson install -C _build --tag devel ) -[ -f "$TARGET/lib/pkgconfig/libhwy.pc" ] || [ -n "$DISABLE_JXL" ] || ( +[ -f "$TARGET/lib/pkgconfig/libhwy.pc" ] || [[ -n "$DISABLE_SIMD" && -n "$DISABLE_JXL" ]] || ( stage "Compiling hwy" mkdir $DEPS/hwy curl -Ls https://github.com/google/highway/archive/refs/tags/$VERSION_HWY.tar.gz | tar xzC $DEPS/hwy --strip-components=1 @@ -288,7 +288,7 @@ node --version # Remove build path from binary sed -i 's/HWY_ASSERT/HWY_DASSERT/' hwy/aligned_allocator.cc emcmake cmake -B_build -H. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$TARGET -DBUILD_SHARED_LIBS=FALSE \ - -DBUILD_TESTING=FALSE -DHWY_ENABLE_CONTRIB=FALSE -DHWY_ENABLE_EXAMPLES=FALSE + -DBUILD_TESTING=FALSE -DHWY_ENABLE_CONTRIB=FALSE -DHWY_ENABLE_EXAMPLES=FALSE -DHWY_ENABLE_TESTS=FALSE make -C _build install ) @@ -327,8 +327,12 @@ node --version -DJPEGXL_FORCE_SYSTEM_BROTLI=TRUE -DJPEGXL_FORCE_SYSTEM_LCMS2=TRUE -DJPEGXL_FORCE_SYSTEM_HWY=TRUE \ -DCMAKE_C_FLAGS="$CFLAGS -DJXL_DEBUG_ON_ABORT=0" -DCMAKE_CXX_FLAGS="$CXXFLAGS -DJXL_DEBUG_ON_ABORT=0" make -C _build install - # Ensure we don't link with lcms2 in the vips-jxl side module - [ -z "$ENABLE_MODULES" ] || sed -i '/^Requires.private:/s/ lcms2//' $TARGET/lib/pkgconfig/libjxl.pc + if [ -n "$ENABLE_MODULES" ]; then + # Ensure we don't link with highway in the vips-jxl side module + [ -z "$ENABLE_SIMD" ] || sed -i '/^Requires.private:/s/ libhwy//' $TARGET/lib/pkgconfig/libjxl.pc + # ... and the same for lcms2 + sed -i '/^Requires.private:/s/ lcms2//' $TARGET/lib/pkgconfig/libjxl.pc + fi ) [ -f "$TARGET/lib/pkgconfig/spng.pc" ] || ( @@ -456,9 +460,9 @@ node --version -Ddeprecated=false -Dexamples=false -Dcplusplus=$LIBVIPS_CPP -Dauto_features=disabled \ ${ENABLE_MODULES:+-Dmodules=enabled} -Dcgif=enabled -Dexif=enabled ${ENABLE_AVIF:+-Dheif=enabled} \ -Dheif-module=enabled -Dimagequant=enabled -Djpeg=enabled ${ENABLE_JXL:+-Djpeg-xl=enabled} \ - -Djpeg-xl-module=enabled -Dlcms=enabled ${ENABLE_SVG:+-Dresvg=enabled} -Dresvg-module=enabled \ - -Dspng=enabled -Dtiff=enabled -Dwebp=enabled -Dnsgif=true -Dppm=true -Danalyze=true -Dradiance=true \ - -Dzlib=enabled + -Djpeg-xl-module=enabled -Dlcms=enabled ${ENABLE_SIMD:+-Dhighway=enabled} ${ENABLE_SVG:+-Dresvg=enabled} \ + -Dresvg-module=enabled -Dspng=enabled -Dtiff=enabled -Dwebp=enabled -Dnsgif=true -Dppm=true -Danalyze=true \ + -Dradiance=true -Dzlib=enabled meson install -C _build --tag runtime,devel # Emscripten requires linking to side modules to find the necessary symbols to export module_dir=$(printf '%s\n' $TARGET/lib/vips-modules-* | sort -n | tail -1)