[BlackBerry] Match th ebuild flags from the platform library
[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(-DWEBCORE_NAVIGATOR_VENDOR="Research In Motion, Ltd.")
10 ADD_DEFINITIONS(-DBUILDING_BLACKBERRY__)
11 ADD_DEFINITIONS(-DBUILD_WEBKIT)
12
13 # Workaround for now so that SK_DEBUG isn't defined in SkPreConfig.h
14 ADD_DEFINITIONS(-DSK_RELEASE)
15
16 # TODO: Make this build-time configurable
17 SET(WTF_USE_PTHREADS 1)
18 ADD_DEFINITIONS(-DWTF_USE_PTHREADS=1)
19 SET(WTF_USE_OPENTYPE_SANITIZER 1)
20 ADD_DEFINITIONS(-DWTF_USE_OPENTYPE_SANITIZER=1)
21
22 IF (ENABLE_GLES2)
23     SET(WTF_USE_ACCELERATED_COMPOSITING 1)
24     ADD_DEFINITIONS(-DWTF_USE_ACCELERATED_COMPOSITING=1)
25     ADD_DEFINITIONS(-DBLACKBERRY_PLATFORM_GRAPHICS_EGL=1)
26     ADD_DEFINITIONS(-DBLACKBERRY_PLATFORM_GRAPHICS_GLES2=1)
27     ADD_DEFINITIONS(-DBLACKBERRY_PLATFORM_GRAPHICS_DRAWING_SURFACE=1)
28     ADD_DEFINITIONS(-DBLACKBERRY_PLATFORM_EXPORT_WEBDOM=1)
29 ENDIF ()
30
31 IF (ADDITIONAL_SYSTEM_INCLUDE_PATH)
32     SET(CMAKE_INCLUDE_SYSTEM_FLAG_C "-Wp,-isystem")
33     SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-Wp,-isystem")
34     FOREACH (directory ${ADDITIONAL_SYSTEM_INCLUDE_PATH})
35         INCLUDE_DIRECTORIES(SYSTEM ${directory})
36     ENDFOREACH ()
37     IF(ENABLE_WEBGL)
38         INCLUDE_DIRECTORIES(SYSTEM ${THIRDPARTY_DIR}/ANGLE/include) #As system so as to be lower-priority than actual system headers
39     ENDIF ()
40 ENDIF ()
41
42 IF (PUBLIC_BUILD)
43     ADD_DEFINITIONS(-DPUBLIC_BUILD=1)
44     message("*** PUBLIC BUILD ***")
45 ELSE (PUBLIC_BUILD)
46     message("*** DRT is ENABLED ***")
47 ENDIF ()
48
49 ADD_DEFINITIONS(-D__QNXNTO__)
50 ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
51 ADD_DEFINITIONS(-D_LARGEFILE64_SOURCE)
52 ADD_DEFINITIONS(-DWTF_USE_LEGACY_VIEWPORT_ADAPTION=1)
53
54 # Find a library only in the staging directory (which is the CMAKE_INSTALL_PATH)
55 # TODO: CMAKE_INSTALL_PATH may not be staging directory.
56 MACRO(FIND_STAGING_LIBRARY _var _libname)
57   FIND_LIBRARY(${_var} ${_libname}
58     PATHS "${CMAKE_INSTALL_PREFIX}"
59     ENV "QNX_TARGET"
60     PATH_SUFFIXES "${CMAKE_SYSTEM_PROCESSOR}/usr/lib" "${CMAKE_SYSTEM_PROCESSOR}/usr/lib/torch-webkit" "${CMAKE_SYSTEM_PROCESSOR}/lib"
61     NO_DEFAULT_PATH)
62 ENDMACRO()
63
64 FIND_STAGING_LIBRARY(Skia_LIBRARY grskia)
65 FIND_STAGING_LIBRARY(Skia_QNX_LIBRARY skia-qnx)
66 FIND_STAGING_LIBRARY(JPEG_LIBRARY jpeg)
67 FIND_STAGING_LIBRARY(PNG_LIBRARY png)
68 FIND_STAGING_LIBRARY(XML2_LIBRARY xml2)
69 FIND_STAGING_LIBRARY(XSLT_LIBRARY xslt)
70 FIND_STAGING_LIBRARY(SQLITE3_LIBRARY sqlite3)
71 FIND_STAGING_LIBRARY(M_LIBRARY m)
72 FIND_STAGING_LIBRARY(FREETYPE_LIBRARY freetype)
73 FIND_STAGING_LIBRARY(ICUData_LIBRARY icudata)
74 FIND_STAGING_LIBRARY(ICUI18N_LIBRARY icui18n)
75 FIND_STAGING_LIBRARY(ICUUC_LIBRARY icuuc)
76 FIND_STAGING_LIBRARY(INTL_LIBRARY intl)
77 FIND_STAGING_LIBRARY(Z_LIBRARY z)
78 FIND_STAGING_LIBRARY(CURL_LIBRARY curl)
79 FIND_STAGING_LIBRARY(WebKitPlatform_LIBRARY webkitplatform)
80 FIND_STAGING_LIBRARY(UUID_LIBRARY uuid-browser)
81 FIND_STAGING_LIBRARY(MMR_LIBRARY mmrndclient)
82 FIND_STAGING_LIBRARY(PPSCache_LIBRARY ppscache)
83 FIND_STAGING_LIBRARY(MD_LIBRARY md)
84 FIND_STAGING_LIBRARY(EGL_LIBRARY EGL)
85 FIND_STAGING_LIBRARY(GLESv2_LIBRARY GLESv2)
86 FIND_STAGING_LIBRARY(HARFBUZZ_LIBRARY harfbuzz)
87 FIND_STAGING_LIBRARY(FONTCONFIG_LIBRARY fontconfig)
88 FIND_STAGING_LIBRARY(PROFILING_LIBRARY profilingS)
89 FIND_STAGING_LIBRARY(LIB_INPUT_UTILITIES input_utilities)
90 FIND_STAGING_LIBRARY(OTS_LIBRARY ots)
91
92 # Add "-fPIC" to CMAKE_SHARED_LIBRARY_C_FLAGS and CMAKE_SHARED_LIBRARY_CXX_FLAGS
93 # This is because "-fPIC" is not included in the default defines under Modules/Platform/QNX.cmake
94 SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC ${CMAKE_SHARED_LIBRARY_C_FLAGS}")
95 SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
96
97 # Show unresolved symbols when doing the final shared object link
98 IF (PROFILING)
99     SET(BLACKBERRY_LINK_FLAGS "-Wl,-z,defs -Wl,-z,relro -Wl,-E")
100 ELSE (PROFILING)
101     SET(BLACKBERRY_LINK_FLAGS "-Wl,-z,defs -Wl,-z,relro")
102 ENDIF ()
103
104 # Set custom CFLAGS for our port
105 IF (CMAKE_COMPILER_IS_GNUCC)
106     SET(CMAKE_CXX_FLAGS "-fstack-protector -fno-rtti -Wformat -Wformat-security -Werror=format-security ${CMAKE_CXX_FLAGS}")
107     SET(CMAKE_C_FLAGS "-fstack-protector -Wformat -Wformat-security -Werror=format-security ${CMAKE_C_FLAGS}")
108     SET(JSC_LINK_FLAGS "-Wl,-z,defs -Wl,-z,relro -N1024K")
109 ENDIF ()
110
111 IF (PROFILING)
112     SET(CMAKE_CXX_FLAGS "-finstrument-functions -g ${CMAKE_CXX_FLAGS}")
113     SET(CMAKE_C_FLAGS "-finstrument-functions -g ${CMAKE_C_FLAGS}")
114 ENDIF ()
115
116 # FIXME: Make this more elegant
117 IF (TARGETING_PLAYBOOK)
118     SET(CMAKE_CXX_FLAGS "-mfpu=vfpv3 -mthumb -mthumb-interwork ${CMAKE_CXX_FLAGS}")
119     SET(CMAKE_C_FLAGS "-mfpu=vfpv3 -mthumb -mthumb-interwork ${CMAKE_C_FLAGS}")
120 ENDIF ()
121
122 ADD_DEFINITIONS(-DRESOURCE_PATH="/usr/share/webkit-owb/resources/")
123 INCLUDE_DIRECTORIES(${CMAKE_INCLUDE_PATH})
124
125 SET(JSC_EXECUTABLE_NAME jsc)
126
127 SET(WTF_LIBRARY_NAME wtf)
128 SET(JavaScriptCore_LIBRARY_NAME javascriptcore)
129 SET(WebCore_LIBRARY_NAME webcore)
130 SET(WebKit_LIBRARY_NAME webkit)
131 SET(WebKit_DRT_LIBRARY_NAME webkit_DRT)
132
133 WEBKIT_OPTION_BEGIN()
134
135 WEBKIT_OPTION_DEFINE(ENABLE_EVENT_MODE_METATAGS "Enable meta-tag touch and mouse events" ON)
136 WEBKIT_OPTION_DEFINE(ENABLE_VIEWPORT_REFLOW "Enable viewport reflow" ON)
137
138 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ANIMATION_API ON)
139 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ASSEMBLER_WX_EXCLUSIVE ON)
140 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BATTERY_STATUS ON)
141 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BLOB ON)
142 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CUSTOM_SCHEME_HANDLER ON)
143 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DEVICE_ORIENTATION ON)
144 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DRAG_SUPPORT OFF)
145 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DOWNLOAD_ATTRIBUTE ON)
146 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FILE_SYSTEM ON)
147 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FILTERS ON)
148 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FULLSCREEN_API ON)
149 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GEOLOCATION ON)
150 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_IMAGE_DECODER_DOWN_SAMPLING ON)
151 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_COLOR ON)
152 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_NOTIFICATIONS ON)
153 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_WEBKIT_BLOB_BUILDER ON)
154 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_STREAM ON)
155 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MICRODATA ON)
156 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NAVIGATOR_CONTENT_UTILS ON)
157 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NOTIFICATIONS ON)
158 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ORIENTATION_EVENTS ON)
159 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PAGE_POPUP ON)
160 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_PAGE_VISIBILITY_API ON)
161 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REPAINT_THROTTLING ON)
162 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REQUEST_ANIMATION_FRAME ON)
163 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SHARED_WORKERS ON)
164 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SMOOTH_SCROLLING ON)
165 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_STYLE_SCOPED ON)
166 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS ON)
167 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIBRATION ON)
168 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO ON)
169 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_TIMING ON)
170 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WORKERS ON)
171 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XHR_RESPONSE_BLOB ON)
172
173 IF (ENABLE_GLES2)
174     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_RENDERING ON)
175     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS ON)
176     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_FILTERS ON)
177     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_SHADERS ON)
178     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL ON)
179 ELSE ()
180     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_RENDERING OFF)
181     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS OFF)
182     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_FILTERS OFF)
183     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_SHADERS OFF)
184     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL OFF)
185 ENDIF ()
186
187 IF (CMAKE_SYSTEM_PROCESSOR MATCHES x86)
188     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_JIT OFF)
189 ELSE ()
190     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_JIT ON)
191 ENDIF ()
192
193 WEBKIT_OPTION_END()
194
195 ADD_DEFINITIONS(-DENABLE_BLACKBERRY_CREDENTIAL_PERSIST=1)
196
197 # Some of our files, such as platform/graphics/chromium/ComplexTextControllerLinux.cpp, require a
198 # newer ICU version than the version associated with the headers in {WebCore, JavaScriptCore}/icu.
199 # Because of <https://bugs.webkit.org/show_bug.cgi?id=70913> we can't directly reference these newer
200 # ICU headers within the QNX system header directory. As a workaround, we copy these newer ICU headers
201 # from the QNX system header directory to a third-party directory under the CMake binary tree.
202 #
203 # FIXME: Make this mechanism more general purpose. Maybe accept a list or directories/files to copy
204 # instead of individual variables. Generalizing this solution may allow us to fix <https://bugs.webkit.org/show_bug.cgi?id=70913>.
205 SET(BLACKBERRY_THIRD_PARTY_DIR "${CMAKE_BINARY_DIR}/ThirdPartyBlackBerry")
206 FILE(COPY ${THIRD_PARTY_ICU_DIR} DESTINATION "${BLACKBERRY_THIRD_PARTY_DIR}/icu")
207 FILE(COPY ${THIRD_PARTY_UNICODE_FILE} DESTINATION ${BLACKBERRY_THIRD_PARTY_DIR})