Unreviewed, rolling out r221006.
[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 20170728)
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 OFF)
17 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_SELECTORS_LEVEL4 PUBLIC ON)
18 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DEVICE_ORIENTATION PUBLIC OFF)
19 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ENCRYPTED_MEDIA PUBLIC OFF)
20 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GAMEPAD PUBLIC OFF)
21 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GEOLOCATION PUBLIC OFF)
22 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INDEXED_DATABASE PRIVATE ON)
23 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INDEXED_DATABASE_IN_WORKERS PRIVATE OFF)
24 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_CONTROLS_SCRIPT PUBLIC ON)
25 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_SOURCE PUBLIC OFF)
26 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML PRIVATE ON)
27 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETSCAPE_PLUGIN_API PRIVATE OFF)
28 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PUBLIC_SUFFIX_LIST PRIVATE ON)
29 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REMOTE_INSPECTOR PRIVATE ON)
30 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SUBTLE_CRYPTO PUBLIC 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_WEB_ANIMATIONS PRIVATE ON)
36 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_AUDIO PUBLIC ON)
37 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL PUBLIC ON)
38
39 if (CMAKE_SYSTEM_NAME MATCHES "Linux")
40     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE ON)
41 else ()
42     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE OFF)
43 endif ()
44
45 WEBKIT_OPTION_DEFINE(USE_GSTREAMER_GL "Whether to enable support for GStreamer GL" PRIVATE OFF)
46
47 WEBKIT_OPTION_END()
48
49 SET_AND_EXPOSE_TO_BUILD(ENABLE_DEVELOPER_MODE ${DEVELOPER_MODE})
50
51 set(ENABLE_API_TESTS ${DEVELOPER_MODE})
52
53 set(JavaScriptCore_LIBRARY_TYPE STATIC)
54 set(WebCore_LIBRARY_TYPE STATIC)
55 set(WebKit2_OUTPUT_NAME WPEWebKit)
56 set(WebKit2_WebProcess_OUTPUT_NAME WPEWebProcess)
57 set(WebKit2_NetworkProcess_OUTPUT_NAME WPENetworkProcess)
58 set(WebKit2_StorageProcess_OUTPUT_NAME WPEStorageProcess)
59
60 find_package(ICU REQUIRED)
61 find_package(Threads REQUIRED)
62 find_package(ZLIB REQUIRED)
63 find_package(GLIB 2.40.0 REQUIRED COMPONENTS gio gio-unix gobject gthread gmodule)
64 find_package(GnuTLS 3.0.0 REQUIRED)
65
66 find_package(Cairo 1.10.2 REQUIRED)
67 find_package(Fontconfig 2.8.0 REQUIRED)
68 find_package(Freetype2 2.4.2 REQUIRED)
69 find_package(HarfBuzz 0.9.18 REQUIRED)
70 find_package(JPEG REQUIRED)
71 find_package(LibEpoxy 1.4.0 REQUIRED)
72 find_package(LibGcrypt 1.6.0 REQUIRED)
73 find_package(LibSoup 2.42.0 REQUIRED)
74 find_package(LibXml2 2.8.0 REQUIRED)
75 find_package(LibXslt 1.1.7 REQUIRED)
76 find_package(PNG REQUIRED)
77 find_package(Sqlite REQUIRED)
78 find_package(WebP REQUIRED)
79
80 find_package(WPEBackend REQUIRED)
81
82 set(USE_CAIRO ON)
83 set(USE_XDGMIME ON)
84 SET_AND_EXPOSE_TO_BUILD(USE_GCRYPT TRUE)
85
86 if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
87     set(GSTREAMER_COMPONENTS app audio pbutils)
88     SET_AND_EXPOSE_TO_BUILD(USE_GSTREAMER TRUE)
89     if (ENABLE_VIDEO)
90         list(APPEND GSTREAMER_COMPONENTS video tag)
91     endif ()
92
93     if (ENABLE_WEB_AUDIO)
94         list(APPEND GSTREAMER_COMPONENTS fft)
95         SET_AND_EXPOSE_TO_BUILD(USE_WEBAUDIO_GSTREAMER TRUE)
96     endif ()
97
98     find_package(GStreamer 1.2.3 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS})
99
100     # FIXME: What about MPEGTS support? USE_GSTREAMER_MPEGTS?
101 endif ()
102
103 if (ENABLE_MEDIA_STREAM OR ENABLE_WEB_RTC)
104     find_package(OpenWebRTC)
105     if (NOT OPENWEBRTC_FOUND)
106         message(FATAL_ERROR "OpenWebRTC is needed for ENABLE_MEDIA_STREAM and ENABLE_WEB_RTC.")
107     endif ()
108     SET_AND_EXPOSE_TO_BUILD(USE_OPENWEBRTC TRUE)
109 endif ()
110
111 if (ENABLE_ACCELERATED_2D_CANVAS)
112     find_package(CairoGL 1.10.2 REQUIRED COMPONENTS cairo-egl)
113 endif ()
114
115 if (ENABLE_SUBTLE_CRYPTO)
116     find_package(Libtasn1 REQUIRED)
117     if (NOT LIBTASN1_FOUND)
118         message(FATAL_ERROR "libtasn1 is required to enable Web Crypto API support.")
119     endif ()
120     if (LIBGCRYPT_VERSION VERSION_LESS 1.7.0)
121         message(FATAL_ERROR "libgcrypt 1.7.0 is required to enable Web Crypto API support.")
122     endif ()
123 endif ()
124
125 add_definitions(-DBUILDING_WPE__=1)
126 add_definitions(-DGETTEXT_PACKAGE="WPE")
127 add_definitions(-DDATA_DIR="${CMAKE_INSTALL_DATADIR}")
128 add_definitions(-DUSER_AGENT_MAJOR_VERSION="601")
129 add_definitions(-DUSER_AGENT_MINOR_VERSION="1")
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 ()