Skip to content

Commit

Permalink
Build libvips against Highway
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke committed Oct 7, 2023
1 parent 6ea902c commit f5437b2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.46.

### Added

- Enable optimized SIMD paths in libvips (using Highway).

### Changed

- Update methods/enums for libvips 8.15.
Expand Down
18 changes: 11 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,15 @@ 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
cd $DEPS/hwy
# 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
)

Expand Down Expand Up @@ -331,8 +331,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" ] || (
Expand Down Expand Up @@ -460,9 +464,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)
Expand Down

0 comments on commit f5437b2

Please sign in to comment.