Skip to content

Add jpegli-static-obj OBJECT build target #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

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