mirror of https://github.com/microsoft/vcpkg.git
[libheif] Fix symbol export quirks, keep plugins (#46392)
This commit is contained in:
parent
0d469fb46c
commit
137cec7e04
|
|
@ -8,6 +8,7 @@ vcpkg_from_github(
|
|||
cxx-linkage-pkgconfig.diff
|
||||
find-modules.diff
|
||||
gdk-pixbuf.patch
|
||||
symbol-exports.diff
|
||||
)
|
||||
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
|
|
@ -35,18 +36,23 @@ vcpkg_cmake_configure(
|
|||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
-DBUILD_TESTING=OFF
|
||||
-DCMAKE_COMPILE_WARNING_AS_ERROR=OFF
|
||||
"-DCMAKE_PROJECT_INCLUDE=${CURRENT_PORT_DIR}/cmake-project-include.cmake"
|
||||
-DPLUGIN_DIRECTORY= # empty
|
||||
-DWITH_DAV1D=OFF
|
||||
-DWITH_EXAMPLES=OFF
|
||||
-DWITH_OpenH264_DECODER=OFF
|
||||
-DWITH_LIBSHARPYUV=OFF
|
||||
-DCMAKE_COMPILE_WARNING_AS_ERROR=OFF
|
||||
-DWITH_OpenH264_DECODER=OFF
|
||||
-DVCPKG_LOCK_FIND_PACKAGE_Brotli=OFF
|
||||
-DVCPKG_LOCK_FIND_PACKAGE_Doxygen=OFF
|
||||
-DVCPKG_LOCK_FIND_PACKAGE_LIBDE265=ON # feature candidate
|
||||
-DVCPKG_LOCK_FIND_PACKAGE_PNG=OFF
|
||||
-DVCPKG_LOCK_FIND_PACKAGE_TIFF=OFF
|
||||
${FEATURE_OPTIONS}
|
||||
OPTIONS_RELEASE
|
||||
"-DPLUGIN_INSTALL_DIRECTORY=${CURRENT_PACKAGES_DIR}/plugins/libheif"
|
||||
OPTIONS_DEBUG
|
||||
"-DPLUGIN_INSTALL_DIRECTORY=${CURRENT_PACKAGES_DIR}/debug/plugins/libheif"
|
||||
MAYBE_UNUSED_VARIABLES
|
||||
VCPKG_LOCK_FIND_PACKAGE_AOM
|
||||
VCPKG_LOCK_FIND_PACKAGE_Brotli
|
||||
|
|
@ -56,7 +62,7 @@ vcpkg_cmake_configure(
|
|||
)
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/libheif/)
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/libheif")
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
|
|
@ -69,6 +75,9 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
|||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/libheif" "${CURRENT_PACKAGES_DIR}/debug/lib/libheif")
|
||||
|
||||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/libheif/heif_version.h" "#define LIBHEIF_PLUGIN_DIRECTORY \"${CURRENT_PACKAGES_DIR}/lib/libheif\"" "")
|
||||
file(GLOB maybe_plugins "${CURRENT_PACKAGES_DIR}/plugins/libheif/*")
|
||||
if(maybe_plugins STREQUAL "")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/plugins" "${CURRENT_PACKAGES_DIR}/debug/plugins")
|
||||
endif()
|
||||
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
diff --git a/heifio/CMakeLists.txt b/heifio/CMakeLists.txt
|
||||
index 920eeca..753bda1 100644
|
||||
--- a/heifio/CMakeLists.txt
|
||||
+++ b/heifio/CMakeLists.txt
|
||||
@@ -20,10 +20,7 @@ set_target_properties(heifio
|
||||
VERSION ${PROJECT_VERSION})
|
||||
|
||||
|
||||
-target_compile_definitions(heifio
|
||||
- PUBLIC
|
||||
- LIBHEIF_EXPORTS
|
||||
- HAVE_VISIBILITY)
|
||||
+# static lib, not changing visibility
|
||||
|
||||
find_package(TIFF)
|
||||
if (TIFF_FOUND)
|
||||
diff --git a/libheif/CMakeLists.txt b/libheif/CMakeLists.txt
|
||||
index 55d6313..2229992 100644
|
||||
--- a/libheif/CMakeLists.txt
|
||||
+++ b/libheif/CMakeLists.txt
|
||||
@@ -232,10 +232,13 @@ if (BUILD_FRAMEWORK)
|
||||
MACOSX_RPATH TRUE)
|
||||
endif()
|
||||
|
||||
-target_compile_definitions(heif
|
||||
- PUBLIC
|
||||
- LIBHEIF_EXPORTS
|
||||
- HAVE_VISIBILITY)
|
||||
+target_compile_definitions(heif PRIVATE LIBHEIF_EXPORTS)
|
||||
+if(NOT BUILD_SHARED_LIBS)
|
||||
+ target_compile_definitions(heif PUBLIC LIBHEIF_STATIC_BUILD)
|
||||
+endif()
|
||||
+if(WITH_REDUCED_VISIBILITY AND NOT MSVC)
|
||||
+ target_compile_definitions(heif PRIVATE HAVE_VISIBILITY)
|
||||
+endif()
|
||||
|
||||
if (PLUGIN_LOADING_SUPPORTED_AND_ENABLED)
|
||||
target_compile_definitions(heif PRIVATE ENABLE_PLUGIN_LOADING=1)
|
||||
diff --git a/libheif/plugins/CMakeLists.txt b/libheif/plugins/CMakeLists.txt
|
||||
index f7379c0..c8a3245 100644
|
||||
--- a/libheif/plugins/CMakeLists.txt
|
||||
+++ b/libheif/plugins/CMakeLists.txt
|
||||
@@ -13,10 +13,10 @@ macro(plugin_compilation name varName foundName optionName defineName)
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR})
|
||||
endif ()
|
||||
- target_compile_definitions(heif-${name}
|
||||
- PUBLIC
|
||||
- LIBHEIF_EXPORTS
|
||||
- HAVE_VISIBILITY)
|
||||
+ target_compile_definitions(heif-${name} PRIVATE LIBHEIF_EXPORTS)
|
||||
+ if(WITH_REDUCED_VISIBILITY AND NOT MSVC)
|
||||
+ target_compile_definitions(heif-${name} PRIVATE HAVE_VISIBILITY)
|
||||
+ endif()
|
||||
target_compile_definitions(heif-${name} PRIVATE PLUGIN_${defineName}=1)
|
||||
target_include_directories(heif-${name} PRIVATE ${PROJECT_SOURCE_DIR} ${libheif_BINARY_DIR} ${libheif_SOURCE_DIR}/libheif ${libheif_SOURCE_DIR}/libheif/api ${${varName}_INCLUDE_DIRS})
|
||||
target_link_libraries(heif-${name} PRIVATE ${${varName}_LIBRARIES} heif)
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"name": "libheif",
|
||||
"version": "1.20.1",
|
||||
"port-version": 1,
|
||||
"description": "libheif is an HEIF and AVIF file format decoder and encoder.",
|
||||
"homepage": "http://www.libheif.org/",
|
||||
"license": "LGPL-3.0-only",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
||||
|
||||
vcpkg_find_acquire_program(PKGCONFIG)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${CURRENT_PORT_DIR}/project"
|
||||
OPTIONS
|
||||
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
|
||||
)
|
||||
vcpkg_cmake_build()
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
cmake_minimum_required(VERSION 3.30)
|
||||
project(libheif-test C CXX)
|
||||
|
||||
find_package(libheif CONFIG REQUIRED)
|
||||
|
||||
add_executable(main main.c)
|
||||
add_library(imported::heif ALIAS heif)
|
||||
target_link_libraries(main PRIVATE imported::heif)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(libheif_pc libheif REQUIRED IMPORTED_TARGET)
|
||||
|
||||
add_executable(main-pkconfig main.c)
|
||||
target_link_libraries(main-pkconfig PRIVATE
|
||||
PkgConfig::libheif_pc
|
||||
)
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#include <libheif/heif.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
heif_context* ctx = heif_context_alloc();
|
||||
heif_context_free(ctx);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"name": "vcpkg-ci-libheif",
|
||||
"version-string": "ci",
|
||||
"description": "Port to test libheif in CI",
|
||||
"homepage": "https://github.com/microsoft/vcpkg",
|
||||
"license": "MIT",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "libheif",
|
||||
"default-features": false
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
}
|
||||
],
|
||||
"default-features": [
|
||||
"ci"
|
||||
],
|
||||
"features": {
|
||||
"ci": {
|
||||
"description": "Feature depenencies. openjpeg is a plugin.",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "libheif",
|
||||
"features": [
|
||||
"openjpeg"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4854,7 +4854,7 @@
|
|||
},
|
||||
"libheif": {
|
||||
"baseline": "1.20.1",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"libhsplasma": {
|
||||
"baseline": "2024-03-07",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "0e3ed4a35299acdbb186b6ac6ad9a3d622e7d09d",
|
||||
"version": "1.20.1",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "fc3d6e0a00a51d41e90f60ba69f165fc8627b647",
|
||||
"version": "1.20.1",
|
||||
|
|
|
|||
Loading…
Reference in New Issue