[WPE] Use libepoxy
[WebKit.git] / Source / cmake / OptionsWPE.cmake
1 include(GNUInstallDirs)
2
3 set(PROJECT_VERSION_MAJOR 0)
4 set(PROJECT_VERSION_MINOR 0)
5 set(PROJECT_VERSION_PATCH 20170427)
6 set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
7 set(WPE_API_VERSION 0.1)
8
9 WEBKIT_OPTION_BEGIN()
10
11 # WebKit2 C API
12 WEBKIT_OPTION_DEFINE(EXPORT_DEPRECATED_WEBKIT2_C_API "Whether to export the WebKit2 C API" PRIVATE OFF)
13
14 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_TRANSFORMS PUBLIC ON)
15 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS PUBLIC OFF)
16 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_REGIONS PUBLIC ON)
17 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_SELECTORS_LEVEL4 PUBLIC ON)
18 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DATABASE_PROCESS PRIVATE ON)
19 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DEVICE_ORIENTATION PUBLIC OFF)
20 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ENCRYPTED_MEDIA PUBLIC OFF)
21 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GAMEPAD PUBLIC OFF)
22 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GEOLOCATION PUBLIC OFF)
23 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INDEXED_DATABASE PRIVATE ON)
24 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INDEXED_DATABASE_IN_WORKERS PRIVATE OFF)
25 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_CONTROLS_SCRIPT PUBLIC ON)
26 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_SOURCE PUBLIC OFF)
27 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML PRIVATE ON)
28 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETSCAPE_PLUGIN_API PRIVATE OFF)
29 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PUBLIC_SUFFIX_LIST PRIVATE ON)
30 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REMOTE_INSPECTOR PRIVATE ON)
31 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS PUBLIC ON)
32 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USER_MESSAGE_HANDLERS PRIVATE ON)
33 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO PUBLIC ON)
34 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO_TRACK PUBLIC ON)
35 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIEW_MODE_CSS_MEDIA PUBLIC ON)
36 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_ANIMATIONS PRIVATE ON)
37 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_AUDIO PUBLIC ON)
38 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL PUBLIC ON)
39 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_TIMING PUBLIC ON)
40
41 if (CMAKE_SYSTEM_NAME MATCHES "Linux")
42     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE ON)
43 else ()
44     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE OFF)
45 endif ()
46
47 WEBKIT_OPTION_DEFINE(USE_GSTREAMER_GL "Whether to enable support for GStreamer GL" PRIVATE OFF)
48
49 WEBKIT_OPTION_END()
50
51 SET_AND_EXPOSE_TO_BUILD(ENABLE_DEVELOPER_MODE ${DEVELOPER_MODE})
52
53 set(ENABLE_WEBCORE ON)
54 set(ENABLE_WEBKIT OFF)
55 set(ENABLE_WEBKIT2 ON)
56 set(ENABLE_API_TESTS ${DEVELOPER_MODE})
57 set(ENABLE_TOOLS ON)
58
59 set(WTF_LIBRARY_TYPE STATIC)
60 set(JavaScriptCore_LIBRARY_TYPE STATIC)
61 set(WebCore_LIBRARY_TYPE STATIC)
62 set(WebKit2_OUTPUT_NAME WPEWebKit)
63 set(WebKit2_WebProcess_OUTPUT_NAME WPEWebProcess)
64 set(WebKit2_NetworkProcess_OUTPUT_NAME WPENetworkProcess)
65 set(WebKit2_DatabaseProcess_OUTPUT_NAME WPEDatabaseProcess)
66
67 find_package(ICU REQUIRED)
68 find_package(Threads REQUIRED)
69 find_package(ZLIB REQUIRED)
70 find_package(GLIB 2.40.0 REQUIRED COMPONENTS gio gio-unix gobject gthread gmodule)
71 find_package(GnuTLS 3.0.0 REQUIRED)
72
73 find_package(Cairo 1.10.2 REQUIRED)
74 find_package(Fontconfig 2.8.0 REQUIRED)
75 find_package(Freetype2 2.4.2 REQUIRED)
76 find_package(HarfBuzz 0.9.18 REQUIRED)
77 find_package(JPEG REQUIRED)
78 find_package(LibEpoxy REQUIRED)
79 find_package(LibGcrypt 1.6.0 REQUIRED)
80 find_package(LibSoup 2.42.0 REQUIRED)
81 find_package(LibXml2 2.8.0 REQUIRED)
82 find_package(LibXslt 1.1.7 REQUIRED)
83 find_package(PNG REQUIRED)
84 find_package(Sqlite REQUIRED)
85 find_package(WebP REQUIRED)
86
87 find_package(WPEBackend REQUIRED)
88
89 set(USE_CAIRO ON)
90 set(USE_XDGMIME ON)
91
92 if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
93     set(GSTREAMER_COMPONENTS app audio pbutils)
94     SET_AND_EXPOSE_TO_BUILD(USE_GSTREAMER TRUE)
95     if (ENABLE_VIDEO)
96         list(APPEND GSTREAMER_COMPONENTS video tag)
97     endif ()
98
99     if (ENABLE_WEB_AUDIO)
100         list(APPEND GSTREAMER_COMPONENTS fft)
101         SET_AND_EXPOSE_TO_BUILD(USE_WEBAUDIO_GSTREAMER TRUE)
102     endif ()
103
104     find_package(GStreamer 1.2.3 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS})
105
106     # FIXME: What about MPEGTS support? USE_GSTREAMER_MPEGTS?
107 endif ()
108
109 if (ENABLE_MEDIA_STREAM OR ENABLE_WEB_RTC)
110     find_package(OpenWebRTC)
111     if (NOT OPENWEBRTC_FOUND)
112         message(FATAL_ERROR "OpenWebRTC is needed for ENABLE_MEDIA_STREAM and ENABLE_WEB_RTC.")
113     endif ()
114     SET_AND_EXPOSE_TO_BUILD(USE_OPENWEBRTC TRUE)
115 endif ()
116
117 if (ENABLE_ACCELERATED_2D_CANVAS)
118     find_package(CairoGL 1.10.2 REQUIRED COMPONENTS cairo-egl)
119 endif ()
120
121 if (ENABLE_SUBTLE_CRYPTO)
122     find_package(Libtasn1 REQUIRED)
123     if (NOT LIBTASN1_FOUND)
124         message(FATAL_ERROR "libtasn1 is required to enable Web Crypto API support.")
125     endif ()
126     if (LIBGCRYPT_VERSION VERSION_LESS 1.7.0)
127         message(FATAL_ERROR "libgcrypt 1.7.0 is required to enable Web Crypto API support.")
128     endif ()
129     SET_AND_EXPOSE_TO_BUILD(USE_GCRYPT TRUE)
130 endif ()
131
132 add_definitions(-DBUILDING_WPE__=1)
133 add_definitions(-DGETTEXT_PACKAGE="WPE")
134 add_definitions(-DDATA_DIR="${CMAKE_INSTALL_DATADIR}")
135
136 set(USE_UDIS86 1)
137
138 SET_AND_EXPOSE_TO_BUILD(USE_LIBEPOXY TRUE)
139 SET_AND_EXPOSE_TO_BUILD(USE_OPENGL_ES_2 TRUE)
140 SET_AND_EXPOSE_TO_BUILD(USE_EGL TRUE)
141
142 SET_AND_EXPOSE_TO_BUILD(ENABLE_GRAPHICS_CONTEXT_3D TRUE)
143
144 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER TRUE)
145 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER_GL TRUE)
146 SET_AND_EXPOSE_TO_BUILD(USE_TILED_BACKING_STORE TRUE)
147 SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS TRUE)
148 SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS_THREADED TRUE)
149
150 set(FORWARDING_HEADERS_DIR ${DERIVED_SOURCES_DIR}/ForwardingHeaders)
151 set(FORWARDING_HEADERS_WPE_DIR ${FORWARDING_HEADERS_DIR}/wpe)
152 set(FORWARDING_HEADERS_WPE_EXTENSION_DIR ${FORWARDING_HEADERS_DIR}/wpe-webextension)
153 set(DERIVED_SOURCES_WPE_API_DIR ${DERIVED_SOURCES_WEBKIT2_DIR}/wpe)
154
155 # Build with -fvisibility=hidden to reduce the size of the shared library.
156 # Not to be used when building the WebKitTestRunner library.
157 if (NOT DEVELOPER_MODE)
158     set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fvisibility=hidden")
159     set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fvisibility=hidden -fvisibility-inlines-hidden")
160 endif ()