From 12fd7e2c7c72dff3a79c8726d903a6771c5b43d6 Mon Sep 17 00:00:00 2001 From: Treata11 Date: Tue, 21 Jan 2025 13:04:18 +0330 Subject: [PATCH 1/4] Build: Add support for Apple framework Signed-off-by: Treata11 --- CMakeLists.txt | 4 ++++ libheif/CMakeLists.txt | 23 ++++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c26ea68453..d3c1e9aa1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/libheif/CMakeLists.txt b/libheif/CMakeLists.txt index 82ca993786..9a33431b75 100644 --- a/libheif/CMakeLists.txt +++ b/libheif/CMakeLists.txt @@ -119,7 +119,7 @@ set(libheif_sources color-conversion/chroma_sampling.h ${libheif_headers}) -add_library(heif ${libheif_sources}) +add_library(heif ${libheif_sources} ${libheif_headers}) if (ENABLE_PLUGIN_LOADING) if (WIN32) @@ -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 @@ -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}) From 76cc7192501f8d46b75906969bea9a07db0cd34a Mon Sep 17 00:00:00 2001 From: Treata11 Date: Tue, 21 Jan 2025 13:16:29 +0330 Subject: [PATCH 2/4] Ignore Finder's files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 795929c780..b4b4f74ca3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,10 @@ # 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/ + +*.DS_Store \ No newline at end of file From 324af20fa48181265df8c37833d46ba7a69aebdc Mon Sep 17 00:00:00 2001 From: Treata11 Date: Wed, 22 Jan 2025 13:21:51 +0330 Subject: [PATCH 3/4] Remove the redundant `libheif_headers` from target `heif` --- libheif/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libheif/CMakeLists.txt b/libheif/CMakeLists.txt index 9a33431b75..e8d7e0dce9 100644 --- a/libheif/CMakeLists.txt +++ b/libheif/CMakeLists.txt @@ -119,7 +119,7 @@ set(libheif_sources color-conversion/chroma_sampling.h ${libheif_headers}) -add_library(heif ${libheif_sources} ${libheif_headers}) +add_library(heif ${libheif_sources}) if (ENABLE_PLUGIN_LOADING) if (WIN32) From aad91a03b87eba199206bb8166530b87e76deac1 Mon Sep 17 00:00:00 2001 From: Treata11 Date: Wed, 22 Jan 2025 13:26:28 +0330 Subject: [PATCH 4/4] Remove osX `.DS_Store` --- .gitignore | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index b4b4f74ca3..f68b0d95ee 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,4 @@ _build third-party/SVT-AV1/ third-party/dav1d/ third-party/libwebp/ -third-party/rav1e/ - -*.DS_Store \ No newline at end of file +third-party/rav1e/ \ No newline at end of file