[CMake] Add Cairo::Cairo target
authorross.kirsling@sony.com <ross.kirsling@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Feb 2020 13:52:03 +0000 (13:52 +0000)
committerross.kirsling@sony.com <ross.kirsling@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Feb 2020 13:52:03 +0000 (13:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=207159

Reviewed by Konstantin Tokarev.

.:

* Source/cmake/FindCairo.cmake:
* Source/cmake/OptionsPlayStation.cmake:

Source/WebCore:

* PlatformWinCairo.cmake:
* platform/Cairo.cmake:

Source/WebKit:

* PlatformGTK.cmake:
* PlatformWPE.cmake:
* PlatformWin.cmake:

Source/WebKitLegacy:

* PlatformWin.cmake:

Tools:

* DumpRenderTree/PlatformWin.cmake:
* ImageDiff/Cairo.cmake:
* TestWebKitAPI/PlatformWPE.cmake:
* TestWebKitAPI/PlatformWin.cmake:
* TestWebKitAPI/glib/CMakeLists.txt:
* WebKitTestRunner/PlatformGTK.cmake:
* WebKitTestRunner/PlatformWPE.cmake:
* WebKitTestRunner/PlatformWin.cmake:
* wpe/backends/CMakeLists.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255670 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 files changed:
ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/PlatformWinCairo.cmake
Source/WebCore/platform/Cairo.cmake
Source/WebKit/ChangeLog
Source/WebKit/PlatformGTK.cmake
Source/WebKit/PlatformWPE.cmake
Source/WebKit/PlatformWin.cmake
Source/WebKitLegacy/ChangeLog
Source/WebKitLegacy/PlatformWin.cmake
Source/cmake/FindCairo.cmake
Source/cmake/OptionsPlayStation.cmake
Tools/ChangeLog
Tools/DumpRenderTree/PlatformWin.cmake
Tools/ImageDiff/Cairo.cmake
Tools/TestWebKitAPI/PlatformWPE.cmake
Tools/TestWebKitAPI/PlatformWin.cmake
Tools/TestWebKitAPI/glib/CMakeLists.txt
Tools/WebKitTestRunner/PlatformGTK.cmake
Tools/WebKitTestRunner/PlatformWPE.cmake
Tools/WebKitTestRunner/PlatformWin.cmake
Tools/wpe/backends/CMakeLists.txt

index 8e43685..82ca27b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2020-02-04  Ross Kirsling  <ross.kirsling@sony.com>
+
+        [CMake] Add Cairo::Cairo target
+        https://bugs.webkit.org/show_bug.cgi?id=207159
+
+        Reviewed by Konstantin Tokarev.
+
+        * Source/cmake/FindCairo.cmake:
+        * Source/cmake/OptionsPlayStation.cmake:
+
 2020-02-02  Ting-Wei Lan  <lantw44@gmail.com>
 
         [CMake] Use opj_config.h to find OpenJPEG include directory
index da0e140..10db0ad 100644 (file)
@@ -1,3 +1,13 @@
+2020-02-04  Ross Kirsling  <ross.kirsling@sony.com>
+
+        [CMake] Add Cairo::Cairo target
+        https://bugs.webkit.org/show_bug.cgi?id=207159
+
+        Reviewed by Konstantin Tokarev.
+
+        * PlatformWinCairo.cmake:
+        * platform/Cairo.cmake:
+
 2020-02-04  youenn fablet  <youenn@apple.com>
 
         MediaDevices should handle changes of iframe allow attribute value
index 8e67a45..91bd9e3 100644 (file)
@@ -55,6 +55,6 @@ list(APPEND WebCore_LIBRARIES
 )
 
 list(APPEND WebCoreTestSupport_LIBRARIES
-    ${CAIRO_LIBRARIES}
+    Cairo::Cairo
     shlwapi
 )
index 9a3a8bf..6a9ec2a 100644 (file)
@@ -18,10 +18,6 @@ list(APPEND WebCore_PRIVATE_FRAMEWORK_HEADERS
     platform/graphics/cairo/RefPtrCairo.h
 )
 
-list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
-    ${CAIRO_INCLUDE_DIRS}
-)
-
 list(APPEND WebCore_LIBRARIES
-    ${CAIRO_LIBRARIES}
+    Cairo::Cairo
 )
index 91b9e3e..6dad371 100644 (file)
@@ -1,3 +1,14 @@
+2020-02-04  Ross Kirsling  <ross.kirsling@sony.com>
+
+        [CMake] Add Cairo::Cairo target
+        https://bugs.webkit.org/show_bug.cgi?id=207159
+
+        Reviewed by Konstantin Tokarev.
+
+        * PlatformGTK.cmake:
+        * PlatformWPE.cmake:
+        * PlatformWin.cmake:
+
 2020-02-04  Fujii Hironori  <Hironori.Fujii@sony.com>
 
         [Win][Clang] WebProcessMain.h(28,14): error: token is not a valid binary operator in a preprocessor subexpression
index f6abc65..50b81fc 100644 (file)
@@ -419,7 +419,6 @@ list(APPEND WebKit_INCLUDE_DIRECTORIES
 )
 
 list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES
-    ${CAIRO_INCLUDE_DIRS}
     ${ENCHANT_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
     ${GSTREAMER_INCLUDE_DIRS}
index 50e399a..04be813 100644 (file)
@@ -271,7 +271,6 @@ list(APPEND WebKit_INCLUDE_DIRECTORIES
 list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES
     ${ATK_INCLUDE_DIRS}
     ${ATK_BRIDGE_INCLUDE_DIRS}
-    ${CAIRO_INCLUDE_DIRS}
     ${FREETYPE_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
     ${GSTREAMER_INCLUDE_DIRS}
@@ -281,11 +280,11 @@ list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES
 )
 
 list(APPEND WebKit_LIBRARIES
+    Cairo::Cairo
     HarfBuzz::HarfBuzz
     HarfBuzz::ICU
     ${ATK_LIBRARIES}
     ${ATK_BRIDGE_LIBRARIES}
-    ${CAIRO_LIBRARIES}
     ${FREETYPE_LIBRARIES}
     ${GLIB_LIBRARIES}
     ${GLIB_GMODULE_LIBRARIES}
index 2e5873b..b7755dc 100644 (file)
@@ -121,10 +121,6 @@ list(APPEND WebKit_INCLUDE_DIRECTORIES
     "${WEBKIT_DIR}/win"
 )
 
-list(APPEND WebKit_SYSTEM_INCLUDE_DIRECTORIES
-    ${CAIRO_INCLUDE_DIRS}
-)
-
 set(WebKitCommonIncludeDirectories ${WebKit_INCLUDE_DIRECTORIES})
 set(WebKitCommonSystemIncludeDirectories ${WebKit_SYSTEM_INCLUDE_DIRECTORIES})
 
index 898f45b..11cf136 100644 (file)
@@ -1,3 +1,12 @@
+2020-02-04  Ross Kirsling  <ross.kirsling@sony.com>
+
+        [CMake] Add Cairo::Cairo target
+        https://bugs.webkit.org/show_bug.cgi?id=207159
+
+        Reviewed by Konstantin Tokarev.
+
+        * PlatformWin.cmake:
+
 2020-02-03  Sihui Liu  <sihui_liu@apple.com>
 
         Crash in WebCore::IDBServer::IDBServer::createIndex
index d327c60..ef03505 100644 (file)
@@ -1,7 +1,6 @@
 if (${WTF_PLATFORM_WIN_CAIRO})
     add_definitions(-DUSE_CAIRO=1 -DUSE_CURL=1 -DWEBKIT_EXPORTS=1)
     list(APPEND WebKitLegacy_PRIVATE_INCLUDE_DIRECTORIES
-        ${CAIRO_INCLUDE_DIRS}
         "${WEBKIT_LIBRARIES_DIR}/include"
     )
     list(APPEND WebKitLegacy_SOURCES_Classes
index d0130ad..9541268 100644 (file)
@@ -1,11 +1,4 @@
-# - Try to find Cairo
-# Once done, this will define
-#
-#  CAIRO_FOUND - system has Cairo
-#  CAIRO_INCLUDE_DIRS - the Cairo include directories
-#  CAIRO_LIBRARIES - link these to use Cairo
-#
-# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+# Copyright (C) 2020 Sony Interactive Entertainment Inc.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-find_package(PkgConfig)
+#[=======================================================================[.rst:
+FindCairo
+--------------
+
+Find Cairo headers and libraries.
+
+Imported Targets
+^^^^^^^^^^^^^^^^
+
+``Cairo::Cairo``
+  The Cairo library, if found.
+
+Result Variables
+^^^^^^^^^^^^^^^^
+
+This will define the following variables in your project:
+
+``Cairo_FOUND``
+  true if (the requested version of) Cairo is available.
+``Cairo_VERSION``
+  the version of Cairo.
+``Cairo_LIBRARIES``
+  the libraries to link against to use Cairo.
+``Cairo_INCLUDE_DIRS``
+  where to find the Cairo headers.
+``Cairo_COMPILE_OPTIONS``
+  this should be passed to target_compile_options(), if the
+  target is not used for linking
+
+#]=======================================================================]
+
+include(FindPkgConfig)
 pkg_check_modules(PC_CAIRO QUIET cairo)
+set(Cairo_COMPILE_OPTIONS ${PC_CAIRO_CFLAGS_OTHER})
+set(Cairo_VERSION ${PC_CAIRO_VERSION})
 
-find_path(CAIRO_INCLUDE_DIRS
+find_path(Cairo_INCLUDE_DIR
     NAMES cairo.h
-    HINTS ${PC_CAIRO_INCLUDEDIR}
-          ${PC_CAIRO_INCLUDE_DIRS}
+    HINTS ${PC_CAIRO_INCLUDEDIR} ${PC_CAIRO_INCLUDE_DIR}
     PATH_SUFFIXES cairo
 )
 
-find_library(CAIRO_LIBRARIES
-    NAMES cairo
-    HINTS ${PC_CAIRO_LIBDIR}
-          ${PC_CAIRO_LIBRARY_DIRS}
+find_library(Cairo_LIBRARY
+    NAMES ${Cairo_NAMES} cairo
+    HINTS ${PC_CAIRO_LIBDIR} ${PC_CAIRO_LIBRARY_DIRS}
 )
 
-if (CAIRO_INCLUDE_DIRS)
-    if (EXISTS "${CAIRO_INCLUDE_DIRS}/cairo-version.h")
-        file(READ "${CAIRO_INCLUDE_DIRS}/cairo-version.h" CAIRO_VERSION_CONTENT)
+if (Cairo_INCLUDE_DIR AND NOT Cairo_VERSION)
+    if (EXISTS "${Cairo_INCLUDE_DIR}/cairo-version.h")
+        file(READ "${Cairo_INCLUDE_DIR}/cairo-version.h" Cairo_VERSION_CONTENT)
 
-        string(REGEX MATCH "#define +CAIRO_VERSION_MAJOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}")
-        set(CAIRO_VERSION_MAJOR "${CMAKE_MATCH_1}")
+        string(REGEX MATCH "#define +CAIRO_VERSION_MAJOR +([0-9]+)" _dummy "${Cairo_VERSION_CONTENT}")
+        set(Cairo_VERSION_MAJOR "${CMAKE_MATCH_1}")
 
-        string(REGEX MATCH "#define +CAIRO_VERSION_MINOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}")
-        set(CAIRO_VERSION_MINOR "${CMAKE_MATCH_1}")
+        string(REGEX MATCH "#define +CAIRO_VERSION_MINOR +([0-9]+)" _dummy "${Cairo_VERSION_CONTENT}")
+        set(Cairo_VERSION_MINOR "${CMAKE_MATCH_1}")
 
-        string(REGEX MATCH "#define +CAIRO_VERSION_MICRO +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}")
-        set(CAIRO_VERSION_MICRO "${CMAKE_MATCH_1}")
+        string(REGEX MATCH "#define +CAIRO_VERSION_MICRO +([0-9]+)" _dummy "${Cairo_VERSION_CONTENT}")
+        set(Cairo_VERSION_PATCH "${CMAKE_MATCH_1}")
 
-        set(CAIRO_VERSION "${CAIRO_VERSION_MAJOR}.${CAIRO_VERSION_MINOR}.${CAIRO_VERSION_MICRO}")
+        set(Cairo_VERSION "${Cairo_VERSION_MAJOR}.${Cairo_VERSION_MINOR}.${Cairo_VERSION_PATCH}")
     endif ()
 endif ()
 
-if ("${Cairo_FIND_VERSION}" VERSION_GREATER "${CAIRO_VERSION}")
-    message(FATAL_ERROR "Required version (" ${Cairo_FIND_VERSION} ") is higher than found version (" ${CAIRO_VERSION} ")")
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Cairo
+    FOUND_VAR Cairo_FOUND
+    REQUIRED_VARS Cairo_LIBRARY Cairo_INCLUDE_DIR
+    VERSION_VAR Cairo_VERSION
+)
+
+if (Cairo_LIBRARY AND NOT TARGET Cairo::Cairo)
+    add_library(Cairo::Cairo UNKNOWN IMPORTED GLOBAL)
+    set_target_properties(Cairo::Cairo PROPERTIES
+        IMPORTED_LOCATION "${Cairo_LIBRARY}"
+        INTERFACE_COMPILE_OPTIONS "${Cairo_COMPILE_OPTIONS}"
+        INTERFACE_INCLUDE_DIRECTORIES "${Cairo_INCLUDE_DIR}"
+    )
 endif ()
 
-include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cairo REQUIRED_VARS CAIRO_INCLUDE_DIRS CAIRO_LIBRARIES
-                                        VERSION_VAR CAIRO_VERSION)
+mark_as_advanced(Cairo_INCLUDE_DIR Cairo_LIBRARIES)
 
-mark_as_advanced(
-    CAIRO_INCLUDE_DIRS
-    CAIRO_LIBRARIES
-)
+if (Cairo_FOUND)
+    set(Cairo_LIBRARIES ${Cairo_LIBRARY})
+    set(Cairo_INCLUDE_DIRS ${Cairo_INCLUDE_DIR})
+endif ()
index 84a5d43..200c78b 100644 (file)
@@ -116,7 +116,6 @@ find_package(ZLIB REQUIRED)
 
 # Emulate what pkg-config would do with statically compiled libraries
 # FIXME: https://bugs.webkit.org/show_bug.cgi?id=192410
-list(APPEND CAIRO_LIBRARIES ${PIXMAN_LIBRARIES})
 list(APPEND CURL_LIBRARIES ${NGHTTP2_LIBRARIES})
 
 SET_AND_EXPOSE_TO_BUILD(HAVE_PTHREAD_SETNAME_NP ON)
index 43537c2..409df11 100644 (file)
@@ -1,3 +1,20 @@
+2020-02-04  Ross Kirsling  <ross.kirsling@sony.com>
+
+        [CMake] Add Cairo::Cairo target
+        https://bugs.webkit.org/show_bug.cgi?id=207159
+
+        Reviewed by Konstantin Tokarev.
+
+        * DumpRenderTree/PlatformWin.cmake:
+        * ImageDiff/Cairo.cmake:
+        * TestWebKitAPI/PlatformWPE.cmake:
+        * TestWebKitAPI/PlatformWin.cmake:
+        * TestWebKitAPI/glib/CMakeLists.txt:
+        * WebKitTestRunner/PlatformGTK.cmake:
+        * WebKitTestRunner/PlatformWPE.cmake:
+        * WebKitTestRunner/PlatformWin.cmake:
+        * wpe/backends/CMakeLists.txt:
+
 2020-02-03  Jiewen Tan  <jiewen_tan@apple.com>
 
         Pass a hint from the extension to decidePolicyForSOAuthorizationLoadWithCurrentPolicy
index cc6548b..f877a3d 100644 (file)
@@ -84,7 +84,9 @@ set(DumpRenderTree_LIBRARIES
 if (${WTF_PLATFORM_WIN_CAIRO})
     list(APPEND DumpRenderTree_INCLUDE_DIRECTORIES
         cairo
-        ${CAIRO_INCLUDE_DIRS}
+    )
+    list(APPEND DumpRenderTreeLib_LIBRARIES
+        Cairo::Cairo
     )
     list(APPEND DumpRenderTreeLib_SOURCES
         cairo/PixelDumpSupportCairo.cpp
index 66c34d6..2167836 100644 (file)
@@ -2,12 +2,8 @@ list(APPEND ImageDiff_SOURCES
     cairo/PlatformImageCairo.cpp
 )
 
-list(APPEND ImageDiff_SYSTEM_INCLUDE_DIRECTORIES
-    ${CAIRO_INCLUDE_DIRS}
-)
-
 list(APPEND ImageDiff_LIBRARIES
-    ${CAIRO_LIBRARIES}
+    Cairo::Cairo
 )
 
 list(APPEND ImageDiff_PRIVATE_DEFINITIONS USE_CAIRO=1)
index a2b5740..3f0b0cc 100644 (file)
@@ -9,7 +9,6 @@ list(APPEND TestWebKit_DEPENDENCIES TestWebKitAPI-forwarding-headers)
 add_dependencies(TestWebKitAPIInjectedBundle TestWebKitAPI-forwarding-headers)
 
 include_directories(SYSTEM
-    ${CAIRO_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
     ${GSTREAMER_INCLUDE_DIRS}
     ${GSTREAMER_AUDIO_INCLUDE_DIRS}
index 387d593..94473f5 100644 (file)
@@ -54,7 +54,7 @@ list(APPEND TestWebCore_LIBRARIES
 
 if (${WTF_PLATFORM_WIN_CAIRO})
     list(APPEND TestWebCore_LIBRARIES
-        ${CAIRO_LIBRARIES}
+        Cairo::Cairo
         ${OPENSSL_LIBRARIES}
         mfuuid
         strmiids
index 35bebee..cdab791 100644 (file)
@@ -12,7 +12,6 @@ set(WebKitGLibAPITests_INCLUDE_DIRECTORIES
 )
 
 set(WebKitGLibAPITests_SYSTEM_INCLUDE_DIRECTORIES
-    ${CAIRO_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
     ${GSTREAMER_INCLUDE_DIRS}
     ${LIBSOUP_INCLUDE_DIRS}
index 43b9869..e9ac26d 100644 (file)
@@ -20,14 +20,13 @@ list(APPEND WebKitTestRunner_INCLUDE_DIRECTORIES
 
 list(APPEND WebKitTestRunner_SYSTEM_INCLUDE_DIRECTORIES
     ${ATK_INCLUDE_DIRS}
-    ${CAIRO_INCLUDE_DIRS}
     ${GTK3_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
 )
 
 list(APPEND WebKitTestRunner_LIBRARIES
+    Cairo::Cairo
     ${ATK_LIBRARIES}
-    ${CAIRO_LIBRARIES}
     ${GTK3_LIBRARIES}
     ${GLIB_LIBRARIES}
     WebCore
index 7d5450b..c15d7c3 100644 (file)
@@ -21,14 +21,13 @@ list(APPEND WebKitTestRunner_INCLUDE_DIRECTORIES
 )
 
 list(APPEND WebKitTestRunner_SYSTEM_INCLUDE_DIRECTORIES
-    ${CAIRO_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
     ${LIBXKBCOMMON_INCLUDE_DIRS}
     ${WPEBACKEND_FDO_INCLUDE_DIRS}
 )
 
 list(APPEND WebKitTestRunner_LIBRARIES
-    ${CAIRO_LIBRARIES}
+    Cairo::Cairo
     ${GLIB_LIBRARIES}
     ${LIBXKBCOMMON_LIBRARIES}
     ${WPEBACKEND_FDO_LIBRARIES}
@@ -36,7 +35,7 @@ list(APPEND WebKitTestRunner_LIBRARIES
 )
 
 set(WebKitTestRunnerInjectedBundle_LIBRARIES
-    ${CAIRO_LIBRARIES}
+    Cairo::Cairo
     ${GLIB_LIBRARIES}
     WebCoreTestSupport
     WebKit
index cdac662..4b40adf 100644 (file)
@@ -24,7 +24,6 @@ list(APPEND WebKitTestRunnerInjectedBundle_SOURCES
 list(APPEND WebKitTestRunner_INCLUDE_DIRECTORIES
     cairo
     win
-    ${CAIRO_INCLUDE_DIRS}
     ${FORWARDING_HEADERS_DIR}
     ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/win
 )
index 9788ab5..f30a512 100644 (file)
@@ -22,7 +22,6 @@ set(WPEToolingBackends_INCLUDE_DIRECTORIES
 set(WPEToolingBackends_SYSTEM_INCLUDE_DIRECTORIES
     ${ATK_INCLUDE_DIRS}
     ${ATK_BRIDGE_INCLUDE_DIRS}
-    ${CAIRO_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
     ${LIBEPOXY_INCLUDE_DIRS}
     ${WPE_INCLUDE_DIRS}
@@ -30,9 +29,9 @@ set(WPEToolingBackends_SYSTEM_INCLUDE_DIRECTORIES
 )
 
 set(WPEToolingBackends_LIBRARIES
+    Cairo::Cairo
     ${ATK_LIBRARIES}
     ${ATK_BRIDGE_LIBRARIES}
-    ${CAIRO_LIBRARIES}
     ${GLIB_LIBRARIES}
     ${LIBEPOXY_LIBRARIES}
     ${LIBXKBCOMMON_LIBRARIES}