Skip to content

Commit

Permalink
Merge pull request #1444 from Treata11/master
Browse files Browse the repository at this point in the history
Add support for Apple framework builds
  • Loading branch information
farindk authored Jan 23, 2025
2 parents e52035e + aad91a0 commit 1a131f9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# see here: https://stackoverflow.com/questions/7335420/global-git-ignore

build
_build
third-party/SVT-AV1/
third-party/dav1d/
third-party/libwebp/
third-party/rav1e/
third-party/rav1e/
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ if (HAVE_UNISTD_H)
add_definitions(-DHAVE_UNISTD_H)
endif()

if (APPLE)
option(BUILD_FRAMEWORK "Build as Apple Frameworks" OFF)
endif()

set(CMAKE_COMPILE_WARNING_AS_ERROR ON CACHE BOOL "Treat compilation warning as error")

if(NOT MSVC)
Expand Down
21 changes: 19 additions & 2 deletions libheif/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,27 @@ set_target_properties(heif
SOVERSION ${PROJECT_VERSION_MAJOR})

if (APPLE)
set_target_properties(heif
PROPERTIES
set_target_properties(heif PROPERTIES
LINK_FLAGS "-Wl,-compatibility_version,${MACOS_COMPATIBLE_VERSION}")
endif ()

if (BUILD_FRAMEWORK)
set_target_properties(heif PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_VERSION "${PACKAGE_VERSION}"
PRODUCT_BUNDLE_IDENTIFIER "github.com/strukturag/libheif"
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
# OUTPUT_NAME "heif"
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO"
XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO"
PUBLIC_HEADER "${libheif_headers}"
MACOSX_FRAMEWORK_IDENTIFIER "github.com/strukturag/libheif"
MACOSX_FRAMEWORK_BUNDLE_VERSION "${PACKAGE_VERSION}"
MACOSX_FRAMEWORK_SHORT_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
MACOSX_RPATH TRUE)
endif()

target_compile_definitions(heif
PUBLIC
LIBHEIF_EXPORTS
Expand Down Expand Up @@ -239,6 +255,7 @@ install(TARGETS heif EXPORT ${PROJECT_NAME}-config
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
FRAMEWORK DESTINATION Library/Frameworks COMPONENT runtime OPTIONAL
)

install(FILES ${libheif_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})
Expand Down

0 comments on commit 1a131f9

Please sign in to comment.