Skip to content

Add jpegli-static-obj OBJECT build target#116

Closed
zeriyoshi wants to merge 2 commits intogoogle:mainfrom
colopl:libjpeg_obj
Closed

Add jpegli-static-obj OBJECT build target#116
zeriyoshi wants to merge 2 commits intogoogle:mainfrom
colopl:libjpeg_obj

Conversation

@zeriyoshi
Copy link

@zeriyoshi zeriyoshi commented Mar 6, 2025

Description

Adds an intermediate object target jpegli-static-obj for building the jpegli-static library.

This makes it easier to extract object files in external projects, allowing the building of completely static binaries.
Combined with the changes in PR #115, this will enable the creation of libraries using jpegli for platforms that require strict static linking, such as iOS applications.

include(FetchContent)

FetchContent_Declare(
    jpegli
    SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party/jpegli
)
FetchContent_MakeAvailable(jpegli)

add_library(${CMAKE_PROJECT_NAME} STATIC
    ${SOURCES}
    $<TARGET_OBJECTS:jpegli-static-obj>
    $<TARGET_OBJECTS:jpegli-libjpeg-obj>
    $<TARGET_OBJECTS:hwy>
)
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
    ${jpegli_BINARY_DIR}/lib/include/jpegli
    ${INCLUDE_DIRS}
)

Pull Request Checklist

  • CLA Signed: Have you signed the Contributor License Agreement (individual or corporate, as appropriate)? Only contributions from signed contributors can be accepted.
  • Authors: Have you considered adding your name to the AUTHORS file?
  • Code Style: Have you ensured your code adheres to the project's coding style guidelines? You can use ./ci.sh lint for automatic code formatting.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant