[CMake] Add ENABLE_WEB_CRYPTO option and make ENABLE_SUBTLE_CRYPTO depend on it.
[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 set(WebKit2_OUTPUT_NAME WPEWebKit)
58 set(WebKit2_WebProcess_OUTPUT_NAME WPEWebProcess)
59 set(WebKit2_NetworkProcess_OUTPUT_NAME WPENetworkProcess)
60 set(WebKit2_StorageProcess_OUTPUT_NAME WPEStorageProcess)
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_MEDIA_STREAM OR ENABLE_WEB_RTC)
89     find_package(OpenWebRTC)
90     if (NOT OPENWEBRTC_FOUND)
91         message(FATAL_ERROR "OpenWebRTC is needed for ENABLE_MEDIA_STREAM and ENABLE_WEB_RTC.")
92     endif ()
93     SET_AND_EXPOSE_TO_BUILD(USE_OPENWEBRTC TRUE)
94 endif ()
95
96 if (ENABLE_ACCELERATED_2D_CANVAS)
97     find_package(CairoGL 1.10.2 REQUIRED COMPONENTS cairo-egl)
98 endif ()
99
100 if (ENABLE_SUBTLE_CRYPTO)
101     find_package(Libtasn1 REQUIRED)
102     if (NOT LIBTASN1_FOUND)
103         message(FATAL_ERROR "libtasn1 is required to enable Web Crypto API support.")
104     endif ()
105     if (LIBGCRYPT_VERSION VERSION_LESS 1.7.0)
106         message(FATAL_ERROR "libgcrypt 1.7.0 is required to enable Web Crypto API support.")
107     endif ()
108 endif ()
109
110 add_definitions(-DBUILDING_WPE__=1)
111 add_definitions(-DGETTEXT_PACKAGE="WPE")
112 add_definitions(-DDATA_DIR="${CMAKE_INSTALL_DATADIR}")
113 add_definitions(-DUSER_AGENT_MAJOR_VERSION="601")
114 add_definitions(-DUSER_AGENT_MINOR_VERSION="1")
115
116 set(USE_UDIS86 1)
117
118 SET_AND_EXPOSE_TO_BUILD(USE_LIBEPOXY TRUE)
119 SET_AND_EXPOSE_TO_BUILD(USE_OPENGL_ES_2 TRUE)
120 SET_AND_EXPOSE_TO_BUILD(USE_EGL TRUE)
121
122 SET_AND_EXPOSE_TO_BUILD(ENABLE_GRAPHICS_CONTEXT_3D TRUE)
123
124 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER TRUE)
125 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER_GL TRUE)
126 SET_AND_EXPOSE_TO_BUILD(USE_TILED_BACKING_STORE TRUE)
127 SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS TRUE)
128 SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS_THREADED TRUE)
129
130 set(FORWARDING_HEADERS_DIR ${DERIVED_SOURCES_DIR}/ForwardingHeaders)
131 set(FORWARDING_HEADERS_WPE_DIR ${FORWARDING_HEADERS_DIR}/wpe)
132 set(FORWARDING_HEADERS_WPE_EXTENSION_DIR ${FORWARDING_HEADERS_DIR}/wpe-webextension)
133 set(DERIVED_SOURCES_WPE_API_DIR ${DERIVED_SOURCES_WEBKIT_DIR}/wpe)
134
135 # Build with -fvisibility=hidden to reduce the size of the shared library.
136 # Not to be used when building the WebKitTestRunner library.
137 if (NOT DEVELOPER_MODE)
138     set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fvisibility=hidden")
139     set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fvisibility=hidden -fvisibility-inlines-hidden")
140 endif ()
141
142 include(GStreamerChecks)