Skip to content

Open-KO/jpeg-cmake

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IJG's libjpeg (with CMake)

Current Version: libjpeg 9f (9.6.0)

Usage

This project provides drop-in CMake support for the IJG's JPEG library. Simply run CMake as normal:

cmake -S . -B build/
cmake --build build/

Alternatively, the important CMake files can be copied to any libjpeg source directory:

cp resources/* ~/jpeg-9f/
cmake -S ~/jpeg-9f/ -B ~/jpeg-9f/build/
cmake --build ~/jpeg-9f/build/

Updating libjpeg

# Delete the contents of the libjpeg subdirectory
rm -rf libjpeg/*

# Copy the source files for libjpeg into the libjpeg subdirectory
cp -a ~/jpeg-9f/ libjpeg/

# Rerun the CMake build process
cmake --build build/

Advanced Configuration

Shared and Static Libraries

jpeg-cmake emulates the behavior of libjpeg and compiles both static and shared libraries by default. Selective compilation of shared and static libraries can be controlled with the LIBJPEG_BUILD_<SHARED|STATIC>_LIBS CMake flags:

cmake -DLIBJPEG_BUILD_SHARED_LIBS=ON -DLIBJPEG_BUILD_STATIC_LIBS=ON ..

Utilities

The libjpeg utility programs are built by default. To disable compilation of these tools, set the LIBJPEG_BUILD_EXECUTABLES flag:

cmake -DLIBJPEG_BUILD_EXECUTABLES=OFF ..

By default, executables are linked against the shared libraries. If static libraries are enabled, executables can optionally be linked statically by using the LIBJPEG_LINK_STATIC flag:

cmake -DLIBJPEG_LINK_STATIC=ON ..

Default output format

The default output format for djpeg can be specified with the DEFAULT_FMT flag. To compile correctly, the flag must be set to one of the enum options listed in djpeg.c:

  • FMT_BMP
  • FMT_GIF
  • FMT_GIF0
  • FMT_OS2
  • FMT_PPM
  • FMT_RLE
  • FMT_TARGA
  • FMT_TIFF
cmake -DDEFAULT_FMT=FMT_BMP ..

Alternate UI

jpeg-9e+ provides an alternate command line interface for cjpeg and djpeg. This interface can be enabled with the LIBJPEG_BUILD_ALT_UI flag:

cmake -DLIBJPEG_BUILD_ALT_UI=ON ..

Tests

The libjpeg test targets are generated by default whenever LIBJPEG_BUILD_EXECUTABLES is enabled. They can be run using the test target:

cmake ..
make
make test

To disable test generation, set the LIBJPEG_BUILD_TESTS flag:

cmake -DLIBJPEG_BUILD_TESTS=OFF ..

Customize jconfig.h

libjpeg provides extensive build customization through modification of jconfig.h. To ease this process, jpeg-cmake provides many of these customization options as CMake flags. For example:

cmake -DGIF_SUPPORTED=OFF -DPROGRESS_REPORT=ON ..

See resources/ConfigureJConfig.cmake for a complete list of flags and their descriptions.

About

IJG's libjpeg with CMake support

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • C 74.2%
  • Shell 16.7%
  • Makefile 2.2%
  • Roff 1.6%
  • GLSL 0.8%
  • CMake 0.7%
  • Other 3.8%