From 353d635b97df5c80f270ec200d16a6664c4d6ab6 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Thu, 18 Jan 2018 10:45:34 -0800 Subject: [PATCH] [freetype][harfbuzz] Fix static freetype dependency. --- ports/freetype/usage | 3 +-- ports/harfbuzz/find-package-freetype.patch | 13 +++++++++++++ ports/harfbuzz/portfile.cmake | 4 +++- scripts/buildsystems/vcpkg.cmake | 11 +++++++++++ 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 ports/harfbuzz/find-package-freetype.patch diff --git a/ports/freetype/usage b/ports/freetype/usage index 3b42b86e4e..458a9dd88f 100644 --- a/ports/freetype/usage +++ b/ports/freetype/usage @@ -1,5 +1,4 @@ The package freetype is compatible with built-in CMake targets: find_package(Freetype REQUIRED) - target_link_libraries(main PRIVATE ${FREETYPE_LIBRARIES}) - target_include_directories(main PRIVATE ${FREETYPE_INCLUDE_DIRS}) + target_link_libraries(main PRIVATE Freetype::Freetype) diff --git a/ports/harfbuzz/find-package-freetype.patch b/ports/harfbuzz/find-package-freetype.patch new file mode 100644 index 0000000000..a556d1377e --- /dev/null +++ b/ports/harfbuzz/find-package-freetype.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 24ccb6f..21df836 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -201,7 +201,7 @@ set(project_headers + ## Find and include needed header folders and libraries + if (HB_HAVE_FREETYPE) + +- include(FindFreetype) ++ find_package(Freetype REQUIRED) + if (NOT FREETYPE_FOUND) + message(FATAL_ERROR "HB_HAVE_FREETYPE was set, but we failed to find it. Maybe add a CMAKE_PREFIX_PATH= to your Freetype2 install prefix") + endif() diff --git a/ports/harfbuzz/portfile.cmake b/ports/harfbuzz/portfile.cmake index 6e58997c17..c4bdbca220 100644 --- a/ports/harfbuzz/portfile.cmake +++ b/ports/harfbuzz/portfile.cmake @@ -10,7 +10,9 @@ vcpkg_from_github( vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} - PATCHES "${CMAKE_CURRENT_LIST_DIR}/0001-fix-uwp-build.patch" + PATCHES + "${CMAKE_CURRENT_LIST_DIR}/0001-fix-uwp-build.patch" + "${CMAKE_CURRENT_LIST_DIR}/find-package-freetype.patch" ) if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index f157d3236c..8ee21d4117 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -206,6 +206,17 @@ macro(find_package name) if(TIFF_LIBRARIES) list(APPEND TIFF_LIBRARIES ${LIBLZMA_LIBRARIES}) endif() + elseif("${name}" STREQUAL "Freetype") + _find_package(${ARGV}) + find_package(ZLIB) + find_package(PNG) + find_package(BZip2) + if(TARGET Freetype::Freetype) + set_property(TARGET Freetype::Freetype APPEND PROPERTY INTERFACE_LINK_LIBRARIES BZip2::BZip2 PNG::PNG ZLIB::ZLIB) + endif() + if(FREETYPE_LIBRARIES) + list(APPEND FREETYPE_LIBRARIES ${BZIP2_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES}) + endif() elseif("${name}" STREQUAL "tinyxml2") _find_package(${ARGV}) if(TARGET tinyxml2_static AND NOT TARGET tinyxml2)