OptionsBlackBerry.cmake 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. set(PROJECT_VERSION_MAJOR 0)
  2. set(PROJECT_VERSION_MINOR 1)
  3. set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
  4. set(DATA_DIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}-${PROJECT_VERSION})
  5. set(WTF_USE_ICU_UNICODE 1)
  6. add_definitions(-DDATA_DIR="${DATA_DIR}")
  7. add_definitions(-DWEBCORE_NAVIGATOR_VENDOR="Research In Motion, Ltd.")
  8. add_definitions(-DBUILDING_BLACKBERRY__)
  9. add_definitions(-DBUILD_WEBKIT)
  10. # Workaround for now so that SK_DEBUG isn't defined in SkPreConfig.h
  11. add_definitions(-DSK_RELEASE)
  12. # TODO: Make this build-time configurable
  13. set(WTF_USE_OPENTYPE_SANITIZER 1)
  14. add_definitions(-DWTF_USE_OPENTYPE_SANITIZER=1)
  15. add_definitions(-DWTF_USE_EXPORT_MACROS=1)
  16. if (ENABLE_GLES2)
  17. set(WTF_USE_ACCELERATED_COMPOSITING 1)
  18. add_definitions(-DWTF_USE_ACCELERATED_COMPOSITING=1)
  19. add_definitions(-DBLACKBERRY_PLATFORM_GRAPHICS_EGL=1)
  20. add_definitions(-DBLACKBERRY_PLATFORM_GRAPHICS_GLES2=1)
  21. add_definitions(-DBLACKBERRY_PLATFORM_GRAPHICS_DRAWING_SURFACE=1)
  22. add_definitions(-DWTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER=1)
  23. endif ()
  24. if (ADDITIONAL_SYSTEM_INCLUDE_PATH)
  25. set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-Wp,-isystem")
  26. set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-Wp,-isystem")
  27. foreach (directory ${ADDITIONAL_SYSTEM_INCLUDE_PATH})
  28. include_directories(SYSTEM ${directory})
  29. endforeach ()
  30. if (ENABLE_WEBGL)
  31. include_directories(SYSTEM ${THIRDPARTY_DIR}/ANGLE/include) #As system so as to be lower-priority than actual system headers
  32. endif ()
  33. endif ()
  34. if (PUBLIC_BUILD)
  35. message("*** PUBLIC BUILD ***")
  36. else (PUBLIC_BUILD)
  37. message("*** DRT is ENABLED ***")
  38. endif ()
  39. add_definitions(-D__QNXNTO__)
  40. add_definitions(-D_FILE_OFFSET_BITS=64)
  41. add_definitions(-D_LARGEFILE64_SOURCE)
  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_LIBRARY_PATH}"
  47. ENV "QNX_TARGET"
  48. PATH_SUFFIXES "${CMAKE_SYSTEM_PROCESSOR}/usr/lib" "${CMAKE_SYSTEM_PROCESSOR}/lib"
  49. NO_DEFAULT_PATH)
  50. endmacro()
  51. macro(FIND_STAGING_STATIC_LIBRARY _var _libname)
  52. set(${_var} "-Bstatic -l${_libname} -Bdynamic" CACHE STRING ${_libname})
  53. endmacro()
  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(FREETYPE_LIBRARY freetype)
  61. FIND_STAGING_LIBRARY(ICUData_LIBRARY icudata)
  62. FIND_STAGING_LIBRARY(ICUI18N_LIBRARY icui18n)
  63. FIND_STAGING_LIBRARY(ICUUC_LIBRARY icuuc)
  64. FIND_STAGING_LIBRARY(INTL_LIBRARY intl)
  65. FIND_STAGING_LIBRARY(Z_LIBRARY z)
  66. FIND_STAGING_LIBRARY(CURL_LIBRARY curl)
  67. FIND_STAGING_LIBRARY(WebKitPlatform_LIBRARY webkitplatform)
  68. FIND_STAGING_LIBRARY(EGL_LIBRARY EGL)
  69. FIND_STAGING_LIBRARY(GLESv2_LIBRARY GLESv2)
  70. FIND_STAGING_LIBRARY(HARFBUZZ_LIBRARY harfbuzz)
  71. FIND_STAGING_LIBRARY(FONTCONFIG_LIBRARY fontconfig)
  72. FIND_STAGING_LIBRARY(PROFILING_LIBRARY profilingS)
  73. FIND_STAGING_LIBRARY(LIB_INPUT_UTILITIES input_utilities)
  74. FIND_STAGING_LIBRARY(OTS_LIBRARY ots)
  75. FIND_STAGING_LIBRARY(LEVELDB_LIBRARY leveldb)
  76. FIND_STAGING_LIBRARY(ITYPE_LIBRARY iType)
  77. FIND_STAGING_LIBRARY(WTLE_LIBRARY WTLE)
  78. # Use jpeg-turbo for device build
  79. if (TARGETING_PLAYBOOK)
  80. FIND_STAGING_STATIC_LIBRARY(JPEG_LIBRARY jpeg-webkit)
  81. else ()
  82. FIND_STAGING_LIBRARY(JPEG_LIBRARY jpeg)
  83. endif ()
  84. # Add "-fPIC" to CMAKE_SHARED_LIBRARY_C_FLAGS and CMAKE_SHARED_LIBRARY_CXX_FLAGS
  85. # This is because "-fPIC" is not included in the default defines under Modules/Platform/QNX.cmake
  86. set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC ${CMAKE_SHARED_LIBRARY_C_FLAGS}")
  87. set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
  88. # Show unresolved symbols when doing the final shared object link
  89. if (PROFILING)
  90. set(BLACKBERRY_LINK_FLAGS "-Wl,-z,defs -Wl,-z,relro -Wl,-E -Wl,--no-keep-memory")
  91. else (PROFILING)
  92. set(BLACKBERRY_LINK_FLAGS "-Wl,-z,defs -Wl,-z,relro -Wl,--no-keep-memory")
  93. endif ()
  94. # Set custom CFLAGS for our port
  95. if (CMAKE_COMPILER_IS_GNUCC)
  96. set(CMAKE_CXX_FLAGS "-fno-exceptions -fstack-protector -fno-rtti -Wformat -Wformat-security -Werror=format-security ${CMAKE_CXX_FLAGS}")
  97. set(CMAKE_C_FLAGS "-fstack-protector -Wformat -Wformat-security -Werror=format-security ${CMAKE_C_FLAGS}")
  98. set(JSC_LINK_FLAGS "-Wl,-z,defs -Wl,-z,relro -N1024K")
  99. endif ()
  100. if (PROFILING)
  101. set(CMAKE_CXX_FLAGS "-finstrument-functions -g ${CMAKE_CXX_FLAGS}")
  102. set(CMAKE_C_FLAGS "-finstrument-functions -g ${CMAKE_C_FLAGS}")
  103. endif ()
  104. # FIXME: Make this more elegant
  105. if (TARGETING_PLAYBOOK)
  106. set(CMAKE_CXX_FLAGS "-mfpu=neon ${CMAKE_CXX_FLAGS}")
  107. set(CMAKE_C_FLAGS "-mfpu=neon ${CMAKE_C_FLAGS}")
  108. set(CMAKE_CXX_FLAGS "-mthumb -mthumb-interwork ${CMAKE_CXX_FLAGS}")
  109. set(CMAKE_C_FLAGS "-mthumb -mthumb-interwork ${CMAKE_C_FLAGS}")
  110. # check for BB_RELEASE_FLAGS or BB_DEBUG_FLAGS to set CMAKE_C_FLAGS{DEBUG|RELEASE} CMAKE_CXX_FLAGS{DEBUG|RELEASE}
  111. if (DEFINED ENV{BB_RELEASE_FLAGS})
  112. set(CMAKE_CXX_FLAGS_RELEASE "$ENV{BB_RELEASE_FLAGS} -DNDEBUG")
  113. set(CMAKE_C_FLAGS_RELEASE "$ENV{BB_RELEASE_FLAGS} -DNDEBUG")
  114. message("== ENV override RELEASE ${CMAKE_CXX_FLAGS_RELEASE}")
  115. endif ()
  116. if (DEFINED ENV{BB_DEBUG_FLAGS})
  117. set(CMAKE_CXX_FLAGS_DEBUG "$ENV{BB_DEBUG_FLAGS}")
  118. set(CMAKE_C_FLAGS_DEBUG "$ENV{BB_DEBUG_FLAGS}")
  119. message("== ENV override DEBUG ${CMAKE_CXX_FLAGS_DEBUG}")
  120. endif ()
  121. endif ()
  122. include_directories(${CMAKE_INCLUDE_PATH})
  123. set(WTF_OUTPUT_NAME wtf)
  124. set(JavaScriptCore_OUTPUT_NAME javascriptcore)
  125. set(WebCore_OUTPUT_NAME webcore)
  126. set(WebKit_OUTPUT_NAME webkit)
  127. set(WebKit_DRT_OUTPUT_NAME webkit_DRT)
  128. WEBKIT_OPTION_BEGIN()
  129. WEBKIT_OPTION_DEFINE(ENABLE_EVENT_MODE_METATAGS "Enable meta-tag touch and mouse events" ON)
  130. WEBKIT_OPTION_DEFINE(ENABLE_VIEWPORT_REFLOW "Enable viewport reflow" ON)
  131. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BATTERY_STATUS ON)
  132. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BLOB ON)
  133. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CONTEXT_MENUS OFF)
  134. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_IMAGE_RESOLUTION ON)
  135. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CUSTOM_SCHEME_HANDLER ON)
  136. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DEVICE_ORIENTATION ON)
  137. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DRAG_SUPPORT OFF)
  138. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DOWNLOAD_ATTRIBUTE ON)
  139. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FAST_MOBILE_SCROLLING ON)
  140. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FILE_SYSTEM ON)
  141. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FILTERS ON)
  142. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FULLSCREEN_API ON)
  143. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GEOLOCATION ON)
  144. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_HIDDEN_PAGE_DOM_TIMER_THROTTLING ON)
  145. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_IMAGE_DECODER_DOWN_SAMPLING ON)
  146. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INDEXED_DATABASE ON)
  147. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_INPUT_TYPE_COLOR ON)
  148. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_NOTIFICATIONS ON)
  149. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LEGACY_VIEWPORT_ADAPTION ON)
  150. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LLINT ON)
  151. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MATHML OFF)
  152. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_CAPTURE ON)
  153. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEDIA_STREAM ON)
  154. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MICRODATA ON)
  155. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NAVIGATOR_CONTENT_UTILS ON)
  156. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETWORK_INFO 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_VISIBILITY_API ON)
  160. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REPAINT_THROTTLING ON)
  161. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REQUEST_ANIMATION_FRAME ON)
  162. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SHARED_WORKERS ON)
  163. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SMOOTH_SCROLLING ON)
  164. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_STYLE_SCOPED ON)
  165. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TEXT_AUTOSIZING ON)
  166. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS ON)
  167. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_SLIDER ON)
  168. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIBRATION ON)
  169. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO ON)
  170. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VIDEO_TRACK OFF)
  171. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_TIMING ON)
  172. if (ENABLE_GLES2)
  173. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_RENDERING ON)
  174. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS ON)
  175. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_FILTERS ON)
  176. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_SHADERS ON)
  177. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL ON)
  178. else ()
  179. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_RENDERING OFF)
  180. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS OFF)
  181. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_FILTERS OFF)
  182. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_SHADERS OFF)
  183. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL OFF)
  184. endif ()
  185. if (CMAKE_SYSTEM_PROCESSOR MATCHES x86)
  186. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_JIT OFF)
  187. else ()
  188. WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_JIT ON)
  189. endif ()
  190. WEBKIT_OPTION_END()
  191. add_definitions(-DENABLE_BLACKBERRY_CREDENTIAL_PERSIST=1)
  192. # Some of our files, such as platform/graphics/chromium/ComplexTextControllerLinux.cpp, require a
  193. # newer ICU version than the version associated with the headers in {WebCore, JavaScriptCore}/icu.
  194. # Because of <https://bugs.webkit.org/show_bug.cgi?id=70913> we can't directly reference these newer
  195. # ICU headers within the QNX system header directory. As a workaround, we copy these newer ICU headers
  196. # from the QNX system header directory to a third-party directory under the CMake binary tree.
  197. #
  198. # FIXME: Make this mechanism more general purpose. Maybe accept a list or directories/files to copy
  199. # instead of individual variables. Generalizing this solution may allow us to fix <https://bugs.webkit.org/show_bug.cgi?id=70913>.
  200. set(BLACKBERRY_THIRD_PARTY_DIR "${CMAKE_BINARY_DIR}/ThirdPartyBlackBerry")
  201. file(COPY ${THIRD_PARTY_ICU_DIR} DESTINATION "${BLACKBERRY_THIRD_PARTY_DIR}/icu")
  202. file(COPY ${THIRD_PARTY_UNICODE_FILE} DESTINATION ${BLACKBERRY_THIRD_PARTY_DIR})
  203. set(ICU_INCLUDE_DIRS "${BLACKBERRY_THIRD_PARTY_DIR}/icu")