summaryrefslogtreecommitdiff
path: root/Build/source/libs/freetype2/freetype-src/CMakeLists.txt
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2020-05-10 06:48:17 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2020-05-10 06:48:17 +0000
commit1ebd3ac2252d05a85495dbed4d2131b9dcc068e9 (patch)
treeff4d9c3b0635402e0df6ae75b4ce66364dfc7171 /Build/source/libs/freetype2/freetype-src/CMakeLists.txt
parent3fa60b71f26b9166920881009ec8a0dffbda13c3 (diff)
freetype2 2.10.2
git-svn-id: svn://tug.org/texlive/trunk@55087 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/freetype2/freetype-src/CMakeLists.txt')
-rw-r--r--Build/source/libs/freetype2/freetype-src/CMakeLists.txt125
1 files changed, 86 insertions, 39 deletions
diff --git a/Build/source/libs/freetype2/freetype-src/CMakeLists.txt b/Build/source/libs/freetype2/freetype-src/CMakeLists.txt
index e3ffb83ba18..a7aec4d05da 100644
--- a/Build/source/libs/freetype2/freetype-src/CMakeLists.txt
+++ b/Build/source/libs/freetype2/freetype-src/CMakeLists.txt
@@ -1,6 +1,6 @@
# CMakeLists.txt
#
-# Copyright (C) 2013-2019 by
+# Copyright (C) 2013-2020 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# Written originally by John Cary <cary@txcorp.com>
@@ -14,14 +14,14 @@
#
# The following will 1. create a build directory and 2. change into it and
# call cmake to configure the build with default parameters as a static
-# library.
+# library. See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
+# for information about Debug, Release, etc. builds.
#
-# cmake -E make_directory build
-# cmake -E chdir build cmake ..
+# cmake -B build -D CMAKE_BUILD_TYPE=Release
#
# For a dynamic library, use
#
-# cmake -E chdir build cmake -D BUILD_SHARED_LIBS:BOOL=true ..
+# cmake -B build -D BUILD_SHARED_LIBS=true -D CMAKE_BUILD_TYPE=Release
#
# For a framework on OS X, use
#
@@ -68,14 +68,26 @@
# . `CMakeLists.txt' is provided as-is since it is normally not used by the
# developer team.
#
-# . Set the `FT_WITH_ZLIB', `FT_WITH_BZIP2', `FT_WITH_PNG', and
-# `FT_WITH_HARFBUZZ' CMake variables to `ON' to force using a dependency.
-# Leave a variable undefined (which is the default) to use the dependency
-# only if it is available. Set `CMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE' to
-# disable a dependency completely (CMake package name, so `BZip2' instead of
-# `BZIP2'). Example:
+# . Set the `FT_WITH_ZLIB', `FT_WITH_BZIP2', `FT_WITH_PNG',
+# `FT_WITH_HARFBUZZ', and `FT_WITH_BROTLI' CMake variables to `ON' to
+# force using a dependency. Leave a variable undefined (which is the
+# default) to use the dependency only if it is available. Example:
#
-# cmake -DFT_WITH_ZLIB=ON -DCMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE [...]
+# cmake -B build -D FT_WITH_ZLIB=ON \
+# -D FT_WITH_BZIP2=ON \
+# -D FT_WITH_PNG=ON \
+# -D FT_WITH_HARFBUZZ=ON \
+# -D FT_WITH_BROTLI=ON [...]
+#
+# Set `CMAKE_DISABLE_FIND_PACKAGE_XXX=TRUE' to disable a dependency completely
+# (where `XXX' is a CMake package name like `BZip2'). Example for disabling all
+# dependencies:
+#
+# cmake -B build -D CMAKE_DISABLE_FIND_PACKAGE_ZLIB=TRUE \
+# -D CMAKE_DISABLE_FIND_PACKAGE_BZip2=TRUE \
+# -D CMAKE_DISABLE_FIND_PACKAGE_PNG=TRUE \
+# -D CMAKE_DISABLE_FIND_PACKAGE_HarfBuzz=TRUE \
+# -D CMAKE_DISABLE_FIND_PACKAGE_BrotliDec=TRUE [...]
#
# . Installation of FreeType can be controlled with the CMake variables
# `SKIP_INSTALL_HEADERS', `SKIP_INSTALL_LIBRARIES', and `SKIP_INSTALL_ALL'
@@ -89,7 +101,7 @@ cmake_minimum_required(VERSION 2.8.12)
if (NOT CMAKE_VERSION VERSION_LESS 3.3)
# Allow symbol visibility settings also on static libraries. CMake < 3.3
- # only sets the propery on a shared library build.
+ # only sets the property on a shared library build.
cmake_policy(SET CMP0063 NEW)
endif ()
@@ -135,26 +147,34 @@ project(freetype C)
set(VERSION_MAJOR "2")
set(VERSION_MINOR "10")
-set(VERSION_PATCH "1")
-
-# SOVERSION scheme: CURRENT.AGE.REVISION
-# If there was an incompatible interface change:
-# Increment CURRENT. Set AGE and REVISION to 0
-# If there was a compatible interface change:
-# Increment AGE. Set REVISION to 0
-# If the source code was changed, but there were no interface changes:
-# Increment REVISION.
-set(LIBRARY_VERSION "6.16.0")
-set(LIBRARY_SOVERSION "6")
-
-# These options mean "require x and complain if not found". They'll get
-# optionally found anyway. Use `-DCMAKE_DISABLE_FIND_PACKAGE_x=TRUE` to disable
-# searching for a packge entirely (x is the CMake package name, so "BZip2"
-# instead of "BZIP2").
+set(VERSION_PATCH "2")
+
+# Generate LIBRARY_VERSION and LIBRARY_SOVERSION.
+set(LIBTOOL_REGEX "version_info='([0-9]+):([0-9]+):([0-9]+)'")
+file(STRINGS "${PROJECT_SOURCE_DIR}/builds/unix/configure.raw"
+ VERSION_INFO
+ REGEX ${LIBTOOL_REGEX})
+string(REGEX REPLACE
+ ${LIBTOOL_REGEX} "\\1"
+ LIBTOOL_CURRENT "${VERSION_INFO}")
+string(REGEX REPLACE
+ ${LIBTOOL_REGEX} "\\2"
+ LIBTOOL_REVISION "${VERSION_INFO}")
+string(REGEX REPLACE
+ ${LIBTOOL_REGEX} "\\3"
+ LIBTOOL_AGE "${VERSION_INFO}")
+
+# This is what libtool does internally on Unix platforms.
+math(EXPR LIBRARY_SOVERSION "${LIBTOOL_CURRENT} - ${LIBTOOL_AGE}")
+set(LIBRARY_VERSION "${LIBRARY_SOVERSION}.${LIBTOOL_AGE}.${LIBTOOL_REVISION}")
+
+# External dependency library detection is automatic. See the notes at the top
+# of this file, for how to force or disable dependencies completely.
option(FT_WITH_ZLIB "Use system zlib instead of internal library." OFF)
option(FT_WITH_BZIP2 "Support bzip2 compressed fonts." OFF)
option(FT_WITH_PNG "Support PNG compressed OpenType embedded bitmaps." OFF)
option(FT_WITH_HARFBUZZ "Improve auto-hinting of OpenType fonts." OFF)
+option(FT_WITH_BROTLI "Support compressed WOFF2 fonts." OFF)
# Disallow in-source builds
@@ -185,10 +205,11 @@ endif ()
# Find dependencies
+set(HARFBUZZ_MIN_VERSION "1.8.0")
if (FT_WITH_HARFBUZZ)
- find_package(HarfBuzz 1.3.0 REQUIRED)
+ find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION} REQUIRED)
else ()
- find_package(HarfBuzz 1.3.0)
+ find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION})
endif ()
if (FT_WITH_PNG)
@@ -209,6 +230,12 @@ else ()
find_package(BZip2)
endif ()
+if (FT_WITH_BROTLI)
+ find_package(BrotliDec REQUIRED)
+else ()
+ find_package(BrotliDec)
+endif ()
+
# Create the configuration file
if (UNIX)
check_include_file("unistd.h" HAVE_UNISTD_H)
@@ -273,6 +300,11 @@ if (HARFBUZZ_FOUND)
"/\\* +(#define +FT_CONFIG_OPTION_USE_HARFBUZZ) +\\*/" "\\1"
FTOPTION_H "${FTOPTION_H}")
endif ()
+if (BROTLIDEC_FOUND)
+ string(REGEX REPLACE
+ "/\\* +(#define +FT_CONFIG_OPTION_USE_BROTLI) +\\*/" "\\1"
+ FTOPTION_H "${FTOPTION_H}")
+endif ()
set(FTOPTION_H_NAME "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h")
if (EXISTS "${FTOPTION_H_NAME}")
@@ -308,7 +340,6 @@ set(BASE_SRCS
src/base/ftpfr.c
src/base/ftstroke.c
src/base/ftsynth.c
- src/base/ftsystem.c
src/base/fttype1.c
src/base/ftwinfnt.c
src/bdf/bdf.c
@@ -332,6 +363,12 @@ set(BASE_SRCS
src/winfonts/winfnt.c
)
+if (UNIX)
+ list(APPEND BASE_SRCS "builds/unix/ftsystem.c")
+else ()
+ list(APPEND BASE_SRCS "src/base/ftsystem.c")
+endif ()
+
if (WIN32)
enable_language(RC)
list(APPEND BASE_SRCS builds/windows/ftdebug.c
@@ -390,7 +427,11 @@ target_include_directories(
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/include
- ${CMAKE_CURRENT_SOURCE_DIR}/include)
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+
+ # Make <ftconfig.h> available for builds/unix/ftsystem.c.
+ ${CMAKE_CURRENT_BINARY_DIR}/include/freetype/config
+)
if (BUILD_FRAMEWORK)
@@ -411,23 +452,29 @@ set(PKG_CONFIG_REQUIRED_PRIVATE "")
if (ZLIB_FOUND)
target_link_libraries(freetype PRIVATE ${ZLIB_LIBRARIES})
target_include_directories(freetype PRIVATE ${ZLIB_INCLUDE_DIRS})
- list(APPEND PKG_CONFIG_REQUIRED_PRIVATE zlib)
+ list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "zlib")
endif ()
if (BZIP2_FOUND)
target_link_libraries(freetype PRIVATE ${BZIP2_LIBRARIES})
target_include_directories(freetype PRIVATE ${BZIP2_INCLUDE_DIR}) # not BZIP2_INCLUDE_DIRS
- list(APPEND PKG_CONFIG_REQUIRED_PRIVATE bzip2)
+ list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "bzip2")
endif ()
if (PNG_FOUND)
target_link_libraries(freetype PRIVATE ${PNG_LIBRARIES})
target_compile_definitions(freetype PRIVATE ${PNG_DEFINITIONS})
target_include_directories(freetype PRIVATE ${PNG_INCLUDE_DIRS})
- list(APPEND PKG_CONFIG_REQUIRED_PRIVATE libpng)
+ list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "libpng")
endif ()
if (HARFBUZZ_FOUND)
target_link_libraries(freetype PRIVATE ${HARFBUZZ_LIBRARIES})
target_include_directories(freetype PRIVATE ${HARFBUZZ_INCLUDE_DIRS})
- list(APPEND PKG_CONFIG_REQUIRED_PRIVATE harfbuzz)
+ list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "harfbuzz >= ${HARFBUZZ_MIN_VERSION}")
+endif ()
+if (BROTLIDEC_FOUND)
+ target_link_libraries(freetype PRIVATE ${BROTLIDEC_LIBRARIES})
+ target_compile_definitions(freetype PRIVATE ${BROTLIDEC_DEFINITIONS})
+ target_include_directories(freetype PRIVATE ${BROTLIDEC_INCLUDE_DIRS})
+ list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "libbrotlidec")
endif ()
@@ -453,7 +500,7 @@ endif ()
if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
# Generate the pkg-config file
if (UNIX)
- file(READ ${PROJECT_SOURCE_DIR}/builds/unix/freetype2.in FREETYPE2_PC_IN)
+ file(READ "${PROJECT_SOURCE_DIR}/builds/unix/freetype2.in" FREETYPE2_PC_IN)
string(REPLACE ";" ", " PKG_CONFIG_REQUIRED_PRIVATE "${PKG_CONFIG_REQUIRED_PRIVATE}")
@@ -465,7 +512,7 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%includedir%" "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
- string(REPLACE "%ft_version%" "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
+ string(REPLACE "%ft_version%" "${LIBTOOL_CURRENT}.${LIBTOOL_REVISION}.${LIBTOOL_AGE}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
string(REPLACE "%REQUIRES_PRIVATE%" "${PKG_CONFIG_REQUIRED_PRIVATE}"
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})