1bbb899e7e7d764bb5e516d8ff0088dfb686959e
[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 include(GStreamerDefinitions)
12
13 # WebKit2 C API
14 WEBKIT_OPTION_DEFINE(EXPORT_DEPRECATED_WEBKIT2_C_API "Whether to export the WebKit2 C API" PRIVATE OFF)
15
16 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_TRANSFORMS PUBLIC ON)
17 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS PUBLIC OFF)
18 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_REGIONS PUBLIC OFF)
19 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_SELECTORS_LEVEL4 PUBLIC ON)
20 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DEVICE_ORIENTATION PUBLIC OFF)
21 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ENCRYPTED_MEDIA PUBLIC OFF)
22 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GAMEPAD PUBLIC OFF)
23 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GEOLOCATION PUBLIC OFF)
24 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INDEXED_DATABASE PRIVATE ON)
25 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INDEXED_DATABASE_IN_WORKERS PRIVATE OFF)
26 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_CONTROLS_SCRIPT PUBLIC ON)
27 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_SOURCE PUBLIC OFF)
28 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML PRIVATE ON)
29 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETSCAPE_PLUGIN_API PRIVATE OFF)
30 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PUBLIC_SUFFIX_LIST PRIVATE ON)
31 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REMOTE_INSPECTOR PRIVATE ON)
32 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SUBTLE_CRYPTO PRIVATE ON)
33 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS PUBLIC ON)
34 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USER_MESSAGE_HANDLERS PRIVATE ON)
35 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_ANIMATIONS PRIVATE ON)
36 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_CRYPTO 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_MEMORY_SAMPLER PRIVATE ON)
41     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE ON)
42 else ()
43     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEMORY_SAMPLER PRIVATE OFF)
44     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE OFF)
45 endif ()
46
47 include(GStreamerDependencies)
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
58 find_package(ICU REQUIRED)
59 find_package(Threads REQUIRED)
60 find_package(ZLIB REQUIRED)
61 find_package(GLIB 2.40.0 REQUIRED COMPONENTS gio gio-unix gobject gthread gmodule)
62 find_package(GnuTLS 3.0.0 REQUIRED)
63
64 find_package(Cairo 1.10.2 REQUIRED)
65 find_package(Fontconfig 2.8.0 REQUIRED)
66 find_package(Freetype2 2.4.2 REQUIRED)
67 find_package(HarfBuzz 0.9.18 REQUIRED)
68 find_package(JPEG REQUIRED)
69 find_package(LibEpoxy 1.4.0 REQUIRED)
70 find_package(LibGcrypt 1.6.0 REQUIRED)
71 find_package(LibSoup 2.42.0 REQUIRED)
72 find_package(LibXml2 2.8.0 REQUIRED)
73 find_package(LibXslt 1.1.7 REQUIRED)
74 find_package(PNG REQUIRED)
75 find_package(Sqlite REQUIRED)
76 find_package(WebP REQUIRED)
77
78 find_package(WPEBackend REQUIRED)
79
80 set(USE_CAIRO ON)
81 set(USE_XDGMIME ON)
82 SET_AND_EXPOSE_TO_BUILD(USE_GCRYPT TRUE)
83
84 if (ENABLE_MEDIA_STREAM OR ENABLE_WEB_RTC)
85     find_package(OpenWebRTC)
86     if (NOT OPENWEBRTC_FOUND)
87         message(FATAL_ERROR "OpenWebRTC is needed for ENABLE_MEDIA_STREAM and ENABLE_WEB_RTC.")
88     endif ()
89     SET_AND_EXPOSE_TO_BUILD(USE_OPENWEBRTC TRUE)
90 endif ()
91
92 if (ENABLE_ACCELERATED_2D_CANVAS)
93     find_package(CairoGL 1.10.2 REQUIRED COMPONENTS cairo-egl)
94 endif ()
95
96 if (ENABLE_SUBTLE_CRYPTO)
97     find_package(Libtasn1 REQUIRED)
98     if (NOT LIBTASN1_FOUND)
99         message(FATAL_ERROR "libtasn1 is required to enable Web Crypto API support.")
100     endif ()
101     if (LIBGCRYPT_VERSION VERSION_LESS 1.7.0)
102         message(FATAL_ERROR "libgcrypt 1.7.0 is required to enable Web Crypto API support.")
103     endif ()
104 endif ()
105
106 add_definitions(-DBUILDING_WPE__=1)
107 add_definitions(-DGETTEXT_PACKAGE="WPE")
108 add_definitions(-DDATA_DIR="${CMAKE_INSTALL_DATADIR}")
109 add_definitions(-DUSER_AGENT_MAJOR_VERSION="601")
110 add_definitions(-DUSER_AGENT_MINOR_VERSION="1")
111
112 set(USE_UDIS86 1)
113
114 SET_AND_EXPOSE_TO_BUILD(USE_LIBEPOXY TRUE)
115 SET_AND_EXPOSE_TO_BUILD(USE_OPENGL_ES_2 TRUE)
116 SET_AND_EXPOSE_TO_BUILD(USE_EGL TRUE)
117
118 SET_AND_EXPOSE_TO_BUILD(ENABLE_GRAPHICS_CONTEXT_3D TRUE)
119
120 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER TRUE)
121 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER_GL TRUE)
122 SET_AND_EXPOSE_TO_BUILD(USE_TILED_BACKING_STORE TRUE)
123 SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS TRUE)
124 SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS_THREADED TRUE)
125
126 set(FORWARDING_HEADERS_DIR ${DERIVED_SOURCES_DIR}/ForwardingHeaders)
127 set(FORWARDING_HEADERS_WPE_DIR ${FORWARDING_HEADERS_DIR}/wpe)
128 set(FORWARDING_HEADERS_WPE_EXTENSION_DIR ${FORWARDING_HEADERS_DIR}/wpe-webextension)
129 set(DERIVED_SOURCES_WPE_API_DIR ${DERIVED_SOURCES_WEBKIT_DIR}/wpe)
130
131 # Build with -fvisibility=hidden to reduce the size of the shared library.
132 # Not to be used when building the WebKitTestRunner library.
133 if (NOT DEVELOPER_MODE)
134     set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fvisibility=hidden")
135     set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fvisibility=hidden -fvisibility-inlines-hidden")
136 endif ()
137
138 include(GStreamerChecks)