[WPE][GTK] Bump minimum versions of GLib, GTK, libsoup, ATK, GStreamer, and Cairo
[WebKit-https.git] / Source / cmake / OptionsWPE.cmake
1 include(GNUInstallDirs)
2 include(VersioningUtils)
3
4 SET_PROJECT_VERSION(2 25 1)
5 set(WPE_API_VERSION 1.0)
6
7 CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(WEBKIT 7 0 4)
8
9 # These are shared variables, but we special case their definition so that we can use the
10 # CMAKE_INSTALL_* variables that are populated by the GNUInstallDirs macro.
11 set(LIB_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBDIR}" CACHE PATH "Absolute path to library installation directory")
12 set(EXEC_INSTALL_DIR "${CMAKE_INSTALL_FULL_BINDIR}" CACHE PATH "Absolute path to executable installation directory")
13 set(LIBEXEC_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/wpe-webkit-${WPE_API_VERSION}" CACHE PATH "Absolute path to install executables executed by the library")
14
15 find_package(Cairo 1.14.0 REQUIRED)
16 find_package(Fontconfig 2.8.0 REQUIRED)
17 find_package(Freetype 2.4.2 REQUIRED)
18 find_package(GLIB 2.44.0 REQUIRED COMPONENTS gio gio-unix gobject gthread gmodule)
19 find_package(HarfBuzz 0.9.18 REQUIRED)
20 find_package(ICU REQUIRED COMPONENTS data i18n uc)
21 find_package(JPEG REQUIRED)
22 find_package(LibEpoxy 1.4.0 REQUIRED)
23 find_package(LibGcrypt 1.6.0 REQUIRED)
24 find_package(LibSoup 2.54.0 REQUIRED)
25 find_package(LibXml2 2.8.0 REQUIRED)
26 find_package(PNG REQUIRED)
27 find_package(Sqlite REQUIRED)
28 find_package(Threads REQUIRED)
29 find_package(WebP REQUIRED)
30 find_package(WPE REQUIRED)
31 find_package(ZLIB REQUIRED)
32
33 WEBKIT_OPTION_BEGIN()
34
35 include(GStreamerDefinitions)
36
37 # Public options shared with other WebKit ports. Do not add any options here
38 # without approval from a WPE reviewer. There must be strong reason to support
39 # changing the value of the option.
40 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS PUBLIC OFF)
41 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ENCRYPTED_MEDIA PUBLIC ${ENABLE_EXPERIMENTAL_FEATURES})
42 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBDRIVER PUBLIC ON)
43 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_CRYPTO PUBLIC ON)
44 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XSLT PUBLIC ON)
45
46 # Private options shared with other WebKit ports. Add options here only if
47 # we need a value different from the default defined in WebKitFeatures.cmake.
48 # Changing these options is completely unsupported.
49 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ASYNC_SCROLLING PRIVATE OFF)
50 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CONTENT_EXTENSIONS PRIVATE ON)
51 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_STREAM PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
52 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML PRIVATE ON)
53 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETSCAPE_PLUGIN_API PRIVATE OFF)
54 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NOTIFICATIONS PRIVATE OFF)
55 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SERVICE_WORKER PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
56 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SHAREABLE_RESOURCE PUBLIC ON)
57 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SMOOTH_SCROLLING PRIVATE OFF)
58 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS PRIVATE ON)
59 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL2 PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
60 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_RTC PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
61
62 # Public options specific to the WPE port. Do not add any options here unless
63 # there is a strong reason we should support changing the value of the option,
64 # and the option is not relevant to any other WebKit ports.
65 WEBKIT_OPTION_DEFINE(ENABLE_ACCESSIBILITY "Whether to enable support for accessibility" PUBLIC ON)
66 WEBKIT_OPTION_DEFINE(ENABLE_GTKDOC "Whether or not to use generate gtkdoc." PUBLIC OFF)
67 WEBKIT_OPTION_DEFINE(USE_OPENJPEG "Whether to enable support for JPEG2000 images." PUBLIC ON)
68 WEBKIT_OPTION_DEFINE(USE_WOFF2 "Whether to enable support for WOFF2 Web Fonts." PUBLIC ON)
69 WEBKIT_OPTION_DEFINE(ENABLE_WPE_QT_API "Whether to enable support for the Qt5/QML plugin" PUBLIC OFF)
70
71 # Private options specific to the WPE port.
72 WEBKIT_OPTION_DEFINE(USE_OPENVR "Whether to use OpenVR as WebVR backend." PRIVATE OFF)
73 WEBKIT_OPTION_DEFINE(USE_GSTREAMER_HOLEPUNCH "Whether to enable GStreamer holepunch" PRIVATE OFF)
74 WEBKIT_OPTION_DEFINE(USE_EXTERNAL_HOLEPUNCH "Whether to enable external holepunch" PRIVATE OFF)
75
76 if (CMAKE_SYSTEM_NAME MATCHES "Linux")
77     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEMORY_SAMPLER PRIVATE ON)
78     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE ON)
79 else ()
80     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEMORY_SAMPLER PRIVATE OFF)
81     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE OFF)
82 endif ()
83
84 SET_AND_EXPOSE_TO_BUILD(ENABLE_DEVELOPER_MODE ${DEVELOPER_MODE})
85 if (DEVELOPER_MODE)
86     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE ON)
87     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MINIBROWSER PUBLIC ON)
88 endif ()
89
90 if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT EXISTS "/.flatpak-info")
91     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BUBBLEWRAP_SANDBOX PUBLIC ON)
92 else ()
93     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BUBBLEWRAP_SANDBOX PUBLIC OFF)
94 endif ()
95
96 # Enable variation fonts when cairo >= 1.16, fontconfig >= 2.13.0, freetype >= 2.9.0 and harfbuzz >= 1.4.2.
97 if (("${PC_CAIRO_VERSION}" VERSION_GREATER "1.16.0" OR "${PC_CAIRO_VERSION}" STREQUAL "1.16.0")
98     AND ("${PC_FONTCONFIG_VERSION}" VERSION_GREATER "2.13.0" OR "${PC_FONTCONFIG_VERSION}" STREQUAL "2.13.0")
99     AND ("${FREETYPE_VERSION_STRING}" VERSION_GREATER "2.9.0" OR "${FREETYPE_VERSION_STRING}" STREQUAL "2.9.0")
100     AND ("${PC_HARFBUZZ_VERSION}" VERSION_GREATER "1.4.2" OR "${PC_HARFBUZZ_VERSION}" STREQUAL "1.4.2"))
101     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VARIATION_FONTS PRIVATE ON)
102 endif ()
103
104 WEBKIT_OPTION_DEPEND(USE_GSTREAMER_HOLEPUNCH ENABLE_VIDEO)
105 WEBKIT_OPTION_DEPEND(USE_EXTERNAL_HOLEPUNCH ENABLE_VIDEO)
106
107 include(GStreamerDependencies)
108
109 WEBKIT_OPTION_END()
110
111 if (ENABLE_ACCESSIBILITY)
112     find_package(ATK 2.16.0)
113     if (NOT ATK_FOUND)
114         message(FATAL_ERROR "atk is needed for ENABLE_ACCESSIBILITY")
115     endif ()
116     find_package(ATKBridge)
117     if (NOT ATK_BRIDGE_FOUND)
118         message(FATAL_ERROR "at-spi2-atk is needed for ENABLE_ACCESSIBILITY")
119     endif ()
120 endif ()
121
122 if (USE_OPENJPEG)
123     find_package(OpenJPEG)
124     if (NOT OpenJPEG_FOUND)
125         message(FATAL_ERROR "libopenjpeg is needed for USE_OPENJPEG.")
126     endif ()
127     if ("${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}.${OPENJPEG_BUILD_VERSION}" VERSION_LESS "2.2.0")
128         message(FATAL_ERROR "libopenjpeg 2.2.0 is required for USE_OPENJPEG.")
129     endif ()
130 endif ()
131
132 if (USE_WOFF2)
133     find_package(WOFF2Dec 1.0.2)
134     if (NOT WOFF2DEC_FOUND)
135         message(FATAL_ERROR "liwoff2dec is needed for USE_WOFF2.")
136     endif ()
137 endif ()
138
139 if (ENABLE_ACCELERATED_2D_CANVAS)
140     find_package(CairoGL 1.10.2 REQUIRED COMPONENTS cairo-egl)
141 endif ()
142
143 if (ENABLE_WEB_CRYPTO)
144     find_package(Libtasn1 REQUIRED)
145     if (NOT LIBTASN1_FOUND)
146         message(FATAL_ERROR "libtasn1 is required to enable Web Crypto API support.")
147     endif ()
148     if (LIBGCRYPT_VERSION VERSION_LESS 1.7.0)
149         message(FATAL_ERROR "libgcrypt 1.7.0 is required to enable Web Crypto API support.")
150     endif ()
151 endif ()
152
153 if (ENABLE_WEBDRIVER)
154     SET_AND_EXPOSE_TO_BUILD(ENABLE_WEBDRIVER_KEYBOARD_INTERACTIONS ON)
155     SET_AND_EXPOSE_TO_BUILD(ENABLE_WEBDRIVER_MOUSE_INTERACTIONS ON)
156     SET_AND_EXPOSE_TO_BUILD(ENABLE_WEBDRIVER_TOUCH_INTERACTIONS OFF)
157 endif ()
158
159 if (ENABLE_XSLT)
160     find_package(LibXslt 1.1.7 REQUIRED)
161 endif ()
162
163 if (ENABLE_WPE_QT_API)
164     find_package(Qt5 REQUIRED COMPONENTS Core Quick Gui)
165     find_package(Qt5Test REQUIRED)
166     find_package(PkgConfig)
167     find_package(WPEBackend-fdo 1.3.0 REQUIRED)
168 endif ()
169
170 add_definitions(-DBUILDING_WPE__=1)
171 add_definitions(-DGETTEXT_PACKAGE="WPE")
172 add_definitions(-DJSC_GLIB_API_ENABLED)
173
174 SET_AND_EXPOSE_TO_BUILD(HAVE_ACCESSIBILITY ${ENABLE_ACCESSIBILITY})
175 SET_AND_EXPOSE_TO_BUILD(USE_ATK ${ENABLE_ACCESSIBILITY})
176 SET_AND_EXPOSE_TO_BUILD(USE_CAIRO TRUE)
177 SET_AND_EXPOSE_TO_BUILD(USE_EGL TRUE)
178 SET_AND_EXPOSE_TO_BUILD(USE_GCRYPT TRUE)
179 SET_AND_EXPOSE_TO_BUILD(USE_LIBEPOXY TRUE)
180 SET_AND_EXPOSE_TO_BUILD(USE_LIBWPE TRUE)
181 SET_AND_EXPOSE_TO_BUILD(USE_OPENGL_ES TRUE)
182 SET_AND_EXPOSE_TO_BUILD(USE_WPE_RENDERER TRUE)
183 SET_AND_EXPOSE_TO_BUILD(USE_XDGMIME TRUE)
184
185 if (WTF_CPU_ARM OR WTF_CPU_MIPS)
186     SET_AND_EXPOSE_TO_BUILD(USE_CAPSTONE ${DEVELOPER_MODE})
187 endif ()
188
189 SET_AND_EXPOSE_TO_BUILD(ENABLE_GRAPHICS_CONTEXT_3D TRUE)
190
191 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER TRUE)
192 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER_GL TRUE)
193 SET_AND_EXPOSE_TO_BUILD(USE_TILED_BACKING_STORE TRUE)
194 SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS TRUE)
195 SET_AND_EXPOSE_TO_BUILD(USE_NICOSIA TRUE)
196
197 # Override the cached variable, gtk-doc does not really work when cross-building or building on Mac.
198 if (CMAKE_CROSSCOMPILING OR APPLE)
199     set(ENABLE_GTKDOC OFF)
200 endif ()
201
202 set(FORWARDING_HEADERS_DIR ${DERIVED_SOURCES_DIR}/ForwardingHeaders)
203 set(FORWARDING_HEADERS_WPE_DIR ${FORWARDING_HEADERS_DIR}/wpe)
204 set(FORWARDING_HEADERS_WPE_EXTENSION_DIR ${FORWARDING_HEADERS_DIR}/wpe-webextension)
205 set(FORWARDING_HEADERS_WPE_DOM_DIR ${FORWARDING_HEADERS_DIR}/wpe-dom)
206 set(DERIVED_SOURCES_JAVASCRIPCOREWPE_DIR ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/javascriptcorewpe)
207 set(DERIVED_SOURCES_JAVASCRIPCORE_GLIB_API_DIR ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/javascriptcorewpe/jsc)
208 set(DERIVED_SOURCES_WPE_API_DIR ${DERIVED_SOURCES_WEBKIT_DIR}/wpe)
209
210 set(WPE_PKGCONFIG_FILE ${CMAKE_BINARY_DIR}/wpe-webkit-${WPE_API_VERSION}.pc)
211 set(WPEWebExtension_PKGCONFIG_FILE ${CMAKE_BINARY_DIR}/wpe-web-extension-${WPE_API_VERSION}.pc)
212
213 include(BubblewrapSandboxChecks)
214 include(GStreamerChecks)