summaryrefslogtreecommitdiff
path: root/Source/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmake')
-rw-r--r--Source/cmake/FindATK.cmake52
-rw-r--r--Source/cmake/FindATSPI.cmake51
-rw-r--r--Source/cmake/FindCFLite.cmake18
-rw-r--r--Source/cmake/FindCairo.cmake77
-rw-r--r--Source/cmake/FindCairoGL.cmake51
-rw-r--r--Source/cmake/FindClang.cmake16
-rw-r--r--Source/cmake/FindDBus.cmake59
-rw-r--r--Source/cmake/FindDirectX.cmake29
-rw-r--r--Source/cmake/FindEGL.cmake53
-rw-r--r--Source/cmake/FindEnchant.cmake48
-rw-r--r--Source/cmake/FindEspeak.cmake42
-rw-r--r--Source/cmake/FindFontconfig.cmake69
-rw-r--r--Source/cmake/FindFreetype2.cmake94
-rw-r--r--Source/cmake/FindGDK2.cmake49
-rw-r--r--Source/cmake/FindGDK3.cmake49
-rw-r--r--Source/cmake/FindGLIB.cmake122
-rw-r--r--Source/cmake/FindGObjectIntrospection.cmake60
-rw-r--r--Source/cmake/FindGStreamer.cmake131
-rw-r--r--Source/cmake/FindGTK2.cmake49
-rw-r--r--Source/cmake/FindGTK3.cmake82
-rw-r--r--Source/cmake/FindGTKUnixPrint.cmake49
-rw-r--r--Source/cmake/FindGUdev.cmake49
-rw-r--r--Source/cmake/FindGeoClue.cmake49
-rw-r--r--Source/cmake/FindGeoClue2.cmake51
-rw-r--r--Source/cmake/FindGperf.cmake19
-rw-r--r--Source/cmake/FindHarfBuzz.cmake61
-rw-r--r--Source/cmake/FindHyphen.cmake45
-rw-r--r--Source/cmake/FindICU.cmake110
-rw-r--r--Source/cmake/FindLLVM.cmake49
-rw-r--r--Source/cmake/FindLibGcrypt.cmake91
-rw-r--r--Source/cmake/FindLibNotify.cmake55
-rw-r--r--Source/cmake/FindLibSoup.cmake57
-rw-r--r--Source/cmake/FindLibsecret.cmake49
-rw-r--r--Source/cmake/FindOpenGL.cmake65
-rw-r--r--Source/cmake/FindOpenGLES2.cmake27
-rw-r--r--Source/cmake/FindOpenWebRTC.cmake49
-rw-r--r--Source/cmake/FindQuickTimeSDK.cmake20
-rw-r--r--Source/cmake/FindSqlite.cmake65
-rw-r--r--Source/cmake/FindWayland.cmake35
-rw-r--r--Source/cmake/FindWebP.cmake51
-rw-r--r--Source/cmake/OptionsCommon.cmake281
-rw-r--r--Source/cmake/OptionsGTK.cmake493
-rw-r--r--Source/cmake/OptionsJSCOnly.cmake79
-rw-r--r--Source/cmake/OptionsMac.cmake119
-rw-r--r--Source/cmake/OptionsWin.cmake185
-rw-r--r--Source/cmake/WebKitCommon.cmake49
-rw-r--r--Source/cmake/WebKitFS.cmake55
-rw-r--r--Source/cmake/WebKitFeatures.cmake349
-rw-r--r--Source/cmake/WebKitHelpers.cmake114
-rw-r--r--Source/cmake/WebKitMacros.cmake447
-rw-r--r--Source/cmake/WebKitPackaging.cmake151
-rw-r--r--Source/cmake/WinTools.make4
-rw-r--r--Source/cmake/gtksymbols.filter13
-rw-r--r--Source/cmake/tools/scripts/COPYRIGHT-END-YEAR1
-rw-r--r--Source/cmake/tools/scripts/VERSION1
-rwxr-xr-xSource/cmake/tools/scripts/auto-version.pl176
-rwxr-xr-xSource/cmake/tools/scripts/feature-defines.pl47
-rw-r--r--Source/cmake/tools/scripts/version-stamp.pl133
58 files changed, 4944 insertions, 0 deletions
diff --git a/Source/cmake/FindATK.cmake b/Source/cmake/FindATK.cmake
new file mode 100644
index 000000000..d49ab2737
--- /dev/null
+++ b/Source/cmake/FindATK.cmake
@@ -0,0 +1,52 @@
+# - Try to find ATK
+# Once done, this will define
+#
+# ATK_INCLUDE_DIRS - the ATK include drectories
+# ATK_LIBRARIES - link these to use ATK
+#
+# Copyright (C) 2012 Samsung Electronics
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(PC_ATK atk)
+
+find_path(ATK_INCLUDE_DIRS
+ NAMES atk/atk.h
+ HINTS ${PC_ATK_INCLUDEDIR}
+ ${PC_ATK_INCLUDE_DIRS}
+ PATH_SUFFIXES atk-1.0
+)
+
+find_library(ATK_LIBRARIES
+ NAMES atk-1.0
+ HINTS ${PC_ATK_LIBRARY_DIRS}
+ ${PC_ATK_LIBDIR}
+)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ATK REQUIRED_VARS ATK_INCLUDE_DIRS ATK_LIBRARIES
+ VERSION_VAR PC_ATK_VERSION)
+mark_as_advanced(
+ ATK_INCLUDE_DIRS
+ ATK_LIBRARIES
+)
diff --git a/Source/cmake/FindATSPI.cmake b/Source/cmake/FindATSPI.cmake
new file mode 100644
index 000000000..5d0e6c423
--- /dev/null
+++ b/Source/cmake/FindATSPI.cmake
@@ -0,0 +1,51 @@
+# Copyright (c) 2013 Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# * Neither the name of Intel Corporation nor the names of its contributors may
+# be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Try to find AT-SPI include and library directories.
+#
+# After successful discovery, this will set for inclusion where needed:
+# ATSPI_INCLUDE_DIRS - containg the AT-SPI headers
+# ATSPI_LIBRARIES - containg the AT-SPI library
+
+include(FindPkgConfig)
+
+pkg_check_modules(ATSPI atspi-2)
+
+set(VERSION_OK TRUE)
+if (ATSPI_VERSION)
+ if (ATSPI_FIND_VERSION_EXACT)
+ if (NOT("${ATSPI_FIND_VERSION}" VERSION_EQUAL "${ATSPI_VERSION}"))
+ set(VERSION_OK FALSE)
+ endif ()
+ else ()
+ if ("${ATSPI_VERSION}" VERSION_LESS "${ATSPI_FIND_VERSION}")
+ set(VERSION_OK FALSE)
+ endif ()
+ endif ()
+endif ()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ATSPI DEFAULT_MSG ATSPI_INCLUDE_DIRS ATSPI_LIBRARIES VERSION_OK)
diff --git a/Source/cmake/FindCFLite.cmake b/Source/cmake/FindCFLite.cmake
new file mode 100644
index 000000000..71e756838
--- /dev/null
+++ b/Source/cmake/FindCFLite.cmake
@@ -0,0 +1,18 @@
+# - Try to find the CFLite library
+# Once done this will define
+#
+# CFLITE_FOUND - System has CFLite
+# CFLITE_INCLUDE_DIR - The CFLite include directory
+# CFLITE_LIBRARIES - The libraries needed to use CFLite
+
+find_path(CFLITE_INCLUDE_DIR NAMES CoreFoundation/CoreFoundation.h)
+
+find_library(CFLITE_LIBRARIES NAMES CFLite.lib)
+
+include(FindPackageHandleStandardArgs)
+
+# handle the QUIETLY and REQUIRED arguments and set COREFOUNDATION_FOUND to TRUE if
+# all listed variables are TRUE
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(CFLite DEFAULT_MSG CFLITE_LIBRARIES CFLITE_INCLUDE_DIR)
+
+mark_as_advanced(CFLITE_INCLUDE_DIR CFLITE_LIBRARIES)
diff --git a/Source/cmake/FindCairo.cmake b/Source/cmake/FindCairo.cmake
new file mode 100644
index 000000000..277f6af38
--- /dev/null
+++ b/Source/cmake/FindCairo.cmake
@@ -0,0 +1,77 @@
+# - 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>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(PC_CAIRO QUIET cairo)
+
+find_path(CAIRO_INCLUDE_DIRS
+ NAMES cairo.h
+ HINTS ${PC_CAIRO_INCLUDEDIR}
+ ${PC_CAIRO_INCLUDE_DIRS}
+ ${WEBKIT_LIBRARIES_INCLUDE_DIR}/cairo
+ PATH_SUFFIXES cairo
+)
+
+find_library(CAIRO_LIBRARIES
+ NAMES cairo
+ HINTS ${PC_CAIRO_LIBDIR}
+ ${PC_CAIRO_LIBRARY_DIRS}
+ ${WEBKIT_LIBRARIES_LINK_DIR}
+)
+
+if (CAIRO_INCLUDE_DIRS)
+ if (EXISTS "${CAIRO_INCLUDE_DIRS}/cairo-version.h")
+ file(READ "${CAIRO_INCLUDE_DIRS}/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_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}")
+
+ set(CAIRO_VERSION "${CAIRO_VERSION_MAJOR}.${CAIRO_VERSION_MINOR}.${CAIRO_VERSION_MICRO}")
+ 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} ")")
+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_DIRS
+ CAIRO_LIBRARIES
+)
diff --git a/Source/cmake/FindCairoGL.cmake b/Source/cmake/FindCairoGL.cmake
new file mode 100644
index 000000000..6d3434786
--- /dev/null
+++ b/Source/cmake/FindCairoGL.cmake
@@ -0,0 +1,51 @@
+# - Try to find CairoGL
+# Once done, this will define
+#
+# CAIROGL_FOUND - system has CairoGL
+# CAIROGL_INCLUDE_DIRS - the CairoGL include directories
+# CAIROGL_LIBRARIES - link these to use CairoGL
+#
+# Copyright (C) 2014 Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(CAIROGL cairo-gl)
+
+if (CAIROGL_FOUND)
+# At the moment CairoGL does not add any extra cflags and libraries, so we can
+# safely ignore CAIROGL_LIBRARIES and CAIROGL_INCLUDE_DIRS for the moment.
+foreach (_component ${CairoGL_FIND_COMPONENTS})
+ string(TOUPPER ${_component} _UPPER_NAME)
+ string(REGEX REPLACE "-" "_" _UPPER_NAME ${_UPPER_NAME})
+ pkg_check_modules(${_UPPER_NAME} ${_component})
+ if (${_UPPER_NAME}_INCLUDE_DIRS)
+ set(CAIROGL_INCLUDE_DIRS ${CAIROGL_INCLUDE_DIRS} ${_UPPER_NAME}_INCLUDE_DIRS)
+ endif ()
+ if (${_UPPER_NAME}_LIBRARIES)
+ set(CAIROGL_LIBRARIES ${CAIROGL_LIBRARIES} ${_UPPER_NAME}_LIBRARIES)
+ endif ()
+endforeach ()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CairoGL DEFAULT_MSG CAIROGL_INCLUDE_DIRS CAIROGL_LIBRARIES)
+endif ()
diff --git a/Source/cmake/FindClang.cmake b/Source/cmake/FindClang.cmake
new file mode 100644
index 000000000..1fc86bb32
--- /dev/null
+++ b/Source/cmake/FindClang.cmake
@@ -0,0 +1,16 @@
+#
+# Check for Clang.
+#
+# The following variables are set:
+# CLANG_EXE
+# CLANG_VERSION
+
+find_program(CLANG_EXE NAMES "clang")
+
+execute_process(COMMAND ${CLANG_EXE} --version OUTPUT_VARIABLE CLANG_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CLANG DEFAULT_MSG
+ CLANG_VERSION)
+
+mark_as_advanced(CLANG_VERSION)
diff --git a/Source/cmake/FindDBus.cmake b/Source/cmake/FindDBus.cmake
new file mode 100644
index 000000000..f4752e8cb
--- /dev/null
+++ b/Source/cmake/FindDBus.cmake
@@ -0,0 +1,59 @@
+# - Try to find DBus
+# Once done, this will define
+#
+# DBUS_FOUND - system has DBus
+# DBUS_INCLUDE_DIRS - the DBus include directories
+# DBUS_LIBRARIES - link these to use DBus
+#
+# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(PC_DBUS QUIET dbus-1)
+
+find_library(DBUS_LIBRARIES
+ NAMES dbus-1
+ HINTS ${PC_DBUS_LIBDIR}
+ ${PC_DBUS_LIBRARY_DIRS}
+)
+
+find_path(DBUS_INCLUDE_DIR
+ NAMES dbus/dbus.h
+ HINTS ${PC_DBUS_INCLUDEDIR}
+ ${PC_DBUS_INCLUDE_DIRS}
+)
+
+get_filename_component(_DBUS_LIBRARY_DIR ${DBUS_LIBRARIES} PATH)
+find_path(DBUS_ARCH_INCLUDE_DIR
+ NAMES dbus/dbus-arch-deps.h
+ HINTS ${PC_DBUS_INCLUDEDIR}
+ ${PC_DBUS_INCLUDE_DIRS}
+ ${_DBUS_LIBRARY_DIR}
+ ${DBUS_INCLUDE_DIR}
+ PATH_SUFFIXES include
+)
+
+set(DBUS_INCLUDE_DIRS ${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBUS REQUIRED_VARS DBUS_INCLUDE_DIRS DBUS_LIBRARIES)
diff --git a/Source/cmake/FindDirectX.cmake b/Source/cmake/FindDirectX.cmake
new file mode 100644
index 000000000..7aac8d494
--- /dev/null
+++ b/Source/cmake/FindDirectX.cmake
@@ -0,0 +1,29 @@
+# - Find DirectX SDK installation
+# Find the DirectX includes and library
+# This module defines
+# DirectX_INCLUDE_DIRS, where to find d3d9.h, etc.
+# DirectX_LIBRARIES, libraries to link against to use DirectX.
+# DirectX_FOUND, If false, do not try to use DirectX.
+# DirectX_ROOT_DIR, directory where DirectX was installed.
+
+find_path(DirectX_INCLUDE_DIRS d3d9.h PATHS
+ "$ENV{DXSDK_DIR}/Include"
+ "$ENV{PROGRAMFILES}/Microsoft DirectX SDK*/Include"
+)
+
+get_filename_component(DirectX_ROOT_DIR "${DirectX_INCLUDE_DIRS}/.." ABSOLUTE)
+
+if (CMAKE_CL_64)
+ set(DirectX_LIBRARY_PATHS "${DirectX_ROOT_DIR}/Lib/x64")
+else ()
+ set(DirectX_LIBRARY_PATHS "${DirectX_ROOT_DIR}/Lib/x86" "${DirectX_ROOT_DIR}/Lib")
+endif ()
+
+find_library(DirectX_D3D9_LIBRARY d3d9 ${DirectX_LIBRARY_PATHS} NO_DEFAULT_PATH)
+find_library(DirectX_D3DX9_LIBRARY d3dx9 ${DirectX_LIBRARY_PATHS} NO_DEFAULT_PATH)
+set(DirectX_LIBRARIES ${DirectX_D3D9_LIBRARY} ${DirectX_D3DX9_LIBRARY})
+
+# handle the QUIETLY and REQUIRED arguments and set DirectX_FOUND to TRUE if all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(DirectX DEFAULT_MSG DirectX_ROOT_DIR DirectX_LIBRARIES DirectX_INCLUDE_DIRS)
+mark_as_advanced(DirectX_INCLUDE_DIRS DirectX_D3D9_LIBRARY DirectX_D3DX9_LIBRARY)
diff --git a/Source/cmake/FindEGL.cmake b/Source/cmake/FindEGL.cmake
new file mode 100644
index 000000000..6406d9b1a
--- /dev/null
+++ b/Source/cmake/FindEGL.cmake
@@ -0,0 +1,53 @@
+# - Try to Find EGL
+# Once done, this will define
+#
+# EGL_FOUND - system has EGL installed.
+# EGL_INCLUDE_DIRS - directories which contain the EGL headers.
+# EGL_LIBRARIES - libraries required to link against EGL.
+# EGL_DEFINITIONS - Compiler switches required for using EGL.
+#
+# Copyright (C) 2012 Intel Corporation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+find_package(PkgConfig)
+
+pkg_check_modules(PC_EGL egl)
+
+if (PC_EGL_FOUND)
+ set(EGL_DEFINITIONS ${PC_EGL_CFLAGS_OTHER})
+endif ()
+
+find_path(EGL_INCLUDE_DIRS NAMES EGL/egl.h
+ HINTS ${PC_EGL_INCLUDEDIR} ${PC_EGL_INCLUDE_DIRS}
+)
+
+set(EGL_NAMES ${EGL_NAMES} egl EGL)
+find_library(EGL_LIBRARIES NAMES ${EGL_NAMES}
+ HINTS ${PC_EGL_LIBDIR} ${PC_EGL_LIBRARY_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(EGL DEFAULT_MSG EGL_INCLUDE_DIRS EGL_LIBRARIES)
+
+mark_as_advanced(EGL_INCLUDE_DIRS EGL_LIBRARIES)
diff --git a/Source/cmake/FindEnchant.cmake b/Source/cmake/FindEnchant.cmake
new file mode 100644
index 000000000..8dd0b5ba2
--- /dev/null
+++ b/Source/cmake/FindEnchant.cmake
@@ -0,0 +1,48 @@
+# - Try to find Enchant
+# Once done, this will define
+#
+# ENCHANT_INCLUDE_DIRS - the Enchant include drectories
+# ENCHANT_LIBRARIES - link these to use Enchant
+#
+# Copyright (C) 2012 Samsung Electronics
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(PC_ENCHANT enchant)
+
+find_path(ENCHANT_INCLUDE_DIRS
+ NAMES enchant.h
+ PATHS ${PC_ENCHANT_INCLUDEDIR}
+ ${PC_ENCHANT_INCLUDE_DIRS}
+)
+
+find_library(ENCHANT_LIBRARIES
+ NAMES enchant
+ PATHS ${PC_ENCHANT_LIBDIR}
+ ${PC_ENCHANT_LIBRARY_DIRS}
+)
+
+mark_as_advanced(
+ ENCHANT_INCLUDE_DIRS
+ ENCHANT_LIBRARIES
+)
diff --git a/Source/cmake/FindEspeak.cmake b/Source/cmake/FindEspeak.cmake
new file mode 100644
index 000000000..d273b6135
--- /dev/null
+++ b/Source/cmake/FindEspeak.cmake
@@ -0,0 +1,42 @@
+# - Try to find Espeak
+# Once done, this will define
+#
+# ESPEAK_INCLUDE_DIRS - the Espeak include drectories
+# ESPEAK_LIBRARIES - link these to use Espeak
+#
+# Copyright (C) 2014 Samsung Electronics
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``A
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_path(ESPEAK_INCLUDE_DIRS
+ NAMES speak_lib.h
+ PATH_SUFFIXES espeak
+)
+
+find_library(ESPEAK_LIBRARIES
+ NAMES espeak
+)
+
+mark_as_advanced(
+ ESPEAK_INCLUDE_DIRS
+ ESPEAK_LIBRARIES
+)
diff --git a/Source/cmake/FindFontconfig.cmake b/Source/cmake/FindFontconfig.cmake
new file mode 100644
index 000000000..2ed605d73
--- /dev/null
+++ b/Source/cmake/FindFontconfig.cmake
@@ -0,0 +1,69 @@
+# - Try to find the Fontconfig
+# Once done this will define
+#
+# FONTCONFIG_FOUND - system has Fontconfig
+# FONTCONFIG_INCLUDE_DIR - The include directory to use for the fontconfig headers
+# FONTCONFIG_LIBRARIES - Link these to use FONTCONFIG
+# FONTCONFIG_DEFINITIONS - Compiler switches required for using FONTCONFIG
+
+# Copyright (c) 2006,2007 Laurent Montel, <montel@kde.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+if (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
+
+ # in cache already
+ set(FONTCONFIG_FOUND TRUE)
+
+else (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
+
+ if (NOT WIN32)
+ # use pkg-config to get the directories and then use these values
+ # in the find_path() and find_library() calls
+ find_package(PkgConfig)
+ pkg_check_modules(PC_FONTCONFIG fontconfig)
+
+ set(FONTCONFIG_DEFINITIONS ${PC_FONTCONFIG_CFLAGS_OTHER})
+ endif (NOT WIN32)
+
+ find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h
+ PATHS
+ ${PC_FONTCONFIG_INCLUDEDIR}
+ ${PC_FONTCONFIG_INCLUDE_DIRS}
+ /usr/X11/include
+ )
+
+ find_library(FONTCONFIG_LIBRARIES NAMES fontconfig
+ PATHS
+ ${PC_FONTCONFIG_LIBDIR}
+ ${PC_FONTCONFIG_LIBRARY_DIRS}
+ )
+
+ include(FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fontconfig DEFAULT_MSG FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR)
+
+ mark_as_advanced(FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR)
+
+endif (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)
diff --git a/Source/cmake/FindFreetype2.cmake b/Source/cmake/FindFreetype2.cmake
new file mode 100644
index 000000000..14e8b16d1
--- /dev/null
+++ b/Source/cmake/FindFreetype2.cmake
@@ -0,0 +1,94 @@
+# Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(PC_FREETYPE2 REQUIRED freetype2)
+
+find_path(FREETYPE2_HEADER_DIR
+ NAMES freetype.h
+ HINTS ${PC_FREETYPE2_INCLUDE_DIRS}
+ ${PC_FREETYPE2_INCLUDEDIR}
+ PATH_SUFFIXES freetype
+)
+
+find_path(FREETYPE2_ROOT_INCLUDE_DIR
+ NAMES freetype/freetype.h
+ HINTS ${PC_FREETYPE2_INCLUDE_DIRS}
+ ${PC_FREETYPE2_INCLUDEDIR}
+)
+
+find_library(FREETYPE2_LIBRARIES
+ NAMES freetype
+ HINTS ${PC_FREETYPE2_LIBDIR}
+ ${PC_FREETYPE2_LIBRARY_DIRS}
+)
+
+set(FREETYPE2_INCLUDE_DIRS ${FREETYPE2_HEADER_DIR})
+
+# Since Freetype 2.5.1 there is no freetype/freetype.h, so this variable can be null
+if (FREETYPE2_ROOT_INCLUDE_DIR)
+ list(APPEND FREETYPE2_INCLUDE_DIRS ${FREETYPE2_ROOT_INCLUDE_DIR})
+endif ()
+
+# Inspired in the original FindFreetype.cmake
+if (FREETYPE2_HEADER_DIR AND EXISTS "${FREETYPE2_HEADER_DIR}/freetype.h")
+ file(STRINGS "${FREETYPE2_HEADER_DIR}/freetype.h" freetype_version_str
+ REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
+
+ unset(FREETYPE2_VERSION_STRING)
+ foreach (VPART MAJOR MINOR PATCH)
+ foreach (VLINE ${freetype_version_str})
+ if (VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}")
+ string(REGEX REPLACE "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$" "\\1"
+ FREETYPE2_VERSION_PART "${VLINE}")
+ if (FREETYPE2_VERSION_STRING)
+ set(FREETYPE2_VERSION_STRING "${FREETYPE2_VERSION_STRING}.${FREETYPE2_VERSION_PART}")
+ else ()
+ set(FREETYPE2_VERSION_STRING "${FREETYPE2_VERSION_PART}")
+ endif ()
+ unset(FREETYPE2_VERSION_PART)
+ endif ()
+ endforeach ()
+ endforeach ()
+endif ()
+
+set(VERSION_OK TRUE)
+if (FREETYPE2_VERSION_STRING)
+ if (PC_FREETYPE2_FIND_VERSION_EXACT)
+ if (NOT("${Freetype2_FIND_VERSION}" VERSION_EQUAL "${FREETYPE2_VERSION_STRING}"))
+ set(VERSION_OK FALSE)
+ endif ()
+ else ()
+ if ("${FREETYPE2_VERSION_STRING}" VERSION_LESS "${Freetype2_FIND_VERSION}")
+ set(VERSION_OK FALSE)
+ endif ()
+ endif ()
+endif ()
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype2 DEFAULT_MSG FREETYPE2_INCLUDE_DIRS FREETYPE2_LIBRARIES VERSION_OK)
+
+mark_as_advanced(
+ FREETYPE2_HEADER_DIR
+ FREETYPE2_LIBRARIES
+ FREETYPE2_ROOT_INCLUDE_DIR
+)
diff --git a/Source/cmake/FindGDK2.cmake b/Source/cmake/FindGDK2.cmake
new file mode 100644
index 000000000..421c902eb
--- /dev/null
+++ b/Source/cmake/FindGDK2.cmake
@@ -0,0 +1,49 @@
+# - Try to find GDK 2
+# Once done, this will define
+#
+# GDK2_FOUND - system has GDK 2
+# GDK2_INCLUDE_DIRS - the GDK 2 include directories
+# GDK2_LIBRARIES - link these to use GDK 2
+#
+# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+# Copyright (C) 2013 Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(GDK2 gdk-2.0)
+
+set(VERSION_OK TRUE)
+if (GDK2_VERSION)
+ if (GDK2_FIND_VERSION_EXACT)
+ if (NOT("${GDK2_FIND_VERSION}" VERSION_EQUAL "${GDK2_VERSION}"))
+ set(VERSION_OK FALSE)
+ endif ()
+ else ()
+ if ("${GDK2_VERSION}" VERSION_LESS "${GDK2_FIND_VERSION}")
+ set(VERSION_OK FALSE)
+ endif ()
+ endif ()
+endif ()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GDK2 DEFAULT_MSG GDK2_INCLUDE_DIRS GDK2_LIBRARIES VERSION_OK)
diff --git a/Source/cmake/FindGDK3.cmake b/Source/cmake/FindGDK3.cmake
new file mode 100644
index 000000000..801656381
--- /dev/null
+++ b/Source/cmake/FindGDK3.cmake
@@ -0,0 +1,49 @@
+# - Try to find GDK 3
+# Once done, this will define
+#
+# GDK3_FOUND - system has GDK 3
+# GDK3_INCLUDE_DIRS - the GDK 3 include directories
+# GDK3_LIBRARIES - link these to use GDK 3
+#
+# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+# Copyright (C) 2013 Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(GDK3 gdk-3.0)
+
+set(VERSION_OK TRUE)
+if (GDK3_VERSION)
+ if (GDK3_FIND_VERSION_EXACT)
+ if (NOT("${GDK3_FIND_VERSION}" VERSION_EQUAL "${GDK3_VERSION}"))
+ set(VERSION_OK FALSE)
+ endif ()
+ else ()
+ if ("${GDK3_VERSION}" VERSION_LESS "${GDK3_FIND_VERSION}")
+ set(VERSION_OK FALSE)
+ endif ()
+ endif ()
+endif ()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GDK3 DEFAULT_MSG GDK3_INCLUDE_DIRS GDK3_LIBRARIES VERSION_OK)
diff --git a/Source/cmake/FindGLIB.cmake b/Source/cmake/FindGLIB.cmake
new file mode 100644
index 000000000..93d3ec547
--- /dev/null
+++ b/Source/cmake/FindGLIB.cmake
@@ -0,0 +1,122 @@
+# - Try to find Glib and its components (gio, gobject etc)
+# Once done, this will define
+#
+# GLIB_FOUND - system has Glib
+# GLIB_INCLUDE_DIRS - the Glib include directories
+# GLIB_LIBRARIES - link these to use Glib
+#
+# Optionally, the COMPONENTS keyword can be passed to find_package()
+# and Glib components can be looked for. Currently, the following
+# components can be used, and they define the following variables if
+# found:
+#
+# gio: GLIB_GIO_LIBRARIES
+# gobject: GLIB_GOBJECT_LIBRARIES
+# gmodule: GLIB_GMODULE_LIBRARIES
+# gthread: GLIB_GTHREAD_LIBRARIES
+#
+# Note that the respective _INCLUDE_DIR variables are not set, since
+# all headers are in the same directory as GLIB_INCLUDE_DIRS.
+#
+# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(PC_GLIB QUIET glib-2.0)
+
+find_library(GLIB_LIBRARIES
+ NAMES glib-2.0
+ HINTS ${PC_GLIB_LIBDIR}
+ ${PC_GLIB_LIBRARY_DIRS}
+)
+
+# Files in glib's main include path may include glibconfig.h, which,
+# for some odd reason, is normally in $LIBDIR/glib-2.0/include.
+get_filename_component(_GLIB_LIBRARY_DIR ${GLIB_LIBRARIES} PATH)
+find_path(GLIBCONFIG_INCLUDE_DIR
+ NAMES glibconfig.h
+ HINTS ${PC_LIBDIR} ${PC_LIBRARY_DIRS} ${_GLIB_LIBRARY_DIR}
+ ${PC_GLIB_INCLUDEDIR} ${PC_GLIB_INCLUDE_DIRS}
+ PATH_SUFFIXES glib-2.0/include
+)
+
+find_path(GLIB_INCLUDE_DIR
+ NAMES glib.h
+ HINTS ${PC_GLIB_INCLUDEDIR}
+ ${PC_GLIB_INCLUDE_DIRS}
+ PATH_SUFFIXES glib-2.0
+)
+
+set(GLIB_INCLUDE_DIRS ${GLIB_INCLUDE_DIR} ${GLIBCONFIG_INCLUDE_DIR})
+
+# Version detection
+if (EXISTS "${GLIBCONFIG_INCLUDE_DIR}/glibconfig.h")
+ file(READ "${GLIBCONFIG_INCLUDE_DIR}/glibconfig.h" GLIBCONFIG_H_CONTENTS)
+ string(REGEX MATCH "#define GLIB_MAJOR_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}")
+ set(GLIB_VERSION_MAJOR "${CMAKE_MATCH_1}")
+ string(REGEX MATCH "#define GLIB_MINOR_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}")
+ set(GLIB_VERSION_MINOR "${CMAKE_MATCH_1}")
+ string(REGEX MATCH "#define GLIB_MICRO_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}")
+ set(GLIB_VERSION_MICRO "${CMAKE_MATCH_1}")
+ set(GLIB_VERSION "${GLIB_VERSION_MAJOR}.${GLIB_VERSION_MINOR}.${GLIB_VERSION_MICRO}")
+endif ()
+
+# Additional Glib components. We only look for libraries, as not all of them
+# have corresponding headers and all headers are installed alongside the main
+# glib ones.
+foreach (_component ${GLIB_FIND_COMPONENTS})
+ if (${_component} STREQUAL "gio")
+ find_library(GLIB_GIO_LIBRARIES NAMES gio-2.0 HINTS ${_GLIB_LIBRARY_DIR})
+ set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GIO_LIBRARIES)
+ elseif (${_component} STREQUAL "gobject")
+ find_library(GLIB_GOBJECT_LIBRARIES NAMES gobject-2.0 HINTS ${_GLIB_LIBRARY_DIR})
+ set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GOBJECT_LIBRARIES)
+ elseif (${_component} STREQUAL "gmodule")
+ find_library(GLIB_GMODULE_LIBRARIES NAMES gmodule-2.0 HINTS ${_GLIB_LIBRARY_DIR})
+ set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GMODULE_LIBRARIES)
+ elseif (${_component} STREQUAL "gthread")
+ find_library(GLIB_GTHREAD_LIBRARIES NAMES gthread-2.0 HINTS ${_GLIB_LIBRARY_DIR})
+ set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GTHREAD_LIBRARIES)
+ elseif (${_component} STREQUAL "gio-unix")
+ # gio-unix is compiled as part of the gio library, but the include paths
+ # are separate from the shared glib ones. Since this is currently only used
+ # by WebKitGTK+ we don't go to extraordinary measures beyond pkg-config.
+ pkg_check_modules(GIO_UNIX QUIET gio-unix-2.0)
+ endif ()
+endforeach ()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLIB REQUIRED_VARS GLIB_INCLUDE_DIRS GLIB_LIBRARIES ${ADDITIONAL_REQUIRED_VARS}
+ VERSION_VAR GLIB_VERSION)
+
+mark_as_advanced(
+ GLIBCONFIG_INCLUDE_DIR
+ GLIB_GIO_LIBRARIES
+ GLIB_GIO_UNIX_LIBRARIES
+ GLIB_GMODULE_LIBRARIES
+ GLIB_GOBJECT_LIBRARIES
+ GLIB_GTHREAD_LIBRARIES
+ GLIB_INCLUDE_DIR
+ GLIB_INCLUDE_DIRS
+ GLIB_LIBRARIES
+)
diff --git a/Source/cmake/FindGObjectIntrospection.cmake b/Source/cmake/FindGObjectIntrospection.cmake
new file mode 100644
index 000000000..e1f49b402
--- /dev/null
+++ b/Source/cmake/FindGObjectIntrospection.cmake
@@ -0,0 +1,60 @@
+# - Try to find gobject-introspection
+# Once done, this will define
+#
+# INTROSPECTION_FOUND - system has gobject-introspection
+# INTROSPECTION_SCANNER - the gobject-introspection scanner, g-ir-scanner
+# INTROSPECTION_COMPILER - the gobject-introspection compiler, g-ir-compiler
+# INTROSPECTION_GENERATE - the gobject-introspection generate, g-ir-generate
+# INTROSPECTION_GIRDIR
+# INTROSPECTION_TYPELIBDIR
+# INTROSPECTION_CFLAGS
+# INTROSPECTION_LIBS
+#
+# Copyright (C) 2010, Pino Toscano, <pino@kde.org>
+# Copyright (C) 2014 Igalia S.L.
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+
+macro(_GIR_GET_PKGCONFIG_VAR _outvar _varname _extra_args)
+ execute_process(
+ COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_varname} ${_extra_args} gobject-introspection-1.0
+ OUTPUT_VARIABLE _result
+ RESULT_VARIABLE _null
+ )
+
+ if (_null)
+ else ()
+ string(REGEX REPLACE "[\r\n]" " " _result "${_result}")
+ string(REGEX REPLACE " +$" "" _result "${_result}")
+ separate_arguments(_result)
+ set(${_outvar} ${_result} CACHE INTERNAL "")
+ endif ()
+endmacro(_GIR_GET_PKGCONFIG_VAR)
+
+find_package(PkgConfig)
+if (PKG_CONFIG_FOUND)
+ if (PACKAGE_FIND_VERSION_COUNT GREATER 0)
+ set(_gir_version_cmp ">=${PACKAGE_FIND_VERSION}")
+ endif ()
+ pkg_check_modules(_pc_gir gobject-introspection-1.0${_gir_version_cmp})
+ if (_pc_gir_FOUND)
+ set(INTROSPECTION_FOUND TRUE)
+ _gir_get_pkgconfig_var(INTROSPECTION_SCANNER "g_ir_scanner" "")
+ _gir_get_pkgconfig_var(INTROSPECTION_COMPILER "g_ir_compiler" "")
+ _gir_get_pkgconfig_var(INTROSPECTION_GENERATE "g_ir_generate" "")
+ _gir_get_pkgconfig_var(INTROSPECTION_GIRDIR "girdir" "")
+ _gir_get_pkgconfig_var(INTROSPECTION_TYPELIBDIR "typelibdir" "")
+ set(INTROSPECTION_CFLAGS "${_pc_gir_CFLAGS}")
+ set(INTROSPECTION_LIBS "${_pc_gir_LIBS}")
+ endif ()
+endif ()
+
+mark_as_advanced(
+ INTROSPECTION_SCANNER
+ INTROSPECTION_COMPILER
+ INTROSPECTION_GENERATE
+ INTROSPECTION_GIRDIR
+ INTROSPECTION_TYPELIBDIR
+ INTROSPECTION_CFLAGS
+ INTROSPECTION_LIBS
+)
diff --git a/Source/cmake/FindGStreamer.cmake b/Source/cmake/FindGStreamer.cmake
new file mode 100644
index 000000000..77c2d9dbc
--- /dev/null
+++ b/Source/cmake/FindGStreamer.cmake
@@ -0,0 +1,131 @@
+# - Try to find GStreamer and its plugins
+# Once done, this will define
+#
+# GSTREAMER_FOUND - system has GStreamer
+# GSTREAMER_INCLUDE_DIRS - the GStreamer include directories
+# GSTREAMER_LIBRARIES - link these to use GStreamer
+#
+# Additionally, gstreamer-base is always looked for and required, and
+# the following related variables are defined:
+#
+# GSTREAMER_BASE_INCLUDE_DIRS - gstreamer-base's include directory
+# GSTREAMER_BASE_LIBRARIES - link to these to use gstreamer-base
+#
+# Optionally, the COMPONENTS keyword can be passed to find_package()
+# and GStreamer plugins can be looked for. Currently, the following
+# plugins can be searched, and they define the following variables if
+# found:
+#
+# gstreamer-app: GSTREAMER_APP_INCLUDE_DIRS and GSTREAMER_APP_LIBRARIES
+# gstreamer-audio: GSTREAMER_AUDIO_INCLUDE_DIRS and GSTREAMER_AUDIO_LIBRARIES
+# gstreamer-fft: GSTREAMER_FFT_INCLUDE_DIRS and GSTREAMER_FFT_LIBRARIES
+# gstreamer-gl: GSTREAMER_GL_INCLUDE_DIRS and GSTREAMER_GL_LIBRARIES
+# gstreamer-mpegts: GSTREAMER_MPEGTS_INCLUDE_DIRS and GSTREAMER_MPEGTS_LIBRARIES
+# gstreamer-pbutils: GSTREAMER_PBUTILS_INCLUDE_DIRS and GSTREAMER_PBUTILS_LIBRARIES
+# gstreamer-tag: GSTREAMER_TAG_INCLUDE_DIRS and GSTREAMER_TAG_LIBRARIES
+# gstreamer-video: GSTREAMER_VIDEO_INCLUDE_DIRS and GSTREAMER_VIDEO_LIBRARIES
+#
+# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+
+# Helper macro to find a GStreamer plugin (or GStreamer itself)
+# _component_prefix is prepended to the _INCLUDE_DIRS and _LIBRARIES variables (eg. "GSTREAMER_AUDIO")
+# _pkgconfig_name is the component's pkg-config name (eg. "gstreamer-1.0", or "gstreamer-video-1.0").
+# _library is the component's library name (eg. "gstreamer-1.0" or "gstvideo-1.0")
+macro(FIND_GSTREAMER_COMPONENT _component_prefix _pkgconfig_name _library)
+
+ string(REGEX MATCH "(.*)>=(.*)" _dummy "${_pkgconfig_name}")
+ if ("${CMAKE_MATCH_2}" STREQUAL "")
+ pkg_check_modules(PC_${_component_prefix} "${_pkgconfig_name} >= ${GStreamer_FIND_VERSION}")
+ else ()
+ pkg_check_modules(PC_${_component_prefix} ${_pkgconfig_name})
+ endif ()
+ set(${_component_prefix}_INCLUDE_DIRS ${PC_${_component_prefix}_INCLUDE_DIRS})
+
+ find_library(${_component_prefix}_LIBRARIES
+ NAMES ${_library}
+ HINTS ${PC_${_component_prefix}_LIBRARY_DIRS} ${PC_${_component_prefix}_LIBDIR}
+ )
+endmacro()
+
+# ------------------------
+# 1. Find GStreamer itself
+# ------------------------
+
+# 1.1. Find headers and libraries
+FIND_GSTREAMER_COMPONENT(GSTREAMER gstreamer-1.0 gstreamer-1.0)
+FIND_GSTREAMER_COMPONENT(GSTREAMER_BASE gstreamer-base-1.0 gstbase-1.0)
+
+# -------------------------
+# 2. Find GStreamer plugins
+# -------------------------
+
+FIND_GSTREAMER_COMPONENT(GSTREAMER_APP gstreamer-app-1.0 gstapp-1.0)
+FIND_GSTREAMER_COMPONENT(GSTREAMER_AUDIO gstreamer-audio-1.0 gstaudio-1.0)
+FIND_GSTREAMER_COMPONENT(GSTREAMER_FFT gstreamer-fft-1.0 gstfft-1.0)
+FIND_GSTREAMER_COMPONENT(GSTREAMER_GL gstreamer-gl-1.0>=1.8.0 gstgl-1.0)
+FIND_GSTREAMER_COMPONENT(GSTREAMER_MPEGTS gstreamer-mpegts-1.0>=1.4.0 gstmpegts-1.0)
+FIND_GSTREAMER_COMPONENT(GSTREAMER_PBUTILS gstreamer-pbutils-1.0 gstpbutils-1.0)
+FIND_GSTREAMER_COMPONENT(GSTREAMER_TAG gstreamer-tag-1.0 gsttag-1.0)
+FIND_GSTREAMER_COMPONENT(GSTREAMER_VIDEO gstreamer-video-1.0 gstvideo-1.0)
+
+# ------------------------------------------------
+# 3. Process the COMPONENTS passed to FIND_PACKAGE
+# ------------------------------------------------
+set(_GSTREAMER_REQUIRED_VARS GSTREAMER_INCLUDE_DIRS GSTREAMER_LIBRARIES GSTREAMER_VERSION GSTREAMER_BASE_INCLUDE_DIRS GSTREAMER_BASE_LIBRARIES)
+
+foreach (_component ${GStreamer_FIND_COMPONENTS})
+ set(_gst_component "GSTREAMER_${_component}")
+ string(TOUPPER ${_gst_component} _UPPER_NAME)
+
+ list(APPEND _GSTREAMER_REQUIRED_VARS ${_UPPER_NAME}_INCLUDE_DIRS ${_UPPER_NAME}_LIBRARIES)
+endforeach ()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GStreamer REQUIRED_VARS _GSTREAMER_REQUIRED_VARS
+ VERSION_VAR GSTREAMER_VERSION)
+
+mark_as_advanced(
+ GSTREAMER_APP_INCLUDE_DIRS
+ GSTREAMER_APP_LIBRARIES
+ GSTREAMER_AUDIO_INCLUDE_DIRS
+ GSTREAMER_AUDIO_LIBRARIES
+ GSTREAMER_BASE_INCLUDE_DIRS
+ GSTREAMER_BASE_LIBRARIES
+ GSTREAMER_FFT_INCLUDE_DIRS
+ GSTREAMER_FFT_LIBRARIES
+ GSTREAMER_GL_INCLUDE_DIRS
+ GSTREAMER_GL_LIBRARIES
+ GSTREAMER_INCLUDE_DIRS
+ GSTREAMER_LIBRARIES
+ GSTREAMER_MPEGTS_INCLUDE_DIRS
+ GSTREAMER_MPEGTS_LIBRARIES
+ GSTREAMER_PBUTILS_INCLUDE_DIRS
+ GSTREAMER_PBUTILS_LIBRARIES
+ GSTREAMER_TAG_INCLUDE_DIRS
+ GSTREAMER_TAG_LIBRARIES
+ GSTREAMER_VIDEO_INCLUDE_DIRS
+ GSTREAMER_VIDEO_LIBRARIES
+)
diff --git a/Source/cmake/FindGTK2.cmake b/Source/cmake/FindGTK2.cmake
new file mode 100644
index 000000000..8bd5688a7
--- /dev/null
+++ b/Source/cmake/FindGTK2.cmake
@@ -0,0 +1,49 @@
+# - Try to find GTK+ 2
+# Once done, this will define
+#
+# GTK2_FOUND - system has GTK+ 2.
+# GTK2_INCLUDE_DIRS - the GTK+ 2. include directories
+# GTK2_LIBRARIES - link these to use GTK+ 2.
+#
+# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+# Copyright (C) 2013 Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(GTK2 gtk+-2.0)
+
+set(VERSION_OK TRUE)
+if (GTK2_VERSION)
+ if (GTK2_FIND_VERSION_EXACT)
+ if (NOT("${GTK2_FIND_VERSION}" VERSION_EQUAL "${GTK2_VERSION}"))
+ set(VERSION_OK FALSE)
+ endif ()
+ else ()
+ if ("${GTK2_VERSION}" VERSION_LESS "${GTK2_FIND_VERSION}")
+ set(VERSION_OK FALSE)
+ endif ()
+ endif ()
+endif ()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2 DEFAULT_MSG GTK2_INCLUDE_DIRS GTK2_LIBRARIES VERSION_OK)
diff --git a/Source/cmake/FindGTK3.cmake b/Source/cmake/FindGTK3.cmake
new file mode 100644
index 000000000..8ce543390
--- /dev/null
+++ b/Source/cmake/FindGTK3.cmake
@@ -0,0 +1,82 @@
+# - Try to find GTK+ 3
+# Once done, this will define
+#
+# GTK3_FOUND - system has GTK+ 3.
+# GTK3_INCLUDE_DIRS - the GTK+ 3. include directories
+# GTK3_LIBRARIES - link these to use GTK+ 3.
+# GTK3_SUPPORTS_GESTURES - GTK+ supports gestures (GTK+ >= 3.14)
+# GTK3_SUPPORTS_QUARTZ - GTK+ supports Quartz backend
+# GTK3_SUPPORTS_X11 - GTK+ supports X11 backend
+# GTK3_SUPPORTS_WAYLAND - GTK+ supports Wayland backend
+#
+# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+# Copyright (C) 2013, 2015 Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(GTK3 gtk+-3.0)
+
+set(VERSION_OK TRUE)
+if (GTK3_VERSION)
+ if (GTK3_FIND_VERSION_EXACT)
+ if (NOT("${GTK3_FIND_VERSION}" VERSION_EQUAL "${GTK3_VERSION}"))
+ set(VERSION_OK FALSE)
+ endif ()
+ else ()
+ if ("${GTK3_VERSION}" VERSION_LESS "${GTK3_FIND_VERSION}")
+ set(VERSION_OK FALSE)
+ endif ()
+ endif ()
+endif ()
+
+if (GTK3_VERSION AND VERSION_OK)
+ pkg_check_modules(GTK3_QUARTZ gtk+-quartz-3.0)
+ if ("${GTK3_QUARTZ_VERSION}" VERSION_EQUAL "${GTK3_VERSION}")
+ set(GTK3_SUPPORTS_QUARTZ TRUE)
+ else ()
+ set(GTK3_SUPPORTS_QUARTZ FALSE)
+ endif ()
+
+ pkg_check_modules(GTK3_X11 gtk+-x11-3.0)
+ if ("${GTK3_X11_VERSION}" VERSION_EQUAL "${GTK3_VERSION}")
+ set(GTK3_SUPPORTS_X11 TRUE)
+ else ()
+ set(GTK3_SUPPORTS_X11 FALSE)
+ endif ()
+
+ pkg_check_modules(GTK3_WAYLAND gtk+-wayland-3.0)
+ if ("${GTK3_WAYLAND_VERSION}" VERSION_EQUAL "${GTK3_VERSION}")
+ set(GTK3_SUPPORTS_WAYLAND TRUE)
+ else ()
+ set(GTK3_SUPPORTS_WAYLAND FALSE)
+ endif ()
+
+ if (NOT("${GTK3_VERSION}" VERSION_LESS "3.14.0"))
+ set(GTK3_SUPPORTS_GESTURES ON)
+ else ()
+ set(GTK3_SUPPORTS_GESTURES OFF)
+ endif ()
+endif ()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3 DEFAULT_MSG GTK3_INCLUDE_DIRS GTK3_LIBRARIES VERSION_OK)
diff --git a/Source/cmake/FindGTKUnixPrint.cmake b/Source/cmake/FindGTKUnixPrint.cmake
new file mode 100644
index 000000000..de3b3eb6e
--- /dev/null
+++ b/Source/cmake/FindGTKUnixPrint.cmake
@@ -0,0 +1,49 @@
+# - Try to find gtk-unix-print
+# Once done, this will define
+#
+# GTK_UNIX_PRINT_FOUND - system has gtk-unix-print
+# GTK_UNIX_PRINT_INCLUDE_DIRS - the gtk-unix-print include directories
+# GTK_UNIX_PRINT_LIBRARIES - link these to use gtk-unix-print
+#
+# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+# Copyright (C) 2014 Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(GTK_UNIX_PRINT gtk+-unix-print-3.0)
+
+set(VERSION_OK TRUE)
+if (GTK_UNIX_PRINT_VERSION)
+ if (GTK_UNIX_PRINT_FIND_VERSION_EXACT)
+ if (NOT("${GTK_UNIX_PRINT_FIND_VERSION}" VERSION_EQUAL "${GTK_UNIX_PRINT_VERSION}"))
+ set(VERSION_OK FALSE)
+ endif ()
+ else ()
+ if ("${GTK_UNIX_PRINT_VERSION}" VERSION_LESS "${GTK_UNIX_PRINT_FIND_VERSION}")
+ set(VERSION_OK FALSE)
+ endif ()
+ endif ()
+endif ()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK_UNIX_PRINT DEFAULT_MSG GTK_UNIX_PRINT_INCLUDE_DIRS GTK_UNIX_PRINT_LIBRARIES VERSION_OK)
diff --git a/Source/cmake/FindGUdev.cmake b/Source/cmake/FindGUdev.cmake
new file mode 100644
index 000000000..b73cf90d9
--- /dev/null
+++ b/Source/cmake/FindGUdev.cmake
@@ -0,0 +1,49 @@
+# - Try to find GUdev
+# Once done, this will define
+#
+# GUDEV_FOUND - system has GUdev
+# GUDEV_INCLUDE_DIRS - the GUdev include directories
+# GUDEV_LIBRARIES - link these to use GUdev
+#
+# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+# Copyright (C) 2013, 2014 Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(GUDEV gudev-1.0)
+
+set(VERSION_OK TRUE)
+if (GUDEV_VERSION)
+ if (GUDEV_FIND_VERSION_EXACT)
+ if (NOT("${GUDEV_FIND_VERSION}" VERSION_EQUAL "${GUDEV_VERSION}"))
+ set(VERSION_OK FALSE)
+ endif ()
+ else ()
+ if ("${GUDEV_VERSION}" VERSION_LESS "${GUDEV_FIND_VERSION}")
+ set(VERSION_OK FALSE)
+ endif ()
+ endif ()
+endif ()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GUDEV DEFAULT_MSG GUDEV_INCLUDE_DIRS GUDEV_LIBRARIES VERSION_OK)
diff --git a/Source/cmake/FindGeoClue.cmake b/Source/cmake/FindGeoClue.cmake
new file mode 100644
index 000000000..b3410c8fc
--- /dev/null
+++ b/Source/cmake/FindGeoClue.cmake
@@ -0,0 +1,49 @@
+# - Try to find GeoClue
+# Once done, this will define
+#
+# GEOCLUE_FOUND - system has GeoClue
+# GEOCLUE_INCLUDE_DIRS - the GeoClue include directories
+# GEOCLUE_LIBRARIES - link these to use GeoClue
+#
+# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+# Copyright (C) 2013, 2014 Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(GEOCLUE geoclue)
+
+set(VERSION_OK TRUE)
+if (GEOCLUE_VERSION)
+ if (GEOCLUE_FIND_VERSION_EXACT)
+ if (NOT("${GEOCLUE_FIND_VERSION}" VERSION_EQUAL "${GEOCLUE_VERSION}"))
+ set(VERSION_OK FALSE)
+ endif ()
+ else ()
+ if ("${GEOCLUE_VERSION}" VERSION_LESS "${GEOCLUE_FIND_VERSION}")
+ set(VERSION_OK FALSE)
+ endif ()
+ endif ()
+endif ()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GEOCLUE DEFAULT_MSG GEOCLUE_INCLUDE_DIRS GEOCLUE_LIBRARIES VERSION_OK)
diff --git a/Source/cmake/FindGeoClue2.cmake b/Source/cmake/FindGeoClue2.cmake
new file mode 100644
index 000000000..fd6c6cf68
--- /dev/null
+++ b/Source/cmake/FindGeoClue2.cmake
@@ -0,0 +1,51 @@
+# - Try to find GeoClue 2
+# Once done, this will define
+#
+# GEOCLUE2_FOUND - system has GeoClue 2.
+# GEOCLUE2_INCLUDE_DIRS - the GeoClue 2. include directories
+# GEOCLUE2_LIBRARIES - link these to use GeoClue 2.
+#
+# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+# Copyright (C) 2013, 2014 Igalia S.L.
+# Copyright (C) 2014 Samsung Electronics. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(GEOCLUE2 libgeoclue-2.0)
+
+set(VERSION_OK FALSE)
+if (GEOCLUE2_VERSION)
+ set(VERSION_OK TRUE)
+ if (GeoClue2_FIND_VERSION_EXACT)
+ if (NOT("${GeoClue2_FIND_VERSION}" VERSION_EQUAL "${GEOCLUE2_VERSION}"))
+ set(VERSION_OK FALSE)
+ endif ()
+ else ()
+ if ("${GEOCLUE2_VERSION}" VERSION_LESS "${GeoClue2_FIND_VERSION}")
+ set(VERSION_OK FALSE)
+ endif ()
+ endif ()
+endif ()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GEOCLUE2 DEFAULT_MSG VERSION_OK)
diff --git a/Source/cmake/FindGperf.cmake b/Source/cmake/FindGperf.cmake
new file mode 100644
index 000000000..0574d32fa
--- /dev/null
+++ b/Source/cmake/FindGperf.cmake
@@ -0,0 +1,19 @@
+# - Find gperf
+# This module looks for gperf. This module defines the
+# following values:
+# GPERF_EXECUTABLE: the full path to the gperf tool.
+# GPERF_FOUND: True if gperf has been found.
+
+include(FindCygwin)
+
+find_program(GPERF_EXECUTABLE
+ gperf
+ ${CYGWIN_INSTALL_PATH}/bin
+)
+
+# handle the QUIETLY and REQUIRED arguments and set GPERF_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gperf DEFAULT_MSG GPERF_EXECUTABLE)
+
+mark_as_advanced(GPERF_EXECUTABLE)
diff --git a/Source/cmake/FindHarfBuzz.cmake b/Source/cmake/FindHarfBuzz.cmake
new file mode 100644
index 000000000..8440c7b2b
--- /dev/null
+++ b/Source/cmake/FindHarfBuzz.cmake
@@ -0,0 +1,61 @@
+# Copyright (c) 2012, Intel Corporation
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# * Neither the name of Intel Corporation nor the names of its contributors may
+# be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Try to find Harfbuzz include and library directories.
+#
+# After successful discovery, this will set for inclusion where needed:
+# HARFBUZZ_INCLUDE_DIRS - containg the HarfBuzz headers
+# HARFBUZZ_LIBRARIES - containg the HarfBuzz library
+
+include(FindPkgConfig)
+
+pkg_check_modules(PC_HARFBUZZ harfbuzz>=0.9.7)
+
+find_path(HARFBUZZ_INCLUDE_DIRS NAMES hb.h
+ HINTS ${PC_HARFBUZZ_INCLUDE_DIRS} ${PC_HARFBUZZ_INCLUDEDIR}
+)
+
+find_library(HARFBUZZ_LIBRARIES NAMES harfbuzz
+ HINTS ${PC_HARFBUZZ_LIBRARY_DIRS} ${PC_HARFBUZZ_LIBDIR}
+)
+
+# HarfBuzz 0.9.18 split ICU support into a separate harfbuzz-icu library.
+if ("${PC_HARFBUZZ_VERSION}" VERSION_GREATER "0.9.17")
+ pkg_check_modules(PC_HARFBUZZ_ICU harfbuzz-icu>=0.9.18 REQUIRED)
+ find_library(HARFBUZZ_ICU_LIBRARIES NAMES harfbuzz-icu
+ HINTS ${PC_HARFBUZZ_ICU_LIBRARY_DIRS} ${PC_HARFBUZZ_ICU_LIBDIR}
+ )
+ list(APPEND HARFBUZZ_LIBRARIES "${HARFBUZZ_ICU_LIBRARIES}")
+endif ()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(HarfBuzz DEFAULT_MSG HARFBUZZ_INCLUDE_DIRS HARFBUZZ_LIBRARIES)
+
+mark_as_advanced(
+ HARFBUZZ_ICU_LIBRARIES
+ HARFBUZZ_INCLUDE_DIRS
+ HARFBUZZ_LIBRARIES
+)
diff --git a/Source/cmake/FindHyphen.cmake b/Source/cmake/FindHyphen.cmake
new file mode 100644
index 000000000..47dfdb492
--- /dev/null
+++ b/Source/cmake/FindHyphen.cmake
@@ -0,0 +1,45 @@
+# - Try to find libhyphen
+# Once done, this will define
+#
+# HYPHEN_FOUND - system has libhyphen installed.
+# HYPHEN_INCLUDE_DIR - directories which contain the libhyphen headers.
+# HYPHEN_LIBRARY - libraries required to link against libhyphen.
+#
+# Copyright (C) 2012 Intel Corporation. All rights reserved.
+# Copyright (C) 2015 Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+find_path(HYPHEN_INCLUDE_DIR NAMES hyphen.h)
+find_library(HYPHEN_LIBRARIES NAMES hyphen hnj)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(HYPHEN DEFAULT_MSG HYPHEN_INCLUDE_DIR HYPHEN_LIBRARIES)
+
+if (HYPHEN_INCLUDE_DIR AND HYPHEN_LIBRARIES)
+ set(HYPHEN_FOUND 1)
+else ()
+ set(HYPHEN_FOUND 0)
+endif ()
+
+mark_as_advanced(HYPHEN_INCLUDE_DIR HYPHEN_LIBRARIES HYPHEN_FOUND)
diff --git a/Source/cmake/FindICU.cmake b/Source/cmake/FindICU.cmake
new file mode 100644
index 000000000..f9d79c191
--- /dev/null
+++ b/Source/cmake/FindICU.cmake
@@ -0,0 +1,110 @@
+# Finds the International Components for Unicode (ICU) Library
+#
+# ICU_FOUND - True if ICU found.
+# ICU_I18N_FOUND - True if ICU's internationalization library found.
+# ICU_INCLUDE_DIRS - Directory to include to get ICU headers
+# Note: always include ICU headers as, e.g.,
+# unicode/utypes.h
+# ICU_LIBRARIES - Libraries to link against for the common ICU
+# ICU_I18N_LIBRARIES - Libraries to link against for ICU internationaliation
+# (note: in addition to ICU_LIBRARIES)
+
+find_package(PkgConfig)
+pkg_check_modules(PC_ICU icu-uc)
+
+# Look for the header file.
+find_path(
+ ICU_INCLUDE_DIR
+ NAMES unicode/utypes.h
+ HINTS ${PC_ICU_INCLUDE_DIRS}
+ ${PC_ICU_INCLUDEDIR}
+ ${WEBKIT_LIBRARIES_INCLUDE_DIR}
+ DOC "Include directory for the ICU library")
+mark_as_advanced(ICU_INCLUDE_DIR)
+
+# Look for the library.
+find_library(
+ ICU_LIBRARY
+ NAMES libicuuc cygicuuc cygicuuc32 icuuc
+ HINTS ${PC_ICU_LIBRARY_DIRS}
+ ${PC_ICU_LIBDIR}
+ ${WEBKIT_LIBRARIES_LINK_DIR}
+ DOC "Libraries to link against for the common parts of ICU")
+mark_as_advanced(ICU_LIBRARY)
+
+# Copy the results to the output variables.
+if (ICU_INCLUDE_DIR AND ICU_LIBRARY)
+ set(ICU_FOUND 1)
+ set(ICU_LIBRARIES ${ICU_LIBRARY})
+ set(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
+
+ set(ICU_VERSION 0)
+ set(ICU_MAJOR_VERSION 0)
+ set(ICU_MINOR_VERSION 0)
+ file(READ "${ICU_INCLUDE_DIR}/unicode/uversion.h" _ICU_VERSION_CONENTS)
+ string(REGEX REPLACE ".*#define U_ICU_VERSION_MAJOR_NUM ([0-9]+).*" "\\1" ICU_MAJOR_VERSION "${_ICU_VERSION_CONENTS}")
+ string(REGEX REPLACE ".*#define U_ICU_VERSION_MINOR_NUM ([0-9]+).*" "\\1" ICU_MINOR_VERSION "${_ICU_VERSION_CONENTS}")
+
+ set(ICU_VERSION "${ICU_MAJOR_VERSION}.${ICU_MINOR_VERSION}")
+
+ # Look for the ICU internationalization libraries
+ pkg_check_modules(PC_ICU_I18N icu-i18n)
+ find_library(
+ ICU_I18N_LIBRARY
+ NAMES icui18n libicui18n libicuin cygicuin cygicuin32 icuin
+ HINTS ${PC_ICU_I18N_LIBRARY_DIRS}
+ ${PC_ICU_I18N_LIBDIR}
+ ${WEBKIT_LIBRARIES_LINK_DIR}
+ DOC "Libraries to link against for ICU internationalization")
+ mark_as_advanced(ICU_I18N_LIBRARY)
+ if (ICU_I18N_LIBRARY)
+ set(ICU_I18N_FOUND 1)
+ set(ICU_I18N_LIBRARIES ${ICU_I18N_LIBRARY})
+ else ()
+ set(ICU_I18N_FOUND 0)
+ set(ICU_I18N_LIBRARIES)
+ endif ()
+
+ # Look for the ICU data libraries
+ find_library(
+ ICU_DATA_LIBRARY
+ NAMES icudata libicudata cygicudata cygicudata32
+ HINTS ${PC_ICU_I18N_LIBRARY_DIRS}
+ ${PC_ICU_I18N_LIBDIR}
+ ${WEBKIT_LIBRARIES_LINK_DIR}
+ DOC "Libraries to link against for ICU data")
+ mark_as_advanced(ICU_DATA_LIBRARY)
+ if (ICU_DATA_LIBRARY)
+ set(ICU_DATA_FOUND 1)
+ set(ICU_DATA_LIBRARIES ${ICU_DATA_LIBRARY})
+ else ()
+ set(ICU_DATA_FOUND 0)
+ set(ICU_DATA_LIBRARIES)
+ endif ()
+else ()
+ set(ICU_FOUND 0)
+ set(ICU_I18N_FOUND 0)
+ set(ICU_DATA_FOUND 0)
+ set(ICU_LIBRARIES)
+ set(ICU_I18N_LIBRARIES)
+ set(ICU_DATA_LIBRARIES)
+ set(ICU_INCLUDE_DIRS)
+ set(ICU_VERSION)
+ set(ICU_MAJOR_VERSION)
+ set(ICU_MINOR_VERSION)
+endif ()
+
+if (ICU_FOUND)
+ if (NOT ICU_FIND_QUIETLY)
+ message(STATUS "Found ICU header files in ${ICU_INCLUDE_DIRS}")
+ message(STATUS "Found ICU libraries: ${ICU_LIBRARIES}")
+ message(STATUS "Found ICU internationaliation libraries: ${ICU_I18N_LIBRARIES}")
+ message(STATUS "Found ICU data libraries: ${ICU_DATA_LIBRARIES}")
+ endif ()
+else ()
+ if (ICU_FIND_REQUIRED)
+ message(FATAL_ERROR "Could not find ICU")
+ else ()
+ message(STATUS "Optional package ICU was not found")
+ endif ()
+endif ()
diff --git a/Source/cmake/FindLLVM.cmake b/Source/cmake/FindLLVM.cmake
new file mode 100644
index 000000000..8a1ac2049
--- /dev/null
+++ b/Source/cmake/FindLLVM.cmake
@@ -0,0 +1,49 @@
+#
+# Check if the llvm-config gives us the path for the llvm libs.
+#
+# The following variables are set:
+# LLVM_CONFIG_EXE
+# LLVM_VERSION
+# LLVM_INCLUDE_DIRS - include directories for the llvm headers.
+# LLVM_STATIC_LIBRARIES - list of paths for the static llvm libraries.
+
+
+foreach (_program_name llvm-config llvm-config-3.7 llvm-config-3.6 llvm-config-3.5)
+ find_program(LLVM_CONFIG_EXE NAMES ${_program_name})
+ if (LLVM_CONFIG_EXE)
+ execute_process(COMMAND ${LLVM_CONFIG_EXE} --version OUTPUT_VARIABLE LLVM_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if ("${LLVM_VERSION}" VERSION_LESS "${LLVM_FIND_VERSION}")
+ unset(LLVM_CONFIG_EXE CACHE)
+ else ()
+ break ()
+ endif ()
+ endif ()
+endforeach ()
+
+execute_process(COMMAND ${LLVM_CONFIG_EXE} --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE)
+execute_process(COMMAND ${LLVM_CONFIG_EXE} --libfiles OUTPUT_VARIABLE LLVM_STATIC_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
+execute_process(COMMAND ${LLVM_CONFIG_EXE} --system-libs OUTPUT_VARIABLE LLVM_SYSTEM_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
+execute_process(COMMAND ${LLVM_CONFIG_EXE} --libdir OUTPUT_VARIABLE LLVM_LIBS_DIRECTORY OUTPUT_STRIP_TRAILING_WHITESPACE)
+execute_process(COMMAND ${LLVM_CONFIG_EXE} --libs OUTPUT_VARIABLE LLVM_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
+execute_process(COMMAND ${LLVM_CONFIG_EXE} --ldflags OUTPUT_VARIABLE LLVM_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+# Depending on how llvm was built, we could have either a global .so file when built using autotools,
+# or multiple .so files for each static library when built using CMake. So, we set the LLVM_LIBS_DIRECTORY
+# variable here accordingly for each case.
+# We need to build the soname manually in any case, since there's currently no way to get it from llvm-config.
+set(LLVM_SONAME "LLVM-${LLVM_VERSION}")
+if (EXISTS "${LLVM_LIBS_DIRECTORY}/lib${LLVM_SONAME}.so")
+ set(LLVM_LIBRARIES "${LLVM_LDFLAGS} -l${LLVM_SONAME}")
+else ()
+ set(LLVM_LIBRARIES "${LLVM_LDFLAGS} ${LLVM_LIBS}")
+endif ()
+
+# convert the list of paths into a cmake list
+separate_arguments(LLVM_STATIC_LIBRARIES)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LLVM
+ REQUIRED_VARS LLVM_VERSION LLVM_INCLUDE_DIRS LLVM_LIBRARIES LLVM_STATIC_LIBRARIES
+ VERSION_VAR LLVM_VERSION)
+
+mark_as_advanced(LLVM_VERSION LLVM_INCLUDE_DIRS LLVM_LIBRARIES LLVM_STATIC_LIBRARIES)
diff --git a/Source/cmake/FindLibGcrypt.cmake b/Source/cmake/FindLibGcrypt.cmake
new file mode 100644
index 000000000..f295682a7
--- /dev/null
+++ b/Source/cmake/FindLibGcrypt.cmake
@@ -0,0 +1,91 @@
+#.rst
+# FindLibGcrypt
+# -------------
+#
+# Finds the Libgcrypt library.
+#
+# This will define the following variables:
+#
+# ``LIBGCRYPT_FOUND``
+# True if the requested version of gcrypt was found
+# ``LIBGCRYPT_VERSION``
+# The version of gcrypt that was found
+# ``LIBGCRYPT_INCLUDE_DIRS``
+# The gcrypt include directories
+# ``LIBGCRYPT_LIBRARIES``
+# The linker libraries needed to use the gcrypt library
+
+# Copyright 2014 Nicolás Alvarez <nicolas.alvarez@gmail.com>
+# Copyright 2016 Igalia S.L
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_program(LIBGCRYPTCONFIG_SCRIPT NAMES libgcrypt-config)
+if (LIBGCRYPTCONFIG_SCRIPT)
+ execute_process(
+ COMMAND "${LIBGCRYPTCONFIG_SCRIPT}" --prefix
+ RESULT_VARIABLE CONFIGSCRIPT_RESULT
+ OUTPUT_VARIABLE PREFIX
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ if (CONFIGSCRIPT_RESULT EQUAL 0)
+ set(LIBGCRYPT_LIB_HINT "${PREFIX}/lib")
+ set(LIBGCRYPT_INCLUDE_HINT "${PREFIX}/include")
+ endif ()
+endif ()
+
+find_library(LIBGCRYPT_LIBRARY
+ NAMES gcrypt
+ HINTS ${LIBGCRYPT_LIB_HINT}
+)
+find_path(LIBGCRYPT_INCLUDE_DIR
+ NAMES gcrypt.h
+ HINTS ${LIBGCRYPT_INCLUDE_HINT}
+)
+
+if (LIBGCRYPT_INCLUDE_DIR)
+ file(STRINGS ${LIBGCRYPT_INCLUDE_DIR}/gcrypt.h GCRYPT_H REGEX "^#define GCRYPT_VERSION ")
+ string(REGEX REPLACE "^#define GCRYPT_VERSION \"(.*)\".*$" "\\1" LIBGCRYPT_VERSION "${GCRYPT_H}")
+endif ()
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(LibGcrypt
+ FOUND_VAR LIBGCRYPT_FOUND
+ REQUIRED_VARS LIBGCRYPT_LIBRARY LIBGCRYPT_INCLUDE_DIR
+ VERSION_VAR LIBGCRYPT_VERSION
+)
+if (LIBGCRYPT_FOUND)
+ set(LIBGCRYPT_LIBRARIES ${LIBGCRYPT_LIBRARY})
+ set(LIBGCRYPT_INCLUDE_DIRS ${LIBGCRYPT_INCLUDE_DIR})
+endif ()
+
+mark_as_advanced(LIBGCRYPT_LIBRARY LIBGCRYPT_INCLUDE_DIR)
+
+include(FeatureSummary)
+set_package_properties(LibGcrypt PROPERTIES
+ DESCRIPTION "A general purpose cryptographic library based on the code from GnuPG."
+ URL "http://www.gnu.org/software/libgcrypt/"
+)
+
diff --git a/Source/cmake/FindLibNotify.cmake b/Source/cmake/FindLibNotify.cmake
new file mode 100644
index 000000000..e76b199ba
--- /dev/null
+++ b/Source/cmake/FindLibNotify.cmake
@@ -0,0 +1,55 @@
+# - Try to find LibNotify
+# This module defines the following variables:
+#
+# LIBNOTIFY_FOUND - LibNotify was found
+# LIBNOTIFY_INCLUDE_DIRS - the LibNotify include directories
+# LIBNOTIFY_LIBRARIES - link these to use LibNotify
+#
+# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+# Copyright (C) 2014 Collabora Ltd.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(LIBNOTIFY QUIET libnotify)
+
+find_path(LIBNOTIFY_INCLUDE_DIRS
+ NAMES notify.h
+ HINTS ${LIBNOTIFY_INCLUDEDIR}
+ ${LIBNOTIFY_INCLUDE_DIRS}
+ PATH_SUFFIXES libnotify
+)
+
+find_library(LIBNOTIFY_LIBRARIES
+ NAMES notify
+ HINTS ${LIBNOTIFY_LIBDIR}
+ ${LIBNOTIFY_LIBRARY_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibNotify REQUIRED_VARS LIBNOTIFY_INCLUDE_DIRS LIBNOTIFY_LIBRARIES
+ VERSION_VAR LIBNOTIFY_VERSION)
+
+mark_as_advanced(
+ LIBNOTIFY_INCLUDE_DIRS
+ LIBNOTIFY_LIBRARIES
+)
diff --git a/Source/cmake/FindLibSoup.cmake b/Source/cmake/FindLibSoup.cmake
new file mode 100644
index 000000000..b76b66b1a
--- /dev/null
+++ b/Source/cmake/FindLibSoup.cmake
@@ -0,0 +1,57 @@
+# - Try to find LibSoup 2.4
+# This module defines the following variables:
+#
+# LIBSOUP_FOUND - LibSoup 2.4 was found
+# LIBSOUP_INCLUDE_DIRS - the LibSoup 2.4 include directories
+# LIBSOUP_LIBRARIES - link these to use LibSoup 2.4
+#
+# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# LibSoup does not provide an easy way to retrieve its version other than its
+# .pc file, so we need to rely on PC_LIBSOUP_VERSION and REQUIRE the .pc file
+# to be found.
+find_package(PkgConfig)
+pkg_check_modules(PC_LIBSOUP REQUIRED QUIET libsoup-2.4)
+
+find_path(LIBSOUP_INCLUDE_DIRS
+ NAMES libsoup/soup.h
+ HINTS ${PC_LIBSOUP_INCLUDEDIR}
+ ${PC_LIBSOUP_INCLUDE_DIRS}
+ PATH_SUFFIXES libsoup-2.4
+)
+
+find_library(LIBSOUP_LIBRARIES
+ NAMES soup-2.4
+ HINTS ${PC_LIBSOUP_LIBDIR}
+ ${PC_LIBSOUP_LIBRARY_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibSoup REQUIRED_VARS LIBSOUP_INCLUDE_DIRS LIBSOUP_LIBRARIES
+ VERSION_VAR PC_LIBSOUP_VERSION)
+
+mark_as_advanced(
+ LIBSOUP_INCLUDE_DIRS
+ LIBSOUP_LIBRARIES
+)
diff --git a/Source/cmake/FindLibsecret.cmake b/Source/cmake/FindLibsecret.cmake
new file mode 100644
index 000000000..d33228a77
--- /dev/null
+++ b/Source/cmake/FindLibsecret.cmake
@@ -0,0 +1,49 @@
+# - Try to find libsecret
+# Once done, this will define
+#
+# LIBSECRET_FOUND - system has libsecret
+# LIBSECRET_INCLUDE_DIRS - the libsecret include directories
+# LIBSECRET_LIBRARIES - link these to use libsecret
+#
+# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+# Copyright (C) 2014 Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(LIBSECRET libsecret-1)
+
+set(VERSION_OK TRUE)
+if (LIBSECRET_VERSION)
+ if (LIBSECRET_FIND_VERSION_EXACT)
+ if (NOT("${LIBSECRET_FIND_VERSION}" VERSION_EQUAL "${LIBSECRET_VERSION}"))
+ set(VERSION_OK FALSE)
+ endif ()
+ else ()
+ if ("${LIBSECRET_VERSION}" VERSION_LESS "${LIBSECRET_FIND_VERSION}")
+ set(VERSION_OK FALSE)
+ endif ()
+ endif ()
+endif ()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBSECRET DEFAULT_MSG LIBSECRET_INCLUDE_DIRS LIBSECRET_LIBRARIES VERSION_OK)
diff --git a/Source/cmake/FindOpenGL.cmake b/Source/cmake/FindOpenGL.cmake
new file mode 100644
index 000000000..60721cdb9
--- /dev/null
+++ b/Source/cmake/FindOpenGL.cmake
@@ -0,0 +1,65 @@
+# - Try to Find OpenGL
+# Once done, this will define
+#
+# OPENGL_FOUND - system has OpenGL installed.
+# OPENGL_INCLUDE_DIRS - directories which contain the OpenGL headers.
+# OPENGL_LIBRARIES - libraries required to link against OpenGL.
+# OPENGL_DEFINITIONS - Compiler switches required for using OpenGL.
+#
+# Copyright (C) 2015 Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+find_package(PkgConfig)
+
+pkg_check_modules(PC_OPENGL gl)
+
+if (PC_OPENGL_FOUND)
+ set(OPENGL_DEFINITIONS ${PC_OPENGL_CFLAGS_OTHER})
+endif ()
+
+find_path(OPENGL_INCLUDE_DIRS NAMES GL/gl.h
+ HINTS ${PC_OPENGL_INCLUDEDIR} ${PC_OPENGL_INCLUDE_DIRS}
+)
+
+set(OPENGL_NAMES ${OPENGL_NAMES} gl GL)
+find_library(OPENGL_LIBRARIES NAMES ${OPENGL_NAMES}
+ HINTS ${PC_OPENGL_LIBDIR} ${PC_OPENGL_LIBRARY_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENGL DEFAULT_MSG OPENGL_INCLUDE_DIRS OPENGL_LIBRARIES)
+
+mark_as_advanced(OPENGL_INCLUDE_DIRS OPENGL_LIBRARIES)
+
+if (OPENGL_FOUND)
+ # We don't use find_package for GLX because it is part of -lGL, unlike EGL. We need to
+ # have OPENGL_INCLUDE_DIRS as part of the directories check_include_files() looks for in
+ # case OpenGL is installed into a non-standard location.
+ include(CMakePushCheckState)
+ CMAKE_PUSH_CHECK_STATE()
+ set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${OPENGL_INCLUDE_DIRS})
+ include(CheckIncludeFiles)
+ check_include_files("GL/glx.h" GLX_FOUND)
+ CMAKE_POP_CHECK_STATE()
+endif ()
diff --git a/Source/cmake/FindOpenGLES2.cmake b/Source/cmake/FindOpenGLES2.cmake
new file mode 100644
index 000000000..5116630bd
--- /dev/null
+++ b/Source/cmake/FindOpenGLES2.cmake
@@ -0,0 +1,27 @@
+# Try to find OpenGLES2. Once done this will define:
+# OPENGLES2_FOUND
+# OPENGLES2_INCLUDE_DIRS
+# OPENGLES2_LIBRARIES
+# OPENGLES2_DEFINITIONS
+
+find_package(PkgConfig)
+
+pkg_check_modules(PC_OPENGLES2 glesv2)
+
+if (PC_OPENGLES2_FOUND)
+ set(OPENGLES2_DEFINITIONS ${PC_OPENGLES2_CFLAGS_OTHER})
+endif ()
+
+find_path(OPENGLES2_INCLUDE_DIRS NAMES GLES2/gl2.h
+ HINTS ${PC_OPENGLES2_INCLUDEDIR} ${PC_OPENGLES2_INCLUDE_DIRS}
+)
+
+set(OPENGLES2_NAMES ${OPENGLES2_NAMES} glesv2 GLESv2)
+find_library(OPENGLES2_LIBRARIES NAMES ${OPENGLES2_NAMES}
+ HINTS ${PC_OPENGLES2_LIBDIR} ${PC_OPENGLES2_LIBRARY_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENGLES2 DEFAULT_MSG OPENGLES2_INCLUDE_DIRS OPENGLES2_LIBRARIES)
+
+mark_as_advanced(OPENGLES2_INCLUDE_DIRS OPENGLES2_LIBRARIES)
diff --git a/Source/cmake/FindOpenWebRTC.cmake b/Source/cmake/FindOpenWebRTC.cmake
new file mode 100644
index 000000000..1ac85a849
--- /dev/null
+++ b/Source/cmake/FindOpenWebRTC.cmake
@@ -0,0 +1,49 @@
+# - Try to find OpenWebRTC.
+# Once done, this will define
+#
+# OPENWEBRTC_FOUND - system has OpenWebRTC.
+# OPENWEBRTC_INCLUDE_DIRS - the OpenWebRTC include directories
+# OPENWEBRTC_LIBRARIES - link these to use OpenWebRTC.
+#
+# Copyright (C) 2015 Igalia S.L.
+# Copyright (C) 2015 Metrological.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(OPENWEBRTC openwebrtc-0.3 openwebrtc-gst-0.3)
+
+set(VERSION_OK TRUE)
+if (OPENWEBRTC_VERSION)
+ if (OPENWEBRTC_FIND_VERSION_EXACT)
+ if (NOT("${OPENWEBRTC_FIND_VERSION}" VERSION_EQUAL "${OPENWEBRTC_VERSION}"))
+ set(VERSION_OK FALSE)
+ endif ()
+ else ()
+ if ("${OPENWEBRTC_VERSION}" VERSION_LESS "${OPENWEBRTC_FIND_VERSION}")
+ set(VERSION_OK FALSE)
+ endif ()
+ endif ()
+endif ()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENWEBRTC DEFAULT_MSG OPENWEBRTC_INCLUDE_DIRS OPENWEBRTC_LIBRARIES VERSION_OK)
diff --git a/Source/cmake/FindQuickTimeSDK.cmake b/Source/cmake/FindQuickTimeSDK.cmake
new file mode 100644
index 000000000..389b67e4e
--- /dev/null
+++ b/Source/cmake/FindQuickTimeSDK.cmake
@@ -0,0 +1,20 @@
+# - Find QuickTime SDK installation
+# Find the QuickTime includes and library
+# This module defines
+# QuickTime_INCLUDE_DIRS, where to find QuickTime.h, etc.
+# QuickTime_LIBRARIES, libraries to link against to use QuickTime.
+# QuickTime_FOUND, If false, do not try to use QuickTime.
+
+find_path(QuickTimeSDK_INCLUDE_DIRS QuickTime.h PATHS
+ "$ENV{PROGRAMFILES}/QuickTime SDK/CIncludes"
+)
+
+set(QuickTimeSDK_LIBRARY_PATH "${QuickTimeSDK_INCLUDE_DIRS}/../Libraries")
+find_library(QuickTimeSDK_CVClient_LIBRARY CVClient ${QuickTimeSDK_LIBRARY_PATH} NO_DEFAULT_PATH)
+find_library(QuickTimeSDK_QTMLClient_LIBRARY QTMLClient ${QuickTimeSDK_LIBRARY_PATH} NO_DEFAULT_PATH)
+set(QuickTimeSDK_LIBRARIES ${QuickTimeSDK_CVClient_LIBRARY} ${QuickTimeSDK_QTMLClient_LIBRARY})
+
+# handle the QUIETLY and REQUIRED arguments and set QuickTimeSDK_FOUND to TRUE if all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(QuickTimeSDK DEFAULT_MSG QuickTimeSDK_LIBRARIES QuickTimeSDK_INCLUDE_DIRS)
+mark_as_advanced(QuickTimeSDK_INCLUDE_DIRS QuickTimeSDK_CVClient_LIBRARY QuickTimeSDK_QTMLClient_LIBRARY)
diff --git a/Source/cmake/FindSqlite.cmake b/Source/cmake/FindSqlite.cmake
new file mode 100644
index 000000000..47caa360c
--- /dev/null
+++ b/Source/cmake/FindSqlite.cmake
@@ -0,0 +1,65 @@
+# - Try to find Sqlite
+# Once done this will define
+#
+# SQLITE_FOUND - system has Sqlite
+# SQLITE_INCLUDE_DIR - the Sqlite include directory
+# SQLITE_LIBRARIES - Link these to use Sqlite
+# SQLITE_DEFINITIONS - Compiler switches required for using Sqlite
+#
+# Copyright (c) 2008, Gilles Caulier, <caulier.gilles@gmail.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+if (SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES)
+ # in cache already
+ set(Sqlite_FIND_QUIETLY TRUE)
+endif (SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES)
+
+# use pkg-config to get the directories and then use these values
+# in the find_path() and find_library() calls
+if (NOT WIN32)
+ find_package(PkgConfig)
+
+ pkg_check_modules(PC_SQLITE sqlite3)
+
+ set(SQLITE_DEFINITIONS ${PC_SQLITE_CFLAGS_OTHER})
+endif (NOT WIN32)
+
+find_path(SQLITE_INCLUDE_DIR NAMES sqlite3.h
+ PATHS
+ ${PC_SQLITE_INCLUDEDIR}
+ ${PC_SQLITE_INCLUDE_DIRS}
+)
+
+find_library(SQLITE_LIBRARIES NAMES sqlite3
+ PATHS
+ ${PC_SQLITE_LIBDIR}
+ ${PC_SQLITE_LIBRARY_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sqlite DEFAULT_MSG SQLITE_INCLUDE_DIR SQLITE_LIBRARIES)
+
+# show the SQLITE_INCLUDE_DIR and SQLITE_LIBRARIES variables only in the advanced view
+mark_as_advanced(SQLITE_INCLUDE_DIR SQLITE_LIBRARIES)
diff --git a/Source/cmake/FindWayland.cmake b/Source/cmake/FindWayland.cmake
new file mode 100644
index 000000000..215a1c283
--- /dev/null
+++ b/Source/cmake/FindWayland.cmake
@@ -0,0 +1,35 @@
+# - Try to find Wayland.
+# Once done, this will define
+#
+# WAYLAND_FOUND - system has Wayland.
+# WAYLAND_INCLUDE_DIRS - the Wayland include directories
+# WAYLAND_LIBRARIES - link these to use Wayland.
+#
+# Copyright (C) 2014 Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(WAYLAND wayland-client wayland-server wayland-egl)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND DEFAULT_MSG WAYLAND_LIBRARIES)
diff --git a/Source/cmake/FindWebP.cmake b/Source/cmake/FindWebP.cmake
new file mode 100644
index 000000000..6772352d9
--- /dev/null
+++ b/Source/cmake/FindWebP.cmake
@@ -0,0 +1,51 @@
+# - Try to find WebP.
+# Once done, this will define
+#
+# WEBP_FOUND - system has WebP.
+# WEBP_INCLUDE_DIRS - the WebP. include directories
+# WEBP_LIBRARIES - link these to use WebP.
+#
+# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
+# Copyright (C) 2013 Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
+# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(PC_WEBP QUIET libwebp)
+
+# Look for the header file.
+find_path(WEBP_INCLUDE_DIRS
+ NAMES webp/decode.h
+ HINTS ${PC_WEBP_INCLUDEDIR} ${PC_WEBP_INCLUDE_DIRS}
+)
+mark_as_advanced(WEBP_INCLUDE_DIRS)
+
+# Look for the library.
+find_library(
+ WEBP_LIBRARIES
+ NAMES webp
+ HINTS ${PC_WEBP_LIBDIR} ${PC_WEBP_LIBRARY_DIRS}
+)
+mark_as_advanced(WEBP_LIBRARIES)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(WEBP DEFAULT_MSG WEBP_INCLUDE_DIRS WEBP_LIBRARIES)
diff --git a/Source/cmake/OptionsCommon.cmake b/Source/cmake/OptionsCommon.cmake
new file mode 100644
index 000000000..afceb4efa
--- /dev/null
+++ b/Source/cmake/OptionsCommon.cmake
@@ -0,0 +1,281 @@
+add_definitions(-DBUILDING_WITH_CMAKE=1)
+add_definitions(-DHAVE_CONFIG_H=1)
+
+# CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS only matters with GCC >= 4.7.0. Since this
+# version, -P does not output empty lines, which currently breaks make_names.pl in
+# WebCore. Investigating whether make_names.pl should be changed instead is left as an exercise to
+# the reader.
+if (MSVC)
+ # FIXME: Some codegenerators don't support paths with spaces. So use the executable name only.
+ get_filename_component(CODE_GENERATOR_PREPROCESSOR_EXECUTABLE ${CMAKE_CXX_COMPILER} ABSOLUTE)
+
+ set(CODE_GENERATOR_PREPROCESSOR_ARGUMENTS "/nologo /EP")
+ set(CODE_GENERATOR_PREPROCESSOR "\"${CODE_GENERATOR_PREPROCESSOR_EXECUTABLE}\" ${CODE_GENERATOR_PREPROCESSOR_ARGUMENTS}")
+
+ set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS ${CODE_GENERATOR_PREPROCESSOR})
+else ()
+ set(CODE_GENERATOR_PREPROCESSOR_EXECUTABLE ${CMAKE_CXX_COMPILER})
+
+ set(CODE_GENERATOR_PREPROCESSOR_ARGUMENTS "-E -P -x c++")
+ set(CODE_GENERATOR_PREPROCESSOR "${CODE_GENERATOR_PREPROCESSOR_EXECUTABLE} ${CODE_GENERATOR_PREPROCESSOR_ARGUMENTS}")
+
+ set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS_ARGUMENTS "-E -x c++")
+ set(CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS "${CODE_GENERATOR_PREPROCESSOR_EXECUTABLE} ${CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS_ARGUMENTS}")
+endif ()
+
+option(USE_THIN_ARCHIVES "Produce all static libraries as thin archives" ON)
+if (USE_THIN_ARCHIVES)
+ execute_process(COMMAND ${CMAKE_AR} -V OUTPUT_VARIABLE AR_VERSION)
+ if ("${AR_VERSION}" MATCHES "^GNU ar")
+ set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> crT <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> crT <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> rT <TARGET> <LINK_FLAGS> <OBJECTS>")
+ set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> rT <TARGET> <LINK_FLAGS> <OBJECTS>")
+ endif ()
+endif ()
+
+set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+define_property(TARGET PROPERTY FOLDER INHERITED BRIEF_DOCS "folder" FULL_DOCS "IDE folder name")
+
+if (COMPILER_IS_GCC_OR_CLANG)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-exceptions -fno-strict-aliasing")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-strict-aliasing -fno-rtti")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
+endif ()
+
+if (COMPILER_IS_CLANG AND CMAKE_GENERATOR STREQUAL "Ninja")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
+endif ()
+
+if (WIN32 AND COMPILER_IS_GCC_OR_CLANG)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-ms-bitfields -Wno-unknown-pragmas")
+ add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
+endif ()
+
+# Ensure that the default include system directories are added to the list of CMake implicit includes.
+# This workarounds an issue that happens when using GCC 6 and using system includes (-isystem).
+# For more details check: https://bugs.webkit.org/show_bug.cgi?id=161697
+macro(DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _compiler _flags _result)
+ file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy" "\n")
+ separate_arguments(_buildFlags UNIX_COMMAND "${_flags}")
+ execute_process(COMMAND ${_compiler} ${_buildFlags} -v -E -x ${_lang} -dD dummy
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles OUTPUT_QUIET
+ ERROR_VARIABLE _gccOutput)
+ file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy")
+ if ("${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+) *\n *End of (search) list")
+ set(${_result} ${CMAKE_MATCH_1})
+ string(REPLACE "\n" " " ${_result} "${${_result}}")
+ separate_arguments(${_result})
+ endif ()
+endmacro()
+
+if (CMAKE_COMPILER_IS_GNUCC)
+ DETERMINE_GCC_SYSTEM_INCLUDE_DIRS("c" "${CMAKE_C_COMPILER}" "${CMAKE_C_FLAGS}" SYSTEM_INCLUDE_DIRS)
+ set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES} ${SYSTEM_INCLUDE_DIRS})
+endif ()
+
+if (CMAKE_COMPILER_IS_GNUCXX)
+ DETERMINE_GCC_SYSTEM_INCLUDE_DIRS("c++" "${CMAKE_CXX_COMPILER}" "${CMAKE_CXX_FLAGS}" SYSTEM_INCLUDE_DIRS)
+ set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES} ${SYSTEM_INCLUDE_DIRS})
+endif ()
+
+# Detect Cortex-A53 core if CPU is ARM64 and OS is Linux.
+# Query /proc/cpuinfo for each available core and check reported CPU part number: 0xd03 signals Cortex-A53.
+# (see Main ID Register in ARM Cortex-A53 MPCore Processor Technical Reference Manual)
+set(WTF_CPU_ARM64_CORTEXA53_INITIALVALUE OFF)
+if (WTF_CPU_ARM64 AND (${CMAKE_SYSTEM_NAME} STREQUAL "Linux"))
+ execute_process(COMMAND nproc OUTPUT_VARIABLE PROC_COUNT)
+ math(EXPR PROC_MAX ${PROC_COUNT}-1)
+ foreach (PROC_ID RANGE ${PROC_MAX})
+ execute_process(COMMAND taskset -c ${PROC_ID} grep "^CPU part" /proc/cpuinfo OUTPUT_VARIABLE PROC_PART)
+ if (PROC_PART MATCHES "0xd03")
+ set(WTF_CPU_ARM64_CORTEXA53_INITIALVALUE ON)
+ break ()
+ endif ()
+ endforeach ()
+endif ()
+option(WTF_CPU_ARM64_CORTEXA53 "Enable Cortex-A53-specific code paths" ${WTF_CPU_ARM64_CORTEXA53_INITIALVALUE})
+
+if (WTF_CPU_ARM64_CORTEXA53)
+ if (NOT WTF_CPU_ARM64)
+ message(FATAL_ERROR "WTF_CPU_ARM64_CORTEXA53 set without WTF_CPU_ARM64")
+ endif ()
+ include(TestCXXAcceptsFlag)
+ CHECK_CXX_ACCEPTS_FLAG(-mfix-cortex-a53-835769 CXX_ACCEPTS_MFIX_CORTEX_A53_835769)
+ if (CXX_ACCEPTS_MFIX_CORTEX_A53_835769)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfix-cortex-a53-835769")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfix-cortex-a53-835769")
+ message(STATUS "Enabling Cortex-A53 workaround for compiler and disabling GNU gold linker, because it doesn't support this workaround.")
+ endif ()
+endif ()
+
+EXPOSE_VARIABLE_TO_BUILD(WTF_CPU_ARM64_CORTEXA53)
+
+set(ARM_TRADITIONAL_DETECTED FALSE)
+if (WTF_CPU_ARM)
+ set(ARM_THUMB2_TEST_SOURCE
+ "
+ #if !defined(thumb2) && !defined(__thumb2__)
+ #error \"Thumb2 instruction set isn't available\"
+ #endif
+ int main() {}
+ ")
+
+ include(CheckCXXSourceCompiles)
+ CHECK_CXX_SOURCE_COMPILES("${ARM_THUMB2_TEST_SOURCE}" ARM_THUMB2_DETECTED)
+ if (NOT ARM_THUMB2_DETECTED)
+ set(ARM_TRADITIONAL_DETECTED TRUE)
+ # See https://bugs.webkit.org/show_bug.cgi?id=159880#c4 for details.
+ message(STATUS "Disabling GNU gold linker, because it doesn't support ARM instruction set properly.")
+ endif ()
+endif ()
+
+# Use ld.gold if it is available and isn't disabled explicitly
+include(CMakeDependentOption)
+CMAKE_DEPENDENT_OPTION(USE_LD_GOLD "Use GNU gold linker" ON
+ "NOT CXX_ACCEPTS_MFIX_CORTEX_A53_835769;NOT ARM_TRADITIONAL_DETECTED;NOT WIN32;NOT APPLE" OFF)
+if (USE_LD_GOLD)
+ execute_process(COMMAND ${CMAKE_C_COMPILER} -fuse-ld=gold -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
+ if ("${LD_VERSION}" MATCHES "GNU gold")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold -Wl,--disable-new-dtags")
+ else ()
+ message(WARNING "GNU gold linker isn't available, using the default system linker.")
+ set(USE_LD_GOLD OFF)
+ endif ()
+endif ()
+
+set(ENABLE_DEBUG_FISSION_DEFAULT OFF)
+if (USE_LD_GOLD AND CMAKE_BUILD_TYPE STREQUAL "Debug")
+ include(TestCXXAcceptsFlag)
+ CHECK_CXX_ACCEPTS_FLAG(-gsplit-dwarf CXX_ACCEPTS_GSPLIT_DWARF)
+ if (CXX_ACCEPTS_GSPLIT_DWARF)
+ set(ENABLE_DEBUG_FISSION_DEFAULT ON)
+ endif ()
+endif ()
+
+option(DEBUG_FISSION "Use Debug Fission support" ${ENABLE_DEBUG_FISSION_DEFAULT})
+
+if (DEBUG_FISSION)
+ if (NOT USE_LD_GOLD)
+ message(FATAL_ERROR "Need GNU gold linker for Debug Fission support")
+ endif ()
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gsplit-dwarf")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gsplit-dwarf")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index")
+endif ()
+
+if (COMPILER_IS_CLANG)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qunused-arguments")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments")
+endif ()
+
+string(TOLOWER ${CMAKE_HOST_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR)
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND "${LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR}" MATCHES "(i[3-6]86|x86|armhf)")
+ # To avoid out of memory when building with debug option in 32bit system.
+ # See https://bugs.webkit.org/show_bug.cgi?id=77327
+ set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "-Wl,--no-keep-memory ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
+endif ()
+
+if (NOT MSVC)
+ string(REGEX MATCHALL "-fsanitize=[^ ]*" ENABLED_COMPILER_SANITIZERS ${CMAKE_CXX_FLAGS})
+endif ()
+
+if (UNIX AND NOT APPLE AND NOT ENABLED_COMPILER_SANITIZERS)
+ set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
+endif ()
+
+if (USE_ARM_LLVM_DISASSEMBLER)
+ find_package(LLVM REQUIRED)
+ SET_AND_EXPOSE_TO_BUILD(HAVE_LLVM TRUE)
+endif ()
+
+# Enable the usage of OpenMP.
+# - At this moment, OpenMP is only used as an alternative implementation
+# to native threads for the parallelization of the SVG filters.
+if (USE_OPENMP)
+ find_package(OpenMP REQUIRED)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
+endif ()
+
+# GTK uses the GNU installation directories as defaults.
+if (NOT PORT STREQUAL "GTK")
+ set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Absolute path to library installation directory")
+ set(EXEC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Absolute path to executable installation directory")
+ set(LIBEXEC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Absolute path to install executables executed by the library")
+endif ()
+
+# The Ninja generator does not yet know how to build archives in pieces, and so response
+# files must be used to deal with very long linker command lines.
+# See https://bugs.webkit.org/show_bug.cgi?id=129771
+# The Apple Toolchain doesn't support response files.
+if (NOT APPLE)
+ # If using Ninja with cmake >= 3.6.0 and icecream, then the build is broken
+ # if enable the response files. See https://bugs.webkit.org/show_bug.cgi?id=168770
+ if (NOT ((((${CMAKE_CXX_COMPILER} MATCHES ".*ccache.*") AND ($ENV{CCACHE_PREFIX} MATCHES ".*icecc.*"))
+ OR (${CMAKE_CXX_COMPILER} MATCHES ".*icecc.*")
+ OR (${AR_VERSION} MATCHES "^BSD ar [^ ]* - libarchive"))
+ AND (CMAKE_GENERATOR STREQUAL "Ninja") AND (${CMAKE_VERSION} VERSION_GREATER 3.5)))
+ set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1)
+ endif ()
+endif ()
+
+# Macros for determining HAVE values.
+include(CheckIncludeFile)
+include(CheckFunctionExists)
+include(CheckSymbolExists)
+include(CheckStructHasMember)
+
+macro(_HAVE_CHECK_INCLUDE _variable _header)
+ check_include_file(${_header} ${_variable}_value)
+ SET_AND_EXPOSE_TO_BUILD(${_variable} ${_variable}_value)
+endmacro()
+
+macro(_HAVE_CHECK_FUNCTION _variable _function)
+ check_function_exists(${_function} ${_variable}_value)
+ SET_AND_EXPOSE_TO_BUILD(${_variable} ${_variable}_value)
+endmacro()
+
+macro(_HAVE_CHECK_SYMBOL _variable _symbol _header)
+ check_symbol_exists(${_symbol} ${_header} ${_variable}_value)
+ SET_AND_EXPOSE_TO_BUILD(${_variable} ${_variable}_value)
+endmacro()
+
+macro(_HAVE_CHECK_STRUCT _variable _struct _member _header)
+ check_struct_has_member(${_struct} ${_member} ${_header} ${_variable}_value)
+ SET_AND_EXPOSE_TO_BUILD(${_variable} ${_variable}_value)
+endmacro()
+
+# Check whether features.h header exists.
+# Including glibc's one defines __GLIBC__, that is used in Platform.h
+_HAVE_CHECK_INCLUDE(HAVE_FEATURES_H features.h)
+
+# Check for headers
+_HAVE_CHECK_INCLUDE(HAVE_ERRNO_H errno.h)
+_HAVE_CHECK_INCLUDE(HAVE_LANGINFO_H langinfo.h)
+_HAVE_CHECK_INCLUDE(HAVE_MMAP sys/mman.h)
+_HAVE_CHECK_INCLUDE(HAVE_PTHREAD_NP_H pthread_np.h)
+_HAVE_CHECK_INCLUDE(HAVE_STRINGS_H strings.h)
+_HAVE_CHECK_INCLUDE(HAVE_SYS_PARAM_H sys/param.h)
+_HAVE_CHECK_INCLUDE(HAVE_SYS_TIME_H sys/time.h)
+_HAVE_CHECK_INCLUDE(HAVE_SYS_TIMEB_H sys/timeb.h)
+
+# Check for functions
+_HAVE_CHECK_FUNCTION(HAVE_ALIGNED_MALLOC _aligned_malloc)
+_HAVE_CHECK_FUNCTION(HAVE_ISDEBUGGERPRESENT IsDebuggerPresent)
+_HAVE_CHECK_FUNCTION(HAVE_LOCALTIME_R localtime_r)
+_HAVE_CHECK_FUNCTION(HAVE_STRNSTR strnstr)
+_HAVE_CHECK_FUNCTION(HAVE_TIMEGM timegm)
+_HAVE_CHECK_FUNCTION(HAVE_VASPRINTF vasprintf)
+
+# Check for symbols
+# Windows has signal.h but is missing symbols that are used in calls to signal.
+_HAVE_CHECK_SYMBOL(HAVE_SIGNAL_H SIGTRAP signal.h)
+
+# Check for struct members
+_HAVE_CHECK_STRUCT(HAVE_STAT_BIRTHTIME "struct stat" st_birthtime sys/stat.h)
+_HAVE_CHECK_STRUCT(HAVE_TM_GMTOFF "struct tm" tm_gmtoff time.h)
+_HAVE_CHECK_STRUCT(HAVE_TM_ZONE "struct tm" tm_zone time.h)
diff --git a/Source/cmake/OptionsGTK.cmake b/Source/cmake/OptionsGTK.cmake
new file mode 100644
index 000000000..1410fb634
--- /dev/null
+++ b/Source/cmake/OptionsGTK.cmake
@@ -0,0 +1,493 @@
+include(GNUInstallDirs)
+
+set(PROJECT_VERSION_MAJOR 2)
+set(PROJECT_VERSION_MINOR 16)
+set(PROJECT_VERSION_MICRO 5)
+set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_MICRO})
+set(WEBKITGTK_API_VERSION 4.0)
+
+if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9.0")
+ message(FATAL_ERROR "GCC 4.9.0 is required to build WebKitGTK+, use a newer GCC version or clang")
+ endif ()
+endif ()
+
+# Libtool library version, not to be confused with API version.
+# See http://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html
+CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(WEBKIT2 56 8 19)
+CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(JAVASCRIPTCORE 23 12 5)
+
+# These are shared variables, but we special case their definition so that we can use the
+# CMAKE_INSTALL_* variables that are populated by the GNUInstallDirs macro.
+set(LIB_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBDIR}" CACHE PATH "Absolute path to library installation directory")
+set(EXEC_INSTALL_DIR "${CMAKE_INSTALL_FULL_BINDIR}" CACHE PATH "Absolute path to executable installation directory")
+set(LIBEXEC_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/webkit2gtk-${WEBKITGTK_API_VERSION}" CACHE PATH "Absolute path to install executables executed by the library")
+
+set(DATA_BUILD_DIR "${CMAKE_BINARY_DIR}/share/${WebKit_OUTPUT_NAME}")
+set(DATA_INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/webkitgtk-${WEBKITGTK_API_VERSION}")
+set(WEBKITGTK_HEADER_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/webkitgtk-${WEBKITGTK_API_VERSION}")
+set(INTROSPECTION_INSTALL_GIRDIR "${CMAKE_INSTALL_FULL_DATADIR}/gir-1.0")
+set(INTROSPECTION_INSTALL_TYPELIBDIR "${LIB_INSTALL_DIR}/girepository-1.0")
+
+find_package(Cairo 1.10.2 REQUIRED)
+find_package(Fontconfig 2.8.0 REQUIRED)
+find_package(Freetype2 2.4.2 REQUIRED)
+find_package(LibGcrypt 1.6.0 REQUIRED)
+find_package(GTK3 3.6.0 REQUIRED)
+find_package(GDK3 3.6.0 REQUIRED)
+find_package(HarfBuzz 0.9.2 REQUIRED)
+find_package(ICU REQUIRED)
+find_package(JPEG REQUIRED)
+find_package(LibSoup 2.42.0 REQUIRED)
+find_package(LibXml2 2.8.0 REQUIRED)
+find_package(PNG REQUIRED)
+find_package(Sqlite REQUIRED)
+find_package(Threads REQUIRED)
+find_package(ZLIB REQUIRED)
+find_package(ATK REQUIRED)
+find_package(WebP REQUIRED)
+find_package(ATSPI 2.5.3)
+find_package(EGL)
+find_package(GTKUnixPrint)
+find_package(OpenGL)
+find_package(OpenGLES2)
+
+WEBKIT_OPTION_BEGIN()
+
+set(USE_WOFF2 ON)
+
+# For old versions of HarfBuzz that do not expose an API for the OpenType MATH
+# table, we enable our own code to parse that table.
+if ("${PC_HARFBUZZ_VERSION}" VERSION_LESS "1.3.3")
+ add_definitions(-DENABLE_OPENTYPE_MATH=1)
+endif ()
+
+# Set the default value for ENABLE_GLES2 automatically.
+# We are not enabling or disabling automatically a feature here, because
+# the feature is by default always on (ENABLE_OPENGL=ON).
+# What we select here automatically is if we use OPENGL (ENABLE_GLES2=OFF)
+# or OPENGLES2 (ENABLE_GLES2=ON) for building the feature.
+set(ENABLE_GLES2_DEFAULT OFF)
+
+if (NOT OPENGL_FOUND AND OPENGLES2_FOUND)
+ set(ENABLE_GLES2_DEFAULT ON)
+endif ()
+
+if (WTF_CPU_X86_64)
+ set(ENABLE_FTL_DEFAULT ON)
+else ()
+ set(ENABLE_FTL_DEFAULT OFF)
+endif ()
+
+# Public options specific to the GTK+ port. Do not add any options here unless
+# there is a strong reason we should support changing the value of the option,
+# and the option is not relevant to any other WebKit ports.
+WEBKIT_OPTION_DEFINE(ENABLE_GLES2 "Whether to enable OpenGL ES 2.0." PUBLIC ${ENABLE_GLES2_DEFAULT})
+WEBKIT_OPTION_DEFINE(ENABLE_GTKDOC "Whether or not to use generate gtkdoc." PUBLIC OFF)
+WEBKIT_OPTION_DEFINE(ENABLE_INTROSPECTION "Whether to enable GObject introspection." PUBLIC ON)
+WEBKIT_OPTION_DEFINE(ENABLE_OPENGL "Whether to use OpenGL." PUBLIC ON)
+WEBKIT_OPTION_DEFINE(ENABLE_PLUGIN_PROCESS_GTK2 "Whether to build WebKitPluginProcess2 to load GTK2 based plugins." PUBLIC ON)
+WEBKIT_OPTION_DEFINE(ENABLE_QUARTZ_TARGET "Whether to enable support for the Quartz windowing target." PUBLIC ${GTK3_SUPPORTS_QUARTZ})
+WEBKIT_OPTION_DEFINE(ENABLE_X11_TARGET "Whether to enable support for the X11 windowing target." PUBLIC ${GTK3_SUPPORTS_X11})
+WEBKIT_OPTION_DEFINE(ENABLE_WAYLAND_TARGET "Whether to enable support for the Wayland windowing target." PUBLIC ${GTK3_SUPPORTS_WAYLAND})
+WEBKIT_OPTION_DEFINE(USE_LIBNOTIFY "Whether to enable the default web notification implementation." PUBLIC ON)
+WEBKIT_OPTION_DEFINE(USE_LIBHYPHEN "Whether to enable the default automatic hyphenation implementation." PUBLIC ON)
+WEBKIT_OPTION_DEFINE(USE_LIBSECRET "Whether to enable the persistent credential storage using libsecret." PUBLIC ON)
+
+# Private options specific to the GTK+ port. Changing these options is
+# completely unsupported. They are intended for use only by WebKit developers.
+WEBKIT_OPTION_DEFINE(USE_GSTREAMER_GL "Whether to enable support for GStreamer GL" PRIVATE OFF)
+WEBKIT_OPTION_DEFINE(USE_GSTREAMER_MPEGTS "Whether to enable support for MPEG-TS" PRIVATE OFF)
+WEBKIT_OPTION_DEFINE(USE_REDIRECTED_XCOMPOSITE_WINDOW "Whether to use a Redirected XComposite Window for accelerated compositing in X11." PRIVATE ON)
+
+# FIXME: Can we use cairo-glesv2 to avoid this conflict?
+WEBKIT_OPTION_CONFLICT(ENABLE_ACCELERATED_2D_CANVAS ENABLE_GLES2)
+
+WEBKIT_OPTION_DEPEND(ENABLE_3D_TRANSFORMS ENABLE_OPENGL)
+WEBKIT_OPTION_DEPEND(ENABLE_ACCELERATED_2D_CANVAS ENABLE_OPENGL)
+WEBKIT_OPTION_DEPEND(ENABLE_GLES2 ENABLE_OPENGL)
+WEBKIT_OPTION_DEPEND(ENABLE_PLUGIN_PROCESS_GTK2 ENABLE_X11_TARGET)
+WEBKIT_OPTION_DEPEND(ENABLE_THREADED_COMPOSITOR ENABLE_OPENGL)
+WEBKIT_OPTION_DEPEND(ENABLE_WEBGL ENABLE_OPENGL)
+WEBKIT_OPTION_DEPEND(USE_REDIRECTED_XCOMPOSITE_WINDOW ENABLE_OPENGL)
+WEBKIT_OPTION_DEPEND(USE_REDIRECTED_XCOMPOSITE_WINDOW ENABLE_X11_TARGET)
+WEBKIT_OPTION_DEPEND(USE_GSTREAMER_GL ENABLE_OPENGL)
+WEBKIT_OPTION_DEPEND(USE_GSTREAMER_GL ENABLE_VIDEO)
+WEBKIT_OPTION_DEPEND(USE_GSTREAMER_MPEGTS ENABLE_VIDEO)
+
+SET_AND_EXPOSE_TO_BUILD(ENABLE_DEVELOPER_MODE ${DEVELOPER_MODE})
+if (DEVELOPER_MODE)
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MINIBROWSER PUBLIC ON)
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE ON)
+else ()
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MINIBROWSER PUBLIC OFF)
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE OFF)
+ if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ set(WebKit2_VERSION_SCRIPT "-Wl,--version-script,${CMAKE_MODULE_PATH}/gtksymbols.filter")
+ endif ()
+endif ()
+
+if (CMAKE_SYSTEM_NAME MATCHES "Linux")
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEMORY_SAMPLER PUBLIC ON)
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE ON)
+else ()
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEMORY_SAMPLER PUBLIC OFF)
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE OFF)
+endif ()
+
+# Public options shared with other WebKit ports. Do not add any options here
+# without approval from a GTK+ reviewer. There must be strong reason to support
+# changing the value of the option.
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DRAG_SUPPORT PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GEOLOCATION PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ICONDATABASE PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_JIT PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SAMPLING_PROFILER PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SPELLCHECK PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_THREADED_COMPOSITOR PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_AUDIO PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_SYSTEM_MALLOC PUBLIC OFF)
+
+# Private options shared with other WebKit ports. Add options here when
+# we need a value different from the default defined in WebKitFeatures.cmake.
+# Changing these options is completely unsupported.
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_TRANSFORMS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCESSIBILITY PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CANVAS_PATH PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_REGIONS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_SELECTORS_LEVEL4 PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DATABASE_PROCESS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DOWNLOAD_ATTRIBUTE PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTL_JIT PRIVATE ${ENABLE_FTL_DEFAULT})
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTPDIR PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FULLSCREEN_API PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INDEXED_DATABASE PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INDEXED_DATABASE_IN_WORKERS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_COLOR PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_CONTROLS_SCRIPT PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NOTIFICATIONS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PUBLIC_SUFFIX_LIST PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SMOOTH_SCROLLING PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USERSELECT_ALL PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USER_MESSAGE_HANDLERS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO_TRACK PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL PRIVATE ON)
+
+# Finalize the value for all options. Do not attempt to use an option before
+# this point, and do not attempt to change any option after this point.
+WEBKIT_OPTION_END()
+
+SET_AND_EXPOSE_TO_BUILD(WTF_PLATFORM_QUARTZ ${ENABLE_QUARTZ_TARGET})
+SET_AND_EXPOSE_TO_BUILD(WTF_PLATFORM_X11 ${ENABLE_X11_TARGET})
+SET_AND_EXPOSE_TO_BUILD(WTF_PLATFORM_WAYLAND ${ENABLE_WAYLAND_TARGET})
+
+# MOZ_X11 and XP_UNIX are required by npapi.h. Their value is not checked;
+# only their definedness is. They should only be defined in the true case.
+if (${ENABLE_X11_TARGET})
+ SET_AND_EXPOSE_TO_BUILD(MOZ_X11 1)
+ SET_AND_EXPOSE_TO_BUILD(XP_UNIX 1)
+endif ()
+
+set(ENABLE_WEBKIT OFF)
+set(ENABLE_WEBKIT2 ON)
+set(ENABLE_PLUGIN_PROCESS ${ENABLE_NETSCAPE_PLUGIN_API})
+
+add_definitions(-DBUILDING_GTK__=1)
+add_definitions(-DGETTEXT_PACKAGE="WebKit2GTK-${WEBKITGTK_API_VERSION}")
+add_definitions(-DDATA_DIR="${CMAKE_INSTALL_DATADIR}")
+add_definitions(-DUSER_AGENT_GTK_MAJOR_VERSION="604")
+add_definitions(-DUSER_AGENT_GTK_MINOR_VERSION="1")
+add_definitions(-DWEBKITGTK_API_VERSION_STRING="${WEBKITGTK_API_VERSION}")
+
+set(GTK_LIBRARIES ${GTK3_LIBRARIES})
+set(GTK_INCLUDE_DIRS ${GTK3_INCLUDE_DIRS})
+set(GDK_LIBRARIES ${GDK3_LIBRARIES})
+set(GDK_INCLUDE_DIRS ${GDK3_INCLUDE_DIRS})
+
+SET_AND_EXPOSE_TO_BUILD(HAVE_GTK_GESTURES ${GTK3_SUPPORTS_GESTURES})
+SET_AND_EXPOSE_TO_BUILD(HAVE_GTK_UNIX_PRINTING ${GTK_UNIX_PRINT_FOUND})
+
+set(glib_components gio gobject gthread gmodule)
+if (ENABLE_GAMEPAD_DEPRECATED OR ENABLE_GEOLOCATION)
+ list(APPEND glib_components gio-unix)
+endif ()
+find_package(GLIB 2.36 REQUIRED COMPONENTS ${glib_components})
+
+if (ENABLE_XSLT)
+ find_package(LibXslt 1.1.7 REQUIRED)
+endif ()
+
+if (ENABLE_ACCELERATED_2D_CANVAS)
+ if (GLX_FOUND)
+ list(APPEND CAIROGL_COMPONENTS cairo-glx)
+ endif ()
+ if (EGL_FOUND)
+ list(APPEND CAIROGL_COMPONENTS cairo-egl)
+ endif ()
+
+ find_package(CairoGL 1.10.2 COMPONENTS ${CAIROGL_COMPONENTS})
+ if (NOT CAIROGL_FOUND)
+ message(FATAL_ERROR "CairoGL is needed for ENABLE_ACCELERATED_2D_CANVAS")
+ endif ()
+endif ()
+
+if (USE_LIBSECRET)
+ find_package(Libsecret)
+ if (NOT LIBSECRET_FOUND)
+ message(FATAL_ERROR "libsecret is needed for USE_LIBSECRET")
+ endif ()
+endif ()
+
+if (ENABLE_GAMEPAD_DEPRECATED)
+ find_package(GUdev)
+ if (NOT GUDEV_FOUND)
+ message(FATAL_ERROR "GUdev is needed for ENABLE_GAMEPAD_DEPRECATED")
+ endif ()
+endif ()
+
+if (ENABLE_GEOLOCATION)
+ find_package(GeoClue2 2.1.5)
+ if (GEOCLUE2_FOUND)
+ SET_AND_EXPOSE_TO_BUILD(USE_GEOCLUE2 ${GEOCLUE2_FOUND})
+ else ()
+ find_package(GeoClue)
+ if (NOT GEOCLUE_FOUND)
+ message(FATAL_ERROR "Geoclue is needed for ENABLE_GEOLOCATION.")
+ endif ()
+ endif ()
+endif ()
+
+if (ENABLE_INTROSPECTION)
+ find_package(GObjectIntrospection)
+ if (NOT INTROSPECTION_FOUND)
+ message(FATAL_ERROR "GObjectIntrospection is needed for ENABLE_INTROSPECTION.")
+ endif ()
+endif ()
+
+if (ENABLE_MEDIA_STREAM OR ENABLE_WEB_RTC)
+ find_package(OpenWebRTC)
+ if (NOT OPENWEBRTC_FOUND)
+ message(FATAL_ERROR "OpenWebRTC is needed for ENABLE_MEDIA_STREAM and ENABLE_WEB_RTC.")
+ endif ()
+ SET_AND_EXPOSE_TO_BUILD(USE_OPENWEBRTC TRUE)
+endif ()
+
+SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER TRUE)
+
+if (ENABLE_OPENGL)
+ # ENABLE_OPENGL is true if either USE_OPENGL or ENABLE_GLES2 is true.
+ # But USE_OPENGL is the opposite of ENABLE_GLES2.
+ if (ENABLE_GLES2)
+ find_package(OpenGLES2 REQUIRED)
+ SET_AND_EXPOSE_TO_BUILD(USE_OPENGL_ES_2 TRUE)
+
+ if (NOT EGL_FOUND)
+ message(FATAL_ERROR "EGL is needed for ENABLE_GLES2.")
+ endif ()
+ else ()
+ if (NOT OPENGL_FOUND)
+ message(FATAL_ERROR "Either OpenGL or OpenGLES2 is needed for ENABLE_OPENGL.")
+ endif ()
+ SET_AND_EXPOSE_TO_BUILD(USE_OPENGL TRUE)
+ endif ()
+
+ if (NOT EGL_FOUND AND (NOT ENABLE_X11_TARGET OR NOT GLX_FOUND))
+ message(FATAL_ERROR "Either GLX or EGL is needed for ENABLE_OPENGL.")
+ endif ()
+
+ SET_AND_EXPOSE_TO_BUILD(ENABLE_GRAPHICS_CONTEXT_3D TRUE)
+
+ SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER_GL TRUE)
+
+ SET_AND_EXPOSE_TO_BUILD(USE_EGL ${EGL_FOUND})
+
+ if (ENABLE_X11_TARGET AND GLX_FOUND AND USE_OPENGL)
+ SET_AND_EXPOSE_TO_BUILD(USE_GLX TRUE)
+ endif ()
+
+ SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS ${ENABLE_THREADED_COMPOSITOR})
+ SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS_THREADED ${ENABLE_THREADED_COMPOSITOR})
+endif ()
+
+if (ENABLE_PLUGIN_PROCESS_GTK2)
+ find_package(GTK2 2.24.10 REQUIRED)
+ find_package(GDK2 2.24.10 REQUIRED)
+endif ()
+
+if (ENABLE_SPELLCHECK)
+ find_package(Enchant)
+ if (NOT PC_ENCHANT_FOUND)
+ message(FATAL_ERROR "Enchant is needed for ENABLE_SPELLCHECK")
+ endif ()
+endif ()
+
+if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
+ set(GSTREAMER_COMPONENTS app pbutils)
+
+ if (ENABLE_VIDEO)
+ list(APPEND GSTREAMER_COMPONENTS video mpegts tag gl)
+ endif ()
+
+ if (ENABLE_WEB_AUDIO)
+ list(APPEND GSTREAMER_COMPONENTS audio fft)
+ endif ()
+
+ find_package(GStreamer 1.2.3 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS})
+
+ if (ENABLE_WEB_AUDIO)
+ if (NOT PC_GSTREAMER_AUDIO_FOUND OR NOT PC_GSTREAMER_FFT_FOUND)
+ message(FATAL_ERROR "WebAudio requires the audio and fft GStreamer libraries. Please check your gst-plugins-base installation.")
+ else ()
+ SET_AND_EXPOSE_TO_BUILD(USE_WEBAUDIO_GSTREAMER TRUE)
+ endif ()
+ endif ()
+
+ if (ENABLE_VIDEO)
+ if (NOT PC_GSTREAMER_APP_FOUND OR NOT PC_GSTREAMER_PBUTILS_FOUND OR NOT PC_GSTREAMER_TAG_FOUND OR NOT PC_GSTREAMER_VIDEO_FOUND)
+ message(FATAL_ERROR "Video playback requires the following GStreamer libraries: app, pbutils, tag, video. Please check your gst-plugins-base installation.")
+ endif ()
+ endif ()
+
+ if (USE_GSTREAMER_MPEGTS)
+ if (NOT PC_GSTREAMER_MPEGTS_FOUND)
+ message(FATAL_ERROR "GStreamer MPEG-TS is needed for USE_GSTREAMER_MPEGTS.")
+ endif ()
+ endif ()
+
+ if (USE_GSTREAMER_GL)
+ if (NOT PC_GSTREAMER_GL_FOUND)
+ message(FATAL_ERROR "GStreamerGL is needed for USE_GSTREAMER_GL.")
+ endif ()
+ endif ()
+
+ SET_AND_EXPOSE_TO_BUILD(USE_GSTREAMER TRUE)
+endif ()
+
+if (ENABLE_QUARTZ_TARGET)
+ if (NOT GTK3_SUPPORTS_QUARTZ)
+ message(FATAL_ERROR "Recompile GTK+ with Quartz backend to use ENABLE_QUARTZ_TARGET")
+ endif ()
+endif ()
+
+if (ENABLE_X11_TARGET)
+ if (NOT GTK3_SUPPORTS_X11)
+ message(FATAL_ERROR "Recompile GTK+ with X11 backend to use ENABLE_X11_TARGET")
+ endif ()
+
+ find_package(X11 REQUIRED)
+ if (NOT X11_Xcomposite_FOUND)
+ message(FATAL_ERROR "libXcomposite is required for ENABLE_X11_TARGET")
+ elseif (NOT X11_Xdamage_FOUND)
+ message(FATAL_ERROR "libXdamage is required for ENABLE_X11_TARGET")
+ elseif (NOT X11_Xrender_FOUND)
+ message(FATAL_ERROR "libXrender is required for ENABLE_X11_TARGET")
+ elseif (NOT X11_Xt_FOUND)
+ message(FATAL_ERROR "libXt is required for ENABLE_X11_TARGET")
+ endif ()
+endif ()
+
+if (ENABLE_WAYLAND_TARGET)
+ if (NOT GTK3_SUPPORTS_WAYLAND)
+ message(FATAL_ERROR "Recompile GTK+ with Wayland backend to use ENABLE_WAYLAND_TARGET")
+ endif ()
+
+ if (GTK3_VERSION VERSION_LESS 3.12)
+ message(FATAL_ERROR "GTK+ 3.12 is required to use ENABLE_WAYLAND_TARGET")
+ endif ()
+
+ if (NOT EGL_FOUND)
+ message(FATAL_ERROR "EGL is required to use ENABLE_WAYLAND_TARGET")
+ endif ()
+
+ find_package(Wayland REQUIRED)
+endif ()
+
+if (USE_LIBNOTIFY)
+ find_package(LibNotify)
+ if (NOT LIBNOTIFY_FOUND)
+ message(FATAL_ERROR "libnotify is needed for USE_LIBNOTIFY.")
+ endif ()
+endif ()
+
+if (USE_LIBHYPHEN)
+ find_package(Hyphen)
+ if (NOT HYPHEN_FOUND)
+ message(FATAL_ERROR "libhyphen is needed for USE_LIBHYPHEN.")
+ endif ()
+endif ()
+
+# Override the cached variables, gtk-doc and gobject-introspection do not really work when cross-building.
+if (CMAKE_CROSSCOMPILING)
+ set(ENABLE_GTKDOC OFF)
+ set(ENABLE_INTROSPECTION OFF)
+endif ()
+
+# Override the cached variable, gtk-doc does not really work when building on Mac.
+if (APPLE)
+ set(ENABLE_GTKDOC OFF)
+endif ()
+
+set(DERIVED_SOURCES_WEBKITGTK_DIR ${DERIVED_SOURCES_DIR}/webkitgtk)
+set(DERIVED_SOURCES_WEBKITGTK_API_DIR ${DERIVED_SOURCES_WEBKITGTK_DIR}/webkit)
+set(DERIVED_SOURCES_WEBKIT2GTK_DIR ${DERIVED_SOURCES_DIR}/webkit2gtk)
+set(DERIVED_SOURCES_WEBKIT2GTK_API_DIR ${DERIVED_SOURCES_WEBKIT2GTK_DIR}/webkit2)
+set(FORWARDING_HEADERS_DIR ${DERIVED_SOURCES_DIR}/ForwardingHeaders)
+set(FORWARDING_HEADERS_WEBKIT2GTK_DIR ${FORWARDING_HEADERS_DIR}/webkit2gtk)
+set(FORWARDING_HEADERS_WEBKIT2GTK_EXTENSION_DIR ${FORWARDING_HEADERS_DIR}/webkit2gtk-webextension)
+
+set(WebKit_PKGCONFIG_FILE ${CMAKE_BINARY_DIR}/Source/WebKit/gtk/webkitgtk-${WEBKITGTK_API_VERSION}.pc)
+set(WebKit2_PKGCONFIG_FILE ${CMAKE_BINARY_DIR}/Source/WebKit2/webkit2gtk-${WEBKITGTK_API_VERSION}.pc)
+set(WebKit2WebExtension_PKGCONFIG_FILE ${CMAKE_BINARY_DIR}/Source/WebKit2/webkit2gtk-web-extension-${WEBKITGTK_API_VERSION}.pc)
+
+set(SHOULD_INSTALL_JS_SHELL ON)
+
+# Add a typelib file to the list of all typelib dependencies. This makes it easy to
+# expose a 'gir' target with all gobject-introspection files.
+macro(ADD_TYPELIB typelib)
+ if (ENABLE_INTROSPECTION)
+ get_filename_component(target_name ${typelib} NAME_WE)
+ add_custom_target(${target_name}-gir ALL DEPENDS ${typelib})
+ list(APPEND GObjectIntrospectionTargets ${target_name}-gir)
+ set(GObjectIntrospectionTargets ${GObjectIntrospectionTargets} PARENT_SCOPE)
+ endif ()
+endmacro()
+
+# CMake does not automatically add --whole-archive when building shared objects from
+# a list of convenience libraries. This can lead to missing symbols in the final output.
+# We add --whole-archive to all libraries manually to prevent the linker from trimming
+# symbols that we actually need later. With ld64 on darwin, we use -all_load instead.
+macro(ADD_WHOLE_ARCHIVE_TO_LIBRARIES _list_name)
+ if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ list(APPEND ${_list_name} -Wl,-all_load)
+ else ()
+ foreach (library IN LISTS ${_list_name})
+ list(APPEND ${_list_name}_TMP -Wl,--whole-archive ${library} -Wl,--no-whole-archive)
+ endforeach ()
+ set(${_list_name} "${${_list_name}_TMP}")
+ endif ()
+endmacro()
+
+if (CMAKE_MAJOR_VERSION LESS 3)
+ # Before CMake 3 it was necessary to use a build script instead of using cmake --build directly
+ # to preserve colors and pretty-printing.
+
+ build_command(COMMAND_LINE_TO_BUILD)
+ # build_command unconditionally adds -i (ignore errors) for make, and there's
+ # no reasonable way to turn that off, so we just replace it with -k, which has
+ # the same effect, except that the return code will indicate that an error occurred.
+ # See: http://www.cmake.org/cmake/help/v3.0/command/build_command.html
+ string(REPLACE " -i" " -k" COMMAND_LINE_TO_BUILD ${COMMAND_LINE_TO_BUILD})
+ file(WRITE
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/build.sh
+ "#!/bin/sh\n"
+ "${COMMAND_LINE_TO_BUILD} $@"
+ )
+ file(COPY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/build.sh
+ DESTINATION ${CMAKE_BINARY_DIR}
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
+ )
+endif ()
diff --git a/Source/cmake/OptionsJSCOnly.cmake b/Source/cmake/OptionsJSCOnly.cmake
new file mode 100644
index 000000000..53b4ee08a
--- /dev/null
+++ b/Source/cmake/OptionsJSCOnly.cmake
@@ -0,0 +1,79 @@
+find_package(Threads REQUIRED)
+
+add_definitions(-DBUILDING_JSCONLY__)
+
+set(PROJECT_VERSION_MAJOR 1)
+set(PROJECT_VERSION_MINOR 0)
+set(PROJECT_VERSION_MICRO 0)
+set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_MICRO})
+
+WEBKIT_OPTION_BEGIN()
+WEBKIT_OPTION_DEFINE(ENABLE_STATIC_JSC "Whether to build JavaScriptCore as a static library." PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTL_JIT PUBLIC ON)
+WEBKIT_OPTION_END()
+
+set(ALL_EVENT_LOOP_TYPES
+ GLib
+ Generic
+)
+
+set(DEFAULT_EVENT_LOOP_TYPE "Generic")
+
+set(EVENT_LOOP_TYPE ${DEFAULT_EVENT_LOOP_TYPE} CACHE STRING "Implementation of event loop to be used in JavaScriptCore (one of ${ALL_EVENT_LOOP_TYPES})")
+
+set(ENABLE_WEBCORE OFF)
+set(ENABLE_WEBKIT OFF)
+set(ENABLE_WEBKIT2 OFF)
+set(ENABLE_API_TESTS ON)
+
+if (WTF_CPU_X86 OR WTF_CPU_X86_64)
+ SET_AND_EXPOSE_TO_BUILD(USE_UDIS86 1)
+endif ()
+
+if (ENABLE_STATIC_JSC)
+ set(JavaScriptCore_LIBRARY_TYPE STATIC)
+endif ()
+
+string(TOLOWER ${EVENT_LOOP_TYPE} LOWERCASE_EVENT_LOOP_TYPE)
+if (LOWERCASE_EVENT_LOOP_TYPE STREQUAL "glib")
+ find_package(GLIB 2.36 REQUIRED COMPONENTS gio gobject)
+ SET_AND_EXPOSE_TO_BUILD(USE_GLIB 1)
+ SET_AND_EXPOSE_TO_BUILD(USE_GLIB_EVENT_LOOP 1)
+ SET_AND_EXPOSE_TO_BUILD(WTF_DEFAULT_EVENT_LOOP 0)
+else ()
+ SET_AND_EXPOSE_TO_BUILD(USE_GENERIC_EVENT_LOOP 1)
+ SET_AND_EXPOSE_TO_BUILD(WTF_DEFAULT_EVENT_LOOP 0)
+endif ()
+
+if (NOT APPLE)
+ find_package(ICU REQUIRED)
+else ()
+ set(ICU_INCLUDE_DIRS
+ "${WEBCORE_DIR}/icu"
+ "${JAVASCRIPTCORE_DIR}/icu"
+ "${WTF_DIR}/icu"
+ )
+ set(ICU_LIBRARIES libicucore.dylib)
+endif ()
+
+# From OptionsGTK.cmake
+if (CMAKE_MAJOR_VERSION LESS 3)
+ # Before CMake 3 it was necessary to use a build script instead of using cmake --build directly
+ # to preserve colors and pretty-printing.
+
+ build_command(COMMAND_LINE_TO_BUILD)
+ # build_command unconditionally adds -i (ignore errors) for make, and there's
+ # no reasonable way to turn that off, so we just replace it with -k, which has
+ # the same effect, except that the return code will indicate that an error occurred.
+ # See: http://www.cmake.org/cmake/help/v3.0/command/build_command.html
+ string(REPLACE " -i" " -k" COMMAND_LINE_TO_BUILD ${COMMAND_LINE_TO_BUILD})
+ file(WRITE
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/build.sh
+ "#!/bin/sh\n"
+ "${COMMAND_LINE_TO_BUILD} $@"
+ )
+ file(COPY ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/build.sh
+ DESTINATION ${CMAKE_BINARY_DIR}
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
+ )
+endif ()
diff --git a/Source/cmake/OptionsMac.cmake b/Source/cmake/OptionsMac.cmake
new file mode 100644
index 000000000..cb9e69ddc
--- /dev/null
+++ b/Source/cmake/OptionsMac.cmake
@@ -0,0 +1,119 @@
+set(WEBKIT_MAC_VERSION 602.1.27)
+
+WEBKIT_OPTION_BEGIN()
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_TRANSFORMS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_OVERFLOW_SCROLLING PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ATTACHMENT_ELEMENT PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ASYNC_SCROLLING PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_AVF_CAPTIONS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CACHE_PARTITIONING PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CANVAS_PATH PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CANVAS_PROXY PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CHANNEL_MESSAGING PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CONTENT_FILTERING PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_BOX_DECORATION_BREAK PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_COMPOSITING PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_DEVICE_ADAPTATION PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_IMAGE_ORIENTATION PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_IMAGE_RESOLUTION PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_REGIONS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_SCROLL_SNAP PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS3_TEXT PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CURSOR_VISIBILITY PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CUSTOM_SCHEME_HANDLER PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DASHBOARD_SUPPORT PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DRAG_SUPPORT PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DATALIST_ELEMENT PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DATA_TRANSFER_ITEMS PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FILTERS_LEVEL_2 PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FONT_LOAD_EVENTS PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FULLSCREEN_API PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GAMEPAD_DEPRECATED PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GEOLOCATION PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ICONDATABASE PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_WEEK PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SERVICE_CONTROLS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SMOOTH_SCROLLING PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INDEXED_DATABASE PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INDEXED_DATABASE_IN_WORKERS PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INDIE_UI PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_COLOR PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_COLOR_POPOVER PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_DATE PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_DATETIMELOCAL PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_MONTH PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_TIME PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_CSS_VENDOR_PREFIXES PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_ENCRYPTED_MEDIA PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_NOTIFICATIONS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_VENDOR_PREFIXES PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LETTERPRESS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LINK_PREFETCH PRIVATE OFF)
+
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MAC_LONG_PRESS PRIVATE ON)
+
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MATHML PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_CONTROLS_SCRIPT PRIVATE ON)
+
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_SOURCE PRIVATE ON)
+
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_STATISTICS PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_METER_ELEMENT PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MOUSE_CURSOR_SCALE PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NAVIGATOR_CONTENT_UTILS PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NAVIGATOR_HWCONCURRENCY PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NOSNIFF PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NOTIFICATIONS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PDFKIT_PLUGIN PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_POINTER_LOCK PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PROXIMITY_EVENTS PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PUBLIC_SUFFIX_LIST PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_QUOTA PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REMOTE_INSPECTOR PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOLUTION_MEDIA_QUERY PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RUBBER_BANDING PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SPEECH_SYNTHESIS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SPEECH_SYNTHESIS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SUBTLE_CRYPTO PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SVG_FONTS PRIVATE ON)
+
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TELEPHONE_NUMBER_DETECTION PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TEXT_AUTOSIZING PRIVATE OFF)
+
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_ICON_LOADING PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USERSELECT_ALL PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USER_MESSAGE_HANDLERS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO_TRACK PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DATACUE_VALUE PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIEW_MODE_CSS_MEDIA PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_AUDIO PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_REPLAY PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_SOCKETS PRIVATE ON)
+
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBVTT_REGIONS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XSLT PRIVATE ON)
+
+# FIXME: These are turned off temporarily to get CMake working easier.
+# https://bugs.webkit.org/show_bug.cgi?id=135856
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS PRIVATE OFF)
+
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DEVICE_ORIENTATION PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTL_JIT PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GAMEPAD PRIVATE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_IOS_AIRPLAY PRIVATE OFF)
+
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DATABASE_PROCESS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEMORY_SAMPLER PRIVATE ON)
+
+WEBKIT_OPTION_END()
+
+set(ENABLE_GRAPHICS_CONTEXT_3D ON)
+set(ENABLE_WEBKIT ON)
+set(ENABLE_WEBKIT2 ON)
diff --git a/Source/cmake/OptionsWin.cmake b/Source/cmake/OptionsWin.cmake
new file mode 100644
index 000000000..acf7d7059
--- /dev/null
+++ b/Source/cmake/OptionsWin.cmake
@@ -0,0 +1,185 @@
+add_definitions(-DNOMINMAX -DUNICODE -D_UNICODE -D_WINDOWS -DWINVER=0x601)
+
+WEBKIT_OPTION_BEGIN()
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_TRANSFORMS PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_OVERFLOW_SCROLLING PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ALLINONE_BUILD PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ATTACHMENT_ELEMENT PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CANVAS_PATH PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CANVAS_PROXY PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CHANNEL_MESSAGING PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS3_TEXT PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_BOX_DECORATION_BREAK PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_COMPOSITING PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_REGIONS PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_SELECTORS_LEVEL4 PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CURSOR_VISIBILITY PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CUSTOM_SCHEME_HANDLER PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DATALIST_ELEMENT PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DATA_TRANSFER_ITEMS PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DEVICE_ORIENTATION PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DRAG_SUPPORT PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FETCH_API PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FULLSCREEN_API PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GAMEPAD PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GEOLOCATION PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ICONDATABASE PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INDEXED_DATABASE PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INDEXED_DATABASE_IN_WORKERS PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_COLOR PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_DATE PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_DATETIMELOCAL PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_MONTH PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_TIME PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_WEEK PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_CSS_VENDOR_PREFIXES PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_NOTIFICATIONS PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_VENDOR_PREFIXES PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LINK_PREFETCH PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MATHML PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_CONTROLS_SCRIPT PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_SOURCE PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_STATISTICS PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_METER_ELEMENT PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MOUSE_CURSOR_SCALE PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NOTIFICATIONS PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PROXIMITY_EVENTS PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_QUOTA PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NAVIGATOR_CONTENT_UTILS PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_READABLE_STREAM_API PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SVG_FONTS PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO_TRACK PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIEW_MODE_CSS_MEDIA PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_ANIMATIONS PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_AUDIO PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_SOCKETS PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_TIMING PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBVTT_REGIONS PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WRITABLE_STREAM_API PUBLIC ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XSLT PUBLIC ON)
+
+# FIXME: Port bmalloc to Windows. https://bugs.webkit.org/show_bug.cgi?id=143310
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_SYSTEM_MALLOC PRIVATE ON)
+
+if (${WTF_PLATFORM_WIN_CAIRO})
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_ENCRYPTED_MEDIA PUBLIC OFF)
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INTL PUBLIC ON)
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL PUBLIC ON)
+else ()
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_ENCRYPTED_MEDIA PUBLIC ON)
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INTL PUBLIC OFF)
+ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL PUBLIC OFF)
+endif ()
+
+WEBKIT_OPTION_END()
+
+if (NOT WEBKIT_LIBRARIES_DIR)
+ if (DEFINED ENV{WEBKIT_LIBRARIES})
+ set(WEBKIT_LIBRARIES_DIR "$ENV{WEBKIT_LIBRARIES}")
+ else ()
+ set(WEBKIT_LIBRARIES_DIR "${CMAKE_SOURCE_DIR}/WebKitLibraries/win")
+ endif ()
+endif ()
+
+set(WEBKIT_LIBRARIES_INCLUDE_DIR "${WEBKIT_LIBRARIES_DIR}/include")
+
+include_directories("${CMAKE_BINARY_DIR}/DerivedSources/ForwardingHeaders" "${CMAKE_BINARY_DIR}/DerivedSources" "${WEBKIT_LIBRARIES_INCLUDE_DIR}")
+if (${MSVC_CXX_ARCHITECTURE_ID} STREQUAL "X86")
+ set(WEBKIT_LIBRARIES_LINK_DIR "${WEBKIT_LIBRARIES_DIR}/lib32")
+ # FIXME: Remove ${WEBKIT_LIBRARIES_LINK_DIR} when find_library is used for everything
+ link_directories("${CMAKE_BINARY_DIR}/lib32" "${WEBKIT_LIBRARIES_LINK_DIR}")
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib32)
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib32)
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin32)
+else ()
+ set(WEBKIT_LIBRARIES_LINK_DIR "${WEBKIT_LIBRARIES_DIR}/lib64")
+ # FIXME: Remove ${WEBKIT_LIBRARIES_LINK_DIR} when find_library is used for everything
+ link_directories("${CMAKE_BINARY_DIR}/lib64" "${WEBKIT_LIBRARIES_LINK_DIR}")
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib64)
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib64)
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin64)
+endif ()
+
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
+
+if (MSVC)
+ add_definitions(
+ /wd4018 /wd4068 /wd4099 /wd4100 /wd4127 /wd4138 /wd4146 /wd4180 /wd4189
+ /wd4201 /wd4206 /wd4244 /wd4251 /wd4267 /wd4275 /wd4288 /wd4291 /wd4305
+ /wd4309 /wd4344 /wd4355 /wd4389 /wd4396 /wd4456 /wd4457 /wd4458 /wd4459
+ /wd4481 /wd4503 /wd4505 /wd4510 /wd4512 /wd4530 /wd4610 /wd4611 /wd4646
+ /wd4702 /wd4706 /wd4722 /wd4800 /wd4819 /wd4951 /wd4952 /wd4996 /wd6011
+ /wd6031 /wd6211 /wd6246 /wd6255 /wd6387
+ )
+
+ # Create pdb files for debugging purposes, also for Release builds
+ add_compile_options(/Zi /GS)
+
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG /OPT:ICF /OPT:REF")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG /OPT:ICF /OPT:REF")
+
+ # We do not use exceptions
+ add_definitions(-D_HAS_EXCEPTIONS=0)
+ add_compile_options(/EHa- /EHc- /EHs- /fp:except-)
+
+ # We have some very large object files that have to be linked
+ add_compile_options(/analyze- /bigobj)
+
+ # Use CRT security features
+ add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1)
+
+ # Turn off certain link features
+ add_compile_options(/Gy- /openmp- /GF-)
+
+ if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:NOREF /OPT:NOICF")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:NOREF /OPT:NOICF")
+
+ # To debug linking time issues, uncomment the following three lines:
+ #add_compile_options(/Bv)
+ #set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /VERBOSE /VERBOSE:INCR /TIME")
+ #set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /VERBOSE /VERBOSE:INCR /TIME")
+ elseif (${CMAKE_BUILD_TYPE} MATCHES "Release")
+ add_compile_options(/Oy-)
+ endif ()
+
+ if (NOT ${CMAKE_GENERATOR} MATCHES "Ninja")
+ link_directories("${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}")
+ add_definitions(/MP)
+ endif ()
+ if (NOT ${CMAKE_CXX_FLAGS} STREQUAL "")
+ string(REGEX REPLACE "(/EH[a-z]+) " "\\1- " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable C++ exceptions
+ string(REGEX REPLACE "/EHsc$" "/EHs- /EHc- " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable C++ exceptions
+ string(REGEX REPLACE "/GR " "/GR- " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable RTTI
+ string(REGEX REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Warnings are important
+ endif ()
+
+ foreach (flag_var
+ CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
+ CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+ # Use the multithreaded static runtime library instead of the default DLL runtime.
+ string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
+
+ # No debug runtime, even in debug builds.
+ if (NOT DEBUG_SUFFIX)
+ string(REGEX REPLACE "/MTd" "/MT" ${flag_var} "${${flag_var}}")
+ string(REGEX REPLACE "/D_DEBUG" "" ${flag_var} "${${flag_var}}")
+ endif ()
+ endforeach ()
+endif ()
+
+set(PORT Win)
+set(JavaScriptCore_LIBRARY_TYPE SHARED)
+set(WTF_LIBRARY_TYPE SHARED)
+set(PAL_LIBRARY_TYPE STATIC)
+
+find_package(ICU REQUIRED)
diff --git a/Source/cmake/WebKitCommon.cmake b/Source/cmake/WebKitCommon.cmake
new file mode 100644
index 000000000..8b50c9d94
--- /dev/null
+++ b/Source/cmake/WebKitCommon.cmake
@@ -0,0 +1,49 @@
+# -----------------------------------------------------------------------------
+# This file is included individually from various subdirectories (JSC, WTF,
+# WebCore, WebKit) in order to allow scripts to build only part of WebKit.
+# We want to run this file only once.
+# -----------------------------------------------------------------------------
+if (NOT HAS_RUN_WEBKIT_COMMON)
+ set(HAS_RUN_WEBKIT_COMMON TRUE)
+
+ # -----------------------------------------------------------------------------
+ # Find common packages (used by all ports)
+ # -----------------------------------------------------------------------------
+ if (WIN32)
+ list(APPEND CMAKE_PROGRAM_PATH $ENV{SystemDrive}/cygwin/bin)
+ endif ()
+
+ # TODO Enforce version requirement for gperf
+ find_package(Gperf 3.0.1 REQUIRED)
+
+ # TODO Enforce version requirement for perl
+ find_package(Perl 5.10.0 REQUIRED)
+
+ find_package(PythonInterp 2.7.0 REQUIRED)
+
+ # We cannot check for RUBY_FOUND because it is set only when the full package is installed and
+ # the only thing we need is the interpreter. Unlike Python, cmake does not provide a macro
+ # for finding only the Ruby interpreter.
+ find_package(Ruby 1.9)
+ if (NOT RUBY_EXECUTABLE OR RUBY_VERSION VERSION_LESS 1.9)
+ message(FATAL_ERROR "Ruby 1.9 or higher is required.")
+ endif ()
+
+ # -----------------------------------------------------------------------------
+ # Helper macros and feature defines
+ # -----------------------------------------------------------------------------
+
+ include(WebKitMacros)
+ include(WebKitFS)
+ include(WebKitHelpers)
+ include(WebKitFeatures)
+
+ include(OptionsCommon)
+ include(Options${PORT})
+
+ # -----------------------------------------------------------------------------
+ # config.h
+ # -----------------------------------------------------------------------------
+
+ CREATE_CONFIGURATION_HEADER()
+endif ()
diff --git a/Source/cmake/WebKitFS.cmake b/Source/cmake/WebKitFS.cmake
new file mode 100644
index 000000000..5130ffcbc
--- /dev/null
+++ b/Source/cmake/WebKitFS.cmake
@@ -0,0 +1,55 @@
+if (NOT BMALLOC_DIR)
+ set(BMALLOC_DIR "${CMAKE_SOURCE_DIR}/Source/bmalloc")
+endif ()
+if (NOT WTF_DIR)
+ set(WTF_DIR "${CMAKE_SOURCE_DIR}/Source/WTF")
+endif ()
+if (NOT JAVASCRIPTCORE_DIR)
+ set(JAVASCRIPTCORE_DIR "${CMAKE_SOURCE_DIR}/Source/JavaScriptCore")
+endif ()
+if (NOT WEBCORE_DIR)
+ set(WEBCORE_DIR "${CMAKE_SOURCE_DIR}/Source/WebCore")
+endif ()
+if (NOT PAL_DIR)
+ set(PAL_DIR "${CMAKE_SOURCE_DIR}/Source/WebCore/PAL")
+endif ()
+if (NOT WEBKIT_DIR)
+ set(WEBKIT_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit")
+endif ()
+if (NOT WEBKIT2_DIR)
+ set(WEBKIT2_DIR "${CMAKE_SOURCE_DIR}/Source/WebKit2")
+endif ()
+if (NOT THIRDPARTY_DIR)
+ set(THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/Source/ThirdParty")
+endif ()
+if (NOT TOOLS_DIR)
+ set(TOOLS_DIR "${CMAKE_SOURCE_DIR}/Tools")
+endif ()
+
+set(DERIVED_SOURCES_DIR "${CMAKE_BINARY_DIR}/DerivedSources")
+set(DERIVED_SOURCES_JAVASCRIPTCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/JavaScriptCore")
+set(DERIVED_SOURCES_WEBCORE_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebCore")
+set(DERIVED_SOURCES_WEBKITLEGACY_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKitLegacy")
+set(DERIVED_SOURCES_WEBKIT_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit")
+set(DERIVED_SOURCES_WEBKIT2_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebKit2")
+set(DERIVED_SOURCES_WEBINSPECTORUI_DIR "${CMAKE_BINARY_DIR}/DerivedSources/WebInspectorUI")
+
+file(MAKE_DIRECTORY ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR})
+file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Source/JavaScriptCore/runtime)
+
+file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBINSPECTORUI_DIR})
+file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/Protocol)
+file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBINSPECTORUI_DIR}/UserInterface/Protocol)
+
+if (ENABLE_WEBCORE)
+ file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBCORE_DIR})
+endif ()
+
+if (ENABLE_WEBKIT2)
+ file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBKIT2_DIR})
+endif ()
+
+if (ENABLE_WEBKIT)
+ file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBKITLEGACY_DIR})
+ file(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBKIT_DIR})
+endif ()
diff --git a/Source/cmake/WebKitFeatures.cmake b/Source/cmake/WebKitFeatures.cmake
new file mode 100644
index 000000000..e5703911a
--- /dev/null
+++ b/Source/cmake/WebKitFeatures.cmake
@@ -0,0 +1,349 @@
+# The settings in this file are the WebKit project default values, and
+# are recommended for most ports. Ports can override these settings in
+# Options*.cmake, but should do so only if there is strong reason to
+# deviate from the defaults of the WebKit project (e.g. if the feature
+# requires platform-specific implementation that does not exist).
+#
+# Most defaults in this file affect end users but not developers.
+# Defaults for development builds are set in FeatureList.pm. Most all
+# features enabled here should also be enabled in FeatureList.pm.
+
+set(_WEBKIT_AVAILABLE_OPTIONS "")
+
+set(PUBLIC YES)
+set(PRIVATE NO)
+
+macro(_ENSURE_OPTION_MODIFICATION_IS_ALLOWED)
+ if (NOT _SETTING_WEBKIT_OPTIONS)
+ message(FATAL_ERROR "Options must be set between WEBKIT_OPTION_BEGIN and WEBKIT_OPTION_END")
+ endif ()
+endmacro()
+
+macro(_ENSURE_IS_WEBKIT_OPTION _name)
+ list(FIND _WEBKIT_AVAILABLE_OPTIONS ${_name} ${_name}_OPTION_INDEX)
+ if (${_name}_OPTION_INDEX EQUAL -1)
+ message(FATAL_ERROR "${_name} is not a valid WebKit option")
+ endif ()
+endmacro()
+
+macro(WEBKIT_OPTION_DEFINE _name _description _public _initial_value)
+ _ENSURE_OPTION_MODIFICATION_IS_ALLOWED()
+
+ set(_WEBKIT_AVAILABLE_OPTIONS_DESCRIPTION_${_name} ${_description})
+ set(_WEBKIT_AVAILABLE_OPTIONS_IS_PUBLIC_${_name} ${_public})
+ set(_WEBKIT_AVAILABLE_OPTIONS_INITIAL_VALUE_${_name} ${_initial_value})
+ set(_WEBKIT_AVAILABLE_OPTIONS_${_name}_CONFLICTS "")
+ set(_WEBKIT_AVAILABLE_OPTIONS_${_name}_DEPENDENCIES "")
+ list(APPEND _WEBKIT_AVAILABLE_OPTIONS ${_name})
+
+ EXPOSE_VARIABLE_TO_BUILD(${_name})
+endmacro()
+
+macro(WEBKIT_OPTION_DEFAULT_PORT_VALUE _name _public _value)
+ _ENSURE_OPTION_MODIFICATION_IS_ALLOWED()
+ _ENSURE_IS_WEBKIT_OPTION(${_name})
+
+ set(_WEBKIT_AVAILABLE_OPTIONS_IS_PUBLIC_${_name} ${_public})
+ set(_WEBKIT_AVAILABLE_OPTIONS_INITIAL_VALUE_${_name} ${_value})
+endmacro()
+
+macro(WEBKIT_OPTION_CONFLICT _name _conflict)
+ _ENSURE_OPTION_MODIFICATION_IS_ALLOWED()
+ _ENSURE_IS_WEBKIT_OPTION(${_name})
+ _ENSURE_IS_WEBKIT_OPTION(${_conflict})
+
+ list(APPEND _WEBKIT_AVAILABLE_OPTIONS_${_name}_CONFLICTS ${_conflict})
+endmacro()
+
+macro(WEBKIT_OPTION_DEPEND _name _depend)
+ _ENSURE_OPTION_MODIFICATION_IS_ALLOWED()
+ _ENSURE_IS_WEBKIT_OPTION(${_name})
+ _ENSURE_IS_WEBKIT_OPTION(${_depend})
+
+ list(APPEND _WEBKIT_AVAILABLE_OPTIONS_${_name}_DEPENDENCIES ${_depend})
+endmacro()
+
+macro(WEBKIT_OPTION_BEGIN)
+ set(_SETTING_WEBKIT_OPTIONS TRUE)
+
+ WEBKIT_OPTION_DEFINE(ENABLE_3D_TRANSFORMS "Toggle 3D transforms support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_ACCELERATED_2D_CANVAS "Toggle accelerated 2D canvas support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_ACCELERATED_OVERFLOW_SCROLLING "Toggle accelerated scrolling support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_ACCESSIBILITY "Toggle accessibility support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_ALLINONE_BUILD "Toggle all-in-one build" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_API_TESTS "Enable public API unit tests" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_ASYNC_SCROLLING "Enable asynchronouse scrolling" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_ATTACHMENT_ELEMENT "Toggle attachment element support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_AVF_CAPTIONS "Toggle AVFoundation caption support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_CACHE_PARTITIONING "Toggle cache partitioning support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_CANVAS_PATH "Toggle Canvas Path support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_CANVAS_PROXY "Toggle CanvasProxy support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_CHANNEL_MESSAGING "Toggle MessageChannel and MessagePort support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_CONTENT_FILTERING "Toggle content filtering support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_CONTEXT_MENUS "Toggle Context Menu support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_CSS3_TEXT "Toggle CSS3 Text support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_CSS_BOX_DECORATION_BREAK "Toggle Box Decoration break (CSS Backgrounds and Borders) support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_CSS_COMPOSITING "Toggle CSS COMPOSITING support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_CSS_DEVICE_ADAPTATION "Toggle CSS Device Adaptation support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_CSS_IMAGE_ORIENTATION "Toggle CSS image-orientation support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_CSS_IMAGE_RESOLUTION "Toggle CSS image-resolution support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_CSS_REGIONS "Toggle CSS regions support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_CSS_SCROLL_SNAP "Toggle CSS snap scroll support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_CSS_SELECTORS_LEVEL4 "Toggle CSS Selectors Level 4 support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_CURSOR_VISIBILITY "Toggle cursor visibility support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_CUSTOM_SCHEME_HANDLER "Toggle Custom Scheme Handler support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_DASHBOARD_SUPPORT "Toggle dashboard support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_DATABASE_PROCESS "Toggle database process support in WebKit2" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_DATACUE_VALUE "Toggle datacue value support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_DATALIST_ELEMENT "Toggle HTML5 datalist support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_DATA_TRANSFER_ITEMS "Toggle HTML5 data transfer items support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_DEVICE_ORIENTATION "Toggle DeviceOrientation support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_DFG_JIT "Toggle data flow graph JIT tier" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_DOWNLOAD_ATTRIBUTE "Toggle download attribute support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_DRAG_SUPPORT "Toggle Drag Support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_ENCRYPTED_MEDIA "Toggle EME support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_FETCH_API "Toggle Fetch API support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_FILTERS_LEVEL_2 "Toggle Filters Module Level 2" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_FONT_LOAD_EVENTS "Toggle Font Load Events support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_FTPDIR "Toggle FTP directory support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_FTL_JIT "Toggle FTL support for JSC" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_FULLSCREEN_API "Toggle Fullscreen API support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_GAMEPAD "Toggle Gamepad support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_GAMEPAD_DEPRECATED "Toggle deprecated Gamepad support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_GEOLOCATION "Toggle Geolocation support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_ICONDATABASE "Toggle Icon database support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_IMAGE_DECODER_DOWN_SAMPLING "Toggle image decoder down sampling support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_INDEXED_DATABASE "Toggle Indexed Database API support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_INDEXED_DATABASE_IN_WORKERS "Toggle support for indexed database in workers" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_INDIE_UI "Toggle Indie UI support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_INPUT_TYPE_COLOR "Toggle Color Input support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_INPUT_TYPE_COLOR_POPOVER "Toggle popover color input support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_INPUT_TYPE_DATE "Toggle date type <input> support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_INPUT_TYPE_DATETIME_INCOMPLETE "Toggle broken datetime type <input> support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_INPUT_TYPE_DATETIMELOCAL "Toggle datetime-local type <input> support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_INPUT_TYPE_MONTH "Toggle month type <input> support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_INPUT_TYPE_TIME "Toggle time type <input> support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_INPUT_TYPE_WEEK "Toggle week type <input> support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_INTERSECTION_OBSERVER "Enable Intersection Observer support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_INTL "Toggle Intl support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_IOS_AIRPLAY "Toggle iOS airplay support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_JIT "Enable JustInTime javascript support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_LEGACY_CSS_VENDOR_PREFIXES "Toggle legacy css vendor prefix support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_LEGACY_ENCRYPTED_MEDIA "Support legacy EME" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_LEGACY_NOTIFICATIONS "Toggle Legacy Desktop Notifications Support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_LEGACY_VENDOR_PREFIXES "Toggle Legacy Vendor Prefix Support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_LETTERPRESS "Toggle letterpress support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_LINK_PREFETCH "Toggle pre fetching support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_MAC_LONG_PRESS "Toggle mac long press support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_MATHML "Toggle MathML support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_CAPTURE "Toggle Media Capture support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_CONTROLS_SCRIPT "Toggle definition of media controls in Javascript" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_SOURCE "Toggle Media Source support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_STREAM "Toggle Media Stream support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_MEDIA_STATISTICS "Toggle Media Statistics support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_MEMORY_SAMPLER "Toggle Memory Sampler support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_METER_ELEMENT "Toggle Meter Tag support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_MHTML "Toggle MHTML support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_MINIBROWSER "Whether to enable MiniBrowser compilation." PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_MOUSE_CURSOR_SCALE "Toggle Scaled mouse cursor support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_NAVIGATOR_CONTENT_UTILS "Toggle Navigator Content Utils support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_NAVIGATOR_HWCONCURRENCY "Toggle Navigator hardware concurrency support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_NOSNIFF "Toggle support for 'X-Content-Type-Options: nosniff'" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_NETSCAPE_PLUGIN_API "Toggle Netscape Plugin support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_NOTIFICATIONS "Toggle Desktop Notifications Support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_ORIENTATION_EVENTS "Toggle Orientation Events support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_PDFKIT_PLUGIN "Toggle PDFKit plugin support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_POINTER_LOCK "Toggle pointer lock support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_PROXIMITY_EVENTS "Toggle Proximity Events support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_PUBLIC_SUFFIX_LIST "Toggle public suffix list support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_QUOTA "Toggle Quota support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_READABLE_STREAM_API "Toggle ReadableStream API support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_READABLE_BYTE_STREAM_API "Toggle support of ReadableStream API byte stream part" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_REMOTE_INSPECTOR "Toggle remote inspector support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_RESOLUTION_MEDIA_QUERY "Toggle resolution media query support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_RESOURCE_USAGE "Toggle resource usage support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_RUBBER_BANDING "Toggle rubber banding support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_SAMPLING_PROFILER "Toggle sampling profiler support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_SERVICE_CONTROLS "Toggle service controls support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_SMOOTH_SCROLLING "Toggle smooth scrolling" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_SPEECH_SYNTHESIS "Toggle Speech Synthesis API support)" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_SPELLCHECK "Toggle Spellchecking support (requires Enchant)" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_SUBTLE_CRYPTO "Toggle subtle crypto support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_SVG_FONTS "Toggle SVG fonts support (imples SVG support)" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_TELEPHONE_NUMBER_DETECTION "Toggle telephone number detection support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_TEXT_AUTOSIZING "Toggle automatic text size adjustment support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_THREADED_COMPOSITOR "Toggle threaded compositor support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_TOUCH_EVENTS "Toggle Touch Events support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_TOUCH_SLIDER "Toggle Touch Slider support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_TOUCH_ICON_LOADING "Toggle Touch Icon Loading Support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_USERSELECT_ALL "Toggle user-select:all support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_USER_MESSAGE_HANDLERS "Toggle user script message handler support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_VIBRATION "Toggle Vibration API support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_VIDEO "Toggle Video support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_VIDEO_TRACK "Toggle Track support for HTML5 video" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_VIEW_MODE_CSS_MEDIA "Toggle Track support for the view-mode media Feature" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_WEBASSEMBLY "Toggle WebAssembly support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_WEBGL "Toggle 3D canvas (WebGL) support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_WEBVTT_REGIONS "Toggle webvtt region support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_WEB_ANIMATIONS "Toggle Web Animations support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_WEB_AUDIO "Toggle Web Audio support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_WEB_REPLAY "Toggle Web Replay support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_WEB_RTC "Toggle WebRTC API support" PRIVATE OFF)
+ WEBKIT_OPTION_DEFINE(ENABLE_WEB_SOCKETS "Toggle Web Sockets support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_WEB_TIMING "Toggle Web Timing support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_WRITABLE_STREAM_API "Toggle WritableStream API support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(ENABLE_XSLT "Toggle XSLT support" PRIVATE ON)
+ WEBKIT_OPTION_DEFINE(USE_SYSTEM_MALLOC "Toggle system allocator instead of WebKit's custom allocator" PRIVATE OFF)
+
+ WEBKIT_OPTION_DEPEND(ENABLE_WEB_RTC ENABLE_MEDIA_STREAM)
+ WEBKIT_OPTION_DEPEND(ENABLE_LEGACY_ENCRYPTED_MEDIA ENABLE_VIDEO)
+ WEBKIT_OPTION_DEPEND(ENABLE_DFG_JIT ENABLE_JIT)
+ WEBKIT_OPTION_DEPEND(ENABLE_FTL_JIT ENABLE_DFG_JIT)
+ WEBKIT_OPTION_DEPEND(ENABLE_SAMPLING_PROFILER ENABLE_JIT)
+ WEBKIT_OPTION_DEPEND(ENABLE_INDEXED_DATABASE_IN_WORKERS ENABLE_INDEXED_DATABASE)
+ WEBKIT_OPTION_DEPEND(ENABLE_MEDIA_CONTROLS_SCRIPT ENABLE_VIDEO)
+ WEBKIT_OPTION_DEPEND(ENABLE_MEDIA_SOURCE ENABLE_VIDEO)
+ WEBKIT_OPTION_DEPEND(ENABLE_VIDEO_TRACK ENABLE_VIDEO)
+ WEBKIT_OPTION_DEPEND(ENABLE_TOUCH_SLIDER ENABLE_TOUCH_EVENTS)
+endmacro()
+
+macro(_WEBKIT_OPTION_ENFORCE_DEPENDS _name)
+ foreach (_dependency ${_WEBKIT_AVAILABLE_OPTIONS_${_name}_DEPENDENCIES})
+ if (NOT ${_dependency})
+ message(STATUS "Disabling ${_name} since ${_dependency} is disabled.")
+ set(${_name} OFF)
+ set(_OPTION_CHANGED TRUE)
+ break ()
+ endif ()
+ endforeach ()
+endmacro()
+
+macro(_WEBKIT_OPTION_ENFORCE_ALL_DEPENDS)
+ set(_OPTION_CHANGED TRUE)
+ while (${_OPTION_CHANGED})
+ set(_OPTION_CHANGED FALSE)
+ foreach (_name ${_WEBKIT_AVAILABLE_OPTIONS})
+ if (${_name})
+ _WEBKIT_OPTION_ENFORCE_DEPENDS(${_name})
+ endif ()
+ endforeach ()
+ endwhile ()
+endmacro()
+
+macro(_WEBKIT_OPTION_ENFORCE_CONFLICTS _name)
+ foreach (_conflict ${_WEBKIT_AVAILABLE_OPTIONS_${_name}_CONFLICTS})
+ if (${_conflict})
+ message(FATAL_ERROR "${_name} conflicts with ${_conflict}. You must disable one or the other.")
+ endif ()
+ endforeach ()
+endmacro()
+
+macro(_WEBKIT_OPTION_ENFORCE_ALL_CONFLICTS)
+ foreach (_name ${_WEBKIT_AVAILABLE_OPTIONS})
+ if (${_name})
+ _WEBKIT_OPTION_ENFORCE_CONFLICTS(${_name})
+ endif ()
+ endforeach ()
+endmacro()
+
+macro(WEBKIT_OPTION_END)
+ set(_SETTING_WEBKIT_OPTIONS FALSE)
+
+ list(SORT _WEBKIT_AVAILABLE_OPTIONS)
+ set(_MAX_FEATURE_LENGTH 0)
+ foreach (_name ${_WEBKIT_AVAILABLE_OPTIONS})
+ string(LENGTH ${_name} _name_length)
+ if (_name_length GREATER _MAX_FEATURE_LENGTH)
+ set(_MAX_FEATURE_LENGTH ${_name_length})
+ endif ()
+
+ option(${_name} "${_WEBKIT_AVAILABLE_OPTIONS_DESCRIPTION_${_name}}" ${_WEBKIT_AVAILABLE_OPTIONS_INITIAL_VALUE_${_name}})
+ if (NOT ${_WEBKIT_AVAILABLE_OPTIONS_IS_PUBLIC_${_name}})
+ mark_as_advanced(FORCE ${_name})
+ endif ()
+ endforeach ()
+
+ # Run through every possible depends to make sure we have disabled anything
+ # that could cause an unnecessary conflict before processing conflicts.
+ _WEBKIT_OPTION_ENFORCE_ALL_DEPENDS()
+ _WEBKIT_OPTION_ENFORCE_ALL_CONFLICTS()
+
+ foreach (_name ${_WEBKIT_AVAILABLE_OPTIONS})
+ if (${_name})
+ list(APPEND FEATURE_DEFINES ${_name})
+ set(FEATURE_DEFINES_WITH_SPACE_SEPARATOR "${FEATURE_DEFINES_WITH_SPACE_SEPARATOR} ${_name}")
+ endif ()
+ endforeach ()
+endmacro()
+
+macro(PRINT_WEBKIT_OPTIONS)
+ message(STATUS "Enabled features:")
+
+ set(_should_print_dots ON)
+ foreach (_name ${_WEBKIT_AVAILABLE_OPTIONS})
+ if (${_WEBKIT_AVAILABLE_OPTIONS_IS_PUBLIC_${_name}})
+ string(LENGTH ${_name} _name_length)
+ set(_message " ${_name} ")
+
+ # Print dots on every other row, for readability.
+ foreach (IGNORE RANGE ${_name_length} ${_MAX_FEATURE_LENGTH})
+ if (${_should_print_dots})
+ set(_message "${_message}.")
+ else ()
+ set(_message "${_message} ")
+ endif ()
+ endforeach ()
+
+ set(_should_print_dots (NOT ${_should_print_dots}))
+
+ set(_message "${_message} ${${_name}}")
+ message(STATUS "${_message}")
+ endif ()
+ endforeach ()
+endmacro()
+
+set(_WEBKIT_CONFIG_FILE_VARIABLES "")
+
+macro(EXPOSE_VARIABLE_TO_BUILD _variable_name)
+ list(APPEND _WEBKIT_CONFIG_FILE_VARIABLES ${_variable_name})
+endmacro()
+
+macro(SET_AND_EXPOSE_TO_BUILD _variable_name)
+ # It's important to handle the case where the value isn't passed, because often
+ # during configuration an empty variable is the result of a failed package search.
+ if (${ARGC} GREATER 1)
+ set(_variable_value ${ARGV1})
+ else ()
+ set(_variable_value OFF)
+ endif ()
+
+ set(${_variable_name} ${_variable_value})
+ EXPOSE_VARIABLE_TO_BUILD(${_variable_name})
+endmacro()
+
+macro(_ADD_CONFIGURATION_LINE_TO_HEADER_STRING _string _variable_name _output_variable_name)
+ if (${${_variable_name}})
+ set(${_string} "${_file_contents}#define ${_output_variable_name} 1\n")
+ else ()
+ set(${_string} "${_file_contents}#define ${_output_variable_name} 0\n")
+ endif ()
+endmacro()
+
+macro(CREATE_CONFIGURATION_HEADER)
+ list(SORT _WEBKIT_CONFIG_FILE_VARIABLES)
+ set(_file_contents "#ifndef CMAKECONFIG_H\n")
+ set(_file_contents "${_file_contents}#define CMAKECONFIG_H\n\n")
+
+ foreach (_variable_name ${_WEBKIT_CONFIG_FILE_VARIABLES})
+ _ADD_CONFIGURATION_LINE_TO_HEADER_STRING(_file_contents ${_variable_name} ${_variable_name})
+ endforeach ()
+ set(_file_contents "${_file_contents}\n#endif /* CMAKECONFIG_H */\n")
+
+ file(WRITE "${CMAKE_BINARY_DIR}/cmakeconfig.h.tmp" "${_file_contents}")
+ execute_process(COMMAND ${CMAKE_COMMAND}
+ -E copy_if_different
+ "${CMAKE_BINARY_DIR}/cmakeconfig.h.tmp"
+ "${CMAKE_BINARY_DIR}/cmakeconfig.h"
+ )
+ file(REMOVE "${CMAKE_BINARY_DIR}/cmakeconfig.h.tmp")
+endmacro()
diff --git a/Source/cmake/WebKitHelpers.cmake b/Source/cmake/WebKitHelpers.cmake
new file mode 100644
index 000000000..2835fcaf7
--- /dev/null
+++ b/Source/cmake/WebKitHelpers.cmake
@@ -0,0 +1,114 @@
+include(CMakeParseArguments)
+# Sets extra compile flags for a target, depending on the compiler being used.
+# Currently, only GCC is supported.
+macro(WEBKIT_SET_EXTRA_COMPILER_FLAGS _target)
+ set(options ENABLE_WERROR IGNORECXX_WARNINGS)
+ CMAKE_PARSE_ARGUMENTS("OPTION" "${options}" "" "" ${ARGN})
+ if (COMPILER_IS_GCC_OR_CLANG)
+ get_target_property(OLD_COMPILE_FLAGS ${_target} COMPILE_FLAGS)
+ if (${OLD_COMPILE_FLAGS} STREQUAL "OLD_COMPILE_FLAGS-NOTFOUND")
+ set(OLD_COMPILE_FLAGS "")
+ endif ()
+
+ if (NOT WIN32)
+ get_target_property(TARGET_TYPE ${_target} TYPE)
+ if (${TARGET_TYPE} STREQUAL "STATIC_LIBRARY") # -fPIC is automatically added to shared libraries
+ set(OLD_COMPILE_FLAGS "-fPIC ${OLD_COMPILE_FLAGS}")
+ endif ()
+ endif ()
+
+ # Suppress -Wparentheses-equality warning of Clang
+ if (COMPILER_IS_CLANG)
+ set(OLD_COMPILE_FLAGS "-Wno-parentheses-equality ${OLD_COMPILE_FLAGS}")
+ endif ()
+
+ # Suppress -Wmissing-field-initializers due to a GCC bug, see https://bugs.webkit.org/show_bug.cgi?id=157888 for details.
+ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION MATCHES "4\\.9")
+ set(OLD_COMPILE_FLAGS "-Wno-missing-field-initializers ${OLD_COMPILE_FLAGS}")
+ endif ()
+
+ # Enable warnings by default
+ if (NOT ${OPTION_IGNORECXX_WARNINGS})
+ set(OLD_COMPILE_FLAGS "-Wall -Wextra -Wcast-align -Wformat-security -Wmissing-format-attribute -Wpointer-arith -Wundef -Wwrite-strings ${OLD_COMPILE_FLAGS}")
+ endif ()
+
+ # Enable errors on warning
+ if (OPTION_ENABLE_WERROR)
+ set(OLD_COMPILE_FLAGS "-Werror ${OLD_COMPILE_FLAGS}")
+ endif ()
+
+ set_target_properties(${_target} PROPERTIES
+ COMPILE_FLAGS "${OLD_COMPILE_FLAGS}")
+
+ unset(OLD_COMPILE_FLAGS)
+ endif ()
+endmacro()
+
+
+# Append the given flag to the target property.
+# Builds on top of get_target_property() and set_target_properties()
+macro(ADD_TARGET_PROPERTIES _target _property _flags)
+ get_target_property(_tmp ${_target} ${_property})
+ if (NOT _tmp)
+ set(_tmp "")
+ endif (NOT _tmp)
+
+ foreach (f ${_flags})
+ set(_tmp "${_tmp} ${f}")
+ endforeach (f ${_flags})
+
+ set_target_properties(${_target} PROPERTIES ${_property} ${_tmp})
+ unset(_tmp)
+endmacro(ADD_TARGET_PROPERTIES _target _property _flags)
+
+
+# Append the given dependencies to the source file
+macro(ADD_SOURCE_DEPENDENCIES _source _deps)
+ get_source_file_property(_tmp ${_source} OBJECT_DEPENDS)
+ if (NOT _tmp)
+ set(_tmp "")
+ endif ()
+
+ foreach (f ${_deps})
+ list(APPEND _tmp "${f}")
+ endforeach ()
+
+ set_source_files_properties(${_source} PROPERTIES OBJECT_DEPENDS "${_tmp}")
+ unset(_tmp)
+endmacro()
+
+
+# Append the given dependencies to the source file
+# This one consider the given dependencies are in ${DERIVED_SOURCES_WEBCORE_DIR}
+# and prepends this to every member of dependencies list
+macro(ADD_SOURCE_WEBCORE_DERIVED_DEPENDENCIES _source _deps)
+ set(_tmp "")
+ foreach (f ${_deps})
+ list(APPEND _tmp "${DERIVED_SOURCES_WEBCORE_DIR}/${f}")
+ endforeach ()
+
+ ADD_SOURCE_DEPENDENCIES(${_source} ${_tmp})
+ unset(_tmp)
+endmacro()
+
+macro(CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE library_name current revision age)
+ math(EXPR ${library_name}_VERSION_MAJOR "${current} - ${age}")
+ set(${library_name}_VERSION_MINOR ${age})
+ set(${library_name}_VERSION_MICRO ${revision})
+ set(${library_name}_VERSION ${${library_name}_VERSION_MAJOR}.${age}.${revision})
+endmacro()
+
+macro(POPULATE_LIBRARY_VERSION library_name)
+if (NOT DEFINED ${library_name}_VERSION_MAJOR)
+ set(${library_name}_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
+endif ()
+if (NOT DEFINED ${library_name}_VERSION_MINOR)
+ set(${library_name}_VERSION_MINOR ${PROJECT_VERSION_MINOR})
+endif ()
+if (NOT DEFINED ${library_name}_VERSION_MICRO)
+ set(${library_name}_VERSION_MICRO ${PROJECT_VERSION_MICRO})
+endif ()
+if (NOT DEFINED ${library_name}_VERSION)
+ set(${library_name}_VERSION ${PROJECT_VERSION})
+endif ()
+endmacro()
diff --git a/Source/cmake/WebKitMacros.cmake b/Source/cmake/WebKitMacros.cmake
new file mode 100644
index 000000000..9558d4358
--- /dev/null
+++ b/Source/cmake/WebKitMacros.cmake
@@ -0,0 +1,447 @@
+include(CMakeParseArguments)
+include(ProcessorCount)
+ProcessorCount(PROCESSOR_COUNT)
+
+macro(WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS)
+ set(_file ${CMAKE_CURRENT_SOURCE_DIR}/Platform${PORT}.cmake)
+ if (EXISTS ${_file})
+ message(STATUS "Using platform-specific CMakeLists: ${_file}")
+ include(${_file})
+ else ()
+ message(STATUS "Platform-specific CMakeLists not found: ${_file}")
+ endif ()
+endmacro()
+
+# Append the given dependencies to the source file
+macro(ADD_SOURCE_DEPENDENCIES _source _deps)
+ set(_tmp)
+ get_source_file_property(_tmp ${_source} OBJECT_DEPENDS)
+ if (NOT _tmp)
+ set(_tmp "")
+ endif ()
+
+ foreach (f ${_deps})
+ list(APPEND _tmp "${f}")
+ endforeach ()
+
+ set_source_files_properties(${_source} PROPERTIES OBJECT_DEPENDS "${_tmp}")
+endmacro()
+
+macro(ADD_PRECOMPILED_HEADER _header _cpp _source)
+ if (MSVC)
+ get_filename_component(PrecompiledBasename ${_cpp} NAME_WE)
+ file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${_source}")
+ set(PrecompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/${_source}/${PrecompiledBasename}.pch")
+ set(_sources ${${_source}})
+
+ set_source_files_properties(${_cpp}
+ PROPERTIES COMPILE_FLAGS "/Yc\"${_header}\" /Fp\"${PrecompiledBinary}\""
+ OBJECT_OUTPUTS "${PrecompiledBinary}")
+ set_source_files_properties(${_sources}
+ PROPERTIES COMPILE_FLAGS "/Yu\"${_header}\" /FI\"${_header}\" /Fp\"${PrecompiledBinary}\""
+ OBJECT_DEPENDS "${PrecompiledBinary}")
+ list(APPEND ${_source} ${_cpp})
+ endif ()
+ #FIXME: Add support for Xcode.
+endmacro()
+
+option(SHOW_BINDINGS_GENERATION_PROGRESS "Show progress of generating bindings" OFF)
+
+# Helper macro which wraps generate-bindings-all.pl script.
+# target is a new target name to be added
+# OUTPUT_SOURCE is a list name which will contain generated sources.(eg. WebCore_SOURCES)
+# INPUT_FILES are IDL files to generate.
+# BASE_DIR is base directory where script is called.
+# IDL_INCLUDES is value of --include argument. (eg. ${WEBCORE_DIR}/bindings/js)
+# FEATURES is a value of --defines argument.
+# DESTINATION is a value of --outputDir argument.
+# GENERATOR is a value of --generator argument.
+# SUPPLEMENTAL_DEPFILE is a value of --supplementalDependencyFile. (optional)
+# PP_EXTRA_OUTPUT is extra outputs of preprocess-idls.pl. (optional)
+# PP_EXTRA_ARGS is extra arguments for preprocess-idls.pl. (optional)
+function(GENERATE_BINDINGS target)
+ set(options)
+ set(oneValueArgs OUTPUT_SOURCE BASE_DIR FEATURES DESTINATION GENERATOR SUPPLEMENTAL_DEPFILE)
+ set(multiValueArgs INPUT_FILES IDL_INCLUDES PP_EXTRA_OUTPUT PP_EXTRA_ARGS)
+ cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+ set(binding_generator ${WEBCORE_DIR}/bindings/scripts/generate-bindings-all.pl)
+ set(idl_attributes_file ${WEBCORE_DIR}/bindings/scripts/IDLAttributes.txt)
+ set(idl_files_list ${CMAKE_CURRENT_BINARY_DIR}/idl_files_${target}.tmp)
+ set(_supplemental_dependency)
+
+ set(content)
+ foreach (f ${arg_INPUT_FILES})
+ if (NOT IS_ABSOLUTE ${f})
+ set(f ${CMAKE_CURRENT_SOURCE_DIR}/${f})
+ endif ()
+ set(content "${content}${f}\n")
+ endforeach ()
+ file(WRITE ${idl_files_list} ${content})
+
+ set(args
+ --defines ${arg_FEATURES}
+ --generator ${arg_GENERATOR}
+ --outputDir ${arg_DESTINATION}
+ --idlFilesList ${idl_files_list}
+ --preprocessor "${CODE_GENERATOR_PREPROCESSOR}"
+ --idlAttributesFile ${idl_attributes_file})
+ if (arg_SUPPLEMENTAL_DEPFILE)
+ list(APPEND args --supplementalDependencyFile ${arg_SUPPLEMENTAL_DEPFILE})
+ endif ()
+ if (PROCESSOR_COUNT)
+ list(APPEND args --numOfJobs ${PROCESSOR_COUNT})
+ endif ()
+ foreach (i IN LISTS arg_IDL_INCLUDES)
+ if (IS_ABSOLUTE ${i})
+ list(APPEND args --include ${i})
+ else ()
+ list(APPEND args --include ${CMAKE_CURRENT_SOURCE_DIR}/${i})
+ endif ()
+ endforeach ()
+ foreach (i IN LISTS arg_PP_EXTRA_OUTPUT)
+ list(APPEND args --ppExtraOutput ${i})
+ endforeach ()
+ foreach (i IN LISTS arg_PP_EXTRA_ARGS)
+ list(APPEND args --ppExtraArgs ${i})
+ endforeach ()
+
+ set(common_generator_dependencies
+ ${WEBCORE_DIR}/bindings/scripts/generate-bindings.pl
+ ${SCRIPTS_BINDINGS}
+ # Changing enabled features should trigger recompiling all IDL files
+ # because some of them use #if.
+ ${CMAKE_BINARY_DIR}/cmakeconfig.h
+ )
+ if (EXISTS ${WEBCORE_DIR}/bindings/scripts/CodeGenerator${arg_GENERATOR}.pm)
+ list(APPEND common_generator_dependencies ${WEBCORE_DIR}/bindings/scripts/CodeGenerator${arg_GENERATOR}.pm)
+ endif ()
+ if (EXISTS ${arg_BASE_DIR}/CodeGenerator${arg_GENERATOR}.pm)
+ list(APPEND common_generator_dependencies ${arg_BASE_DIR}/CodeGenerator${arg_GENERATOR}.pm)
+ endif ()
+ foreach (i IN LISTS common_generator_dependencies)
+ list(APPEND args --generatorDependency ${i})
+ endforeach ()
+
+ set(gen_sources)
+ set(gen_headers)
+ foreach (_file ${arg_INPUT_FILES})
+ get_filename_component(_name ${_file} NAME_WE)
+ list(APPEND gen_sources ${arg_DESTINATION}/JS${_name}.cpp)
+ list(APPEND gen_headers ${arg_DESTINATION}/JS${_name}.h)
+ endforeach ()
+ set(${arg_OUTPUT_SOURCE} ${${arg_OUTPUT_SOURCE}} ${gen_sources} PARENT_SCOPE)
+ set(act_args)
+ if (SHOW_BINDINGS_GENERATION_PROGRESS)
+ list(APPEND args --showProgress)
+ endif ()
+ if (${CMAKE_VERSION} VERSION_LESS 3.2)
+ set_source_files_properties(${gen_sources} ${gen_headers} PROPERTIES GENERATED 1)
+ else ()
+ list(APPEND act_args BYPRODUCTS ${gen_sources} ${gen_headers})
+ if (SHOW_BINDINGS_GENERATION_PROGRESS)
+ list(APPEND act_args USES_TERMINAL)
+ endif ()
+ endif ()
+ add_custom_target(${target}
+ COMMAND ${PERL_EXECUTABLE} ${binding_generator} ${args}
+ WORKING_DIRECTORY ${arg_BASE_DIR}
+ COMMENT "Generate bindings (${target})"
+ VERBATIM ${act_args})
+endfunction()
+
+macro(GENERATE_FONT_NAMES _infile)
+ set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_names.pl)
+ set(_arguments --fonts ${_infile})
+ set(_outputfiles ${DERIVED_SOURCES_WEBCORE_DIR}/WebKitFontFamilyNames.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/WebKitFontFamilyNames.h)
+
+ add_custom_command(
+ OUTPUT ${_outputfiles}
+ MAIN_DEPENDENCY ${_infile}
+ DEPENDS ${MAKE_NAMES_DEPENDENCIES} ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
+ COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR} ${_arguments}
+ VERBATIM)
+endmacro()
+
+
+macro(GENERATE_EVENT_FACTORY _infile _outfile)
+ set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_event_factory.pl)
+
+ add_custom_command(
+ OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/${_outfile}
+ MAIN_DEPENDENCY ${_infile}
+ DEPENDS ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
+ COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
+ VERBATIM)
+endmacro()
+
+
+macro(GENERATE_EXCEPTION_CODE_DESCRIPTION _infile _outfile)
+ set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_dom_exceptions.pl)
+
+ add_custom_command(
+ OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/${_outfile}
+ MAIN_DEPENDENCY ${_infile}
+ DEPENDS ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
+ COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
+ VERBATIM)
+endmacro()
+
+
+macro(GENERATE_SETTINGS_MACROS _infile _outfile)
+ set(NAMES_GENERATOR ${WEBCORE_DIR}/page/make_settings.pl)
+
+ # Do not list the output in more than one independent target that may
+ # build in parallel or the two instances of the rule may conflict.
+ # <https://cmake.org/cmake/help/v3.0/command/add_custom_command.html>
+ set(_extra_output
+ ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.h
+ ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.cpp
+ ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.idl
+ )
+ set(_args BYPRODUCTS ${_extra_output})
+ if (${CMAKE_VERSION} VERSION_LESS 3.2)
+ set_source_files_properties(${_extra_output} PROPERTIES GENERATED 1)
+ set(_args)
+ endif ()
+ add_custom_command(
+ OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/${_outfile}
+ MAIN_DEPENDENCY ${_infile}
+ DEPENDS ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS}
+ COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --input ${_infile} --outputDir ${DERIVED_SOURCES_WEBCORE_DIR}
+ VERBATIM ${_args})
+endmacro()
+
+
+macro(GENERATE_DOM_NAMES _namespace _attrs)
+ set(NAMES_GENERATOR ${WEBCORE_DIR}/dom/make_names.pl)
+ set(_arguments --attrs ${_attrs})
+ set(_outputfiles ${DERIVED_SOURCES_WEBCORE_DIR}/${_namespace}Names.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/${_namespace}Names.h)
+ set(_extradef)
+ set(_tags)
+
+ foreach (f ${ARGN})
+ if (_tags)
+ set(_extradef "${_extradef} ${f}")
+ else ()
+ set(_tags ${f})
+ endif ()
+ endforeach ()
+
+ if (_tags)
+ set(_arguments "${_arguments}" --tags ${_tags} --factory --wrapperFactory)
+ set(_outputfiles "${_outputfiles}" ${DERIVED_SOURCES_WEBCORE_DIR}/${_namespace}ElementFactory.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/${_namespace}ElementFactory.h ${DERIVED_SOURCES_WEBCORE_DIR}/JS${_namespace}ElementWrapperFactory.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/JS${_namespace}ElementWrapperFactory.h)
+ endif ()
+
+ if (_extradef)
+ set(_additionArguments "${_additionArguments}" --extraDefines=${_extradef})
+ endif ()
+
+ add_custom_command(
+ OUTPUT ${_outputfiles}
+ DEPENDS ${MAKE_NAMES_DEPENDENCIES} ${NAMES_GENERATOR} ${SCRIPTS_BINDINGS} ${_attrs} ${_tags}
+ COMMAND ${PERL_EXECUTABLE} ${NAMES_GENERATOR} --preprocessor "${CODE_GENERATOR_PREPROCESSOR_WITH_LINEMARKERS}" --outputDir ${DERIVED_SOURCES_WEBCORE_DIR} ${_arguments} ${_additionArguments}
+ VERBATIM)
+endmacro()
+
+macro(MAKE_HASH_TOOLS _source)
+ get_filename_component(_name ${_source} NAME_WE)
+
+ if (${_source} STREQUAL "DocTypeStrings")
+ set(_hash_tools_h "${DERIVED_SOURCES_WEBCORE_DIR}/HashTools.h")
+ else ()
+ set(_hash_tools_h "")
+ endif ()
+
+ add_custom_command(
+ OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/${_name}.cpp ${_hash_tools_h}
+ MAIN_DEPENDENCY ${_source}.gperf
+ COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/make-hash-tools.pl ${DERIVED_SOURCES_WEBCORE_DIR} ${_source}.gperf ${GPERF_EXECUTABLE}
+ VERBATIM)
+
+ unset(_name)
+ unset(_hash_tools_h)
+endmacro()
+
+macro(WEBKIT_WRAP_SOURCELIST)
+ foreach (_file ${ARGN})
+ get_filename_component(_basename ${_file} NAME_WE)
+ get_filename_component(_path ${_file} PATH)
+
+ if (NOT _file MATCHES "${DERIVED_SOURCES_WEBCORE_DIR}")
+ string(REGEX REPLACE "/" "\\\\\\\\" _sourcegroup "${_path}")
+ source_group("${_sourcegroup}" FILES ${_file})
+ endif ()
+ endforeach ()
+
+ source_group("DerivedSources" REGULAR_EXPRESSION "${DERIVED_SOURCES_WEBCORE_DIR}")
+endmacro()
+
+macro(WEBKIT_FRAMEWORK _target)
+ include_directories(SYSTEM ${${_target}_SYSTEM_INCLUDE_DIRECTORIES})
+ add_library(${_target} ${${_target}_LIBRARY_TYPE}
+ ${${_target}_HEADERS}
+ ${${_target}_SOURCES}
+ )
+ target_include_directories(${_target} PUBLIC "$<BUILD_INTERFACE:${${_target}_INCLUDE_DIRECTORIES}>")
+ target_include_directories(${_target} PRIVATE "$<BUILD_INTERFACE:${${_target}_PRIVATE_INCLUDE_DIRECTORIES}>")
+ target_link_libraries(${_target} ${${_target}_LIBRARIES})
+ set_target_properties(${_target} PROPERTIES COMPILE_DEFINITIONS "BUILDING_${_target}")
+
+ if (${_target}_OUTPUT_NAME)
+ set_target_properties(${_target} PROPERTIES OUTPUT_NAME ${${_target}_OUTPUT_NAME})
+ endif ()
+
+ if (${_target}_PRE_BUILD_COMMAND)
+ add_custom_target(_${_target}_PreBuild COMMAND ${${_target}_PRE_BUILD_COMMAND} VERBATIM)
+ add_dependencies(${_target} _${_target}_PreBuild)
+ endif ()
+
+ if (${_target}_POST_BUILD_COMMAND)
+ add_custom_command(TARGET ${_target} POST_BUILD COMMAND ${${_target}_POST_BUILD_COMMAND} VERBATIM)
+ endif ()
+
+ if (APPLE AND NOT PORT STREQUAL "GTK" AND NOT ${${_target}_LIBRARY_TYPE} MATCHES STATIC)
+ set_target_properties(${_target} PROPERTIES FRAMEWORK TRUE)
+ install(TARGETS ${_target} FRAMEWORK DESTINATION ${LIB_INSTALL_DIR})
+ endif ()
+endmacro()
+
+macro(WEBKIT_CREATE_FORWARDING_HEADER _target_directory _file)
+ get_filename_component(_source_path "${CMAKE_SOURCE_DIR}/Source/" ABSOLUTE)
+ get_filename_component(_absolute "${_file}" ABSOLUTE)
+ get_filename_component(_name "${_file}" NAME)
+ set(_target_filename "${_target_directory}/${_name}")
+
+ # Try to make the path in the forwarding header relative to the Source directory
+ # so that these forwarding headers are compatible with the ones created by the
+ # WebKit2 generate-forwarding-headers script.
+ string(REGEX REPLACE "${_source_path}/" "" _relative ${_absolute})
+
+ set(_content "#include \"${_relative}\"\n")
+
+ if (EXISTS "${_target_filename}")
+ file(READ "${_target_filename}" _old_content)
+ endif ()
+
+ if (NOT _old_content STREQUAL _content)
+ file(WRITE "${_target_filename}" "${_content}")
+ endif ()
+endmacro()
+
+macro(WEBKIT_CREATE_FORWARDING_HEADERS _framework)
+ # On Windows, we copy the entire contents of forwarding headers.
+ if (NOT WIN32)
+ set(_processing_directories 0)
+ set(_processing_files 0)
+ set(_target_directory "${DERIVED_SOURCES_DIR}/ForwardingHeaders/${_framework}")
+
+ file(GLOB _files "${_target_directory}/*.h")
+ foreach (_file ${_files})
+ file(READ "${_file}" _content)
+ string(REGEX MATCH "^#include \"([^\"]*)\"" _matched ${_content})
+ if (_matched AND NOT EXISTS "${CMAKE_SOURCE_DIR}/Source/${CMAKE_MATCH_1}")
+ file(REMOVE "${_file}")
+ endif ()
+ endforeach ()
+
+ foreach (_currentArg ${ARGN})
+ if ("${_currentArg}" STREQUAL "DIRECTORIES")
+ set(_processing_directories 1)
+ set(_processing_files 0)
+ elseif ("${_currentArg}" STREQUAL "FILES")
+ set(_processing_directories 0)
+ set(_processing_files 1)
+ elseif (_processing_directories)
+ file(GLOB _files "${_currentArg}/*.h")
+ foreach (_file ${_files})
+ WEBKIT_CREATE_FORWARDING_HEADER(${_target_directory} ${_file})
+ endforeach ()
+ elseif (_processing_files)
+ WEBKIT_CREATE_FORWARDING_HEADER(${_target_directory} ${_currentArg})
+ endif ()
+ endforeach ()
+ endif ()
+endmacro()
+
+# Helper macro which wraps generate-message-receiver.py and generate-message-header.py scripts
+# _output_source is a list name which will contain generated sources.(eg. WebKit2_SOURCES)
+# _input_files are messages.in files to generate.
+macro(GENERATE_WEBKIT2_MESSAGE_SOURCES _output_source _input_files)
+ foreach (_file ${_input_files})
+ get_filename_component(_name ${_file} NAME_WE)
+ add_custom_command(
+ OUTPUT ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}MessageReceiver.cpp ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}Messages.h
+ MAIN_DEPENDENCY ${_file}
+ DEPENDS ${WEBKIT2_DIR}/Scripts/webkit/__init__.py
+ ${WEBKIT2_DIR}/Scripts/webkit/messages.py
+ ${WEBKIT2_DIR}/Scripts/webkit/model.py
+ ${WEBKIT2_DIR}/Scripts/webkit/parser.py
+ COMMAND ${PYTHON_EXECUTABLE} ${WEBKIT2_DIR}/Scripts/generate-message-receiver.py ${_file} > ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}MessageReceiver.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${WEBKIT2_DIR}/Scripts/generate-messages-header.py ${_file} > ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}Messages.h
+ WORKING_DIRECTORY ${WEBKIT2_DIR}
+ VERBATIM)
+
+ list(APPEND ${_output_source} ${DERIVED_SOURCES_WEBKIT2_DIR}/${_name}MessageReceiver.cpp)
+ endforeach ()
+endmacro()
+
+macro(MAKE_JS_FILE_ARRAYS _output_cpp _output_h _scripts _scripts_dependencies)
+ if (NOT CMAKE_VERSION VERSION_LESS 3.1)
+ set(_python_path ${CMAKE_COMMAND} -E env "PYTHONPATH=${JavaScriptCore_SCRIPTS_DIR}")
+ elseif (WIN32)
+ set(_python_path set "PYTHONPATH=${JavaScriptCore_SCRIPTS_DIR}" &&)
+ else ()
+ set(_python_path "PYTHONPATH=${JavaScriptCore_SCRIPTS_DIR}")
+ endif ()
+
+ add_custom_command(
+ OUTPUT ${_output_h} ${_output_cpp}
+ MAIN_DEPENDENCY ${WEBCORE_DIR}/Scripts/make-js-file-arrays.py
+ DEPENDS ${${_scripts}}
+ COMMAND ${_python_path} ${PYTHON_EXECUTABLE} ${WEBCORE_DIR}/Scripts/make-js-file-arrays.py ${_output_h} ${_output_cpp} ${${_scripts}}
+ VERBATIM)
+ list(APPEND WebCore_DERIVED_SOURCES ${_output_cpp})
+ ADD_SOURCE_DEPENDENCIES(${${_scripts_dependencies}} ${_output_h} ${_output_cpp})
+endmacro()
+
+# Helper macro for using all-in-one builds
+# This macro removes the sources included in the _all_in_one_file from the input _file_list.
+# _file_list is a list of source files
+# _all_in_one_file is an all-in-one cpp file includes other cpp files
+# _result_file_list is the output file list
+macro(PROCESS_ALLINONE_FILE _file_list _all_in_one_file _result_file_list _no_compile)
+ file(STRINGS ${_all_in_one_file} _all_in_one_file_content)
+ set(${_result_file_list} ${_file_list})
+ set(_allins "")
+ foreach (_line ${_all_in_one_file_content})
+ string(REGEX MATCH "^#include [\"<](.*)[\">]" _found ${_line})
+ if (_found)
+ list(APPEND _allins ${CMAKE_MATCH_1})
+ endif ()
+ endforeach ()
+
+ foreach (_allin ${_allins})
+ if (${_no_compile})
+ # For DerivedSources.cpp, we still need the derived sources to be generated, but we do not want them to be compiled
+ # individually. We add the header to the result file list so that CMake knows to keep generating the files.
+ string(REGEX REPLACE "(.*)\\.cpp" "\\1" _allin_no_ext ${_allin})
+ string(REGEX REPLACE ";([^;]*/)${_allin_no_ext}\\.cpp;" ";\\1${_allin_no_ext}.h;" _new_result "${${_result_file_list}};")
+ else ()
+ string(REGEX REPLACE ";[^;]*/${_allin};" ";" _new_result "${${_result_file_list}};")
+ endif ()
+ set(${_result_file_list} ${_new_result})
+ endforeach ()
+
+endmacro()
+
+# Helper macros for debugging CMake problems.
+macro(WEBKIT_DEBUG_DUMP_COMMANDS)
+ set(CMAKE_VERBOSE_MAKEFILE ON)
+endmacro()
+
+macro(WEBKIT_DEBUG_DUMP_VARIABLES)
+ set_cmake_property(_variableNames VARIABLES)
+ foreach (_variableName ${_variableNames})
+ message(STATUS "${_variableName}=${${_variableName}}")
+ endforeach ()
+endmacro()
diff --git a/Source/cmake/WebKitPackaging.cmake b/Source/cmake/WebKitPackaging.cmake
new file mode 100644
index 000000000..4b4b9f9a5
--- /dev/null
+++ b/Source/cmake/WebKitPackaging.cmake
@@ -0,0 +1,151 @@
+# -----------------------------------------------------------------------------
+# This file defines the basics of CPack behavior for WebKit
+#
+# The following CPack variables will be defined if they were unset:
+# - CPACK_PACKAGE_NAME to WebKit-${PORT}
+# - CPACK_SOURCE_IGNORE_FILES to a known pattern of good files
+#
+# The following variables affect the behavior of packaging:
+# - WEBKIT_CPACK_ALL_PORTS if defined and true, will not limit packaging
+# to just include files of the port (affects CPACK_SOURCE_IGNORE_FILES,
+# just if this variable was not defined before).
+# - WEBKIT_CPACK_ADD_TESTS if defined and true, will also add tests
+# (affects CPACK_SOURCE_IGNORE_FILES, just if this variable was
+# not defined before)
+# - WEBKIT_CPACK_ADD_TOOLS if defined and true, will also add tools
+# (affects CPACK_SOURCE_IGNORE_FILES, just if this variable was
+# not defined before)
+# -----------------------------------------------------------------------------
+
+if (NOT DEFINED CPACK_PACKAGE_NAME)
+ set(CPACK_PACKAGE_NAME WebKit-${PORT})
+endif ()
+
+if (NOT DEFINED CPACK_SOURCE_IGNORE_FILES)
+ set(CPACK_SOURCE_IGNORE_FILES
+ # Version control:
+ "/CVS/"
+ "/\\\\.svn/"
+ "/\\\\.bzr/"
+ "/\\\\.hg/"
+ "/\\\\.git/"
+ "\\\\.swp$"
+ "\\\\.#"
+ "/#"
+ "/\\\\.gitignore$"
+ "/\\\\.gitattributes$"
+
+ # SVN-only files should be ignored (site, examples...)
+ "/PerformanceTests/"
+ "/Examples/"
+ "/Websites/"
+
+ # Other build systems:
+ # - Makefiles (.mk/Makefile)
+ "\\\\.mk$"
+ "\\\\.make$"
+ "Makefile"
+ # - XCode (Mac)
+ "\\\\.xcodeproj"
+ "\\\\.xcconfig"
+ # - GYP
+ "\\\\.gyp"
+ # - QMake (Qt)
+ "\\\\.pri$"
+ "\\\\.pro$"
+
+ # Development & Runtime created files
+ "~$"
+ "\\\\.mode"
+ "\\\\.pbxuser$"
+ "\\\\.perspective"
+ "\\\\.pyc$"
+ "\\\\.pyo$"
+ "/cmake-build/"
+ "/build/"
+ "/WebKitBuild/"
+ "/Tools/Scripts/webkitpy/thirdparty/autoinstalled/"
+ )
+
+ if (NOT WEBKIT_CPACK_ADD_TESTS)
+ list(APPEND CPACK_SOURCE_IGNORE_FILES
+ "/LayoutTests/"
+ "/ManualTests/"
+ "/tests/"
+ )
+ endif (NOT WEBKIT_CPACK_ADD_TESTS)
+
+ if (NOT WEBKIT_CPACK_ADD_TOOLS)
+ list(APPEND CPACK_SOURCE_IGNORE_FILES
+ "/Tools/"
+ "/manual-tools/"
+ "/tools/"
+ "/PageLoadTools/"
+ )
+ endif (NOT WEBKIT_CPACK_ADD_TOOLS)
+
+
+ if (NOT WEBKIT_CPACK_ALL_PORTS)
+ # File and Directory patterns that no CMake-ified port uses
+ set(FILE_PATTERNS_UNKNOWN_PORTS
+ "/carbon/" "/Carbon/" "carbon\\\\." "Carbon\\\\."
+ "/cf/" "/Cf/" "cf\\\\." "Cf\\\\."
+ "/cg/" "/Cg/" "cg\\\\." "Cg\\\\."
+ "/chromium/" "/Chromium/" "chromium\\\\." "Chromium\\\\."
+ "/cocoa/" "/Cocoa/" "cocoa\\\\." "Cocoa\\\\."
+ "/Configurations/" "/Configurations/" "Configurations\\\\." "Configurations\\\\."
+ "/curl/" "/Curl/" "curl\\\\." "Curl\\\\."
+ "/gstreamer/" "/Gstreamer/" "gstreamer\\\\." "Gstreamer\\\\."
+ "/gtk/" "/Gtk/" "gtk\\\\." "Gtk\\\\."
+ "/iphone/" "/Iphone/" "iphone\\\\." "Iphone\\\\."
+ "/mac/" "/Mac/" "mac\\\\." "Mac\\\\."
+ "/opentype/" "/Opentype/" "opentype\\\\." "Opentype\\\\."
+ "/openvg/" "/Openvg/" "openvg\\\\." "Openvg\\\\."
+ "/qscriptengine/" "/Qscriptengine/" "qscriptengine\\\\." "Qscriptengine\\\\."
+ "/qscriptstring/" "/Qscriptstring/" "qscriptstring\\\\." "Qscriptstring\\\\."
+ "/qscriptvalue/" "/Qscriptvalue/" "qscriptvalue\\\\." "Qscriptvalue\\\\."
+ "/qt/" "/Qt/" "qt\\\\." "Qt\\\\."
+ "/qt4/" "/Qt4/" "qt4\\\\." "Qt4\\\\."
+ "/win/" "/Win/" "win\\\\." "Win\\\\."
+ "/wxcode/" "/Wxcode/" "wxcode\\\\." "Wxcode\\\\."
+ "/WebKitLibraries/"
+ "/English\\\\.lproj/"
+ "/Source/WebKit2/"
+ "\\\\.a$"
+ "\\\\.exe$"
+ "\\\\.mm$"
+ )
+
+ # Append all Unknown port patterns
+ foreach (_pattern ${FILE_PATTERNS_UNKNOWN_PORTS})
+ list(FIND FILE_PATTERNS_${PORT} ${_pattern} _pattern_index)
+ if (_pattern_index GREATER -1)
+ message("pattern ${_pattern} declared of 'no-port' is actually used by ${PORT}")
+ else ()
+ list(APPEND CPACK_SOURCE_IGNORE_FILES ${_pattern})
+ endif ()
+ endforeach ()
+
+ # Append all "other-ports" patterns
+ foreach (_port ${ALL_PORTS})
+ if (NOT ${_port} STREQUAL ${PORT})
+ foreach (_pattern ${FILE_PATTERNS_${_port}})
+
+ list(FIND FILE_PATTERNS_${PORT} ${_pattern} _pattern_index)
+ if (_pattern_index GREATER -1)
+ message("pattern ${_pattern} of port ${_port} is also used by ${PORT}")
+ else ()
+ list(APPEND CPACK_SOURCE_IGNORE_FILES ${_pattern})
+ endif ()
+ endforeach ()
+ endif ()
+ endforeach ()
+
+ endif (NOT WEBKIT_CPACK_ALL_PORTS)
+
+endif (NOT DEFINED CPACK_SOURCE_IGNORE_FILES)
+
+# -----------------------------------------------------------------------------
+# Include CPack that will define targets based on the variables defined before
+# -----------------------------------------------------------------------------
+include(CPack)
diff --git a/Source/cmake/WinTools.make b/Source/cmake/WinTools.make
new file mode 100644
index 000000000..5405214d1
--- /dev/null
+++ b/Source/cmake/WinTools.make
@@ -0,0 +1,4 @@
+install:
+ xcopy "$(SRCROOT)\*.cmake" "$(DSTROOT)\AppleInternal\tools\cmake" /e/v/i/h/y
+ xcopy "$(SRCROOT)\tools\scripts\*" "$(DSTROOT)\AppleInternal\tools\scripts" /e/v/i/h/y
+ xcopy "$(SRCROOT)\tools\vsprops\*" "$(DSTROOT)\AppleInternal\tools\vsprops" /e/v/i/h/y
diff --git a/Source/cmake/gtksymbols.filter b/Source/cmake/gtksymbols.filter
new file mode 100644
index 000000000..39ab09c1d
--- /dev/null
+++ b/Source/cmake/gtksymbols.filter
@@ -0,0 +1,13 @@
+{
+global:
+ webkit_*;
+ WebProcessMainUnix;
+ NetworkProcessMainUnix;
+ PluginProcessMainUnix;
+ DatabaseProcessMainUnix;
+ _ZN6WebKit22WebGtkExtensionManager10initializeEPK14OpaqueWKBundlePKv;
+ _ZN6WebKit22WebGtkExtensionManager9singletonEv;
+local:
+ webkit_media_player_debug;
+ *;
+};
diff --git a/Source/cmake/tools/scripts/COPYRIGHT-END-YEAR b/Source/cmake/tools/scripts/COPYRIGHT-END-YEAR
new file mode 100644
index 000000000..9b3c23668
--- /dev/null
+++ b/Source/cmake/tools/scripts/COPYRIGHT-END-YEAR
@@ -0,0 +1 @@
+2015
diff --git a/Source/cmake/tools/scripts/VERSION b/Source/cmake/tools/scripts/VERSION
new file mode 100644
index 000000000..2d8c4cdf7
--- /dev/null
+++ b/Source/cmake/tools/scripts/VERSION
@@ -0,0 +1 @@
+534
diff --git a/Source/cmake/tools/scripts/auto-version.pl b/Source/cmake/tools/scripts/auto-version.pl
new file mode 100755
index 000000000..0a8e7dca1
--- /dev/null
+++ b/Source/cmake/tools/scripts/auto-version.pl
@@ -0,0 +1,176 @@
+#!/usr/bin/perl -w
+
+use strict;
+use File::Path qw(make_path);
+use File::Spec;
+use File::Basename;
+use Cwd 'abs_path';
+use Win32;
+
+# Copyright (C) 2007, 2009, 2014 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+sub splitVersion($);
+
+die "You must supply an output path as the argument.\n" if ($#ARGV < 0);
+
+my $rawPath = $0;
+
+if ($^O eq "cygwin") {
+ chomp($rawPath = `/usr/bin/cygpath -u "$0"`);
+}
+
+my $thisDirectory = dirname(abs_path($rawPath));
+
+my $FALLBACK_VERSION_PATH = File::Spec->catfile($thisDirectory, 'VERSION');
+open(FALLBACK_VERSION_FILE, '<', $FALLBACK_VERSION_PATH) or die "Unable to open $FALLBACK_VERSION_PATH: $!";
+my $FALLBACK_VERSION = <FALLBACK_VERSION_FILE>;
+close FALLBACK_VERSION_FILE;
+chomp($FALLBACK_VERSION);
+
+my $COPYRIGHT_END_YEAR_PATH = File::Spec->catfile($thisDirectory, 'COPYRIGHT-END-YEAR');
+open(COPYRIGHT_END_YEAR_FILE, '<', $COPYRIGHT_END_YEAR_PATH) or die "Unable to open $COPYRIGHT_END_YEAR_PATH: $!";
+my $COPYRIGHT_END_YEAR = <COPYRIGHT_END_YEAR_FILE>;
+close COPYRIGHT_END_YEAR_FILE;
+chomp($COPYRIGHT_END_YEAR);
+
+# Make sure we don't have any leading or trailing quote
+$ARGV[0] =~ s/^\"//;
+$ARGV[0] =~ s/\"$//;
+
+my $OUTPUT_DIR = File::Spec->catdir(File::Spec->canonpath($ARGV[0]), 'include');
+unless (-d $OUTPUT_DIR) {
+ make_path($OUTPUT_DIR) or die "Couldn't create $OUTPUT_DIR: $!";
+}
+
+my $OUTPUT_FILE = File::Spec->catfile($OUTPUT_DIR, 'autoversion.h');
+
+# Take the initial version number from RC_ProjectSourceVersion if it
+# exists, otherwise fall back to the version number stored in the source.
+my $ENVIRONMENT_VERSION = $ENV{'RC_ProjectSourceVersion'} || $ENV{'RC_PROJECTSOURCEVERSION'};
+my $PROPOSED_VERSION = $ENVIRONMENT_VERSION || $FALLBACK_VERSION;
+chomp($PROPOSED_VERSION);
+
+my ($BUILD_MAJOR_VERSION, $BUILD_MINOR_VERSION, $BUILD_TINY_VERSION, $BUILD_VARIANT_VERSION, $ADJUSTED_PROPOSED_VERSION, $FULL_BUILD_MAJOR_VERSION) = splitVersion($PROPOSED_VERSION);
+
+my $TINY_VERSION = $BUILD_TINY_VERSION;
+my $VERSION_TEXT = $ADJUSTED_PROPOSED_VERSION;
+my $VERSION_TEXT_SHORT = $VERSION_TEXT;
+
+my $SVN_REVISION = '';
+if (!$ENVIRONMENT_VERSION) {
+ # If we didn't pull the version number from the environment then we're doing
+ # an engineering build and we'll stamp the build with some more information.
+
+ my $BUILD_DATE = localtime(time);
+ my $SVN_REVISION = `svn info`;
+ $SVN_REVISION =~ m/Revision: (\d+)/;
+ $SVN_REVISION= $1;
+
+ chomp($BUILD_DATE);
+ chomp($SVN_REVISION);
+
+ $VERSION_TEXT_SHORT .= "+";
+ my $USER = Win32::LoginName;
+ $VERSION_TEXT = "$VERSION_TEXT_SHORT $USER - $BUILD_DATE - r$SVN_REVISION";
+}
+
+open(OUTPUT_FILE, '>', $OUTPUT_FILE) or die "Couldn't open $OUTPUT_FILE: $!";
+print OUTPUT_FILE <<EOF;
+#define __VERSION_TEXT__ "$VERSION_TEXT"
+#define __BUILD_NUMBER__ "$VERSION_TEXT"
+#define __BUILD_NUMBER_SHORT__ "$VERSION_TEXT_SHORT"
+#define __VERSION_MAJOR__ $BUILD_MAJOR_VERSION
+#define __VERSION_MINOR__ $BUILD_MINOR_VERSION
+#define __VERSION_TINY__ $BUILD_TINY_VERSION
+#define __VERSION_BUILD__ $BUILD_VARIANT_VERSION
+#define __BUILD_NUMBER_MAJOR__ $BUILD_MAJOR_VERSION
+#define __BUILD_NUMBER_MINOR__ $BUILD_MINOR_VERSION
+#define __BUILD_NUMBER_VARIANT__ $BUILD_TINY_VERSION
+#define __SVN_REVISION__ $SVN_REVISION
+#define __FULL_BUILD_MAJOR_VERSION__ $FULL_BUILD_MAJOR_VERSION
+EOF
+
+if (defined $COPYRIGHT_END_YEAR) {
+ print OUTPUT_FILE "#define __COPYRIGHT_YEAR_END_TEXT__ \"$COPYRIGHT_END_YEAR\"\n";
+}
+close(OUTPUT_FILE);
+
+sub packTwoValues($$)
+{
+ my $first = shift;
+ my $second = shift;
+
+ die "First version component ($first) is too large. Must be between 0 and 99" if ($first > 99);
+ die "Second version component ($second) is too large. Must be between 0 and 999" if ($second > 999);
+
+ return $first * 1000 + $second;
+}
+
+sub splitVersion($)
+{
+ my $PROPOSED_VERSION = shift;
+
+ $PROPOSED_VERSION =~ s/^\s+//g; # Get rid of any leading whitespace
+ $PROPOSED_VERSION =~ s/\s+$//g; # Get rid of any trailing whitespace
+
+ # Split out the components of the dotted version number.
+ my @components = split(/\./, $PROPOSED_VERSION) or die "Couldn't parse $PROPOSED_VERSION";
+ my $componentCount = scalar(@components);
+
+ my $BUILD_MAJOR_VERSION = $components[0];
+
+ # Have the minor and tiny components default to zero if not present.
+ my $BUILD_MINOR_VERSION = 0;
+ my $BUILD_TINY_VERSION = 0;
+ my $BUILD_MICRO_VERSION = 0;
+ my $BUILD_NANO_VERSION = 0;
+ if ($componentCount > 1) {
+ $BUILD_MINOR_VERSION = $components[1];
+ }
+ if ($componentCount > 2) {
+ $BUILD_TINY_VERSION = $components[2];
+ }
+ if ($componentCount > 3) {
+ $BUILD_MICRO_VERSION = $components[3];
+ }
+
+ my $RETURN_NANO_VERSION = $ENV{'RC_ProjectBuildVersion'} || $ENV{'RC_PROJECTBUILDVERSION'} || $BUILD_MICRO_VERSION;
+ if ($componentCount > 4) {
+ $BUILD_NANO_VERSION = $components[4];
+ $RETURN_NANO_VERSION = $BUILD_NANO_VERSION;
+ }
+
+ # Cut the major component down to three characters by dropping any
+ # extra leading digits, then adjust the major version portion of the
+ # version string to match.
+ my $originalLength = length($BUILD_MAJOR_VERSION);
+ my $FULL_BUILD_MAJOR_VERSION = $BUILD_MAJOR_VERSION;
+ $BUILD_MAJOR_VERSION =~ s/^.*(\d\d\d)$/$1/;
+
+ my $charactersToRemove = $originalLength - length($BUILD_MAJOR_VERSION);
+
+ $PROPOSED_VERSION = substr($PROPOSED_VERSION, $charactersToRemove);
+
+ return ($BUILD_MAJOR_VERSION, packTwoValues($BUILD_MINOR_VERSION, $BUILD_TINY_VERSION), packTwoValues($BUILD_MICRO_VERSION, $BUILD_NANO_VERSION), $RETURN_NANO_VERSION, $PROPOSED_VERSION, $FULL_BUILD_MAJOR_VERSION);
+}
diff --git a/Source/cmake/tools/scripts/feature-defines.pl b/Source/cmake/tools/scripts/feature-defines.pl
new file mode 100755
index 000000000..71c0b565f
--- /dev/null
+++ b/Source/cmake/tools/scripts/feature-defines.pl
@@ -0,0 +1,47 @@
+#!/usr/bin/perl -w
+
+# Copyright (C) 2013-2014 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+use strict;
+use File::Spec;
+
+my $FeatureDefines = ($ARGV[1] eq 'cairo') ? 'FeatureDefinesCairo.props' : 'FeatureDefines.props';
+my $FeatureDefinesFile = File::Spec->catfile($ARGV[0], 'tools', 'vsprops', $FeatureDefines);
+
+open(FEATURE_DEFINES, '<', $FeatureDefinesFile) or die "Unable to open $FeatureDefinesFile: $!";
+my @lines = <FEATURE_DEFINES>;
+close(FEATURE_DEFINES);
+
+my @enabled = grep(/<ENABLE_/, @lines);
+@enabled = grep(!/\/>/, @enabled);
+for (@enabled) {
+ s/<\/.*>//;
+ s/<.*>//;
+ s/^\s+//;
+ s/\s+$//;
+ chomp();
+}
+
+my $result = join(' ', @enabled);
+
+print "$result\n";
diff --git a/Source/cmake/tools/scripts/version-stamp.pl b/Source/cmake/tools/scripts/version-stamp.pl
new file mode 100644
index 000000000..b0627f004
--- /dev/null
+++ b/Source/cmake/tools/scripts/version-stamp.pl
@@ -0,0 +1,133 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Cwd 'abs_path';
+use File::Basename;
+use File::Spec;
+use POSIX;
+
+# Copyright (C) 2007, 2009, 2014 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+sub exitStatus($);
+
+my $rawPath = $0;
+
+my $thisDirectory = dirname(abs_path($rawPath));
+
+my $VERSION_STAMPER = File::Spec->catfile($thisDirectory, '..', 'VersionStamper', 'VersionStamper.exe');
+
+unless (-e $VERSION_STAMPER) {
+ print "No $VERSION_STAMPER executable. Exiting.\n";
+ exit(0);
+}
+
+my ($intdir, $target);
+if (scalar(@ARGV) > 1) {
+ $intdir = $ARGV[0];
+ $target = $ARGV[1];
+} else {
+ my @arguments = split(/\s+/, $ARGV[0]) or die "Couldn't parse $ARGV[0]";
+ die "You must supply the build output directory and the target to be stamped with version information.\n" if (scalar(@arguments) < 2);
+ $intdir = $arguments[0];
+ $target = $arguments[1];
+}
+
+# Make sure we don't have any leading or trailing quote characters.
+$intdir =~ s/^\"//;
+$intdir =~ s/\"$//;
+
+$target =~ s/^\"//;
+$target =~ s/\"$//;
+
+my %components =
+(
+ '__VERSION_TEXT__' => undef,
+ '__VERSION_MAJOR__' => undef,
+ '__VERSION_MINOR__' => undef,
+ '__VERSION_TINY__' => undef,
+ '__VERSION_BUILD__' => undef,
+ '__FULL_BUILD_MAJOR_VERSION__' => undef,
+);
+
+my $VERSION_FILE = File::Spec->catfile(File::Spec->canonpath($intdir), 'include', 'autoversion.h');
+
+open(VERSION_INFO, '<', $VERSION_FILE) or die "Unable to open $VERSION_FILE: $!\n";
+while (my $line = <VERSION_INFO>) {
+ foreach my $componentKey (keys %components) {
+ if ($line !~ m/$componentKey/) {
+ next;
+ }
+
+ $line =~ s/#define $componentKey//;
+ $line =~ s/^\s*(.*)\s*$/$1/;
+ $line =~ s/^"(.*)"$/$1/;
+ chomp($line);
+
+ $components{$componentKey} = $line;
+ }
+}
+close(VERSION_INFO);
+
+print "Processing version $components{'__VERSION_TEXT__'} for $target\n";
+
+my $TARGET_PATH = File::Spec->canonpath($target);
+
+# Replace forward slashes with backslashes in case we are running Cygwin Perl.
+$TARGET_PATH =~ s/\//\\/g;
+
+print "Adjusting RC_PROJECTSOURCEVERSION and RC_ProjectSourceVersion to be safe for VersionStamper.\n";
+
+my $SAFE_PROJECT_VERSION = "$components{'__FULL_BUILD_MAJOR_VERSION__'}.$components{'__VERSION_MINOR__'}.$components{'__VERSION_TINY__'}";
+my $SAFE_BUILD_VERSION = $ENV{RC_ProjectBuildVersion} || $ENV{RC_PROJECTBUILDVERSION} || $components{'__VERSION_BUILD__'};
+
+print "Using RC_PROJECTSOURCEVERSION=$SAFE_PROJECT_VERSION and RC_PROJECTBUILDVERSION=$SAFE_BUILD_VERSION\n";
+
+# Note: These environment settings only affect this script and its child processes:
+$ENV{RC_PROJECTSOURCEVERSION} = $SAFE_PROJECT_VERSION;
+$ENV{RC_ProjectSourceVersion} = $SAFE_PROJECT_VERSION;
+
+my $rc = system($VERSION_STAMPER, '--verbose', $TARGET_PATH, '--fileMajor', $components{'__FULL_BUILD_MAJOR_VERSION__'},
+ '--fileMinor', $components{'__VERSION_MINOR__'}, '--fileRevision', $components{'__VERSION_TINY__'},
+ '--fileBuild', $SAFE_BUILD_VERSION, '--productMajor', $components{'__FULL_BUILD_MAJOR_VERSION__'},
+ '--productMinor', $components{'__VERSION_MINOR__'}, '--productRevision', $components{'__VERSION_TINY__'},
+ '--productBuild', $components{'__VERSION_BUILD__'});
+
+exit(exitStatus($rc));
+
+# This method is for portability. Return the system-appropriate exit
+# status of a child process.
+#
+# Args: pass the child error status returned by the last pipe close,
+# for example "$?".
+sub exitStatus($)
+{
+ my ($returnvalue) = @_;
+ if ($^O eq "MSWin32") {
+ return $returnvalue >> 8;
+ }
+ if (!WIFEXITED($returnvalue)) {
+ return 254;
+ }
+ return WEXITSTATUS($returnvalue);
+}