Skip to content

Tiff - Automatically download/build liblerc dependency if missing during build #8

Description

@RandallFlagg

Title: Automatically download/build liblerc dependency if missing during build

Problem

libtiff includes support for [LERC](https://github.com/Esri/lerc) compression. However, if liblerc (or Lerc.dll / libLerc.so) is not installed on the host system, the build process fails or fails to link properly.

Manually downloading and building liblerc as a prerequisite introduces extra setup overhead for automated build pipelines and CI workflows.

Proposed Solution

Add an automated fallback mechanism in the CMake build system to automatically fetch and compile liblerc if it is not detected on the system.

This can be achieved via CMake's FetchContent module:

# Check for system LERC library first
find_package(LERC QUIET)

if(NOT LERC_FOUND)
    message(STATUS "LERC dynamic library not found locally. Fetching and building automatically...")
    include(FetchContent)
    FetchContent_Declare(
        lerc
        GIT_REPOSITORY https://github.com/Esri/lerc.git
        GIT_TAG        v4.0.0 # Or appropriate release tag
    )
    FetchContent_MakeAvailable(lerc)
endif()

Benefits

  • Simplifies automated CI/CD build scripts by removing the need to pre-install liblerc.
  • Ensures seamless builds across environments without requiring manual dependency management.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions