Meta: Add fontconfig and freetype vcpkg overlays

Temporary until their canonical git forge is back up and running
This commit is contained in:
Andrew Kaster 2025-03-17 20:16:42 -06:00 committed by Andrew Kaster
parent b8adf193f5
commit 20890d7b70
Notes: github-actions[bot] 2025-03-18 06:26:39 +00:00
18 changed files with 812 additions and 0 deletions

View file

@ -88,3 +88,6 @@ set(XML_PARSER_DEBUG ON)
# set(gn_include_dirs_DEBUG ON)
# set(gn_ldflags_DEBUG ON)
# set(gn_lib_dirs_DEBUG ON)
# Third-party: fontconfig overlay
# set(Fontconfig_LIBRARY_DEBUG ON)
# set(UUID_LIBRARY_DEBUG ON)

View file

@ -0,0 +1,13 @@
diff --git a/meson.build b/meson.build
index 08d9532..37cc195 100644
--- a/meson.build
+++ b/meson.build
@@ -289,7 +289,7 @@ if fc_cachedir in ['yes', 'no', 'default']
endif
endif
-if host_machine.system() != 'windows'
+if host_machine.system() != 'windows' and host_machine.system() != 'emscripten'
thread_dep = dependency('threads')
conf.set('HAVE_PTHREAD', 1)
deps += [thread_dep]

View file

@ -0,0 +1,14 @@
diff --git a/meson.build b/meson.build
index 8e78700..95bae59 100644
--- a/meson.build
+++ b/meson.build
@@ -112,6 +112,9 @@ check_alignofs = [
]
add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
+if cc.get_id() == 'clang' and host_machine.cpu_family() == 'wasm'
+ add_project_arguments('-matomics', '-mbulk-memory', language: 'c')
+endif
c_args = []

View file

@ -0,0 +1,130 @@
diff --git a/fc-cache/meson.build b/fc-cache/meson.build
index 5e40fac..3c3e46b 100644
--- a/fc-cache/meson.build
+++ b/fc-cache/meson.build
@@ -1,6 +1,7 @@
fccache = executable('fc-cache', ['fc-cache.c', fcstdint_h, alias_headers, ft_alias_headers],
include_directories: [incbase, incsrc],
link_with: [libfontconfig],
+ dependencies: [getopt_dep],
c_args: c_args,
install: true,
)
diff --git a/fc-cat/meson.build b/fc-cat/meson.build
index f26e4b8..476c0f9 100644
--- a/fc-cat/meson.build
+++ b/fc-cat/meson.build
@@ -1,6 +1,7 @@
fccat = executable('fc-cat', ['fc-cat.c', fcstdint_h, alias_headers, ft_alias_headers],
include_directories: [incbase, incsrc],
link_with: [libfontconfig],
+ dependencies: [getopt_dep],
c_args: c_args,
install: true,
)
diff --git a/fc-conflist/meson.build b/fc-conflist/meson.build
index f543cf9..f06640b 100644
--- a/fc-conflist/meson.build
+++ b/fc-conflist/meson.build
@@ -1,6 +1,7 @@
fcconflist = executable('fc-conflist', ['fc-conflist.c', fcstdint_h, alias_headers, ft_alias_headers],
include_directories: [incbase, incsrc],
link_with: [libfontconfig],
+ dependencies: [getopt_dep],
c_args: c_args,
install: true,
)
diff --git a/fc-list/meson.build b/fc-list/meson.build
index 2f679d5..4b0fb62 100644
--- a/fc-list/meson.build
+++ b/fc-list/meson.build
@@ -1,6 +1,7 @@
fclist = executable('fc-list', ['fc-list.c', fcstdint_h, alias_headers, ft_alias_headers],
include_directories: [incbase, incsrc],
link_with: [libfontconfig],
+ dependencies: [getopt_dep],
c_args: c_args,
install: true,
)
diff --git a/fc-match/meson.build b/fc-match/meson.build
index aca8bc8..cab4f09 100644
--- a/fc-match/meson.build
+++ b/fc-match/meson.build
@@ -1,6 +1,7 @@
fcmatch = executable('fc-match', ['fc-match.c', fcstdint_h, alias_headers, ft_alias_headers],
include_directories: [incbase, incsrc],
link_with: [libfontconfig],
+ dependencies: [getopt_dep],
c_args: c_args,
install: true,
)
diff --git a/fc-pattern/meson.build b/fc-pattern/meson.build
index 07de245..b957c67 100644
--- a/fc-pattern/meson.build
+++ b/fc-pattern/meson.build
@@ -1,6 +1,7 @@
fcpattern = executable('fc-pattern', ['fc-pattern.c', fcstdint_h, alias_headers, ft_alias_headers],
include_directories: [incbase, incsrc],
link_with: [libfontconfig],
+ dependencies: [getopt_dep],
c_args: c_args,
install: true,
)
diff --git a/fc-query/meson.build b/fc-query/meson.build
index d0f2dd4..940b021 100644
--- a/fc-query/meson.build
+++ b/fc-query/meson.build
@@ -1,7 +1,7 @@
fcquery = executable('fc-query', ['fc-query.c', fcstdint_h, alias_headers, ft_alias_headers],
include_directories: [incbase, incsrc],
link_with: [libfontconfig],
- dependencies: [freetype_dep],
+ dependencies: [freetype_dep, getopt_dep],
c_args: c_args,
install: true,
)
diff --git a/fc-scan/meson.build b/fc-scan/meson.build
index 4de2134..c5b2b67 100644
--- a/fc-scan/meson.build
+++ b/fc-scan/meson.build
@@ -1,7 +1,7 @@
fcscan = executable('fc-scan', ['fc-scan.c', fcstdint_h, alias_headers, ft_alias_headers],
include_directories: [incbase, incsrc],
link_with: [libfontconfig],
- dependencies: [freetype_dep],
+ dependencies: [freetype_dep, getopt_dep],
c_args: c_args,
install: true,
)
diff --git a/fc-validate/meson.build b/fc-validate/meson.build
index e2b956e..8902d59 100644
--- a/fc-validate/meson.build
+++ b/fc-validate/meson.build
@@ -1,7 +1,7 @@
fcvalidate = executable('fc-validate', ['fc-validate.c', fcstdint_h, alias_headers, ft_alias_headers],
include_directories: [incbase, incsrc],
link_with: [libfontconfig],
- dependencies: [freetype_dep],
+ dependencies: [freetype_dep, getopt_dep],
c_args: c_args,
install: true,
)
diff --git a/meson.build b/meson.build
index f616600..6d82a16 100644
--- a/meson.build
+++ b/meson.build
@@ -202,6 +202,14 @@ if cc.links(files('meson-cc-tests/solaris-atomic-operations.c'), name: 'Solaris
conf.set('HAVE_SOLARIS_ATOMIC_OPS', 1)
endif
+if host_machine.system() == 'windows'
+ conf.set('HAVE_GETOPT', 1)
+ conf.set('HAVE_GETOPT_LONG', 1)
+ getopt_dep = cc.find_library('getopt', required: false)
+else
+ getopt_dep = dependency('', required: false)
+endif
+
# Check iconv support
iconv_dep = []

View file

@ -0,0 +1,19 @@
--- a/conf.d/link_confs.py 2022-03-24 04:13:59.000982000 +0900
+++ b/conf.d/link_confs.py 2022-03-24 04:14:46.271964000 +0900
@@ -4,6 +4,7 @@
import sys
import argparse
import platform
+import shutil
from pathlib import PurePath
if __name__=='__main__':
@@ -32,7 +33,7 @@
except FileNotFoundError:
pass
try:
- os.symlink(os.path.relpath(src, start=args.confpath), dst)
+ shutil.copyfile(src, dst)
except NotImplementedError:
# Not supported on this version of Windows
break

View file

@ -0,0 +1,109 @@
vcpkg_from_gitlab(
GITLAB_URL https://gitlab.com
OUT_SOURCE_PATH SOURCE_PATH
REPO freedesktop-sdk/mirrors/freedesktop/fontconfig/fontconfig
REF ${VERSION}
SHA512 daa6d1e6058e12c694d9e1512e09be957ff7f3fa375246b9d13eb0a8cf2f21e1512a5cabe93f270e96790e2c20420bf7422d213e43ab9749da3255286ea65a7c
HEAD_REF master
PATCHES
emscripten.diff
no-etc-symlinks.patch
libgetopt.patch
fix-wasm-shared-memory-atomics.patch
)
set(options "")
if("nls" IN_LIST FEATURES)
list(APPEND options "-Dnls=enabled")
else()
list(APPEND options "-Dnls=disabled")
endif()
if("tools" IN_LIST FEATURES)
list(APPEND options "-Dtools=enabled")
else()
list(APPEND options "-Dtools=disabled")
endif()
vcpkg_configure_meson(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${options}
-Ddoc=disabled
-Dcache-build=disabled
-Diconv=enabled
-Dtests=disabled
ADDITIONAL_BINARIES
"gperf = ['${CURRENT_HOST_INSTALLED_DIR}/tools/gperf/gperf${VCPKG_HOST_EXECUTABLE_SUFFIX}']"
)
# https://www.freedesktop.org/software/fontconfig/fontconfig-user.html
# Adding OPTIONS for e.g. baseconfig-dir etc. won't work since meson will try to install into those dirs!
# Since adding OPTIONS does not work use a replacement in the generated config.h instead
set(replacement "")
if(VCPKG_TARGET_IS_WINDOWS)
set(replacement "**invalid-fontconfig-dir-do-not-use**")
endif()
set(configfile "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/config.h")
vcpkg_replace_string("${configfile}" "${CURRENT_PACKAGES_DIR}" "${replacement}")
vcpkg_replace_string("${configfile}" "#define FC_TEMPLATEDIR \"/share/fontconfig/conf.avail\"" "#define FC_TEMPLATEDIR \"/usr/share/fontconfig/conf.avail\"" IGNORE_UNCHANGED)
if(NOT VCPKG_BUILD_TYPE)
set(configfile "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/config.h")
vcpkg_replace_string("${configfile}" "${CURRENT_PACKAGES_DIR}/debug" "${replacement}")
vcpkg_replace_string("${configfile}" "#define FC_TEMPLATEDIR \"/share/fontconfig/conf.avail\"" "#define FC_TEMPLATEDIR \"/usr/share/fontconfig/conf.avail\"" IGNORE_UNCHANGED)
endif()
vcpkg_install_meson(ADD_BIN_TO_PATH)
vcpkg_copy_pdbs()
#Fix missing libintl static dependency
if("nls" IN_LIST FEATURES AND VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
if(NOT VCPKG_BUILD_TYPE)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/fontconfig.pc" "-liconv" "-liconv -lintl" IGNORE_UNCHANGED)
endif()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/fontconfig.pc" "-liconv" "-liconv -lintl" IGNORE_UNCHANGED)
endif()
vcpkg_fixup_pkgconfig()
# Fix paths in debug pc file.
set(_file "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/fontconfig.pc")
if(EXISTS "${_file}")
file(READ "${_file}" _contents)
string(REPLACE "/etc" "/../etc" _contents "${_contents}")
string(REPLACE "/var" "/../var" _contents "${_contents}")
file(WRITE "${_file}" "${_contents}")
endif()
# Make path to cache in fonts.conf relative
set(_file "${CURRENT_PACKAGES_DIR}/etc/fonts/fonts.conf")
if(EXISTS "${_file}")
vcpkg_replace_string("${_file}" "${CURRENT_PACKAGES_DIR}/var/cache/fontconfig" "./../../var/cache/fontconfig" IGNORE_UNCHANGED)
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/var"
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/debug/etc")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
if(VCPKG_TARGET_IS_WINDOWS)
set(DEFINE_FC_PUBLIC "#define FcPublic __declspec(dllimport)")
else()
set(DEFINE_FC_PUBLIC "#define FcPublic __attribute__((visibility(\"default\")))")
endif()
foreach(HEADER IN ITEMS fcfreetype.h fontconfig.h)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/fontconfig/${HEADER}"
"#define FcPublic"
"${DEFINE_FC_PUBLIC}"
)
endforeach()
endif()
if("tools" IN_LIST FEATURES)
vcpkg_copy_tools(
TOOL_NAMES fc-match fc-cat fc-list fc-pattern fc-query fc-scan fc-cache fc-validate fc-conflist
AUTO_CLEAN
)
endif()
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")

View file

@ -0,0 +1,9 @@
fontconfig is compatible with built-in CMake targets:
find_package(Fontconfig REQUIRED) # since CMake 3.14
target_link_libraries(main PRIVATE Fontconfig::Fontconfig)
fontconfig provides pkg-config modules:
# Font configuration and customization library
fontconfig

View file

@ -0,0 +1,51 @@
_find_package(${ARGS})
if(Fontconfig_FOUND) # theoretically this could be skipped. If the wrapper is installed it should be found!
if(NOT TARGET Fontconfig::Fontconfig)
# Simplify wrapper for case of vendored FindFontconfig.cmake
add_library(Fontconfig::Fontconfig UNKNOWN IMPORTED)
endif()
include(SelectLibraryConfigurations)
find_library(Fontconfig_LIBRARY_DEBUG NAMES fontconfig fontconfigd NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_INSTALLED_DIR}/debug" NO_DEFAULT_PATH)
find_library(Fontconfig_LIBRARY_RELEASE NAMES fontconfig NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH)
select_library_configurations(Fontconfig)
set_target_properties(Fontconfig::Fontconfig PROPERTIES
IMPORTED_CONFIGURATIONS "Release"
IMPORTED_LOCATION_RELEASE "${Fontconfig_LIBRARY_RELEASE}"
)
if(Fontconfig_LIBRARY_DEBUG)
set_property(TARGET Fontconfig::Fontconfig APPEND PROPERTY IMPORTED_CONFIGURATIONS "Debug")
set_target_properties(Fontconfig::Fontconfig PROPERTIES IMPORTED_LOCATION_DEBUG "${Fontconfig_LIBRARY_DEBUG}")
endif()
find_package(Freetype)
if(Freetype_FOUND)
list(APPEND Fontconfig_LIBRARIES "${FREETYPE_LIBRARIES}")
if(TARGET Freetype::Freetype)
set_property(TARGET Fontconfig::Fontconfig APPEND PROPERTY INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:Freetype::Freetype>")
else()
# TODO link FREETYPE_LIBRARIES transformed for $<CONFIG:...>.
endif()
endif()
find_package(EXPAT)
if(EXPAT_FOUND)
list(APPEND Fontconfig_LIBRARIES "${EXPAT_LIBRARIES}")
if(TARGET EXPAT::EXPAT)
set_property(TARGET Fontconfig::Fontconfig APPEND PROPERTY INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:EXPAT::EXPAT>")
else()
# TODO link EXPAT_LIBRARIES transformed for $<CONFIG:...>.
endif()
endif()
if("@VCPKG_TARGET_IS_LINUX@")
find_library(UUID_LIBRARY_DEBUG NAMES uuid uuidd uuid_d NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_INSTALLED_DIR}/debug" NO_DEFAULT_PATH)
find_library(UUID_LIBRARY_RELEASE NAMES uuid NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH)
select_library_configurations(UUID)
if(UUID_LIBRARIES)
list(APPEND Fontconfig_LIBRARIES "${UUID_LIBRARIES}")
if(UUID_LIBRARY_DEBUG)
set_property(TARGET Fontconfig::Fontconfig APPEND PROPERTY INTERFACE_LINK_LIBRARIES "$<$<NOT:$<CONFIG:DEBUG>>:${UUID_LIBRARY_RELEASE}>")
set_property(TARGET Fontconfig::Fontconfig APPEND PROPERTY INTERFACE_LINK_LIBRARIES "$<$<CONFIG:DEBUG>:${UUID_LIBRARY_DEBUG}>")
else()
set_property(TARGET Fontconfig::Fontconfig APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${UUID_LIBRARY_RELEASE}")
endif()
endif()
endif()
endif()

View file

@ -0,0 +1,60 @@
{
"name": "fontconfig",
"version": "2.15.0",
"port-version": 2,
"description": "Library for configuring and customizing font access.",
"homepage": "https://www.freedesktop.org/wiki/Software/fontconfig",
"license": "MIT",
"supports": "!uwp",
"dependencies": [
"dirent",
"expat",
{
"name": "freetype",
"default-features": false
},
{
"name": "gperf",
"host": true
},
{
"name": "libiconv",
"platform": "!windows"
},
{
"name": "libuuid",
"platform": "!osx & !windows"
},
{
"name": "pthread",
"platform": "!emscripten & !windows"
},
{
"name": "vcpkg-tool-meson",
"host": true
}
],
"features": {
"nls": {
"description": "Native languages support",
"dependencies": [
{
"name": "gettext",
"host": true,
"default-features": false,
"features": [
"tools"
]
},
"gettext-libintl"
]
},
"tools": {
"description": "Build tools",
"supports": "!emscripten",
"dependencies": [
"getopt"
]
}
}
}

View file

@ -0,0 +1,65 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index db48e9f..5c35276 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -328,6 +328,10 @@ else ()
list(APPEND BASE_SRCS src/base/ftdebug.c)
endif ()
+if(MSVC)
+ add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS)
+endif()
+
if (BUILD_FRAMEWORK)
list(APPEND BASE_SRCS builds/mac/freetype-Info.plist)
endif ()
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 4f2eaca..1e01fe4 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -1038,6 +1038,11 @@ FT_BEGIN_HEADER
* Especially for TrueType fonts see also the documentation for
* @FT_Size_Metrics.
*/
+
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#define generic GenericFromFreeTypeLibrary
+#endif
+
typedef struct FT_FaceRec_
{
FT_Long num_faces;
@@ -1910,6 +1915,9 @@ FT_BEGIN_HEADER
} FT_GlyphSlotRec;
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#undef generic
+#endif
/*************************************************************************/
/*************************************************************************/
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 3f8619d..edf03b6 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -528,6 +528,9 @@
return error;
}
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#define generic GenericFromFreeTypeLibrary
+#endif
static void
ft_glyphslot_clear( FT_GlyphSlot slot )
@@ -1195,6 +1198,9 @@
FT_FREE( face );
}
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#undef generic
+#endif
static void
Destroy_Driver( FT_Driver driver )

View file

@ -0,0 +1,21 @@
diff --git a/builds/cmake/FindBrotliDec.cmake b/builds/cmake/FindBrotliDec.cmake
index 46356b1fd..ed4cc2409 100644
--- a/builds/cmake/FindBrotliDec.cmake
+++ b/builds/cmake/FindBrotliDec.cmake
@@ -35,10 +35,15 @@ find_path(BROTLIDEC_INCLUDE_DIRS
PATH_SUFFIXES brotli)
find_library(BROTLIDEC_LIBRARIES
- NAMES brotlidec
+ NAMES brotlidec brotlidec-static NAMES_PER_DIR
HINTS ${PC_BROTLIDEC_LIBDIR}
${PC_BROTLIDEC_LIBRARY_DIRS})
+ find_library(BROTLICOMMON_LIBRARIES
+ NAMES brotlicommon-static brotlicommon NAMES_PER_DIR
+ HINTS ${PC_BROTLIDEC_LIBDIR}
+ ${PC_BROTLIDEC_LIBRARY_DIRS})
+ set(BROTLIDEC_LIBRARIES "${BROTLIDEC_LIBRARIES};${BROTLICOMMON_LIBRARIES}")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(

View file

@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 469a141a2..eec19c7d0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -517,7 +517,7 @@ if (BZIP2_FOUND)
if (PC_BZIP2_FOUND)
list(APPEND PKGCONFIG_REQUIRES_PRIVATE "bzip2")
else ()
- list(APPEND PKGCONFIG_LIBS_PRIVATE "-lbz2")
+ list(APPEND PKGCONFIG_REQUIRES_PRIVATE "bzip2")
endif ()
endif ()
if (PNG_FOUND)

View file

@ -0,0 +1,40 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cb1b9a0f2..edca5d579 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -508,7 +508,6 @@ set(PKG_CONFIG_REQUIRED_PRIVATE "")
set(PKGCONFIG_LIBS_PRIVATE "")
if (ZLIB_FOUND)
- target_link_libraries(freetype PRIVATE ${ZLIB_LIBRARIES})
+ target_link_libraries(freetype PRIVATE ZLIB::ZLIB)
- target_include_directories(freetype PRIVATE ${ZLIB_INCLUDE_DIRS})
list(APPEND PKGCONFIG_REQUIRES_PRIVATE "zlib")
endif ()
@@ -596,12 +596,25 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
install(
EXPORT freetype-targets
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype
- FILE freetype-config.cmake
COMPONENT headers)
install(
FILES ${PROJECT_BINARY_DIR}/freetype-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype
COMPONENT headers)
+
+ if(ZLIB_FOUND AND BUILD_SHARED_LIBS)
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/freetype-config.cmake"
+[[include(CMakeFindDependencyMacro)
+find_dependency(ZLIB)
+include("${CMAKE_CURRENT_LIST_DIR}/freetype-targets.cmake")
+]])
+ else()
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/freetype-config.cmake"
+[[include("${CMAKE_CURRENT_LIST_DIR}/freetype-targets.cmake")
+]])
+ endif()
+
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freetype-config.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype)
endif ()

View file

@ -0,0 +1,98 @@
if("subpixel-rendering" IN_LIST FEATURES)
set(SUBPIXEL_RENDERING_PATCH "subpixel-rendering.patch")
endif()
string(REPLACE "." "-" VERSION_HYPHEN "${VERSION}")
vcpkg_from_gitlab(
GITLAB_URL https://gitlab.com/
OUT_SOURCE_PATH SOURCE_PATH
REPO freetype/freetype
REF "VER-${VERSION_HYPHEN}"
SHA512 fccfaa15eb79a105981bf634df34ac9ddf1c53550ec0b334903a1b21f9f8bf5eb2b3f9476e554afa112a0fca58ec85ab212d674dfd853670efec876bacbe8a53
HEAD_REF master
PATCHES
0003-Fix-UWP.patch
brotli-static.patch
bzip2.patch
fix-exports.patch
${SUBPIXEL_RENDERING_PATCH}
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
zlib FT_REQUIRE_ZLIB
bzip2 FT_REQUIRE_BZIP2
error-strings FT_ENABLE_ERROR_STRINGS
png FT_REQUIRE_PNG
brotli FT_REQUIRE_BROTLI
INVERTED_FEATURES
zlib FT_DISABLE_ZLIB
bzip2 FT_DISABLE_BZIP2
png FT_DISABLE_PNG
brotli FT_DISABLE_BROTLI
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DFT_DISABLE_HARFBUZZ=ON
${FEATURE_OPTIONS}
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/freetype)
# Rename for easy usage (VS integration; CMake and autotools will not care)
file(RENAME "${CURRENT_PACKAGES_DIR}/include/freetype2/freetype" "${CURRENT_PACKAGES_DIR}/include/freetype")
file(RENAME "${CURRENT_PACKAGES_DIR}/include/freetype2/ft2build.h" "${CURRENT_PACKAGES_DIR}/include/ft2build.h")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/freetype2")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
# Fix the include dir [freetype2 -> freetype]
file(READ "${CURRENT_PACKAGES_DIR}/share/freetype/freetype-targets.cmake" CONFIG_MODULE)
string(REPLACE "\${_IMPORT_PREFIX}/include/freetype2" "\${_IMPORT_PREFIX}/include" CONFIG_MODULE "${CONFIG_MODULE}")
string(REPLACE "\${_IMPORT_PREFIX}/lib/brotlicommon-static.lib" [[\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/brotlicommon-static.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/brotlicommon-static.lib>]] CONFIG_MODULE "${CONFIG_MODULE}")
string(REPLACE "\${_IMPORT_PREFIX}/lib/brotlidec-static.lib" [[\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/brotlidec-static.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/brotlidec-static.lib>]] CONFIG_MODULE "${CONFIG_MODULE}")
string(REPLACE "\${_IMPORT_PREFIX}/lib/brotlidec.lib" [[\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/brotlidec.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/brotlidec.lib>]] CONFIG_MODULE "${CONFIG_MODULE}")
string(REPLACE "\${_IMPORT_PREFIX}/lib/brotlidec.lib" [[\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/brotlidec.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/brotlidec.lib>]] CONFIG_MODULE "${CONFIG_MODULE}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/freetype/freetype-targets.cmake "${CONFIG_MODULE}")
find_library(FREETYPE_DEBUG NAMES freetyped PATHS "${CURRENT_PACKAGES_DIR}/debug/lib/" NO_DEFAULT_PATH)
if(NOT VCPKG_BUILD_TYPE)
file(READ "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/freetype2.pc" _contents)
if(FREETYPE_DEBUG)
string(REPLACE "-lfreetype" "-lfreetyped" _contents "${_contents}")
endif()
string(REPLACE "-I\${includedir}/freetype2" "-I\${includedir}" _contents "${_contents}")
file(WRITE "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/freetype2.pc" "${_contents}")
endif()
file(READ "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/freetype2.pc" _contents)
string(REPLACE "-I\${includedir}/freetype2" "-I\${includedir}" _contents "${_contents}")
file(WRITE "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/freetype2.pc" "${_contents}")
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
if(VCPKG_TARGET_IS_WINDOWS)
set(dll_linkage 1)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(dll_linkage 0)
endif()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/freetype/config/public-macros.h" "#elif defined( DLL_IMPORT )" "#elif ${dll_linkage}")
endif()
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake"
"${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(
FILE_LIST
"${SOURCE_PATH}/LICENSE.TXT"
"${SOURCE_PATH}/docs/FTL.TXT"
"${SOURCE_PATH}/docs/GPLv2.TXT"
)

View file

@ -0,0 +1,13 @@
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 1976b33af959..b3425e55feec 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -123,7 +123,7 @@ FT_BEGIN_HEADER
* When this macro is not defined, FreeType offers alternative LCD
* rendering technology that produces excellent output.
*/
-/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
+#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING
/**************************************************************************

View file

@ -0,0 +1,4 @@
freetype is compatible with built-in CMake targets:
find_package(Freetype REQUIRED)
target_link_libraries(main PRIVATE Freetype::Freetype) # since CMake 3.10

View file

@ -0,0 +1,95 @@
cmake_policy(PUSH)
cmake_policy(SET CMP0012 NEW)
cmake_policy(SET CMP0054 NEW)
list(REMOVE_ITEM ARGS "NO_MODULE" "CONFIG" "MODULE")
_find_package(${ARGS} CONFIG)
if(Freetype_FOUND)
include("${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake")
get_target_property(_freetype_include_dirs freetype INTERFACE_INCLUDE_DIRECTORIES)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
get_target_property(_freetype_location_debug freetype IMPORTED_IMPLIB_DEBUG)
get_target_property(_freetype_location_release freetype IMPORTED_IMPLIB_RELEASE)
endif()
if(NOT _freetype_location_debug AND NOT _freetype_location_release)
get_target_property(_freetype_location_debug freetype IMPORTED_LOCATION_DEBUG)
get_target_property(_freetype_location_release freetype IMPORTED_LOCATION_RELEASE)
endif()
set(FREETYPE_FOUND TRUE)
set(FREETYPE_INCLUDE_DIRS "${_freetype_include_dirs}")
set(FREETYPE_INCLUDE_DIR_ft2build "${_freetype_include_dirs}")
set(FREETYPE_INCLUDE_DIR_freetype2 "${_freetype_include_dirs}")
set(FREETYPE_LIBRARY_DEBUG "${_freetype_location_debug}" CACHE INTERNAL "vcpkg")
set(FREETYPE_LIBRARY_RELEASE "${_freetype_location_release}" CACHE INTERNAL "vcpkg")
select_library_configurations(FREETYPE)
set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY})
set(FREETYPE_VERSION_STRING "${Freetype_VERSION}")
unset(_freetype_include_dirs)
unset(_freetype_location_debug)
unset(_freetype_location_release)
endif()
if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
if("@FT_REQUIRE_ZLIB@")
find_package(ZLIB)
endif()
if("@FT_REQUIRE_BZIP2@")
find_package(BZip2)
endif()
if("@FT_REQUIRE_PNG@")
find_package(PNG)
endif()
if("@FT_REQUIRE_BROTLI@")
find_library(BROTLIDEC_LIBRARY_RELEASE NAMES brotlidec brotlidec-static PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" PATH_SUFFIXES lib NO_DEFAULT_PATH)
find_library(BROTLIDEC_LIBRARY_DEBUG NAMES brotlidec brotlidec-static brotlidecd brotlidec-staticd PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" PATH_SUFFIXES lib NO_DEFAULT_PATH)
find_library(BROTLICOMMON_LIBRARY_RELEASE NAMES brotlicommon brotlicommon-static PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" PATH_SUFFIXES lib NO_DEFAULT_PATH)
find_library(BROTLICOMMON_LIBRARY_DEBUG NAMES brotlicommon brotlicommon-static brotlicommond brotlicommon-staticd PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug" PATH_SUFFIXES lib NO_DEFAULT_PATH)
include(SelectLibraryConfigurations)
select_library_configurations(BROTLIDEC)
select_library_configurations(BROTLICOMMON)
endif("@FT_REQUIRE_BROTLI@")
if(TARGET Freetype::Freetype)
if("@FT_REQUIRE_ZLIB@")
set_property(TARGET Freetype::Freetype APPEND PROPERTY INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
endif()
if("@FT_REQUIRE_BZIP2@")
set_property(TARGET Freetype::Freetype APPEND PROPERTY INTERFACE_LINK_LIBRARIES BZip2::BZip2)
endif()
if("@FT_REQUIRE_PNG@")
set_property(TARGET Freetype::Freetype APPEND PROPERTY INTERFACE_LINK_LIBRARIES PNG::PNG)
endif()
if("@FT_REQUIRE_BROTLI@")
if(BROTLIDEC_LIBRARY_DEBUG)
set_property(TARGET Freetype::Freetype APPEND PROPERTY INTERFACE_LINK_LIBRARIES "\$<\$<CONFIG:DEBUG>:${BROTLIDEC_LIBRARY_DEBUG}>")
set_property(TARGET Freetype::Freetype APPEND PROPERTY INTERFACE_LINK_LIBRARIES "\$<\$<CONFIG:DEBUG>:${BROTLICOMMON_LIBRARY_DEBUG}>")
endif()
if(BROTLIDEC_LIBRARY_RELEASE)
set_property(TARGET Freetype::Freetype APPEND PROPERTY INTERFACE_LINK_LIBRARIES "\$<\$<NOT:$<CONFIG:DEBUG>>:${BROTLIDEC_LIBRARY_RELEASE}>")
set_property(TARGET Freetype::Freetype APPEND PROPERTY INTERFACE_LINK_LIBRARIES "\$<\$<NOT:$<CONFIG:DEBUG>>:${BROTLICOMMON_LIBRARY_RELEASE}>")
endif()
endif()
endif()
if(FREETYPE_LIBRARIES)
if("@FT_REQUIRE_ZLIB@")
list(APPEND FREETYPE_LIBRARIES ${ZLIB_LIBRARIES})
endif()
if("@FT_REQUIRE_BZIP2@")
list(APPEND FREETYPE_LIBRARIES ${BZIP2_LIBRARIES})
endif()
if("@FT_REQUIRE_PNG@")
list(APPEND FREETYPE_LIBRARIES ${PNG_LIBRARIES})
endif()
if("@FT_REQUIRE_BROTLI@")
list(APPEND FREETYPE_LIBRARIES ${BROTLIDEC_LIBRARIES} ${BROTLICOMMON_LIBRARIES})
endif()
endif()
endif()
cmake_policy(POP)

View file

@ -0,0 +1,55 @@
{
"name": "freetype",
"version": "2.13.3",
"description": "A library to render fonts.",
"homepage": "https://www.freetype.org/",
"license": "FTL OR GPL-2.0-or-later",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"default-features": [
"brotli",
"bzip2",
"png",
"zlib"
],
"features": {
"brotli": {
"description": "Support decompression of WOFF2 streams",
"dependencies": [
"brotli"
]
},
"bzip2": {
"description": "Support bzip2 compressed fonts.",
"dependencies": [
"bzip2"
]
},
"error-strings": {
"description": "Enable support for meaningful error descriptions."
},
"png": {
"description": "Support PNG compressed OpenType embedded bitmaps.",
"dependencies": [
"libpng"
]
},
"subpixel-rendering": {
"description": "Enables subpixel rendering."
},
"zlib": {
"description": "Use zlib instead of internal library for DEFLATE",
"dependencies": [
"zlib"
]
}
}
}