Changeset 256601 in webkit


Ignore:
Timestamp:
Feb 14, 2020 6:42:31 AM (4 years ago)
Author:
don.olmstead@sony.com
Message:

[CMake] Add Fontconfig::Fontconfig target
https://bugs.webkit.org/show_bug.cgi?id=207730

Reviewed by Adrian Perez de Castro.

.:

Redo the Fontconfig find module to export a target.

  • Source/cmake/FindFontconfig.cmake:

Source/WebCore:

Use the Fontconfig::Fontconfig target.

  • platform/FreeType.cmake:

Tools:

Use the Fontconfig::Fontconfig target.

  • WebKitTestRunner/PlatformGTK.cmake:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r256200 r256601  
     12020-02-14  Don Olmstead  <don.olmstead@sony.com>
     2
     3        [CMake] Add Fontconfig::Fontconfig target
     4        https://bugs.webkit.org/show_bug.cgi?id=207730
     5
     6        Reviewed by Adrian Perez de Castro.
     7
     8        Redo the Fontconfig find module to export a target.
     9
     10        * Source/cmake/FindFontconfig.cmake:
     11
    1122020-02-10  Michael Catanzaro  <mcatanzaro@gnome.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r256585 r256601  
     12020-02-14  Don Olmstead  <don.olmstead@sony.com>
     2
     3        [CMake] Add Fontconfig::Fontconfig target
     4        https://bugs.webkit.org/show_bug.cgi?id=207730
     5
     6        Reviewed by Adrian Perez de Castro.
     7
     8        Use the Fontconfig::Fontconfig target.
     9
     10        * platform/FreeType.cmake:
     11
    1122020-02-13  Fujii Hironori  <Hironori.Fujii@sony.com>
    213
  • trunk/Source/WebCore/platform/FreeType.cmake

    r253388 r256601  
    3030
    3131list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
    32     ${FONTCONFIG_INCLUDE_DIRS}
    3332    ${FREETYPE_INCLUDE_DIRS}
    3433)
    3534
    3635list(APPEND WebCore_LIBRARIES
     36    ${FREETYPE_LIBRARIES}
     37    Fontconfig::Fontconfig
    3738    HarfBuzz::HarfBuzz
    3839    HarfBuzz::ICU
    39     ${FONTCONFIG_LIBRARIES}
    40     ${FREETYPE_LIBRARIES}
    4140)
  • trunk/Source/cmake/FindFontconfig.cmake

    r251005 r256601  
    1 # - Try to find the  Fontconfig
    2 # Once done this will define
    3 #
    4 #  FONTCONFIG_FOUND - system has Fontconfig
    5 #  FONTCONFIG_INCLUDE_DIR - The include directory to use for the fontconfig headers
    6 #  FONTCONFIG_LIBRARIES - Link these to use FONTCONFIG
    7 #  FONTCONFIG_DEFINITIONS - Compiler switches required for using FONTCONFIG
    8 
    9 # Copyright (c) 2006,2007 Laurent Montel, <montel@kde.org>
     1# Copyright (C) 2020 Sony Interactive Entertainment Inc.
    102#
    113# Redistribution and use in source and binary forms, with or without
    124# modification, are permitted provided that the following conditions
    135# are met:
     6# 1.  Redistributions of source code must retain the above copyright
     7#     notice, this list of conditions and the following disclaimer.
     8# 2.  Redistributions in binary form must reproduce the above copyright
     9#     notice, this list of conditions and the following disclaimer in the
     10#     documentation and/or other materials provided with the distribution.
    1411#
    15 # 1. Redistributions of source code must retain the copyright
    16 #    notice, this list of conditions and the following disclaimer.
    17 # 2. Redistributions in binary form must reproduce the copyright
    18 #    notice, this list of conditions and the following disclaimer in the
    19 #    documentation and/or other materials provided with the distribution.
    20 # 3. The name of the author may not be used to endorse or promote products
    21 #    derived from this software without specific prior written permission.
    22 #
    23 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    24 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    25 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    26 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    27 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    28 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    29 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    30 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    31 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    32 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    33 #
     12# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
     13# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     14# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     15# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
     16# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     17# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     18# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     19# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     20# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     21# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     22# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    3423
    35 if (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
     24#[=======================================================================[.rst:
     25FindFontconfig
     26--------------
    3627
    37     # in cache already
    38     set(FONTCONFIG_FOUND TRUE)
     28Find Fontconfig headers and libraries.
    3929
    40 else (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
     30Imported Targets
     31^^^^^^^^^^^^^^^^
    4132
    42     if (NOT WIN32)
    43         # use pkg-config to get the directories and then use these values
    44         # in the find_path() and find_library() calls
    45         find_package(PkgConfig)
    46         pkg_check_modules(PC_FONTCONFIG fontconfig)
     33``Fontconfig::Fontconfig``
     34  The Fontconfig library, if found.
    4735
    48       set(FONTCONFIG_DEFINITIONS ${PC_FONTCONFIG_CFLAGS_OTHER})
    49     endif (NOT WIN32)
     36Result Variables
     37^^^^^^^^^^^^^^^^
    5038
    51     find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h
    52         HINTS ${PC_FONTCONFIG_INCLUDEDIR} ${PC_FONTCONFIG_INCLUDE_DIRS}
    53         PATHS /usr/X11/include
     39This will define the following variables in your project:
     40
     41``Fontconfig_FOUND``
     42  true if (the requested version of) Fontconfig is available.
     43``Fontconfig_VERSION``
     44  the version of Fontconfig.
     45``Fontconfig_LIBRARIES``
     46  the libraries to link against to use Fontconfig.
     47``Fontconfig_INCLUDE_DIRS``
     48  where to find the Fontconfig headers.
     49``Fontconfig_COMPILE_OPTIONS``
     50  this should be passed to target_compile_options(), if the
     51  target is not used for linking
     52
     53#]=======================================================================]
     54
     55# TODO: Remove when cmake_minimum_version bumped to 3.14.
     56
     57include(FindPkgConfig)
     58pkg_check_modules(PC_FONTCONFIG QUIET fontconfig)
     59set(Fontconfig_COMPILE_OPTIONS ${PC_FONTCONFIG_CFLAGS_OTHER})
     60set(Fontconfig_VERSION ${PC_FONTCONFIG_CFLAGS_VERSION})
     61
     62find_path(Fontconfig_INCLUDE_DIR
     63    NAMES fontconfig/fontconfig.h
     64    HINTS ${PC_FONTCONFIG_INCLUDEDIR} ${PC_FONTCONFIG_INCLUDE_DIRS} /usr/X11/include
     65)
     66
     67find_library(Fontconfig_LIBRARY
     68    NAMES ${Fontconfig_NAMES} fontconfig
     69    HINTS ${PC_FONTCONFIG_LIBDIR} ${PC_FONTCONFIG_LIBRARY_DIRS}
     70)
     71
     72# Taken from CMake's FindFontconfig.cmake
     73if (Fontconfig_INCLUDE_DIR AND NOT Fontconfig_VERSION)
     74  file(STRINGS ${Fontconfig_INCLUDE_DIR}/fontconfig/fontconfig.h _contents REGEX "^#define[ \t]+FC_[A-Z]+[ \t]+[0-9]+$")
     75  unset(Fontconfig_VERSION)
     76  foreach (VPART MAJOR MINOR REVISION)
     77    foreach (VLINE ${_contents})
     78      if (VLINE MATCHES "^#define[\t ]+FC_${VPART}[\t ]+([0-9]+)$")
     79        set(Fontconfig_VERSION_PART "${CMAKE_MATCH_1}")
     80        if (Fontconfig_VERSION)
     81          string(APPEND Fontconfig_VERSION ".${Fontconfig_VERSION_PART}")
     82        else ()
     83          set(Fontconfig_VERSION "${Fontconfig_VERSION_PART}")
     84        endif ()
     85      endif ()
     86    endforeach ()
     87  endforeach ()
     88endif ()
     89
     90include(FindPackageHandleStandardArgs)
     91find_package_handle_standard_args(Fontconfig
     92    FOUND_VAR Fontconfig_FOUND
     93    REQUIRED_VARS Fontconfig_LIBRARY Fontconfig_INCLUDE_DIR
     94    VERSION_VAR Fontconfig_VERSION
     95)
     96
     97if (Fontconfig_LIBRARY AND NOT TARGET Fontconfig::Fontconfig)
     98    add_library(Fontconfig::Fontconfig UNKNOWN IMPORTED GLOBAL)
     99    set_target_properties(Fontconfig::Fontconfig PROPERTIES
     100        IMPORTED_LOCATION "${Fontconfig_LIBRARY}"
     101        INTERFACE_COMPILE_OPTIONS "${Fontconfig_COMPILE_OPTIONS}"
     102        INTERFACE_INCLUDE_DIRECTORIES "${Fontconfig_INCLUDE_DIR}"
    54103    )
     104endif ()
    55105
    56     find_library(FONTCONFIG_LIBRARIES NAMES fontconfig
    57         HINTS ${PC_FONTCONFIG_LIBDIR} ${PC_FONTCONFIG_LIBRARY_DIRS}
    58     )
     106mark_as_advanced(Fontconfig_INCLUDE_DIR Fontconfig_LIBRARIES)
    59107
    60     include(FindPackageHandleStandardArgs)
    61     FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fontconfig DEFAULT_MSG FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR)
    62 
    63     mark_as_advanced(FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR)
    64 
    65 endif (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
     108if (Fontconfig_FOUND)
     109    set(Fontconfig_LIBRARIES ${Fontconfig_LIBRARY})
     110    set(Fontconfig_INCLUDE_DIRS ${Fontconfig_INCLUDE_DIR})
     111endif ()
  • trunk/Tools/ChangeLog

    r256583 r256601  
     12020-02-14  Don Olmstead  <don.olmstead@sony.com>
     2
     3        [CMake] Add Fontconfig::Fontconfig target
     4        https://bugs.webkit.org/show_bug.cgi?id=207730
     5
     6        Reviewed by Adrian Perez de Castro.
     7
     8        Use the Fontconfig::Fontconfig target.
     9
     10        * WebKitTestRunner/PlatformGTK.cmake:
     11
    1122020-02-13  Kate Cheney  <katherine_cheney@apple.com>
    213
  • trunk/Tools/WebKitTestRunner/PlatformGTK.cmake

    r255670 r256601  
    3535set(WebKitTestRunnerInjectedBundle_LIBRARIES
    3636    ${ATK_LIBRARIES}
    37     ${FONTCONFIG_LIBRARIES}
    3837    ${GLIB_LIBRARIES}
    3938    ${GTK3_LIBRARIES}
     39    Fontconfig::Fontconfig
    4040    WebCoreTestSupport
    4141    WebKit
Note: See TracChangeset for help on using the changeset viewer.