Skip to content

csparker247/jpeg-cmake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IJG's libjpeg (with CMake)

Current Version: libjpeg 10 (10.0.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-10/
cmake -S ~/jpeg-10/ -B ~/jpeg-10/build/
cmake --build ~/jpeg-10/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-10/ 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 BUILD_<SHARED|STATIC>_LIBS CMake flags:

cmake -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON ..

Utilities

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

cmake -DBUILD_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 LINK_STATIC flag:

cmake -DLINK_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 BUILD_ALT_UI flag:

cmake -DBUILD_ALT_UI=ON ..

Tests

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

cmake ..
make
make test

To disable test generation, set the BUILD_TESTS flag:

cmake -DBUILD_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.

Project Versioning Scheme

Prior to libjpeg 10, this CMake project used an independent versioning scheme based only on changes to the CMake configuration. Going forward, this project's major.minor versions will be taken from the libjpeg release. The patch version will indicate bug fixes and feature additions in the CMake project.

About

IJG's libjpeg with CMake support

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors