03bb1d626a3c813d4dcadfc992f6da3829635691
[WebKit-https.git] / Source / cmake / OptionsBlackBerry.cmake
1 SET(PROJECT_VERSION_MAJOR 0)
2 SET(PROJECT_VERSION_MINOR 1)
3 SET(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
4
5 SET(DATA_DIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}-${PROJECT_VERSION})
6
7 ADD_DEFINITIONS(-DDATA_DIR="${DATA_DIR}")
8
9 ADD_DEFINITIONS(-DBUILDING_BLACKBERRY__)
10 ADD_DEFINITIONS(-DBUILD_WEBKIT)
11
12 # Workaround for now so that SK_DEBUG isn't defined in SkPreConfig.h
13 ADD_DEFINITIONS(-DSK_RELEASE)
14
15 # TODO: Make this build-time configurable
16 SET(WTF_USE_PTHREADS 1)
17 ADD_DEFINITIONS(-DWTF_USE_PTHREADS=1)
18
19 IF (TARGETING_PLAYBOOK)
20     SET(WTF_USE_ACCELERATED_COMPOSITING 1)
21     ADD_DEFINITIONS(-DWTF_USE_ACCELERATED_COMPOSITING=1)
22     ADD_DEFINITIONS(-DBLACKBERRY_PLATFORM_GRAPHICS_EGL=1)
23     ADD_DEFINITIONS(-DBLACKBERRY_PLATFORM_EXPORT_WEBDOM=1)
24 ENDIF ()
25
26 IF (ADDITIONAL_SYSTEM_INCLUDE_PATH)
27     SET(CMAKE_INCLUDE_SYSTEM_FLAG_C "-Wp,-isystem")
28     SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-Wp,-isystem")
29     FOREACH (directory ${ADDITIONAL_SYSTEM_INCLUDE_PATH})
30         INCLUDE_DIRECTORIES(SYSTEM ${directory})
31     ENDFOREACH ()
32 ENDIF ()
33
34 IF (ENABLE_DRT)
35     message("*** DRT is ENABLED ***")
36 ENDIF ()
37
38 ADD_DEFINITIONS(-D__QNXNTO__)
39 ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
40 ADD_DEFINITIONS(-D_LARGEFILE64_SOURCE)
41
42 # Find a library only in the staging directory (which is the CMAKE_INSTALL_PATH)
43 # TODO: CMAKE_INSTALL_PATH may not be staging directory.
44 MACRO(FIND_STAGING_LIBRARY _var _libname)
45   FIND_LIBRARY(${_var} ${_libname}
46     PATHS "${CMAKE_INSTALL_PREFIX}"
47     ENV "QNX_TARGET"
48     PATH_SUFFIXES "${CMAKE_SYSTEM_PROCESSOR}/usr/lib" "${CMAKE_SYSTEM_PROCESSOR}/usr/lib/torch-webkit" "${CMAKE_SYSTEM_PROCESSOR}/lib"
49     NO_DEFAULT_PATH)
50 ENDMACRO()
51
52 FIND_STAGING_LIBRARY(Skia_LIBRARY grskia)
53 FIND_STAGING_LIBRARY(Skia_QNX_LIBRARY skia-qnx)
54 FIND_STAGING_LIBRARY(JPEG_LIBRARY jpeg)
55 FIND_STAGING_LIBRARY(PNG_LIBRARY png)
56 FIND_STAGING_LIBRARY(XML2_LIBRARY xml2)
57 FIND_STAGING_LIBRARY(XSLT_LIBRARY xslt)
58 FIND_STAGING_LIBRARY(SQLITE3_LIBRARY sqlite3)
59 FIND_STAGING_LIBRARY(M_LIBRARY m)
60 FIND_STAGING_LIBRARY(NBUTIL_LIBRARY nbutil)
61 FIND_STAGING_LIBRARY(FREETYPE_LIBRARY freetype)
62 FIND_STAGING_LIBRARY(ICUData_LIBRARY icudata)
63 FIND_STAGING_LIBRARY(ICUI18N_LIBRARY icui18n)
64 FIND_STAGING_LIBRARY(ICUUC_LIBRARY icuuc)
65 FIND_STAGING_LIBRARY(Iconv_LIBRARY iconv)
66 FIND_STAGING_LIBRARY(INTL_LIBRARY intl)
67 FIND_STAGING_LIBRARY(Z_LIBRARY z)
68 FIND_STAGING_LIBRARY(Socket_LIBRARY socket)
69 FIND_STAGING_LIBRARY(CURL_LIBRARY curl)
70 FIND_STAGING_LIBRARY(SSL_LIBRARY ssl)
71 FIND_STAGING_LIBRARY(Crypto_LIBRARY crypto)
72 FIND_STAGING_LIBRARY(WebKitPlatform_LIBRARY webkitplatform)
73 FIND_STAGING_LIBRARY(UUID_LIBRARY uuid-browser)
74 FIND_STAGING_LIBRARY(Screen_LIBRARY screen)
75 FIND_STAGING_LIBRARY(MMR_LIBRARY mmrndclient)
76 FIND_STAGING_LIBRARY(PPSCache_LIBRARY ppscache)
77 FIND_STAGING_LIBRARY(MD_LIBRARY md)
78 FIND_STAGING_LIBRARY(AOI_LIBRARY aoi)
79 FIND_STAGING_LIBRARY(CLIPBOARD_LIBRARY clipboard)
80 FIND_STAGING_LIBRARY(EGL_LIBRARY EGL)
81 FIND_STAGING_LIBRARY(GLESv2_LIBRARY GLESv2)
82 FIND_STAGING_LIBRARY(STRM_LIBRARY strm)
83 FIND_STAGING_LIBRARY(HARFBUZZ_LIBRARY harfbuzz)
84 FIND_STAGING_LIBRARY(FONTCONFIG_LIBRARY fontconfig)
85 FIND_STAGING_LIBRARY(PROFILING_LIBRARY profilingS)
86 FIND_STAGING_LIBRARY(LIB_INPUT_UTILITIES input_utilities)
87
88 # Show unresolved symbols when doing the final shared object link
89 IF (PROFILING)
90     SET(BLACKBERRY_LINK_FLAGS "-Wl,-z,defs -Wl,-zrelro -Wl,-E")
91 ELSE (PROFILING)
92     SET(BLACKBERRY_LINK_FLAGS "-Wl,-z,defs -Wl,-zrelro")
93 ENDIF ()
94
95 # Set custom CFLAGS for our port
96 IF (CMAKE_COMPILER_IS_GNUCC)
97     SET(CMAKE_CXX_FLAGS "-fstack-protector -fno-rtti -Wformat -Wformat-security -Werror=format-security ${CMAKE_CXX_FLAGS}")
98     SET(CMAKE_C_FLAGS "-fstack-protector -fno-rtti -Wformat -Wformat-security -Werror=format-security ${CMAKE_C_FLAGS}")
99     SET(JSC_LINK_FLAGS "-N1024K")
100 ENDIF ()
101
102 IF (PROFILING)
103     SET(CMAKE_CXX_FLAGS "-finstrument-functions -g ${CMAKE_CXX_FLAGS}")
104     SET(CMAKE_C_FLAGS "-finstrument-functions -g ${CMAKE_C_FLAGS}")
105 ENDIF ()
106
107 # FIXME: Make this more elegant
108 IF (TARGETING_PLAYBOOK)
109     SET(CMAKE_CXX_FLAGS "-mfpu=vfpv3 -mthumb -mthumb-interwork ${CMAKE_CXX_FLAGS}")
110     SET(CMAKE_C_FLAGS "-mfpu=vfpv3 -mthumb -mthumb-interwork ${CMAKE_C_FLAGS}")
111 ENDIF ()
112
113 ADD_DEFINITIONS(-DRESOURCE_PATH="/usr/share/webkit-owb/resources/")
114 INCLUDE_DIRECTORIES(${CMAKE_INCLUDE_PATH})
115
116 SET(JSC_EXECUTABLE_NAME jsc)
117
118 SET(WTF_LIBRARY_NAME wtf)
119 SET(JavaScriptCore_LIBRARY_NAME javascriptcore)
120 SET(WebCore_LIBRARY_NAME webcore)
121 SET(WebKit_LIBRARY_NAME webkit)
122 SET(WebKit_DRT_LIBRARY_NAME webkit_DRT)
123
124 IF (TARGETING_PLAYBOOK)
125     WEBKIT_FEATURE(ENABLE_3D_RENDERING "Enable 3D Rendering" DEFAULT ON)
126     WEBKIT_FEATURE(ENABLE_WEBGL "Enable WebGL" DEFAULT ON)
127 ELSE ()
128     WEBKIT_FEATURE(ENABLE_3D_RENDERING "Enable 3D Rendering" DEFAULT OFF)
129     WEBKIT_FEATURE(ENABLE_WEBGL "Enable WebGL" DEFAULT OFF)
130 ENDIF ()
131
132 WEBKIT_FEATURE(ENABLE_ASSEMBLER_WX_EXCLUSIVE "Assembler WX Exclusive" DEFAULT ON)
133 WEBKIT_FEATURE(ENABLE_BLACKBERRY_CARET_APPEARANCE "Blackberry Caret Appearance" DEFAULT OFF)
134 WEBKIT_FEATURE(ENABLE_BLOB "Enable blob slice" DEFAULT OFF)
135 WEBKIT_FEATURE(ENABLE_CHANNEL_MESSAGING "Enable channel messaging" DEFAULT ON)
136 WEBKIT_FEATURE(ENABLE_CLIENT_BASED_GEOLOCATION "Client based Geolocation" DEFAULT ON)
137 WEBKIT_FEATURE(ENABLE_DATABASE "Enable database" DEFAULT ON)
138 WEBKIT_FEATURE(ENABLE_DATAGRID "Enable datagrid" DEFAULT OFF)
139 WEBKIT_FEATURE(ENABLE_DATALIST "Enable datalist" DEFAULT ON)
140 WEBKIT_FEATURE(ENABLE_DETAILS "Enable details element" DEFAULT ON)
141 WEBKIT_FEATURE(ENABLE_DEVICE_ORIENTATION "Enable Device Orientation" DEFAULT ON)
142 WEBKIT_FEATURE(ENABLE_DOM_STORAGE "Enable DOM storage" DEFAULT ON)
143 WEBKIT_FEATURE(ENABLE_DRAG_SUPPORT "Enable Drag Support" DEFAULT OFF)
144 WEBKIT_FEATURE(ENABLE_EVENTSOURCE "Enable event source" DEFAULT ON)
145 WEBKIT_FEATURE(ENABLE_EVENT_MODE_METATAGS "Enable meta-tag touch and mouse events" DEFAULT ON)
146 WEBKIT_FEATURE(ENABLE_FAST_MOBILE_SCROLLING "Enable fast mobile scrolling" DEFAULT ON)
147 WEBKIT_FEATURE(ENABLE_FILE_SYSTEM "Enable file system" DEFAULT OFF)
148 WEBKIT_FEATURE(ENABLE_FILTERS "Enable SVG filters" DEFAULT ON)
149 WEBKIT_FEATURE(ENABLE_FIXED_REPORTED_SIZE "Fixed Reported Size" DEFAULT ON)
150 WEBKIT_FEATURE(ENABLE_FTPDIR "Enable FTP directory browsing" DEFAULT ON)
151 WEBKIT_FEATURE(ENABLE_GEOLOCATION "Enable geolocation" DEFAULT ON)
152 WEBKIT_FEATURE(ENABLE_GLIB_SUPPORT "Enable Glib support" DEFAULT OFF)
153 WEBKIT_FEATURE(ENABLE_GROUP_BASED_DATABASE "Enable Group Based Database support" DEFAULT OFF)
154 WEBKIT_FEATURE(ENABLE_ICONDATABASE "Enable icon database" DEFAULT ON)
155 WEBKIT_FEATURE(ENABLE_IMAGE_DECODER_DOWN_SAMPLING "Enable image decoder down sampling" DEFAULT ON)
156 WEBKIT_FEATURE(ENABLE_INDEXED_DATABASE "Enable IndexDB" DEFAULT OFF)
157 WEBKIT_FEATURE(ENABLE_INPUT_COLOR "Enable Color Input" DEFAULT ON)
158 WEBKIT_FEATURE(ENABLE_INSPECTOR "Enable inspector" DEFAULT ON)
159 WEBKIT_FEATURE(ENABLE_JAVASCRIPT_DEBUGGER "Enable JavaScript debugger" DEFAULT ON)
160 WEBKIT_FEATURE(ENABLE_MATHML "Enable MathML" DEFAULT ON)
161 WEBKIT_FEATURE(ENABLE_METER_TAG "Enable Meter Tag" DEFAULT ON)
162 WEBKIT_FEATURE(ENABLE_NETSCAPE_PLUGIN_API "Enable Netscape plugin API" DEFAULT ON)
163 WEBKIT_FEATURE(ENABLE_NOTIFICATIONS "Enable notifications" DEFAULT ON)
164 WEBKIT_FEATURE(ENABLE_OFFLINE_WEB_APPLICATIONS "Enable offline web applications" DEFAULT ON)
165 WEBKIT_FEATURE(ENABLE_BLACKBERRY_OBJECT_ALLOCATOR "Enable BlackBerry object allocator" DEFAULT ON)
166 WEBKIT_FEATURE(ENABLE_ORIENTATION_EVENTS "Enable orientation events" DEFAULT ON)
167 WEBKIT_FEATURE(ENABLE_PROGRESS_TAG "Enable progress tag" DEFAULT ON)
168 WEBKIT_FEATURE(ENABLE_REPAINT_THROTTLING "Enable repaint throttling" DEFAULT ON)
169 WEBKIT_FEATURE(ENABLE_RUBY "Enable Ruby" DEFAULT ON)
170 WEBKIT_FEATURE(ENABLE_SANDBOX "Enable Sandbox" DEFAULT OFF)
171 WEBKIT_FEATURE(ENABLE_SHARED_WORKERS "Enable shared workers" DEFAULT ON)
172 WEBKIT_FEATURE(ENABLE_SVG "Enable SVG" DEFAULT ON)
173 WEBKIT_FEATURE(ENABLE_SVG_ANIMATION "Enable SVG animation" DEFAULT ON)
174 WEBKIT_FEATURE(ENABLE_SVG_AS_IMAGE "Enable SVG as image" DEFAULT ON)
175 WEBKIT_FEATURE(ENABLE_SVG_FONTS "Enable SVG fonts" DEFAULT ON)
176 WEBKIT_FEATURE(ENABLE_SVG_FOREIGN_OBJECT "Enable SVG foreign object" DEFAULT ON)
177 WEBKIT_FEATURE(ENABLE_SVG_USE "Enable SVG use" DEFAULT ON)
178 WEBKIT_FEATURE(ENABLE_TOUCH_EVENTS "Enable touch events " DEFAULT ON)
179 WEBKIT_FEATURE(ENABLE_VIDEO "Enable video" DEFAULT ON)
180 WEBKIT_FEATURE(ENABLE_VIEWPORT_REFLOW "Enable viewport reflow" DEFAULT ON)
181 WEBKIT_FEATURE(ENABLE_WEB_SOCKETS "Enable web sockets" DEFAULT ON)
182 WEBKIT_FEATURE(ENABLE_WML "Enable WML" DEFAULT OFF)
183 WEBKIT_FEATURE(ENABLE_WORKERS "Enable workers" DEFAULT ON)
184 WEBKIT_FEATURE(ENABLE_XHTMLMP "Enable XHTMLMP" DEFAULT OFF)
185 WEBKIT_FEATURE(ENABLE_XPATH "Enable XPath" DEFAULT ON)
186 WEBKIT_FEATURE(ENABLE_XSLT "Enable XSLT" DEFAULT ON)
187 WEBKIT_FEATURE(ENABLE_CSS3_FLEXBOX "Enable CSS3 Flexbox" DEFAULT ON)
188 WEBKIT_FEATURE(ENABLE_PLUGIN_PROXY_FOR_VIDEO "Plugin Proxy for Video" DEFAULT OFF)
189 WEBKIT_FEATURE(ENABLE_ANIMATION_API "Enable animation API" DEFAULT ON)
190
191 IF (ENABLE_DRT)
192     WEBKIT_FEATURE(ENABLE_DRT "Enable DRT" DEFAULT ON)
193 ELSE ()
194     WEBKIT_FEATURE(ENABLE_DRT "Enable DRT" DEFAULT OFF)
195 ENDIF ()
196
197 IF (CMAKE_SYSTEM_PROCESSOR MATCHES x86)
198     WEBKIT_FEATURE(ENABLE_JIT "Enable JIT" DEFAULT OFF)
199     WEBKIT_FEATURE(ENABLE_SKIA_GPU_CANVAS "Enable GPU-backed Skia canvases" DEFAULT OFF)
200 ELSE ()
201     WEBKIT_FEATURE(ENABLE_JIT "Enable JIT" DEFAULT ON)
202     WEBKIT_FEATURE(ENABLE_SKIA_GPU_CANVAS "Enable GPU-backed Skia canvases" DEFAULT ON)
203 ENDIF ()
204
205 # Some of our files, such as platform/graphics/chromium/ComplexTextControllerLinux.cpp, require a
206 # newer ICU version than the version associated with the headers in {WebCore, JavaScriptCore}/icu.
207 # Because of <https://bugs.webkit.org/show_bug.cgi?id=70913> we can't directly reference these newer
208 # ICU headers within the QNX system header directory. As a workaround, we copy these newer ICU headers
209 # from the QNX system header directory to a third-party directory under the CMake binary tree.
210 #
211 # FIXME: Make this mechanism more general purpose. Maybe accept a list or directories/files to copy
212 # instead of individual variables. Generalizing this solution may allow us to fix <https://bugs.webkit.org/show_bug.cgi?id=70913>.
213 SET(BLACKBERRY_THIRD_PARTY_DIR "${CMAKE_BINARY_DIR}/ThirdPartyBlackBerry")
214 FILE(COPY ${THIRD_PARTY_ICU_DIR} DESTINATION "${BLACKBERRY_THIRD_PARTY_DIR}/icu")
215 FILE(COPY ${THIRD_PARTY_UNICODE_FILE} DESTINATION ${BLACKBERRY_THIRD_PARTY_DIR})