2013-10-24 08:49:08 +02:00
|
|
|
# CMakeLists.txt
|
|
|
|
#
|
2021-01-17 07:18:48 +01:00
|
|
|
# Copyright (C) 2013-2021 by
|
2013-10-24 08:49:08 +02:00
|
|
|
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
|
|
|
#
|
2015-06-28 11:07:07 +02:00
|
|
|
# Written originally by John Cary <cary@txcorp.com>
|
2013-10-24 08:49:08 +02:00
|
|
|
#
|
|
|
|
# This file is part of the FreeType project, and may only be used, modified,
|
|
|
|
# and distributed under the terms of the FreeType project license,
|
|
|
|
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
|
|
|
|
# indicate that you have read the license and understand and accept it
|
|
|
|
# fully.
|
|
|
|
#
|
2015-06-28 11:07:07 +02:00
|
|
|
#
|
2018-04-07 22:34:24 +02:00
|
|
|
# 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
|
2019-11-08 00:39:41 +01:00
|
|
|
# library. See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
|
|
|
|
# for information about Debug, Release, etc. builds.
|
2013-10-24 08:49:08 +02:00
|
|
|
#
|
2019-11-08 00:39:41 +01:00
|
|
|
# cmake -B build -D CMAKE_BUILD_TYPE=Release
|
2014-05-16 08:09:43 +02:00
|
|
|
#
|
|
|
|
# For a dynamic library, use
|
2013-10-24 08:49:08 +02:00
|
|
|
#
|
2019-11-08 00:39:41 +01:00
|
|
|
# cmake -B build -D BUILD_SHARED_LIBS=true -D CMAKE_BUILD_TYPE=Release
|
2013-10-24 08:49:08 +02:00
|
|
|
#
|
2014-05-16 08:09:43 +02:00
|
|
|
# For a framework on OS X, use
|
|
|
|
#
|
2018-04-07 22:34:24 +02:00
|
|
|
# cmake -E chdir build cmake -G Xcode -D BUILD_FRAMEWORK:BOOL=true ..
|
2014-10-18 10:42:28 +02:00
|
|
|
#
|
|
|
|
# For an iOS static library, use
|
|
|
|
#
|
2018-04-07 22:34:24 +02:00
|
|
|
# cmake -E chdir build cmake -G Xcode -D IOS_PLATFORM=OS ..
|
2014-10-18 10:42:28 +02:00
|
|
|
#
|
|
|
|
# or
|
|
|
|
#
|
2018-04-07 22:34:24 +02:00
|
|
|
# cmake -E chdir build cmake -G Xcode -D IOS_PLATFORM=SIMULATOR ..
|
|
|
|
#
|
2018-06-10 14:19:31 +02:00
|
|
|
# or
|
|
|
|
#
|
|
|
|
# cmake -E chdir build cmake -G Xcode -D IOS_PLATFORM=SIMULATOR64 ..
|
|
|
|
#
|
2018-04-07 22:34:24 +02:00
|
|
|
# Finally, build the project with:
|
|
|
|
#
|
|
|
|
# cmake --build build
|
|
|
|
#
|
|
|
|
# Install it with
|
|
|
|
#
|
|
|
|
# (sudo) cmake --build build --target install
|
|
|
|
#
|
|
|
|
# A binary distribution can be made with
|
|
|
|
#
|
|
|
|
# cmake --build build --config Release --target package
|
2014-10-18 10:42:28 +02:00
|
|
|
#
|
|
|
|
# Please refer to the cmake manual for further options, in particular, how
|
|
|
|
# to modify compilation and linking parameters.
|
2013-10-24 08:49:08 +02:00
|
|
|
#
|
|
|
|
# Some notes.
|
|
|
|
#
|
2015-06-28 11:07:07 +02:00
|
|
|
# . `cmake' creates configuration files in
|
|
|
|
#
|
|
|
|
# <build-directory>/include/freetype/config
|
|
|
|
#
|
|
|
|
# which should be further modified if necessary.
|
2013-10-24 08:49:08 +02:00
|
|
|
#
|
|
|
|
# . You can use `cmake' directly on a freshly cloned FreeType git
|
|
|
|
# repository.
|
|
|
|
#
|
2015-06-28 11:07:07 +02:00
|
|
|
# . `CMakeLists.txt' is provided as-is since it is normally not used by the
|
2013-10-24 08:49:08 +02:00
|
|
|
# developer team.
|
2015-11-27 06:34:39 +01:00
|
|
|
#
|
2019-09-05 14:10:01 +02:00
|
|
|
# . 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
|
2019-11-08 00:39:41 +01:00
|
|
|
# default) to use the dependency only if it is available. Example:
|
2019-09-05 14:10:01 +02:00
|
|
|
#
|
2019-11-08 00:39:41 +01:00
|
|
|
# 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 [...]
|
2015-11-27 07:11:42 +01:00
|
|
|
#
|
2019-11-08 00:39:41 +01:00
|
|
|
# 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 [...]
|
2016-04-16 10:24:24 +02:00
|
|
|
#
|
|
|
|
# . Installation of FreeType can be controlled with the CMake variables
|
|
|
|
# `SKIP_INSTALL_HEADERS', `SKIP_INSTALL_LIBRARIES', and `SKIP_INSTALL_ALL'
|
|
|
|
# (this is compatible with the same CMake variables in zlib's CMake
|
|
|
|
# support).
|
2013-10-24 08:49:08 +02:00
|
|
|
|
2018-04-07 22:34:24 +02:00
|
|
|
# FreeType explicitly marks the API to be exported and relies on the compiler
|
|
|
|
# to hide all other symbols. CMake supports a C_VISBILITY_PRESET property
|
|
|
|
# starting with 2.8.12.
|
|
|
|
cmake_minimum_required(VERSION 2.8.12)
|
2013-10-24 08:49:08 +02:00
|
|
|
|
2018-04-07 22:34:24 +02:00
|
|
|
if (NOT CMAKE_VERSION VERSION_LESS 3.3)
|
|
|
|
# Allow symbol visibility settings also on static libraries. CMake < 3.3
|
2019-09-05 12:02:59 +02:00
|
|
|
# only sets the property on a shared library build.
|
2018-04-07 22:34:24 +02:00
|
|
|
cmake_policy(SET CMP0063 NEW)
|
2021-05-15 23:36:00 +02:00
|
|
|
|
|
|
|
# Support new IN_LIST if() operator.
|
|
|
|
cmake_policy(SET CMP0057 NEW)
|
2018-04-07 22:34:24 +02:00
|
|
|
endif ()
|
2015-06-28 10:42:47 +02:00
|
|
|
|
|
|
|
include(CheckIncludeFile)
|
|
|
|
|
2014-10-18 10:42:28 +02:00
|
|
|
# CMAKE_TOOLCHAIN_FILE must be set before `project' is called, which
|
|
|
|
# configures the base build environment and references the toolchain file
|
|
|
|
if (APPLE)
|
|
|
|
if (DEFINED IOS_PLATFORM)
|
|
|
|
if (NOT "${IOS_PLATFORM}" STREQUAL "OS"
|
2018-06-10 14:19:31 +02:00
|
|
|
AND NOT "${IOS_PLATFORM}" STREQUAL "SIMULATOR"
|
|
|
|
AND NOT "${IOS_PLATFORM}" STREQUAL "SIMULATOR64")
|
2014-10-18 10:42:28 +02:00
|
|
|
message(FATAL_ERROR
|
2018-06-10 14:19:31 +02:00
|
|
|
"IOS_PLATFORM must be set to either OS, SIMULATOR, or SIMULATOR64")
|
2014-10-18 10:42:28 +02:00
|
|
|
endif ()
|
|
|
|
if (NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode")
|
|
|
|
message(AUTHOR_WARNING
|
|
|
|
"You should use Xcode generator with IOS_PLATFORM enabled to get Universal builds.")
|
|
|
|
endif ()
|
|
|
|
if (BUILD_SHARED_LIBS)
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"BUILD_SHARED_LIBS can not be on with IOS_PLATFORM enabled")
|
|
|
|
endif ()
|
|
|
|
if (BUILD_FRAMEWORK)
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"BUILD_FRAMEWORK can not be on with IOS_PLATFORM enabled")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
# iOS only uses static libraries
|
|
|
|
set(BUILD_SHARED_LIBS OFF)
|
|
|
|
|
|
|
|
set(CMAKE_TOOLCHAIN_FILE
|
2016-03-11 06:50:23 +01:00
|
|
|
${CMAKE_SOURCE_DIR}/builds/cmake/iOS.cmake)
|
2014-10-18 10:42:28 +02:00
|
|
|
endif ()
|
|
|
|
else ()
|
|
|
|
if (DEFINED IOS_PLATFORM)
|
|
|
|
message(FATAL_ERROR "IOS_PLATFORM is not supported on this platform")
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
|
2015-06-28 10:26:33 +02:00
|
|
|
|
2018-04-07 22:34:24 +02:00
|
|
|
project(freetype C)
|
|
|
|
|
|
|
|
set(VERSION_MAJOR "2")
|
* Version 2.10.0 released.
==========================
Tag sources with `VER-2-10-0'.
* docs/VERSION.TXT: Add entry for version 2.10.0.
* docs/CHANGES: Updated.
* README, Jamfile (RefDoc), src/base/ftver.rc,
builds/windows/vc2010/freetype.vcxproj,
builds/windows/vc2010/index.html,
builds/windows/visualc/freetype.dsp,
builds/windows/visualc/freetype.vcproj,
builds/windows/visualc/index.html,
builds/windows/visualce/freetype.dsp,
builds/windows/visualce/freetype.vcproj,
builds/windows/visualce/index.html,
builds/wince/vc2005-ce/freetype.vcproj,
builds/wince/vc2005-ce/index.html,
builds/wince/vc2008-ce/freetype.vcproj,
builds/wince/vc2008-ce/index.html: s/2.9.1/2.10.0/, s/291/2100/.
* include/freetype/freetype.h (FREETYPE_MINOR): Set to 10.
(FREETYPE_PATCH): Set to 0.
* builds/unix/configure.raw (version_info): Set to 23:0:17.
* CMakeLists.txt (VERSION_MINOR): Set to 10.
(VERSION_PATCH): Set to 0.
* builds/toplevel.mk (version, winversion): Since the minor version
number has two digits now, never omit the patch number. We would
get ambiguous zip file names otherwise.
(dist): Remove remnants of `docmaker' tool.
(do-dist): Remove unused intermediate files.
* src/cff/cffparse.c (destrict_c2s_item): Guard function with
CFF_CONFIG_OPTION_OLD_ENGINE macro.
2019-03-15 07:27:02 +01:00
|
|
|
set(VERSION_MINOR "10")
|
2020-10-20 07:10:27 +02:00
|
|
|
set(VERSION_PATCH "4")
|
2018-04-07 22:34:24 +02:00
|
|
|
|
2019-09-05 12:02:59 +02:00
|
|
|
# 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}")
|
2018-04-07 22:34:24 +02:00
|
|
|
|
2019-11-08 00:39:41 +01:00
|
|
|
# External dependency library detection is automatic. See the notes at the top
|
|
|
|
# of this file, for how to force or disable dependencies completely.
|
2018-04-07 22:34:24 +02:00
|
|
|
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)
|
2019-09-05 14:10:01 +02:00
|
|
|
option(FT_WITH_BROTLI "Support compressed WOFF2 fonts." OFF)
|
2013-10-24 08:49:08 +02:00
|
|
|
|
2015-06-28 10:26:33 +02:00
|
|
|
|
|
|
|
# Disallow in-source builds
|
2018-05-08 00:10:36 +02:00
|
|
|
if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
|
2015-06-28 10:26:33 +02:00
|
|
|
message(FATAL_ERROR
|
2018-04-07 22:34:24 +02:00
|
|
|
"In-source builds are not permitted! Make a separate folder for"
|
|
|
|
" building, e.g.,\n"
|
|
|
|
" cmake -E make_directory build\n"
|
|
|
|
" cmake -E chdir build cmake ..\n"
|
|
|
|
"Before that, remove the files created by this failed run with\n"
|
|
|
|
" cmake -E remove CMakeCache.txt\n"
|
|
|
|
" cmake -E remove_directory CMakeFiles")
|
2015-06-28 10:26:33 +02:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
2015-06-28 11:03:10 +02:00
|
|
|
# Add local cmake modules
|
2018-04-07 22:34:24 +02:00
|
|
|
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/builds/cmake)
|
2015-06-28 11:03:10 +02:00
|
|
|
|
|
|
|
|
2014-05-16 08:09:43 +02:00
|
|
|
if (BUILD_FRAMEWORK)
|
|
|
|
if (NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode")
|
2014-10-18 10:42:28 +02:00
|
|
|
message(FATAL_ERROR
|
|
|
|
"You should use Xcode generator with BUILD_FRAMEWORK enabled")
|
2014-05-16 08:09:43 +02:00
|
|
|
endif ()
|
|
|
|
set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD_32_64_BIT)")
|
|
|
|
set(BUILD_SHARED_LIBS ON)
|
|
|
|
endif ()
|
|
|
|
|
2015-06-28 11:03:10 +02:00
|
|
|
|
|
|
|
# Find dependencies
|
2021-01-23 14:15:29 +01:00
|
|
|
set(HARFBUZZ_MIN_VERSION "2.0.0")
|
2018-04-07 22:34:24 +02:00
|
|
|
if (FT_WITH_HARFBUZZ)
|
2019-09-05 12:02:59 +02:00
|
|
|
find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION} REQUIRED)
|
2018-04-07 22:34:24 +02:00
|
|
|
else ()
|
2019-09-05 12:02:59 +02:00
|
|
|
find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION})
|
2018-04-07 22:34:24 +02:00
|
|
|
endif ()
|
2015-06-28 11:03:10 +02:00
|
|
|
|
2018-04-07 22:34:24 +02:00
|
|
|
if (FT_WITH_PNG)
|
|
|
|
find_package(PNG REQUIRED)
|
|
|
|
else ()
|
|
|
|
find_package(PNG)
|
|
|
|
endif ()
|
2015-06-28 11:03:10 +02:00
|
|
|
|
2018-04-07 22:34:24 +02:00
|
|
|
if (FT_WITH_ZLIB)
|
|
|
|
find_package(ZLIB REQUIRED)
|
|
|
|
else ()
|
|
|
|
find_package(ZLIB)
|
|
|
|
endif ()
|
2013-10-24 08:49:08 +02:00
|
|
|
|
2018-04-07 22:34:24 +02:00
|
|
|
if (FT_WITH_BZIP2)
|
|
|
|
find_package(BZip2 REQUIRED)
|
|
|
|
else ()
|
|
|
|
find_package(BZip2)
|
|
|
|
endif ()
|
2015-06-28 11:03:10 +02:00
|
|
|
|
2019-09-05 14:10:01 +02:00
|
|
|
if (FT_WITH_BROTLI)
|
|
|
|
find_package(BrotliDec REQUIRED)
|
|
|
|
else ()
|
|
|
|
find_package(BrotliDec)
|
|
|
|
endif ()
|
|
|
|
|
2013-10-24 08:49:08 +02:00
|
|
|
# Create the configuration file
|
2015-06-25 16:38:11 +02:00
|
|
|
if (UNIX)
|
2015-06-28 10:42:47 +02:00
|
|
|
check_include_file("unistd.h" HAVE_UNISTD_H)
|
|
|
|
check_include_file("fcntl.h" HAVE_FCNTL_H)
|
2013-10-24 08:49:08 +02:00
|
|
|
|
2020-07-02 10:10:25 +02:00
|
|
|
file(READ "${PROJECT_SOURCE_DIR}/builds/unix/ftconfig.h.in"
|
2015-06-25 16:38:11 +02:00
|
|
|
FTCONFIG_H)
|
2015-06-28 10:42:47 +02:00
|
|
|
if (HAVE_UNISTD_H)
|
|
|
|
string(REGEX REPLACE
|
2018-04-07 22:34:24 +02:00
|
|
|
"#undef +(HAVE_UNISTD_H)" "#define \\1 1"
|
2015-06-28 10:42:47 +02:00
|
|
|
FTCONFIG_H "${FTCONFIG_H}")
|
|
|
|
endif ()
|
|
|
|
if (HAVE_FCNTL_H)
|
|
|
|
string(REGEX REPLACE
|
2018-04-07 22:34:24 +02:00
|
|
|
"#undef +(HAVE_FCNTL_H)" "#define \\1 1"
|
2015-06-28 10:42:47 +02:00
|
|
|
FTCONFIG_H "${FTCONFIG_H}")
|
|
|
|
endif ()
|
2019-04-15 10:46:19 +02:00
|
|
|
else ()
|
2018-05-03 00:19:55 +02:00
|
|
|
file(READ "${PROJECT_SOURCE_DIR}/include/freetype/config/ftconfig.h"
|
|
|
|
FTCONFIG_H)
|
2015-06-25 16:38:11 +02:00
|
|
|
endif ()
|
2019-04-15 10:46:19 +02:00
|
|
|
|
|
|
|
set(FTCONFIG_H_NAME "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h")
|
|
|
|
if (EXISTS "${FTCONFIG_H_NAME}")
|
|
|
|
file(READ "${FTCONFIG_H_NAME}" ORIGINAL_FTCONFIG_H)
|
|
|
|
else ()
|
|
|
|
set(ORIGINAL_FTCONFIG_H "")
|
|
|
|
endif ()
|
|
|
|
if (NOT (ORIGINAL_FTCONFIG_H STREQUAL FTCONFIG_H))
|
|
|
|
file(WRITE "${FTCONFIG_H_NAME}" "${FTCONFIG_H}")
|
|
|
|
endif ()
|
2013-10-24 08:49:08 +02:00
|
|
|
|
2015-06-28 10:42:47 +02:00
|
|
|
|
2015-06-28 11:03:10 +02:00
|
|
|
# Create the options file
|
|
|
|
file(READ "${PROJECT_SOURCE_DIR}/include/freetype/config/ftoption.h"
|
|
|
|
FTOPTION_H)
|
|
|
|
if (ZLIB_FOUND)
|
|
|
|
string(REGEX REPLACE
|
|
|
|
"/\\* +(#define +FT_CONFIG_OPTION_SYSTEM_ZLIB) +\\*/" "\\1"
|
|
|
|
FTOPTION_H "${FTOPTION_H}")
|
|
|
|
endif ()
|
|
|
|
if (BZIP2_FOUND)
|
|
|
|
string(REGEX REPLACE
|
|
|
|
"/\\* +(#define +FT_CONFIG_OPTION_USE_BZIP2) +\\*/" "\\1"
|
|
|
|
FTOPTION_H "${FTOPTION_H}")
|
|
|
|
endif ()
|
|
|
|
if (PNG_FOUND)
|
|
|
|
string(REGEX REPLACE
|
|
|
|
"/\\* +(#define +FT_CONFIG_OPTION_USE_PNG) +\\*/" "\\1"
|
|
|
|
FTOPTION_H "${FTOPTION_H}")
|
|
|
|
endif ()
|
|
|
|
if (HARFBUZZ_FOUND)
|
|
|
|
string(REGEX REPLACE
|
|
|
|
"/\\* +(#define +FT_CONFIG_OPTION_USE_HARFBUZZ) +\\*/" "\\1"
|
|
|
|
FTOPTION_H "${FTOPTION_H}")
|
|
|
|
endif ()
|
2019-09-05 14:10:01 +02:00
|
|
|
if (BROTLIDEC_FOUND)
|
|
|
|
string(REGEX REPLACE
|
|
|
|
"/\\* +(#define +FT_CONFIG_OPTION_USE_BROTLI) +\\*/" "\\1"
|
|
|
|
FTOPTION_H "${FTOPTION_H}")
|
|
|
|
endif ()
|
2019-04-15 10:46:19 +02:00
|
|
|
|
|
|
|
set(FTOPTION_H_NAME "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h")
|
|
|
|
if (EXISTS "${FTOPTION_H_NAME}")
|
|
|
|
file(READ "${FTOPTION_H_NAME}" ORIGINAL_FTOPTION_H)
|
|
|
|
else ()
|
|
|
|
set(ORIGINAL_FTOPTION_H "")
|
|
|
|
endif ()
|
|
|
|
if (NOT (ORIGINAL_FTOPTION_H STREQUAL FTOPTION_H))
|
|
|
|
file(WRITE "${FTOPTION_H_NAME}" "${FTOPTION_H}")
|
|
|
|
endif ()
|
2015-06-28 10:42:47 +02:00
|
|
|
|
|
|
|
|
Another adjustment to header locations.
This change is a result of a discussion thread on freetype-devel
http://lists.nongnu.org/archive/html/freetype-devel/2015-06/msg00041.html
Re-introduce the `freetype2' subdirectory for all FreeType header
files after installation, and rename the `freetype2' subdirectory in
the git repository to `freetype'.
* include/freetype2: Renamed to...
* include/freetype: This.
* CMakeLists.txt (PUBLIC_HEADERS, PUBLIC_CONFIG_HEADERS,
PRIVATE_HEADERS): Updated.
Update creation of `ftconfig.h'.
Install generated `ftconfig.h'.
* Jamfile (HDRMACRO, RefDoc), autogen.sh: Updated.
* builds/amiga/include/config/ftconfig.h, builds/freetype.mk
(PUBLIC_DIR), builds/symbian/bld.inf, builds/toplevel.mk (work),
builds/unix/freetype2.in: Updated.
* builds/unix/freetype-config.in: Updated.
* builds/unix/configure.raw: Don't check for `rmdir'.
* builds/unix/unix-def.in (DELDIR): Use `rm -rf', which is portable
according to the autoconf info manual.
* builds/unix/install.mk (install, uninstall,
distclean_project_unix): Update and simplify.
* builds/wince/*, builds/windows/*: Updated.
* devel/ft2build.h, include/ft2build.h: Updated.
* include/freetype2/config/ftheader.h,
include/freetype2/internal/ftserv.h,
include/freetype2/internal/internal.h: Update all header file
macros.
* src/tools/chktrcmp.py (TRACE_DEF_FILES): Updated.
* docs/*: Updated.
2015-06-25 13:04:57 +02:00
|
|
|
file(GLOB PUBLIC_HEADERS "include/ft2build.h" "include/freetype/*.h")
|
|
|
|
file(GLOB PUBLIC_CONFIG_HEADERS "include/freetype/config/*.h")
|
|
|
|
file(GLOB PRIVATE_HEADERS "include/freetype/internal/*.h")
|
2014-05-16 08:09:43 +02:00
|
|
|
|
2015-06-28 11:07:07 +02:00
|
|
|
|
2013-10-24 08:49:08 +02:00
|
|
|
set(BASE_SRCS
|
|
|
|
src/autofit/autofit.c
|
2015-06-25 15:45:13 +02:00
|
|
|
src/base/ftbase.c
|
2013-10-24 08:49:08 +02:00
|
|
|
src/base/ftbbox.c
|
2014-05-13 07:33:48 +02:00
|
|
|
src/base/ftbdf.c
|
2013-10-24 08:49:08 +02:00
|
|
|
src/base/ftbitmap.c
|
|
|
|
src/base/ftcid.c
|
|
|
|
src/base/ftfstype.c
|
|
|
|
src/base/ftgasp.c
|
|
|
|
src/base/ftglyph.c
|
|
|
|
src/base/ftgxval.c
|
|
|
|
src/base/ftinit.c
|
|
|
|
src/base/ftmm.c
|
|
|
|
src/base/ftotval.c
|
|
|
|
src/base/ftpatent.c
|
|
|
|
src/base/ftpfr.c
|
|
|
|
src/base/ftstroke.c
|
|
|
|
src/base/ftsynth.c
|
|
|
|
src/base/fttype1.c
|
|
|
|
src/base/ftwinfnt.c
|
|
|
|
src/bdf/bdf.c
|
|
|
|
src/bzip2/ftbzip2.c
|
|
|
|
src/cache/ftcache.c
|
|
|
|
src/cff/cff.c
|
|
|
|
src/cid/type1cid.c
|
|
|
|
src/gzip/ftgzip.c
|
|
|
|
src/lzw/ftlzw.c
|
|
|
|
src/pcf/pcf.c
|
|
|
|
src/pfr/pfr.c
|
|
|
|
src/psaux/psaux.c
|
|
|
|
src/pshinter/pshinter.c
|
2015-06-25 15:45:13 +02:00
|
|
|
src/psnames/psnames.c
|
2013-10-24 08:49:08 +02:00
|
|
|
src/raster/raster.c
|
2020-08-20 04:58:14 +02:00
|
|
|
src/sdf/sdf.c
|
2013-10-24 08:49:08 +02:00
|
|
|
src/sfnt/sfnt.c
|
|
|
|
src/smooth/smooth.c
|
|
|
|
src/truetype/truetype.c
|
|
|
|
src/type1/type1.c
|
|
|
|
src/type42/type42.c
|
|
|
|
src/winfonts/winfnt.c
|
|
|
|
)
|
|
|
|
|
2019-11-08 00:39:41 +01:00
|
|
|
if (UNIX)
|
|
|
|
list(APPEND BASE_SRCS "builds/unix/ftsystem.c")
|
2021-01-27 12:43:41 +01:00
|
|
|
elseif (WIN32)
|
|
|
|
list(APPEND BASE_SRCS "builds/windows/ftsystem.c")
|
2019-11-08 00:39:41 +01:00
|
|
|
else ()
|
|
|
|
list(APPEND BASE_SRCS "src/base/ftsystem.c")
|
|
|
|
endif ()
|
|
|
|
|
2015-06-26 06:46:59 +02:00
|
|
|
if (WIN32)
|
2018-04-07 22:34:24 +02:00
|
|
|
enable_language(RC)
|
|
|
|
list(APPEND BASE_SRCS builds/windows/ftdebug.c
|
|
|
|
src/base/ftver.rc)
|
2015-06-26 06:46:59 +02:00
|
|
|
elseif (WINCE)
|
2018-04-07 22:34:24 +02:00
|
|
|
list(APPEND BASE_SRCS builds/wince/ftdebug.c)
|
2015-06-26 06:46:59 +02:00
|
|
|
else ()
|
2018-04-07 22:34:24 +02:00
|
|
|
list(APPEND BASE_SRCS src/base/ftdebug.c)
|
2015-06-26 06:46:59 +02:00
|
|
|
endif ()
|
|
|
|
|
2014-05-16 08:09:43 +02:00
|
|
|
if (BUILD_FRAMEWORK)
|
2018-04-07 22:34:24 +02:00
|
|
|
list(APPEND BASE_SRCS builds/mac/freetype-Info.plist)
|
2014-05-16 08:09:43 +02:00
|
|
|
endif ()
|
|
|
|
|
2018-04-07 22:34:24 +02:00
|
|
|
|
2017-11-09 12:38:26 +01:00
|
|
|
if (NOT DISABLE_FORCE_DEBUG_POSTFIX)
|
|
|
|
set(CMAKE_DEBUG_POSTFIX d)
|
2019-04-15 10:46:19 +02:00
|
|
|
endif ()
|
2015-06-28 11:07:07 +02:00
|
|
|
|
2018-04-07 22:34:24 +02:00
|
|
|
|
2014-05-16 08:09:43 +02:00
|
|
|
add_library(freetype
|
|
|
|
${PUBLIC_HEADERS}
|
|
|
|
${PUBLIC_CONFIG_HEADERS}
|
|
|
|
${PRIVATE_HEADERS}
|
|
|
|
${BASE_SRCS}
|
|
|
|
)
|
|
|
|
|
2018-04-07 22:34:24 +02:00
|
|
|
set_target_properties(
|
|
|
|
freetype PROPERTIES
|
|
|
|
C_VISIBILITY_PRESET hidden)
|
|
|
|
|
|
|
|
target_compile_definitions(
|
|
|
|
freetype PRIVATE FT2_BUILD_LIBRARY)
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
target_compile_definitions(
|
|
|
|
freetype PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS)
|
2018-07-25 05:01:34 +02:00
|
|
|
if (BUILD_SHARED_LIBS)
|
|
|
|
target_compile_definitions(
|
|
|
|
freetype PRIVATE DLL_EXPORT)
|
|
|
|
endif ()
|
2018-04-07 22:34:24 +02:00
|
|
|
endif ()
|
2015-06-28 11:07:07 +02:00
|
|
|
|
2015-08-02 18:35:49 +02:00
|
|
|
if (BUILD_SHARED_LIBS)
|
|
|
|
set_target_properties(freetype PROPERTIES
|
2018-04-07 22:34:24 +02:00
|
|
|
VERSION ${LIBRARY_VERSION}
|
|
|
|
SOVERSION ${LIBRARY_SOVERSION})
|
2015-08-02 18:35:49 +02:00
|
|
|
endif ()
|
|
|
|
|
2018-05-08 00:10:36 +02:00
|
|
|
# Pick up ftconfig.h and ftoption.h generated above, first.
|
2018-04-07 22:34:24 +02:00
|
|
|
target_include_directories(
|
|
|
|
freetype
|
2018-05-08 00:10:36 +02:00
|
|
|
PUBLIC
|
|
|
|
$<INSTALL_INTERFACE:include/freetype2>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
|
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
2018-08-31 07:34:30 +02:00
|
|
|
PRIVATE
|
2018-05-08 00:10:36 +02:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/include
|
2019-11-08 00:39:41 +01:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
|
|
|
|
|
|
# Make <ftconfig.h> available for builds/unix/ftsystem.c.
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/include/freetype/config
|
|
|
|
)
|
2018-04-07 22:34:24 +02:00
|
|
|
|
2015-08-02 18:35:49 +02:00
|
|
|
|
2014-05-16 08:09:43 +02:00
|
|
|
if (BUILD_FRAMEWORK)
|
|
|
|
set_property(SOURCE ${PUBLIC_CONFIG_HEADERS}
|
|
|
|
PROPERTY MACOSX_PACKAGE_LOCATION Headers/config
|
|
|
|
)
|
|
|
|
set_target_properties(freetype PROPERTIES
|
|
|
|
FRAMEWORK TRUE
|
|
|
|
MACOSX_FRAMEWORK_INFO_PLIST builds/mac/freetype-Info.plist
|
|
|
|
PUBLIC_HEADER "${PUBLIC_HEADERS}"
|
|
|
|
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
|
|
|
|
)
|
|
|
|
endif ()
|
2013-10-24 08:49:08 +02:00
|
|
|
|
2015-11-27 18:37:21 +01:00
|
|
|
|
2018-04-07 22:34:24 +02:00
|
|
|
set(PKG_CONFIG_REQUIRED_PRIVATE "")
|
2021-02-14 21:25:21 +01:00
|
|
|
set(PKG_CONFIG_LIBS_PRIVATE "")
|
2015-06-28 11:03:10 +02:00
|
|
|
|
|
|
|
if (ZLIB_FOUND)
|
2018-04-07 22:34:24 +02:00
|
|
|
target_link_libraries(freetype PRIVATE ${ZLIB_LIBRARIES})
|
|
|
|
target_include_directories(freetype PRIVATE ${ZLIB_INCLUDE_DIRS})
|
2019-09-05 12:02:59 +02:00
|
|
|
list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "zlib")
|
2015-06-28 11:03:10 +02:00
|
|
|
endif ()
|
|
|
|
if (BZIP2_FOUND)
|
2018-04-07 22:34:24 +02:00
|
|
|
target_link_libraries(freetype PRIVATE ${BZIP2_LIBRARIES})
|
|
|
|
target_include_directories(freetype PRIVATE ${BZIP2_INCLUDE_DIR}) # not BZIP2_INCLUDE_DIRS
|
2021-02-14 21:25:21 +01:00
|
|
|
list(APPEND PKG_CONFIG_LIBS_PRIVATE "-lbz2")
|
2015-06-28 11:03:10 +02:00
|
|
|
endif ()
|
|
|
|
if (PNG_FOUND)
|
2018-04-07 22:34:24 +02:00
|
|
|
target_link_libraries(freetype PRIVATE ${PNG_LIBRARIES})
|
|
|
|
target_compile_definitions(freetype PRIVATE ${PNG_DEFINITIONS})
|
|
|
|
target_include_directories(freetype PRIVATE ${PNG_INCLUDE_DIRS})
|
2019-09-05 12:02:59 +02:00
|
|
|
list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "libpng")
|
2015-06-28 11:03:10 +02:00
|
|
|
endif ()
|
2021-05-15 23:36:00 +02:00
|
|
|
if (HarfBuzz_FOUND)
|
|
|
|
target_link_libraries(freetype PRIVATE ${HarfBuzz_LIBRARY})
|
|
|
|
target_include_directories(freetype PRIVATE ${HarfBuzz_INCLUDE_DIRS})
|
2019-09-05 12:02:59 +02:00
|
|
|
list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "harfbuzz >= ${HARFBUZZ_MIN_VERSION}")
|
2015-06-28 11:03:10 +02:00
|
|
|
endif ()
|
2019-09-05 14:10:01 +02:00
|
|
|
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 ()
|
2015-06-28 11:03:10 +02:00
|
|
|
|
|
|
|
|
2018-04-07 22:34:24 +02:00
|
|
|
# Installation
|
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2016-04-16 10:24:24 +02:00
|
|
|
if (NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL)
|
2018-04-07 22:34:24 +02:00
|
|
|
install(
|
|
|
|
# Note the trailing slash in the argument to `DIRECTORY'!
|
|
|
|
DIRECTORY ${PROJECT_SOURCE_DIR}/include/
|
|
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/freetype2
|
|
|
|
COMPONENT headers
|
|
|
|
PATTERN "internal" EXCLUDE
|
|
|
|
PATTERN "ftconfig.h" EXCLUDE
|
|
|
|
PATTERN "ftoption.h" EXCLUDE)
|
|
|
|
install(
|
|
|
|
FILES ${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h
|
|
|
|
${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h
|
|
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/freetype2/freetype/config
|
|
|
|
COMPONENT headers)
|
2016-04-16 10:24:24 +02:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
|
2018-04-07 22:34:24 +02:00
|
|
|
# Generate the pkg-config file
|
2021-03-15 20:51:30 +01:00
|
|
|
file(READ "${PROJECT_SOURCE_DIR}/builds/unix/freetype2.in" FREETYPE2_PC_IN)
|
|
|
|
|
|
|
|
string(REPLACE ";" ", " PKG_CONFIG_REQUIRED_PRIVATE "${PKG_CONFIG_REQUIRED_PRIVATE}")
|
|
|
|
|
|
|
|
string(REPLACE "%prefix%" ${CMAKE_INSTALL_PREFIX}
|
|
|
|
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
|
|
|
|
string(REPLACE "%exec_prefix%" "\${prefix}"
|
|
|
|
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
|
|
|
|
string(REPLACE "%libdir%" "\${prefix}/${CMAKE_INSTALL_LIBDIR}"
|
|
|
|
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
|
|
|
|
string(REPLACE "%includedir%" "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}"
|
|
|
|
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
|
|
|
|
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})
|
|
|
|
string(REPLACE "%LIBS_PRIVATE%" "${PKG_CONFIG_LIBS_PRIVATE}"
|
|
|
|
FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
|
|
|
|
|
|
|
|
set(FREETYPE2_PC_IN_NAME "${PROJECT_BINARY_DIR}/freetype2.pc")
|
|
|
|
if (EXISTS "${FREETYPE2_PC_IN_NAME}")
|
|
|
|
file(READ "${FREETYPE2_PC_IN_NAME}" ORIGINAL_FREETYPE2_PC_IN)
|
|
|
|
else ()
|
|
|
|
set(ORIGINAL_FREETYPE2_PC_IN "")
|
2018-04-07 22:34:24 +02:00
|
|
|
endif ()
|
2021-03-15 20:51:30 +01:00
|
|
|
if (NOT (ORIGINAL_FREETYPE2_PC_IN STREQUAL FREETYPE2_PC_IN))
|
|
|
|
file(WRITE "${FREETYPE2_PC_IN_NAME}" ${FREETYPE2_PC_IN})
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
install(
|
|
|
|
FILES ${PROJECT_BINARY_DIR}/freetype2.pc
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
|
|
|
|
COMPONENT pkgconfig)
|
2018-04-07 22:34:24 +02:00
|
|
|
|
2020-08-25 13:53:54 +02:00
|
|
|
include(CMakePackageConfigHelpers)
|
|
|
|
write_basic_package_version_file(
|
|
|
|
${PROJECT_BINARY_DIR}/freetype-config-version.cmake
|
|
|
|
VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
|
|
|
|
COMPATIBILITY SameMajorVersion)
|
|
|
|
|
2018-04-07 22:34:24 +02:00
|
|
|
install(
|
|
|
|
TARGETS freetype
|
|
|
|
EXPORT freetype-targets
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
2018-10-17 11:25:32 +02:00
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
2018-04-07 22:34:24 +02:00
|
|
|
FRAMEWORK DESTINATION Library/Frameworks
|
|
|
|
COMPONENT libraries)
|
|
|
|
install(
|
2016-04-16 10:24:24 +02:00
|
|
|
EXPORT freetype-targets
|
2018-04-07 22:34:24 +02:00
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype
|
|
|
|
FILE freetype-config.cmake
|
|
|
|
COMPONENT headers)
|
2020-08-25 13:53:54 +02:00
|
|
|
install(
|
|
|
|
FILES ${PROJECT_BINARY_DIR}/freetype-config-version.cmake
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype
|
|
|
|
COMPONENT headers)
|
2016-04-16 10:24:24 +02:00
|
|
|
endif ()
|
2013-10-24 08:49:08 +02:00
|
|
|
|
2015-06-28 11:07:07 +02:00
|
|
|
|
2013-10-24 08:49:08 +02:00
|
|
|
# Packaging
|
2018-04-07 22:34:24 +02:00
|
|
|
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
|
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The FreeType font rendering library.")
|
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
|
2021-02-22 15:33:23 +01:00
|
|
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.TXT")
|
2018-04-07 22:34:24 +02:00
|
|
|
|
2013-10-24 08:49:08 +02:00
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
|
2018-04-07 22:34:24 +02:00
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
|
|
|
|
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
2013-10-24 08:49:08 +02:00
|
|
|
|
2018-04-07 22:34:24 +02:00
|
|
|
if (WIN32)
|
|
|
|
set(CPACK_GENERATOR ZIP)
|
2019-04-15 10:46:19 +02:00
|
|
|
else ()
|
2018-04-07 22:34:24 +02:00
|
|
|
set(CPACK_GENERATOR TGZ)
|
2019-04-15 10:46:19 +02:00
|
|
|
endif ()
|
2015-06-28 11:07:07 +02:00
|
|
|
|
2018-04-07 22:34:24 +02:00
|
|
|
set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
|
|
|
|
set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C/C++ Headers")
|
|
|
|
set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION
|
|
|
|
"Library used to build programs which use FreeType")
|
|
|
|
set(CPACK_COMPONENT_HEADERS_DESCRIPTION
|
|
|
|
"C/C++ header files for use with FreeType")
|
|
|
|
set(CPACK_COMPONENT_HEADERS_DEPENDS libraries)
|
|
|
|
set(CPACK_COMPONENT_LIBRARIES_GROUP "Development")
|
|
|
|
set(CPACK_COMPONENT_HEADERS_GROUP "Development")
|
2015-06-28 11:07:07 +02:00
|
|
|
|
2018-04-07 22:34:24 +02:00
|
|
|
include(CPack)
|