[CMake] Autogenerate cmakeconfig.h.cmake
[WebKit-https.git] / Source / cmake / OptionsEfl.cmake
1 set(PROJECT_VERSION_MAJOR 1)
2 set(PROJECT_VERSION_MINOR 11)
3 set(PROJECT_VERSION_MICRO 0)
4 set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_MICRO})
5
6 set(ENABLE_WEBKIT OFF)
7 set(ENABLE_WEBKIT2 ON)
8
9 # FIXME: Disable WERROR in clang build because of many warnings.
10 if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
11     set(ADDITIONAL_COMPILER_FLAGS ENABLE_WERROR)
12 endif ()
13
14 set(WTF_USE_SOUP 1)
15 set(WTF_USE_UDIS86 1)
16
17 set(WTF_LIBRARY_TYPE STATIC)
18 set(WTF_OUTPUT_NAME wtf_efl)
19 set(JavaScriptCore_OUTPUT_NAME javascriptcore_efl)
20 set(WebCore_OUTPUT_NAME webcore_efl)
21 set(WebKit2_OUTPUT_NAME ewebkit2)
22
23 set(CPACK_SOURCE_GENERATOR TBZ2)
24 set(GLIB_COMPONENTS gio gobject gthread)
25 set(DATA_INSTALL_DIR "share/${WebKit2_OUTPUT_NAME}-${PROJECT_VERSION_MAJOR}" CACHE PATH "Installation path for theme data")
26 set(HEADER_INSTALL_DIR "include/${WebKit2_OUTPUT_NAME}-${PROJECT_VERSION_MAJOR}" CACHE PATH "Installation path for header files")
27 set(THEME_BINARY_DIR ${CMAKE_BINARY_DIR}/WebCore/platform/efl/DefaultTheme)
28 set(WEB_INSPECTOR_DIR "${DATA_INSTALL_DIR}/inspector")
29 set(WEBINSPECTORUI_DIR "${CMAKE_SOURCE_DIR}/Source/WebInspectorUI")
30
31 # FIXME: Consider to use linker script
32 if (NOT SHARED_CORE AND NOT DEVELOPER_MODE)
33     set(CMAKE_C_FLAGS_RELEASE "-fvisibility=hidden ${CMAKE_C_FLAGS_RELEASE}")
34     set(CMAKE_CXX_FLAGS_RELEASE "-fvisibility=hidden ${CMAKE_CXX_FLAGS_RELEASE}")
35 endif ()
36
37 # Optimize binary size for release builds by removing dead sections on unix/gcc.
38 if (CMAKE_COMPILER_IS_GNUCC AND UNIX AND NOT APPLE)
39     set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffunction-sections -fdata-sections")
40     set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ffunction-sections -fdata-sections -fno-rtti")
41     set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} -Wl,--gc-sections")
42 endif ()
43
44 add_definitions(-DBUILDING_EFL__=1)
45 add_definitions(-DWTF_USE_CROSS_PLATFORM_CONTEXT_MENUS=1)
46 add_definitions(-DDATA_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}"
47                 -DDEFAULT_THEME_DIR="${THEME_BINARY_DIR}")
48 add_definitions(-DWEB_INSPECTOR_DIR=\"${CMAKE_BINARY_DIR}/${WEB_INSPECTOR_DIR}\")
49 add_definitions(-DWEB_INSPECTOR_INSTALL_DIR=\"${CMAKE_INSTALL_PREFIX}/${WEB_INSPECTOR_DIR}\")
50
51 # EWebKit2 tests need a hint to find out where processes such as WebProcess are located at.
52 add_definitions(-DWEBKIT_EXEC_PATH=\"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}\")
53
54 file(MAKE_DIRECTORY ${THEME_BINARY_DIR})
55
56 WEBKIT_OPTION_BEGIN()
57
58 if (DEVELOPER_MODE)
59     set(ENABLE_TOOLS ON)
60     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PUBLIC ON)
61     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MINIBROWSER PUBLIC ON)
62 else ()
63     set(ENABLE_TOOLS OFF)
64     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PUBLIC OFF)
65     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MINIBROWSER PUBLIC OFF)
66     set(WEBKIT2_VERSION_SCRIPT "-Wl,--version-script,${CMAKE_MODULE_PATH}/eflsymbols.filter")
67 endif ()
68
69 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_TRANSFORMS PUBLIC ON)
70 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCESSIBILITY PUBLIC ON)
71 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ATTACHMENT_ELEMENT PUBLIC OFF)
72 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BATTERY_STATUS PUBLIC ON)
73 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS3_TEXT PUBLIC ON)
74 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_DEVICE_ADAPTATION PUBLIC ON)
75 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_GRID_LAYOUT PUBLIC OFF)
76 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_IMAGE_SET PUBLIC ON)
77 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_REGIONS PUBLIC ON)
78 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_SCROLL_SNAP PUBLIC OFF)
79 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_SELECTORS_LEVEL4 PUBLIC ON)
80 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CUSTOM_SCHEME_HANDLER PUBLIC ON)
81 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DATALIST_ELEMENT PUBLIC ON)
82 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DOM4_EVENTS_CONSTRUCTOR PUBLIC ON)
83 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DOWNLOAD_ATTRIBUTE PUBLIC ON)
84 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DRAG_SUPPORT PUBLIC ON)
85 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ENCRYPTED_MEDIA PUBLIC OFF)
86 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ENCRYPTED_MEDIA_V2 PUBLIC ON)
87 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FILTERS_LEVEL_2 PUBLIC OFF)
88 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FULLSCREEN_API PUBLIC ON)
89 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GAMEPAD PUBLIC OFF)
90 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GAMEPAD_DEPRECATED PUBLIC ON)
91 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GEOLOCATION PUBLIC ON)
92 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INDEXED_DATABASE_IN_WORKERS PUBLIC OFF)
93 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INDEXED_DATABASE PUBLIC OFF)
94 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_COLOR PUBLIC ON)
95 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LINK_PREFETCH PUBLIC ON)
96 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_CAPTURE PUBLIC ON)
97 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_CONTROLS_SCRIPT PUBLIC ON)
98 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_SOURCE PUBLIC ON)
99 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEMORY_SAMPLER PUBLIC ON)
100 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML PUBLIC PUBLIC ON)
101 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MOUSE_CURSOR_SCALE PUBLIC ON)
102 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NAVIGATOR_CONTENT_UTILS PUBLIC ON)
103 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NAVIGATOR_HWCONCURRENCY PUBLIC ON)
104 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETSCAPE_PLUGIN_API PUBLIC ON)
105 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETWORK_PROCESS PUBLIC ON)
106 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NOSNIFF PUBLIC PUBLIC ON)
107 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PICTURE_SIZES PUBLIC ON)
108 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOLUTION_MEDIA_QUERY PUBLIC ON)
109 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REQUEST_ANIMATION_FRAME PUBLIC ON)
110 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SECCOMP_FILTERS PUBLIC OFF)
111 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SPEECH_SYNTHESIS PUBLIC ON)
112 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SPELLCHECK PUBLIC ON)
113 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SUBTLE_CRYPTO PUBLIC OFF)
114 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TEMPLATE_ELEMENT PUBLIC ON)
115 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS PUBLIC ON)
116 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_SLIDER PUBLIC ON)
117 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USERSELECT_ALL PUBLIC ON)
118 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIBRATION PUBLIC ON)
119 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO PUBLIC ON)
120 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO_TRACK PUBLIC ON)
121 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIEW_MODE_CSS_MEDIA PUBLIC ON)
122 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_AUDIO PUBLIC ON)
123 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_TIMING PUBLIC ON)
124 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL PUBLIC ON)
125 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XHR_TIMEOUT PUBLIC ON)
126
127 WEBKIT_OPTION_END()
128
129 # Begin to find necessary packages for EFL port.
130 find_package(Cairo 1.10.2 REQUIRED)
131 find_package(Fontconfig 2.8.0 REQUIRED)
132 find_package(LibXml2 2.8.0 REQUIRED)
133 find_package(LibXslt 1.1.7 REQUIRED)
134 find_package(ICU REQUIRED)
135 find_package(JPEG REQUIRED)
136 find_package(PNG REQUIRED)
137 find_package(Sqlite REQUIRED)
138 find_package(Threads REQUIRED)
139 find_package(WebP REQUIRED)
140 find_package(ZLIB REQUIRED)
141
142 option(ENABLE_ECORE_X "Enable Ecore_X specific usage (cursor, bell)" ON)
143 if (ENABLE_ECORE_X)
144     # We need Xext.h to disable Xlib error messages  when running WTR on Xvfb.
145     # These errors are dumped on stderr and makes the test driver thinks that
146     # the test case has failed.
147     find_package(X11 REQUIRED)
148
149     list(APPEND ECORE_ADDITIONAL_COMPONENTS X)
150     add_definitions(-DHAVE_ECORE_X)
151     add_definitions(-DWTF_PLATFORM_X11=1)
152     add_definitions(-DMOZ_X11)
153 endif ()
154
155 if (ENABLE_ACCESSIBILITY)
156     find_package(ATK 2.10.0 REQUIRED)
157     set(EFL_REQUIRED_VERSION 1.9)
158 else ()
159     add_definitions(-DHAVE_ACCESSIBILITY=0)
160     set(EFL_REQUIRED_VERSION 1.8)
161 endif ()
162
163 find_package(Ecore ${EFL_REQUIRED_VERSION} COMPONENTS Evas File Input Imf Imf_Evas ${ECORE_ADDITIONAL_COMPONENTS} CONFIG)
164 find_package(Edje ${EFL_REQUIRED_VERSION} REQUIRED CONFIG)
165 find_package(Eet ${EFL_REQUIRED_VERSION} REQUIRED CONFIG)
166 find_package(Eeze ${EFL_REQUIRED_VERSION} REQUIRED CONFIG)
167 find_package(Efreet ${EFL_REQUIRED_VERSION} REQUIRED CONFIG)
168 find_package(Eina ${EFL_REQUIRED_VERSION} REQUIRED CONFIG)
169 find_package(Eo ${EFL_REQUIRED_VERSION} REQUIRED CONFIG)
170 find_package(Evas ${EFL_REQUIRED_VERSION} REQUIRED CONFIG)
171
172 find_package(Freetype2 2.4.2 REQUIRED)
173 find_package(GLIB 2.38.0 REQUIRED COMPONENTS ${GLIB_COMPONENTS})
174 find_package(HarfBuzz 0.9.2 REQUIRED)
175 find_package(LibSoup 2.42.0 REQUIRED)
176
177 if (ENABLE_BATTERY_STATUS)
178     find_package(Eldbus ${EFL_REQUIRED_VERSION} CONFIG)
179 endif ()
180
181 if (ENABLE_GEOLOCATION)
182     list(APPEND GLIB_COMPONENTS gio-unix)
183     find_package(GeoClue2 2.1.5)
184     if (GEOCLUE2_FOUND)
185       set(WTF_USE_GEOCLUE2 1)
186     else ()
187       find_package(GeoClue)
188       set(WTF_USE_GEOCLUE2 0)
189     endif ()
190 endif ()
191
192 if (ENABLE_MEDIA_STREAM)
193     find_package(OpenWebRTC)
194     if (OPENWEBRTC_FOUND)
195         add_definitions(-DWTF_USE_OPENWEBRTC)
196     endif ()
197 endif ()
198
199 if (ENABLE_NETSCAPE_PLUGIN_API)
200     set(ENABLE_PLUGIN_PROCESS 1)
201 endif ()
202
203 if (WTF_OS_UNIX)
204     set(ENABLE_X11_TARGET ON)
205     add_definitions(-DXP_UNIX)
206 endif (WTF_OS_UNIX)
207
208 if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
209     set(GSTREAMER_COMPONENTS app mpegts pbutils)
210     set(WTF_USE_GSTREAMER 1)
211     add_definitions(-DWTF_USE_GSTREAMER=1)
212
213     if (ENABLE_VIDEO)
214         list(APPEND GSTREAMER_COMPONENTS video tag)
215     endif ()
216
217     if (ENABLE_WEB_AUDIO)
218         list(APPEND GSTREAMER_COMPONENTS audio fft)
219         add_definitions(-DWTF_USE_WEBAUDIO_GSTREAMER=1)
220     endif ()
221
222     find_package(GStreamer 1.0.5 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS})
223
224     if (PC_GSTREAMER_MPEGTS_FOUND)
225         add_definitions(-DWTF_USE_GSTREAMER_MPEGTS)
226         set(USE_GSTREAMER_MPEGTS TRUE)
227     endif ()
228 endif ()
229
230 add_definitions(-DWTF_USE_COORDINATED_GRAPHICS=1)
231 add_definitions(-DWTF_USE_COORDINATED_GRAPHICS_MULTIPROCESS=1)
232 add_definitions(-DWTF_USE_TEXTURE_MAPPER=1)
233 add_definitions(-DWTF_USE_TILED_BACKING_STORE=1)
234
235 set(WTF_USE_3D_GRAPHICS 1)
236 add_definitions(-DWTF_USE_3D_GRAPHICS=1)
237 add_definitions(-DWTF_USE_GRAPHICS_SURFACE=1)
238
239 option(ENABLE_GLES2 "Enable GLES Support")
240 if (ENABLE_GLES2)
241     find_package(GLES REQUIRED)
242     set(WTF_USE_OPENGL_ES_2 1)
243     add_definitions(-DWTF_USE_OPENGL_ES_2=1)
244 else ()
245     find_package(OpenGL REQUIRED)
246     set(WTF_USE_OPENGL 1)
247     add_definitions(-DWTF_USE_OPENGL=1)
248 endif ()
249
250 option(ENABLE_EGL "Enable EGL Support")
251 if (ENABLE_EGL)
252     find_package(EGL REQUIRED)
253     set(WTF_USE_EGL 1)
254     add_definitions(-DWTF_USE_EGL=1)
255 else ()
256     CHECK_INCLUDE_FILES("GL/glx.h" OPENGLX_FOUND)
257     add_definitions(-DWTF_USE_GLX=1)
258 endif ()
259
260 if (ENABLE_WEBGL AND OPENGLX_FOUND)
261     if (NOT X11_Xcomposite_FOUND OR NOT X11_Xrender_FOUND)
262         # FIXME: Add support for NOT X11_Xcomposite for GLX
263         message(FATAL_ERROR "To use WebGL with GLX support requires X11_Xcomposite.")
264     endif ()
265 endif ()
266
267 if (ENABLE_SECCOMP_FILTERS)
268     find_package(LibSeccomp REQUIRED)
269 endif ()
270
271 if (ENABLE_SPELLCHECK)
272     find_package(Enchant REQUIRED)
273 endif ()
274
275 if (ENABLE_SPEECH_SYNTHESIS)
276     find_package(Espeak REQUIRED)
277     add_definitions(-DENABLE_SPEECH_SYNTHESIS=1)
278 endif ()
279
280 if (ENABLE_FTL_JIT)
281     if (WTF_CPU_X86_64)
282         find_package(LLVM 3.6.0 REQUIRED)
283     elseif (WTF_CPU_ARM64)
284         find_package(LLVM REQUIRED)
285         if (NOT "${LLVM_VERSION}" STREQUAL "3.5.0ftl")
286             message(FATAL_ERROR "FTL JIT is only available on AArch64 architecture with patched LLVM 3.5.0, use Tools/Scripts/update-webkitefl-libs llvm-3.5-for-AArch64 to build it.")
287         endif ()
288     else ()
289         message(FATAL_ERROR "FTL JIT is only available on X86_64 and AArch64 architectures.")
290     endif ()
291     SET_AND_EXPOSE_TO_BUILD(HAVE_LLVM TRUE)
292     if (ENABLE_FTL_NATIVE_CALL_INLINING)
293         find_package(Clang REQUIRED)
294     endif ()
295 endif ()
296
297 if (ENABLE_SUBTLE_CRYPTO)
298     find_package(GnuTLS 3.0.0 REQUIRED)
299 endif ()