tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

CMakeLists.txt (22455B)


      1 # CMakeLists.txt
      2 #
      3 # Copyright (C) 2013-2025 by
      4 # David Turner, Robert Wilhelm, and Werner Lemberg.
      5 #
      6 # Written originally by John Cary <cary@txcorp.com>
      7 #
      8 # This file is part of the FreeType project, and may only be used, modified,
      9 # and distributed under the terms of the FreeType project license,
     10 # LICENSE.TXT.  By continuing to use, modify, or distribute this file you
     11 # indicate that you have read the license and understand and accept it
     12 # fully.
     13 #
     14 #
     15 # The following will (1) create a build directory, and (2) change into it and
     16 # call cmake to configure the build with default parameters as a static
     17 # library.  See
     18 #
     19 #   https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
     20 #
     21 # for information about debug or release builds, for example
     22 #
     23 #   cmake -B build -D CMAKE_BUILD_TYPE=Release
     24 #
     25 #
     26 # For a dynamic library, use
     27 #
     28 #   cmake -B build -D BUILD_SHARED_LIBS=true -D CMAKE_BUILD_TYPE=Release
     29 #
     30 # For a framework on OS X, use
     31 #
     32 #   cmake -E chdir build cmake -G Xcode -D BUILD_FRAMEWORK:BOOL=true ..
     33 #
     34 # For an iOS static library, use
     35 #
     36 #   cmake -E chdir build cmake -G Xcode -D IOS_PLATFORM=OS ..
     37 #
     38 # or
     39 #
     40 #   cmake -E chdir build cmake -G Xcode -D IOS_PLATFORM=SIMULATOR ..
     41 #
     42 # or
     43 #
     44 #   cmake -E chdir build cmake -G Xcode -D IOS_PLATFORM=SIMULATOR64 ..
     45 #
     46 #
     47 # Finally, build the project with
     48 #
     49 #   cmake --build build
     50 #
     51 # Install it with
     52 #
     53 #   (sudo) cmake --build build --target install
     54 #
     55 # A binary distribution can be made with
     56 #
     57 #   cmake --build build --config Release --target package
     58 #
     59 # Please refer to the cmake manual for further options, in particular, how
     60 # to modify compilation and linking parameters.
     61 #
     62 # Some notes.
     63 #
     64 # - Say `cmake -LAH` to see all configuration options.
     65 #
     66 # - `cmake' creates configuration files in
     67 #
     68 #     <build-directory>/include/freetype/config
     69 #
     70 #   which should be further modified if necessary.
     71 #
     72 # - You can use `cmake' directly on a freshly cloned FreeType git
     73 #   repository.
     74 #
     75 # - `CMakeLists.txt' is provided as-is since it is normally not used by the
     76 #   developer team.
     77 #
     78 # - Set the `FT_REQUIRE_ZLIB', `FT_REQUIRE_BZIP2', `FT_REQUIRE_PNG',
     79 #   `FT_REQUIRE_HARFBUZZ', and `FT_REQUIRE_BROTLI' CMake variables to `ON'
     80 #   or `TRUE' to force using a dependency.  Leave a variable undefined
     81 #   (which is the default) to use the dependency only if it is available.
     82 #   Example:
     83 #
     84 #     cmake -B build -D FT_REQUIRE_ZLIB=TRUE \
     85 #                    -D FT_REQUIRE_BZIP2=TRUE \
     86 #                    -D FT_REQUIRE_PNG=TRUE \
     87 #                    -D FT_REQUIRE_HARFBUZZ=TRUE \
     88 #                    -D FT_REQUIRE_BROTLI=TRUE [...]
     89 #
     90 # - Set the `FT_DYNAMIC_HARFBUZZ' CMake variable to `ON' or `TRUE' to load
     91 #   the HarfBuzz library dynamically at runtime, if possible.  Example:
     92 #
     93 #     cmake -B build -D FT_DYNAMIC_HARFBUZZ=TRUE [...]
     94 #
     95 # - Set `FT_DISABLE_XXX=TRUE' to disable a dependency completely (where
     96 #   `XXX' is a CMake package name like `BZip2').  Example for disabling all
     97 #   dependencies:
     98 #
     99 #     cmake -B build -D FT_DISABLE_ZLIB=TRUE \
    100 #                    -D FT_DISABLE_BZIP2=TRUE \
    101 #                    -D FT_DISABLE_PNG=TRUE \
    102 #                    -D FT_DISABLE_HARFBUZZ=TRUE \
    103 #                    -D FT_DISABLE_BROTLI=TRUE [...]
    104 #
    105 # - NOTE: If a package is set as DISABLED, it cannot be set as REQUIRED
    106 #   without unsetting the DISABLED value first.  For example, if
    107 #   `FT_DISABLE_HARFBUZZ=TRUE' has been set (Cache is present), you need to
    108 #   call `FT_DISABLE_HARFBUZZ=FALSE' before calling
    109 #   `FT_REQUIRE_HARFBUZZ=TRUE'.
    110 #
    111 # - Installation of FreeType can be controlled with the CMake variables
    112 #   `SKIP_INSTALL_HEADERS', `SKIP_INSTALL_LIBRARIES', and `SKIP_INSTALL_ALL'
    113 #   (this is compatible with the same CMake variables in zlib's CMake
    114 #   support).
    115 
    116 # CMake 3.12 provides for IMPORTED targets for common libraries like zlib, libpng and bzip2
    117 cmake_minimum_required(VERSION 3.12...3.31.0)
    118 
    119 include(CheckIncludeFile)
    120 include(CMakeDependentOption)
    121 
    122 # CMAKE_TOOLCHAIN_FILE must be set before `project' is called, which
    123 # configures the base build environment and references the toolchain file
    124 if (APPLE)
    125  if (DEFINED IOS_PLATFORM)
    126    if (NOT "${IOS_PLATFORM}" STREQUAL "OS"
    127        AND NOT "${IOS_PLATFORM}" STREQUAL "SIMULATOR"
    128        AND NOT "${IOS_PLATFORM}" STREQUAL "SIMULATOR64")
    129      message(FATAL_ERROR
    130        "IOS_PLATFORM must be set to either OS, SIMULATOR, or SIMULATOR64")
    131    endif ()
    132    if (NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode")
    133      message(AUTHOR_WARNING
    134        "You should use Xcode generator with IOS_PLATFORM enabled to get Universal builds.")
    135    endif ()
    136    if (BUILD_SHARED_LIBS)
    137      message(FATAL_ERROR
    138        "BUILD_SHARED_LIBS can not be on with IOS_PLATFORM enabled")
    139    endif ()
    140    if (BUILD_FRAMEWORK)
    141      message(FATAL_ERROR
    142        "BUILD_FRAMEWORK can not be on with IOS_PLATFORM enabled")
    143    endif ()
    144 
    145    # iOS only uses static libraries
    146    set(BUILD_SHARED_LIBS OFF)
    147 
    148    set(CMAKE_TOOLCHAIN_FILE
    149      ${CMAKE_SOURCE_DIR}/builds/cmake/iOS.cmake)
    150  endif ()
    151 else ()
    152  if (DEFINED IOS_PLATFORM)
    153    message(FATAL_ERROR "IOS_PLATFORM is not supported on this platform")
    154  endif ()
    155 endif ()
    156 
    157 
    158 project(freetype C)
    159 
    160 set(VERSION_MAJOR "2")
    161 set(VERSION_MINOR "14")
    162 set(VERSION_PATCH "1")
    163 
    164 # Generate LIBRARY_VERSION and LIBRARY_SOVERSION.
    165 set(LIBTOOL_REGEX "version_info='([0-9]+):([0-9]+):([0-9]+)'")
    166 file(STRINGS "${PROJECT_SOURCE_DIR}/builds/unix/configure.raw"
    167  VERSION_INFO
    168  REGEX ${LIBTOOL_REGEX})
    169 string(REGEX REPLACE
    170  ${LIBTOOL_REGEX} "\\1"
    171  LIBTOOL_CURRENT "${VERSION_INFO}")
    172 string(REGEX REPLACE
    173  ${LIBTOOL_REGEX} "\\2"
    174  LIBTOOL_REVISION "${VERSION_INFO}")
    175 string(REGEX REPLACE
    176  ${LIBTOOL_REGEX} "\\3"
    177  LIBTOOL_AGE "${VERSION_INFO}")
    178 
    179 # This is what libtool does internally on Unix platforms.
    180 math(EXPR LIBRARY_SOVERSION "${LIBTOOL_CURRENT} - ${LIBTOOL_AGE}")
    181 set(LIBRARY_VERSION "${LIBRARY_SOVERSION}.${LIBTOOL_AGE}.${LIBTOOL_REVISION}")
    182 
    183 # External dependency library detection is automatic.  See the notes at the
    184 # top of this file, for how to force or disable dependencies completely.
    185 option(FT_DISABLE_ZLIB
    186  "Disable use of system zlib and use internal zlib library instead." OFF)
    187 cmake_dependent_option(FT_REQUIRE_ZLIB
    188  "Require system zlib instead of internal zlib library." OFF
    189  "NOT FT_DISABLE_ZLIB" OFF)
    190 
    191 option(FT_DISABLE_BZIP2
    192  "Disable support of bzip2 compressed fonts." OFF)
    193 cmake_dependent_option(FT_REQUIRE_BZIP2
    194  "Require support of bzip2 compressed fonts." OFF
    195  "NOT FT_DISABLE_BZIP2" OFF)
    196 
    197 option(FT_DISABLE_PNG
    198  "Disable support of PNG compressed OpenType embedded bitmaps." OFF)
    199 cmake_dependent_option(FT_REQUIRE_PNG
    200  "Require support of PNG compressed OpenType embedded bitmaps." OFF
    201  "NOT FT_DISABLE_PNG" OFF)
    202 
    203 option(FT_DISABLE_HARFBUZZ
    204  "Disable HarfBuzz (used for improving auto-hinting of OpenType fonts)." OFF)
    205 cmake_dependent_option(FT_DYNAMIC_HARFBUZZ
    206  "Load HarfBuzz library dynamically at runtime, if possible." ON
    207  "NOT FT_DISABLE_HARFBUZZ" OFF)
    208 cmake_dependent_option(FT_REQUIRE_HARFBUZZ
    209  "Require HarfBuzz for improving auto-hinting of OpenType fonts." OFF
    210  "NOT FT_DISABLE_HARFBUZZ" OFF)
    211 
    212 option(FT_DISABLE_BROTLI
    213  "Disable support of compressed WOFF2 fonts." OFF)
    214 cmake_dependent_option(FT_REQUIRE_BROTLI
    215  "Require support of compressed WOFF2 fonts." OFF
    216  "NOT FT_DISABLE_BROTLI" OFF)
    217 
    218 option(FT_ENABLE_ERROR_STRINGS
    219  "Enable support for meaningful error descriptions." OFF)
    220 
    221 # Disallow in-source builds
    222 if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
    223  message(FATAL_ERROR
    224    "In-source builds are not permitted!  Make a separate folder for"
    225    " building, e.g.,\n"
    226    "  cmake -E make_directory build\n"
    227    "  cmake -E chdir build cmake ..\n"
    228    "Before that, remove the files created by this failed run with\n"
    229    "  cmake -E remove CMakeCache.txt\n"
    230    "  cmake -E remove_directory CMakeFiles")
    231 endif ()
    232 
    233 
    234 # Add local cmake modules
    235 list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/builds/cmake)
    236 
    237 
    238 if (BUILD_FRAMEWORK)
    239  if (NOT "${CMAKE_GENERATOR}" STREQUAL "Xcode")
    240    message(FATAL_ERROR
    241      "You should use Xcode generator with BUILD_FRAMEWORK enabled")
    242  endif ()
    243  set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)")
    244  set(BUILD_SHARED_LIBS ON)
    245 endif ()
    246 
    247 
    248 # Find dependencies
    249 include(FindPkgConfig)
    250 include(CMakePushCheckState)
    251 include(CheckSymbolExists)
    252 
    253 if (NOT FT_DISABLE_HARFBUZZ)
    254  set(HARFBUZZ_MIN_VERSION "2.0.0")
    255 
    256  if (FT_DYNAMIC_HARFBUZZ)
    257    if (WIN32)  # Windows uses its own LoadLibrary()
    258      set(FT_DYNAMIC_HARFBUZZ_ENABLED TRUE)
    259    else()
    260      cmake_push_check_state(RESET)
    261      check_symbol_exists(dlopen "dlfcn.h" HAVE_DLOPEN_IN_LIBC)
    262      if (NOT HAVE_DLOPEN_IN_LIBC)
    263        set(CMAKE_REQUIRED_LIBRARIES dl)
    264        check_symbol_exists(dlopen "dlfcn.h" HAVE_DLOPEN_IN_LIBDL)
    265      endif()
    266      cmake_pop_check_state()
    267 
    268      if (HAVE_DLOPEN_IN_LIBC OR HAVE_DLOPEN_IN_LIBDL)
    269        set(FT_DYNAMIC_HARFBUZZ_ENABLED TRUE)
    270        if (HAVE_DLOPEN_IN_LIBDL)
    271          set(FT_NEED_LIBDL TRUE)
    272        endif()
    273      endif()
    274    endif()
    275  endif()
    276 
    277  if (FT_DYNAMIC_HARFBUZZ_ENABLED)
    278    message(STATUS "Enabled dynamic loading of HarfBuzz library at runtime.")
    279  elseif (FT_REQUIRE_HARFBUZZ)
    280    find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION} REQUIRED)
    281  else ()
    282    find_package(HarfBuzz ${HARFBUZZ_MIN_VERSION})
    283  endif ()
    284 endif ()
    285 
    286 if (NOT FT_DISABLE_PNG)
    287  if (FT_REQUIRE_PNG)
    288    find_package(PNG REQUIRED)
    289  else ()
    290    find_package(PNG)
    291  endif ()
    292  # FreePNG calls FindZLIB so unset ZLIB_FOUND to respect FT_DISABLE_ZLIB
    293  unset(ZLIB_FOUND)
    294 endif ()
    295 
    296 if (NOT FT_DISABLE_ZLIB)
    297  if (FT_REQUIRE_ZLIB)
    298    find_package(ZLIB REQUIRED)
    299  else ()
    300    find_package(ZLIB)
    301  endif ()
    302 endif ()
    303 
    304 if (NOT FT_DISABLE_BZIP2)
    305  # Genuine BZip2 does not provide bzip2.pc, but some platforms have it.
    306  # For better dependency in freetype2.pc, bzip2.pc is searched
    307  # regardless of the availability of libbz2. If bzip2.pc is found,
    308  # Requires.private is used instead of Libs.private.
    309  if (FT_REQUIRE_BZIP2)
    310    find_package(BZip2 REQUIRED)
    311  else ()
    312    find_package(BZip2)
    313  endif ()
    314  pkg_check_modules(PC_BZIP2 bzip2)
    315 endif ()
    316 
    317 if (NOT FT_DISABLE_BROTLI)
    318  if (FT_REQUIRE_BROTLI)
    319    find_package(BrotliDec REQUIRED)
    320  else ()
    321    find_package(BrotliDec)
    322  endif ()
    323 endif ()
    324 
    325 # Create the configuration file
    326 if (UNIX AND NOT WIN32)
    327  check_include_file("unistd.h" HAVE_UNISTD_H)
    328  check_include_file("fcntl.h" HAVE_FCNTL_H)
    329 
    330  file(READ "${PROJECT_SOURCE_DIR}/builds/unix/ftconfig.h.in"
    331    FTCONFIG_H)
    332  if (HAVE_UNISTD_H)
    333    string(REGEX REPLACE
    334      "#undef +(HAVE_UNISTD_H)" "#define \\1 1"
    335      FTCONFIG_H "${FTCONFIG_H}")
    336  endif ()
    337  if (HAVE_FCNTL_H)
    338    string(REGEX REPLACE
    339      "#undef +(HAVE_FCNTL_H)" "#define \\1 1"
    340      FTCONFIG_H "${FTCONFIG_H}")
    341  endif ()
    342 else ()
    343  file(READ "${PROJECT_SOURCE_DIR}/include/freetype/config/ftconfig.h"
    344    FTCONFIG_H)
    345 endif ()
    346 
    347 set(FTCONFIG_H_NAME "${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h")
    348 if (EXISTS "${FTCONFIG_H_NAME}")
    349  file(READ "${FTCONFIG_H_NAME}" ORIGINAL_FTCONFIG_H)
    350 else ()
    351  set(ORIGINAL_FTCONFIG_H "")
    352 endif ()
    353 if (NOT (ORIGINAL_FTCONFIG_H STREQUAL FTCONFIG_H))
    354  file(WRITE "${FTCONFIG_H_NAME}" "${FTCONFIG_H}")
    355 endif ()
    356 
    357 
    358 # Create the options file
    359 file(READ "${PROJECT_SOURCE_DIR}/include/freetype/config/ftoption.h"
    360  FTOPTION_H)
    361 if (ZLIB_FOUND)
    362  string(REGEX REPLACE
    363    "/\\* +(#define +FT_CONFIG_OPTION_SYSTEM_ZLIB) +\\*/" "\\1"
    364    FTOPTION_H "${FTOPTION_H}")
    365 endif ()
    366 if (BZIP2_FOUND)
    367  string(REGEX REPLACE
    368    "/\\* +(#define +FT_CONFIG_OPTION_USE_BZIP2) +\\*/" "\\1"
    369    FTOPTION_H "${FTOPTION_H}")
    370 endif ()
    371 if (PNG_FOUND)
    372  string(REGEX REPLACE
    373    "/\\* +(#define +FT_CONFIG_OPTION_USE_PNG) +\\*/" "\\1"
    374    FTOPTION_H "${FTOPTION_H}")
    375 endif ()
    376 if (HARFBUZZ_FOUND OR FT_DYNAMIC_HARFBUZZ_ENABLED)
    377  string(REGEX REPLACE
    378    "/\\* +(#define +FT_CONFIG_OPTION_USE_HARFBUZZ) +\\*/" "\\1"
    379    FTOPTION_H "${FTOPTION_H}")
    380  if (FT_DYNAMIC_HARFBUZZ_ENABLED)
    381    string(REGEX REPLACE
    382      "/\\* +(#define +FT_CONFIG_OPTION_USE_HARFBUZZ_DYNAMIC) +\\*/" "\\1"
    383      FTOPTION_H "${FTOPTION_H}")
    384  endif ()
    385 endif ()
    386 if (BROTLIDEC_FOUND)
    387  string(REGEX REPLACE
    388    "/\\* +(#define +FT_CONFIG_OPTION_USE_BROTLI) +\\*/" "\\1"
    389    FTOPTION_H "${FTOPTION_H}")
    390 endif ()
    391 
    392 if (FT_ENABLE_ERROR_STRINGS)
    393  string(REGEX REPLACE
    394    "/\\* +(#define +FT_CONFIG_OPTION_ERROR_STRINGS) +\\*/" "\\1"
    395    FTOPTION_H "${FTOPTION_H}")
    396 endif ()
    397 
    398 set(FTOPTION_H_NAME "${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h")
    399 if (EXISTS "${FTOPTION_H_NAME}")
    400  file(READ "${FTOPTION_H_NAME}" ORIGINAL_FTOPTION_H)
    401 else ()
    402  set(ORIGINAL_FTOPTION_H "")
    403 endif ()
    404 if (NOT (ORIGINAL_FTOPTION_H STREQUAL FTOPTION_H))
    405  file(WRITE "${FTOPTION_H_NAME}" "${FTOPTION_H}")
    406 endif ()
    407 
    408 
    409 file(GLOB PUBLIC_HEADERS "include/ft2build.h" "include/freetype/*.h")
    410 file(GLOB PUBLIC_CONFIG_HEADERS "include/freetype/config/*.h")
    411 file(GLOB PRIVATE_HEADERS "include/freetype/internal/*.h")
    412 
    413 
    414 set(BASE_SRCS
    415  src/autofit/autofit.c
    416  src/base/ftbase.c
    417  src/base/ftbbox.c
    418  src/base/ftbdf.c
    419  src/base/ftbitmap.c
    420  src/base/ftcid.c
    421  src/base/ftfstype.c
    422  src/base/ftgasp.c
    423  src/base/ftglyph.c
    424  src/base/ftgxval.c
    425  src/base/ftinit.c
    426  src/base/ftmm.c
    427  src/base/ftotval.c
    428  src/base/ftpatent.c
    429  src/base/ftpfr.c
    430  src/base/ftstroke.c
    431  src/base/ftsynth.c
    432  src/base/fttype1.c
    433  src/base/ftwinfnt.c
    434  src/bdf/bdf.c
    435  src/bzip2/ftbzip2.c
    436  src/cache/ftcache.c
    437  src/cff/cff.c
    438  src/cid/type1cid.c
    439  src/gzip/ftgzip.c
    440  src/lzw/ftlzw.c
    441  src/pcf/pcf.c
    442  src/pfr/pfr.c
    443  src/psaux/psaux.c
    444  src/pshinter/pshinter.c
    445  src/psnames/psnames.c
    446  src/raster/raster.c
    447  src/sdf/sdf.c
    448  src/sfnt/sfnt.c
    449  src/smooth/smooth.c
    450  src/svg/svg.c
    451  src/truetype/truetype.c
    452  src/type1/type1.c
    453  src/type42/type42.c
    454  src/winfonts/winfnt.c
    455 )
    456 
    457 if (WIN32)
    458  list(APPEND BASE_SRCS "builds/windows/ftsystem.c")
    459 elseif (UNIX)
    460  list(APPEND BASE_SRCS "builds/unix/ftsystem.c")
    461 else ()
    462  list(APPEND BASE_SRCS "src/base/ftsystem.c")
    463 endif ()
    464 
    465 if (WIN32)
    466  enable_language(RC)
    467  list(APPEND BASE_SRCS builds/windows/ftdebug.c
    468                        src/base/ftver.rc)
    469 elseif (WINCE)
    470  list(APPEND BASE_SRCS builds/wince/ftdebug.c)
    471 else ()
    472  list(APPEND BASE_SRCS src/base/ftdebug.c)
    473 endif ()
    474 
    475 if (BUILD_FRAMEWORK)
    476  list(APPEND BASE_SRCS builds/mac/freetype-Info.plist)
    477 endif ()
    478 
    479 
    480 if (NOT DISABLE_FORCE_DEBUG_POSTFIX)
    481  set(CMAKE_DEBUG_POSTFIX d)
    482 endif ()
    483 
    484 
    485 add_library(freetype
    486  ${PUBLIC_HEADERS}
    487  ${PUBLIC_CONFIG_HEADERS}
    488  ${PRIVATE_HEADERS}
    489  ${BASE_SRCS}
    490 )
    491 
    492 target_compile_definitions(
    493  freetype PRIVATE FT2_BUILD_LIBRARY)
    494 
    495 if (WIN32)
    496  target_compile_definitions(
    497    freetype PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS)
    498  if (BUILD_SHARED_LIBS)
    499    target_compile_definitions(
    500      freetype PRIVATE DLL_EXPORT)
    501  endif ()
    502 else ()
    503  # Windows handles exports with DLL_EXPORT defined above.
    504  set_target_properties(freetype PROPERTIES
    505    C_VISIBILITY_PRESET hidden)
    506 endif ()
    507 
    508 if (BUILD_SHARED_LIBS)
    509  set_target_properties(freetype PROPERTIES
    510    VERSION ${LIBRARY_VERSION}
    511    SOVERSION ${LIBRARY_SOVERSION})
    512 endif ()
    513 
    514 # Pick up ftconfig.h and ftoption.h generated above, first.
    515 target_include_directories(
    516  freetype
    517    PUBLIC
    518      $<INSTALL_INTERFACE:include/freetype2>
    519      $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
    520      $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
    521    PRIVATE
    522      ${CMAKE_CURRENT_BINARY_DIR}/include
    523      ${CMAKE_CURRENT_SOURCE_DIR}/include
    524 
    525      # Make <ftconfig.h> available for builds/unix/ftsystem.c.
    526      ${CMAKE_CURRENT_BINARY_DIR}/include/freetype/config
    527 )
    528 
    529 
    530 if (BUILD_FRAMEWORK)
    531  set_property(SOURCE ${PUBLIC_CONFIG_HEADERS}
    532    PROPERTY MACOSX_PACKAGE_LOCATION Headers/config
    533  )
    534  set_target_properties(freetype PROPERTIES
    535    FRAMEWORK TRUE
    536    MACOSX_FRAMEWORK_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/builds/mac/freetype-Info.plist
    537    PUBLIC_HEADER "${PUBLIC_HEADERS}"
    538    XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
    539  )
    540 endif ()
    541 
    542 # 'freetype-interface' is an interface library, to be accessed with
    543 # `EXPORT_NAME Freetype::Freetype`.  This is the target name provided by
    544 # CMake's `FindFreetype.cmake`, so we provide it for compatibility.
    545 add_library(freetype-interface INTERFACE)
    546 set_target_properties(freetype-interface PROPERTIES
    547  EXPORT_NAME Freetype::Freetype
    548  INTERFACE_LINK_LIBRARIES freetype)
    549 
    550 set(PKGCONFIG_REQUIRES "")
    551 set(PKGCONFIG_REQUIRES_PRIVATE "")
    552 set(PKGCONFIG_LIBS "-L\${libdir} -lfreetype")
    553 set(PKGCONFIG_LIBS_PRIVATE "")
    554 
    555 if (ZLIB_FOUND)
    556  target_link_libraries(freetype PRIVATE ZLIB::ZLIB)
    557  list(APPEND PKGCONFIG_REQUIRES_PRIVATE "zlib")
    558 endif ()
    559 if (BZIP2_FOUND)
    560  target_link_libraries(freetype PRIVATE BZip2::BZip2)
    561  if (PC_BZIP2_FOUND)
    562    list(APPEND PKGCONFIG_REQUIRES_PRIVATE "bzip2")
    563  else ()
    564    list(APPEND PKGCONFIG_LIBS_PRIVATE "-lbz2")
    565  endif ()
    566 endif ()
    567 if (PNG_FOUND)
    568  target_link_libraries(freetype PRIVATE PNG::PNG)
    569  list(APPEND PKGCONFIG_REQUIRES_PRIVATE "libpng")
    570 endif ()
    571 if (FT_DYNAMIC_HARFBUZZ_ENABLED AND FT_NEED_LIBDL)
    572  target_link_libraries(freetype PRIVATE dl)
    573  list(APPEND PKGCONFIG_LIBS_PRIVATE " -ldl")
    574 endif ()
    575 if (HarfBuzz_FOUND AND (NOT FT_DYNAMIC_HARFBUZZ_ENABLED))
    576  target_link_libraries(freetype PRIVATE HarfBuzz::HarfBuzz)
    577  list(APPEND PKGCONFIG_REQUIRES_PRIVATE "harfbuzz >= ${HARFBUZZ_MIN_VERSION}")
    578 endif ()
    579 if (BROTLIDEC_FOUND)
    580  target_link_libraries(freetype PRIVATE ${BROTLIDEC_LIBRARIES})
    581  target_compile_definitions(freetype PRIVATE ${BROTLIDEC_DEFINITIONS})
    582  target_include_directories(freetype PRIVATE ${BROTLIDEC_INCLUDE_DIRS})
    583  list(APPEND PKGCONFIG_REQUIRES_PRIVATE "libbrotlidec")
    584 endif ()
    585 
    586 
    587 # Installation
    588 include(GNUInstallDirs)
    589 
    590 if (NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL)
    591  install(
    592    # Note the trailing slash in the argument to `DIRECTORY'!
    593    DIRECTORY ${PROJECT_SOURCE_DIR}/include/
    594      DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/freetype2
    595      COMPONENT headers
    596      PATTERN "internal" EXCLUDE
    597      PATTERN "ftconfig.h" EXCLUDE
    598      PATTERN "ftoption.h" EXCLUDE)
    599  install(
    600    FILES ${PROJECT_BINARY_DIR}/include/freetype/config/ftconfig.h
    601          ${PROJECT_BINARY_DIR}/include/freetype/config/ftoption.h
    602      DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/freetype2/freetype/config
    603      COMPONENT headers)
    604 endif ()
    605 
    606 if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
    607  # Generate the pkg-config file
    608  file(READ "${PROJECT_SOURCE_DIR}/builds/unix/freetype2.in" FREETYPE2_PC_IN)
    609 
    610  string(REPLACE ";" ", " PKGCONFIG_REQUIRES_PRIVATE "${PKGCONFIG_REQUIRES_PRIVATE}")
    611 
    612  string(REPLACE "%prefix%" ${CMAKE_INSTALL_PREFIX}
    613          FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
    614  string(REPLACE "%exec_prefix%" "\${prefix}"
    615          FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
    616  string(REPLACE "%libdir%" "\${prefix}/${CMAKE_INSTALL_LIBDIR}"
    617          FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
    618  string(REPLACE "%includedir%" "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}"
    619          FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
    620  string(REPLACE "%ft_version%" "${LIBTOOL_CURRENT}.${LIBTOOL_REVISION}.${LIBTOOL_AGE}"
    621          FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
    622 
    623  if (BUILD_SHARED_LIBS)
    624    string(REPLACE "%PKGCONFIG_REQUIRES%" "${PKGCONFIG_REQUIRES}"
    625            FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
    626    string(REPLACE "%PKGCONFIG_REQUIRES_PRIVATE%" "${PKGCONFIG_REQUIRES_PRIVATE}"
    627            FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
    628    string(REPLACE "%PKGCONFIG_LIBS%" "${PKGCONFIG_LIBS}"
    629            FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
    630    string(REPLACE "%PKGCONFIG_LIBS_PRIVATE%" "${PKGCONFIG_LIBS_PRIVATE}"
    631            FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
    632  else ()
    633    string(REPLACE "%PKGCONFIG_REQUIRES%" "${PKGCONFIG_REQUIRES} ${PKGCONFIG_REQUIRES_PRIVATE}"
    634            FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
    635    string(REPLACE "%PKGCONFIG_REQUIRES_PRIVATE%" ""
    636            FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
    637    string(REPLACE "%PKGCONFIG_LIBS%" "${PKGCONFIG_LIBS} ${PKGCONFIG_LIBS_PRIVATE}"
    638            FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
    639    string(REPLACE "%PKGCONFIG_LIBS_PRIVATE%" ""
    640            FREETYPE2_PC_IN ${FREETYPE2_PC_IN})
    641  endif ()
    642 
    643  set(FREETYPE2_PC_IN_NAME "${PROJECT_BINARY_DIR}/freetype2.pc")
    644  if (EXISTS "${FREETYPE2_PC_IN_NAME}")
    645    file(READ "${FREETYPE2_PC_IN_NAME}" ORIGINAL_FREETYPE2_PC_IN)
    646  else ()
    647    set(ORIGINAL_FREETYPE2_PC_IN "")
    648  endif ()
    649  if (NOT (ORIGINAL_FREETYPE2_PC_IN STREQUAL FREETYPE2_PC_IN))
    650    file(WRITE "${FREETYPE2_PC_IN_NAME}" ${FREETYPE2_PC_IN})
    651  endif ()
    652 
    653  install(
    654    FILES ${PROJECT_BINARY_DIR}/freetype2.pc
    655    DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
    656    COMPONENT pkgconfig)
    657 
    658  include(CMakePackageConfigHelpers)
    659  write_basic_package_version_file(
    660    ${PROJECT_BINARY_DIR}/freetype-config-version.cmake
    661    VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
    662    COMPATIBILITY SameMajorVersion)
    663 
    664  install(
    665    TARGETS freetype freetype-interface
    666      EXPORT freetype-targets
    667      LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    668      ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
    669      RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    670      FRAMEWORK DESTINATION Library/Frameworks
    671      COMPONENT libraries)
    672  install(
    673    EXPORT freetype-targets
    674      DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype
    675      FILE freetype-config.cmake
    676      COMPONENT headers)
    677  install(
    678    FILES ${PROJECT_BINARY_DIR}/freetype-config-version.cmake
    679    DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype
    680    COMPONENT headers)
    681 endif ()
    682 
    683 
    684 # Packaging
    685 set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
    686 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The FreeType font rendering library.")
    687 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
    688 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.TXT")
    689 
    690 set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
    691 set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
    692 set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
    693 set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
    694 
    695 if (WIN32)
    696  set(CPACK_GENERATOR ZIP)
    697 else ()
    698  set(CPACK_GENERATOR TGZ)
    699 endif ()
    700 
    701 set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
    702 set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C/C++ Headers")
    703 set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION
    704  "Library used to build programs which use FreeType")
    705 set(CPACK_COMPONENT_HEADERS_DESCRIPTION
    706  "C/C++ header files for use with FreeType")
    707 set(CPACK_COMPONENT_HEADERS_DEPENDS libraries)
    708 set(CPACK_COMPONENT_LIBRARIES_GROUP "Development")
    709 set(CPACK_COMPONENT_HEADERS_GROUP "Development")
    710 
    711 include(CPack)