From 5d992a46de4a9721c9be7c527b98e81447ebb341 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Thu, 9 Jun 2022 00:44:40 +0200 Subject: [PATCH] [harfbuzz] Fix CMake config (#25092) * Use 'supports' to restrict 'coretext' * Minor portfile changes * Minimal fix to harfbuzzConfig.cmake * Update versions --- ports/harfbuzz/harfbuzzConfig.cmake.in | 28 ++++++++++++-------------- ports/harfbuzz/portfile.cmake | 16 +++++++-------- ports/harfbuzz/vcpkg.json | 4 +++- versions/baseline.json | 2 +- versions/h-/harfbuzz.json | 5 +++++ 5 files changed, 29 insertions(+), 26 deletions(-) diff --git a/ports/harfbuzz/harfbuzzConfig.cmake.in b/ports/harfbuzz/harfbuzzConfig.cmake.in index d4db3ea41c..42f8b2ee72 100644 --- a/ports/harfbuzz/harfbuzzConfig.cmake.in +++ b/ports/harfbuzz/harfbuzzConfig.cmake.in @@ -1,11 +1,21 @@ # For old projects where the minimum CMake version is lower than 3.3. +cmake_policy(SET CMP0012 NEW) +cmake_policy(SET CMP0054 NEW) cmake_policy(SET CMP0057 NEW) -include(CMakeFindDependencyMacro) + +# Traditional find module variables (vcpkg polyfill) +set(HARFBUZZ_INCLUDE_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/harfbuzz" CACHE INTERNAL "") +set(HARFBUZZ_INCLUDE_DIRS "${HARFBUZZ_INCLUDE_DIR}") +set(HARFBUZZ_LIBRARY harfbuzz::harfbuzz CACHE INTERNAL "") +set(HARFBUZZ_LIBRARIES harfbuzz::harfbuzz) if(TARGET harfbuzz) - return() + set(HARFBUZZ_FOUND TRUE) + return() endif() +include(CMakeFindDependencyMacro) + add_library(harfbuzz INTERFACE IMPORTED GLOBAL) add_library(harfbuzz::harfbuzz ALIAS harfbuzz) @@ -56,16 +66,4 @@ if ("icu" IN_LIST HARFBUZZ_FEATURES) target_link_libraries(harfbuzz INTERFACE ICU::uc) endif() -get_filename_component(_INSTALL_DIR "${CMAKE_CURRENT_LIST_DIR}/../../" ABSOLUTE) -target_include_directories(harfbuzz INTERFACE "${_INSTALL_DIR}/include/harfbuzz") - -set(HARFBUZZ_LIBRARY harfbuzz::harfbuzz PARENT_SCOPE) -set(HARFBUZZ_LIBRARIES harfbuzz::harfbuzz PARENT_SCOPE) -set(HARFBUZZ_INCLUDE_DIR "${_INSTALL_DIR}/include/harfbuzz" PARENT_SCOPE) -set(HARFBUZZ_INCLUDE_DIRS "${_INSTALL_DIR}/include/harfbuzz" PARENT_SCOPE) - -if(HARFBUZZ_LIBRARY_RELEASE) - set(HARFBUZZ_FOUND TRUE PARENT_SCOPE) -else() - set(HARFBUZZ_FOUND FALSE PARENT_SCOPE) -endif() +target_include_directories(harfbuzz INTERFACE "${HARFBUZZ_INCLUDE_DIR}") diff --git a/ports/harfbuzz/portfile.cmake b/ports/harfbuzz/portfile.cmake index 426150b7c9..6e618698bb 100644 --- a/ports/harfbuzz/portfile.cmake +++ b/ports/harfbuzz/portfile.cmake @@ -18,9 +18,6 @@ else() endif() if("coretext" IN_LIST FEATURES) list(APPEND FEATURE_OPTIONS -Dcoretext=enabled) # Enable CoreText shaper backend on macOS - if(NOT VCPKG_TARGET_IS_OSX) - message(FATAL_ERROR "Feature 'coretext' os only available on OSX") - endif() else() list(APPEND FEATURE_OPTIONS -Dcoretext=disabled) endif() @@ -39,8 +36,9 @@ list(APPEND FEATURE_OPTIONS -Dfreetype=enabled) #Enable freetype interop helpers vcpkg_configure_meson( - SOURCE_PATH ${SOURCE_PATH} - OPTIONS ${FEATURE_OPTIONS} + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} -Dcairo=disabled # Use Cairo graphics library -Dintrospection=disabled # Generate gobject-introspection bindings (.gir/.typelib files) -Ddocs=disabled # Generate documentation with gtk-doc @@ -76,11 +74,9 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/cmake") configure_file("${CMAKE_CURRENT_LIST_DIR}/harfbuzzConfig.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/harfbuzzConfig.cmake" @ONLY) -# Handle copyright -file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) - +vcpkg_list(SET TOOL_NAMES) if("glib" IN_LIST FEATURES) - list(APPEND TOOL_NAMES hb-subset hb-shape hb-ot-shape-closure) + vcpkg_list(APPEND TOOL_NAMES hb-subset hb-shape hb-ot-shape-closure) endif() if(TOOL_NAMES) vcpkg_copy_tools(TOOL_NAMES ${TOOL_NAMES} AUTO_CLEAN) @@ -89,3 +85,5 @@ endif() if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") endif() + +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/harfbuzz/vcpkg.json b/ports/harfbuzz/vcpkg.json index 9d86ed458a..948366a2fc 100644 --- a/ports/harfbuzz/vcpkg.json +++ b/ports/harfbuzz/vcpkg.json @@ -1,6 +1,7 @@ { "name": "harfbuzz", "version": "4.2.0", + "port-version": 1, "description": "HarfBuzz OpenType text shaping engine", "homepage": "https://github.com/harfbuzz/harfbuzz", "license": "MIT-Modern-Variant", @@ -20,7 +21,8 @@ ], "features": { "coretext": { - "description": "Enable CoreText shaper backend on macOS" + "description": "Enable CoreText shaper backend on macOS", + "supports": "osx" }, "glib": { "description": "Glib Unicode callbacks support", diff --git a/versions/baseline.json b/versions/baseline.json index fe1e8d2150..1093860be8 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2750,7 +2750,7 @@ }, "harfbuzz": { "baseline": "4.2.0", - "port-version": 0 + "port-version": 1 }, "hash-library": { "baseline": "8", diff --git a/versions/h-/harfbuzz.json b/versions/h-/harfbuzz.json index 32ecc780ae..7de0c7f954 100644 --- a/versions/h-/harfbuzz.json +++ b/versions/h-/harfbuzz.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "aa86b69179481aee3a47cb7452a7058a65e6da0c", + "version": "4.2.0", + "port-version": 1 + }, { "git-tree": "02ad2865be7815604bb2c0e6cbc368f3d23d93d6", "version": "4.2.0",