[WPE] Add libepoxy to the Jhbuild moduleset
[WebKit-https.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_API_TESTS ${DEVELOPER_MODE})
54
55 set(JavaScriptCore_LIBRARY_TYPE STATIC)
56 set(WebCore_LIBRARY_TYPE STATIC)
57 set(WebKit2_OUTPUT_NAME WPEWebKit)
58 set(WebKit2_WebProcess_OUTPUT_NAME WPEWebProcess)
59 set(WebKit2_NetworkProcess_OUTPUT_NAME WPENetworkProcess)
60 set(WebKit2_DatabaseProcess_OUTPUT_NAME WPEDatabaseProcess)
61
62 find_package(ICU REQUIRED)
63 find_package(Threads REQUIRED)
64 find_package(ZLIB REQUIRED)
65 find_package(GLIB 2.40.0 REQUIRED COMPONENTS gio gio-unix gobject gthread gmodule)
66 find_package(GnuTLS 3.0.0 REQUIRED)
67
68 find_package(Cairo 1.10.2 REQUIRED)
69 find_package(Fontconfig 2.8.0 REQUIRED)
70 find_package(Freetype2 2.4.2 REQUIRED)
71 find_package(HarfBuzz 0.9.18 REQUIRED)
72 find_package(JPEG REQUIRED)
73 find_package(LibEpoxy 1.4.0 REQUIRED)
74 find_package(LibGcrypt 1.6.0 REQUIRED)
75 find_package(LibSoup 2.42.0 REQUIRED)
76 find_package(LibXml2 2.8.0 REQUIRED)
77 find_package(LibXslt 1.1.7 REQUIRED)
78 find_package(PNG REQUIRED)
79 find_package(Sqlite REQUIRED)
80 find_package(WebP REQUIRED)
81
82 find_package(WPEBackend REQUIRED)
83
84 set(USE_CAIRO ON)
85 set(USE_XDGMIME ON)
86 SET_AND_EXPOSE_TO_BUILD(USE_GCRYPT TRUE)
87
88 if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
89     set(GSTREAMER_COMPONENTS app audio pbutils)
90     SET_AND_EXPOSE_TO_BUILD(USE_GSTREAMER TRUE)
91     if (ENABLE_VIDEO)
92         list(APPEND GSTREAMER_COMPONENTS video tag)
93     endif ()
94
95     if (ENABLE_WEB_AUDIO)
96         list(APPEND GSTREAMER_COMPONENTS fft)
97         SET_AND_EXPOSE_TO_BUILD(USE_WEBAUDIO_GSTREAMER TRUE)
98     endif ()
99
100     find_package(GStreamer 1.2.3 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS})
101
102     # FIXME: What about MPEGTS support? USE_GSTREAMER_MPEGTS?
103 endif ()
104
105 if (ENABLE_MEDIA_STREAM OR ENABLE_WEB_RTC)
106     find_package(OpenWebRTC)
107     if (NOT OPENWEBRTC_FOUND)
108         message(FATAL_ERROR "OpenWebRTC is needed for ENABLE_MEDIA_STREAM and ENABLE_WEB_RTC.")
109     endif ()
110     SET_AND_EXPOSE_TO_BUILD(USE_OPENWEBRTC TRUE)
111 endif ()
112
113 if (ENABLE_ACCELERATED_2D_CANVAS)
114     find_package(CairoGL 1.10.2 REQUIRED COMPONENTS cairo-egl)
115 endif ()
116
117 if (ENABLE_SUBTLE_CRYPTO)
118     find_package(Libtasn1 REQUIRED)
119     if (NOT LIBTASN1_FOUND)
120         message(FATAL_ERROR "libtasn1 is required to enable Web Crypto API support.")
121     endif ()
122     if (LIBGCRYPT_VERSION VERSION_LESS 1.7.0)
123         message(FATAL_ERROR "libgcrypt 1.7.0 is required to enable Web Crypto API support.")
124     endif ()
125 endif ()
126
127 add_definitions(-DBUILDING_WPE__=1)
128 add_definitions(-DGETTEXT_PACKAGE="WPE")
129 add_definitions(-DDATA_DIR="${CMAKE_INSTALL_DATADIR}")
130
131 set(USE_UDIS86 1)
132
133 SET_AND_EXPOSE_TO_BUILD(USE_LIBEPOXY TRUE)
134 SET_AND_EXPOSE_TO_BUILD(USE_OPENGL_ES_2 TRUE)
135 SET_AND_EXPOSE_TO_BUILD(USE_EGL TRUE)
136
137 SET_AND_EXPOSE_TO_BUILD(ENABLE_GRAPHICS_CONTEXT_3D TRUE)
138
139 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER TRUE)
140 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER_GL TRUE)
141 SET_AND_EXPOSE_TO_BUILD(USE_TILED_BACKING_STORE TRUE)
142 SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS TRUE)
143 SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS_THREADED TRUE)
144
145 set(FORWARDING_HEADERS_DIR ${DERIVED_SOURCES_DIR}/ForwardingHeaders)
146 set(FORWARDING_HEADERS_WPE_DIR ${FORWARDING_HEADERS_DIR}/wpe)
147 set(FORWARDING_HEADERS_WPE_EXTENSION_DIR ${FORWARDING_HEADERS_DIR}/wpe-webextension)
148 set(DERIVED_SOURCES_WPE_API_DIR ${DERIVED_SOURCES_WEBKIT2_DIR}/wpe)
149
150 # Build with -fvisibility=hidden to reduce the size of the shared library.
151 # Not to be used when building the WebKitTestRunner library.
152 if (NOT DEVELOPER_MODE)
153     set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fvisibility=hidden")
154     set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fvisibility=hidden -fvisibility-inlines-hidden")
155 endif ()