Build

Platform requirements

  • Requires zlib
  • Fixed width integer types
  • Integers must be two’s complement.
  • CHAR_BIT must equal 8.
  • size_t must be unsigned and at least 32-bit, 16-bit platforms are not supported.

Build system

Meson is the primary build system but CMake is also supported.

CMake

mkdir -p cbuild
cd cbuild
cmake ..
make
make install

Meson

meson build
cd build
ninja
ninja install

Filter optimizations

The SPNG_OPTIMIZE_FILTER define controls filter optimization.

The Meson project has an optimize_filter option, the CMake equivalent is OPTIMIZE_FILTER, these are enabled by default.

For amalgamation builds define SPNG_OPTIMIZE_FILTER before including spng.h.

Filter optimizations require SSE2/SSSE3 on x86, compiler-specific macros are used to omit the need for the -msse2 and -mssse3 compiler flags, if the code does not compile without these flags you should file a bug report.

Profile-guided optimization (PGO)

Profile-guided optimization (PGO) improves performance by up to 20%.

Note

Run in root directory

git clone https://gitlab.com/randy408/benchmark_images.git
cd build
meson configure -Dbuildtype=release --default-library both -Db_pgo=generate
ninja
./example ../benchmark_images/medium_rgb8.png
./example ../benchmark_images/medium_rgba8.png
./example ../benchmark_images/large_palette.png
meson configure -Db_pgo=use
ninja
ninja install