cmake cannot run if python 2 isn't available
[WebKit-https.git] / Source / cmake / OptionsWPE.cmake
1 include(GNUInstallDirs)
2 include(VersioningUtils)
3
4 SET_PROJECT_VERSION(2 23 0)
5 set(WPE_API_VERSION 0.1)
6
7 CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(WEBKIT 4 0 2)
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 WEBKIT_OPTION_BEGIN()
16
17 include(GStreamerDefinitions)
18
19 # Public options shared with other WebKit ports. Do not add any options here
20 # without approval from a WPE reviewer. There must be strong reason to support
21 # changing the value of the option.
22 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS PUBLIC OFF)
23 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ENCRYPTED_MEDIA PUBLIC ${ENABLE_EXPERIMENTAL_FEATURES})
24 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_JIT PUBLIC ON)
25 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBDRIVER PUBLIC ON)
26 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_CRYPTO PUBLIC ON)
27 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XSLT PUBLIC ON)
28 WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_SYSTEM_MALLOC PUBLIC OFF)
29
30 # Private options shared with other WebKit ports. Add options here only if
31 # we need a value different from the default defined in WebKitFeatures.cmake.
32 # Changing these options is completely unsupported.
33 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCESSIBILITY PRIVATE ON)
34 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ASYNC_SCROLLING PRIVATE ON)
35 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GEOLOCATION PRIVATE OFF)
36 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML PRIVATE ON)
37 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETSCAPE_PLUGIN_API PRIVATE OFF)
38 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NOTIFICATIONS PRIVATE OFF)
39 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SERVICE_WORKER PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
40 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SMOOTH_SCROLLING PRIVATE OFF)
41 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS PRIVATE ON)
42 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL2 PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
43 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_STREAM PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
44 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_RTC PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
45
46 # Public options specific to the WPE port. Do not add any options here unless
47 # there is a strong reason we should support changing the value of the option,
48 # and the option is not relevant to any other WebKit ports.
49 WEBKIT_OPTION_DEFINE(USE_WOFF2 "Whether to enable support for WOFF2 Web Fonts." PUBLIC ON)
50
51 # Private options specific to the WPE port.
52 WEBKIT_OPTION_DEFINE(USE_OPENVR "Whether to use OpenVR as WebVR backend." PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
53
54 if (CMAKE_SYSTEM_NAME MATCHES "Linux")
55     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEMORY_SAMPLER PRIVATE ON)
56     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE ON)
57 else ()
58     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEMORY_SAMPLER PRIVATE OFF)
59     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE OFF)
60 endif ()
61
62 SET_AND_EXPOSE_TO_BUILD(ENABLE_DEVELOPER_MODE ${DEVELOPER_MODE})
63 if (DEVELOPER_MODE)
64     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE ON)
65     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MINIBROWSER PUBLIC ON)
66 endif ()
67
68 include(GStreamerDependencies)
69
70 WEBKIT_OPTION_END()
71
72 find_package(Cairo 1.10.2 REQUIRED)
73 find_package(Fontconfig 2.8.0 REQUIRED)
74 find_package(Freetype 2.4.2 REQUIRED)
75 find_package(GLIB 2.40.0 REQUIRED COMPONENTS gio gio-unix gobject gthread gmodule)
76 find_package(HarfBuzz 0.9.18 REQUIRED)
77 find_package(ICU REQUIRED)
78 find_package(JPEG REQUIRED)
79 find_package(LibEpoxy 1.4.0 REQUIRED)
80 find_package(LibGcrypt 1.6.0 REQUIRED)
81 find_package(LibSoup 2.42.0 REQUIRED)
82 find_package(LibXml2 2.8.0 REQUIRED)
83 find_package(PNG REQUIRED)
84 find_package(Sqlite REQUIRED)
85 find_package(Threads REQUIRED)
86 find_package(WebP REQUIRED)
87 find_package(WPE REQUIRED)
88 find_package(ZLIB REQUIRED)
89
90 if (USE_WOFF2)
91     find_package(WOFF2Dec 1.0.2)
92     if (NOT WOFF2DEC_FOUND)
93         message(FATAL_ERROR "liwoff2dec is needed for USE_WOFF2.")
94     endif ()
95 endif ()
96
97 if (ENABLE_ACCELERATED_2D_CANVAS)
98     find_package(CairoGL 1.10.2 REQUIRED COMPONENTS cairo-egl)
99 endif ()
100
101 if (ENABLE_SUBTLE_CRYPTO)
102     find_package(Libtasn1 REQUIRED)
103     if (NOT LIBTASN1_FOUND)
104         message(FATAL_ERROR "libtasn1 is required to enable Web Crypto API support.")
105     endif ()
106     if (LIBGCRYPT_VERSION VERSION_LESS 1.7.0)
107         message(FATAL_ERROR "libgcrypt 1.7.0 is required to enable Web Crypto API support.")
108     endif ()
109 endif ()
110
111 if (ENABLE_XSLT)
112     find_package(LibXslt 1.1.7 REQUIRED)
113 endif ()
114
115 add_definitions(-DBUILDING_WPE__=1)
116 add_definitions(-DGETTEXT_PACKAGE="WPE")
117 add_definitions(-DJSC_GLIB_API_ENABLED)
118
119 SET_AND_EXPOSE_TO_BUILD(USE_CAIRO TRUE)
120 SET_AND_EXPOSE_TO_BUILD(USE_EGL TRUE)
121 SET_AND_EXPOSE_TO_BUILD(USE_GCRYPT TRUE)
122 SET_AND_EXPOSE_TO_BUILD(USE_LIBEPOXY TRUE)
123 SET_AND_EXPOSE_TO_BUILD(USE_OPENGL_ES TRUE)
124 SET_AND_EXPOSE_TO_BUILD(USE_XDGMIME TRUE)
125
126 if (WTF_CPU_ARM OR WTF_CPU_MIPS)
127     SET_AND_EXPOSE_TO_BUILD(USE_CAPSTONE ${DEVELOPER_MODE})
128 endif ()
129
130 SET_AND_EXPOSE_TO_BUILD(ENABLE_GRAPHICS_CONTEXT_3D TRUE)
131
132 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER TRUE)
133 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER_GL TRUE)
134 SET_AND_EXPOSE_TO_BUILD(USE_TILED_BACKING_STORE TRUE)
135 SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS TRUE)
136 SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS_THREADED TRUE)
137 SET_AND_EXPOSE_TO_BUILD(USE_NICOSIA TRUE)
138
139 set(FORWARDING_HEADERS_DIR ${DERIVED_SOURCES_DIR}/ForwardingHeaders)
140 set(FORWARDING_HEADERS_WPE_DIR ${FORWARDING_HEADERS_DIR}/wpe)
141 set(FORWARDING_HEADERS_WPE_EXTENSION_DIR ${FORWARDING_HEADERS_DIR}/wpe-webextension)
142 set(FORWARDING_HEADERS_WPE_DOM_DIR ${FORWARDING_HEADERS_DIR}/wpe-dom)
143 set(DERIVED_SOURCES_JAVASCRIPCOREWPE_DIR ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/javascriptcorewpe)
144 set(DERIVED_SOURCES_JAVASCRIPCORE_GLIB_API_DIR ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/javascriptcorewpe/jsc)
145 set(DERIVED_SOURCES_WPE_API_DIR ${DERIVED_SOURCES_WEBKIT_DIR}/wpe)
146
147 include(GStreamerChecks)