[CMake] Properly detect compiler flags, needed libs, and fallbacks for usage of 64...
[WebKit-https.git] / Source / cmake / OptionsWPE.cmake
1 include(GNUInstallDirs)
2 include(VersioningUtils)
3
4 SET_PROJECT_VERSION(2 21 1)
5 set(WPE_API_VERSION 0.1)
6
7 CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(WEBKIT 2 0 0)
8
9 # These are shared variables, but we special case their definition so that we can use the
10 # CMAKE_INSTALL_* variables that are populated by the GNUInstallDirs macro.
11 set(LIB_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBDIR}" CACHE PATH "Absolute path to library installation directory")
12 set(EXEC_INSTALL_DIR "${CMAKE_INSTALL_FULL_BINDIR}" CACHE PATH "Absolute path to executable installation directory")
13 set(LIBEXEC_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/wpe-webkit-${WPE_API_VERSION}" CACHE PATH "Absolute path to install executables executed by the library")
14
15 WEBKIT_OPTION_BEGIN()
16
17 include(GStreamerDefinitions)
18
19 # Public options shared with other WebKit ports. Do not add any options here
20 # without approval from a WPE reviewer. There must be strong reason to support
21 # changing the value of the option.
22 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS PUBLIC OFF)
23 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ENCRYPTED_MEDIA PUBLIC ${ENABLE_EXPERIMENTAL_FEATURES})
24 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_JIT PUBLIC ON)
25 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBDRIVER PUBLIC ON)
26 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_CRYPTO PUBLIC ON)
27 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XSLT PUBLIC ON)
28 WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_SYSTEM_MALLOC PUBLIC OFF)
29
30 # Private options shared with other WebKit ports. Add options here only if
31 # we need a value different from the default defined in WebKitFeatures.cmake.
32 # Changing these options is completely unsupported.
33 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCESSIBILITY PRIVATE ON)
34 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ASYNC_SCROLLING PRIVATE ON)
35 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GEOLOCATION PRIVATE OFF)
36 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MHTML PRIVATE ON)
37 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETSCAPE_PLUGIN_API PRIVATE OFF)
38 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NOTIFICATIONS PRIVATE OFF)
39 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SERVICE_WORKER PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
40 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SMOOTH_SCROLLING PRIVATE OFF)
41 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_TOUCH_EVENTS PRIVATE ON)
42 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL2 PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
43
44 # Public options specific to the WPE port. Do not add any options here unless
45 # there is a strong reason we should support changing the value of the option,
46 # and the option is not relevant to any other WebKit ports.
47 WEBKIT_OPTION_DEFINE(USE_WOFF2 "Whether to enable support for WOFF2 Web Fonts." PUBLIC ON)
48
49 # Private options specific to the WPE port.
50 WEBKIT_OPTION_DEFINE(USE_OPENVR "Whether to use OpenVR as WebVR backend." PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
51
52 if (CMAKE_SYSTEM_NAME MATCHES "Linux")
53     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEMORY_SAMPLER PRIVATE ON)
54     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE ON)
55 else ()
56     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MEMORY_SAMPLER PRIVATE OFF)
57     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_RESOURCE_USAGE PRIVATE OFF)
58 endif ()
59
60 SET_AND_EXPOSE_TO_BUILD(ENABLE_DEVELOPER_MODE ${DEVELOPER_MODE})
61 if (DEVELOPER_MODE)
62     WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE ON)
63 endif ()
64
65 include(GStreamerDependencies)
66
67 WEBKIT_OPTION_END()
68
69 find_package(Cairo 1.10.2 REQUIRED)
70 find_package(Fontconfig 2.8.0 REQUIRED)
71 find_package(Freetype2 2.4.2 REQUIRED)
72 find_package(GLIB 2.40.0 REQUIRED COMPONENTS gio gio-unix gobject gthread gmodule)
73 find_package(HarfBuzz 0.9.18 REQUIRED)
74 find_package(ICU REQUIRED)
75 find_package(JPEG REQUIRED)
76 find_package(LibEpoxy 1.4.0 REQUIRED)
77 find_package(LibGcrypt 1.6.0 REQUIRED)
78 find_package(LibSoup 2.42.0 REQUIRED)
79 find_package(LibXml2 2.8.0 REQUIRED)
80 find_package(PNG REQUIRED)
81 find_package(Sqlite REQUIRED)
82 find_package(Threads REQUIRED)
83 find_package(WebP REQUIRED)
84 find_package(WPEBackend REQUIRED)
85 find_package(ZLIB REQUIRED)
86
87 if (USE_WOFF2)
88     find_package(WOFF2Dec 1.0.2)
89     if (NOT WOFF2DEC_FOUND)
90         message(FATAL_ERROR "liwoff2dec is needed for USE_WOFF2.")
91     endif ()
92 endif ()
93
94 if (ENABLE_ACCELERATED_2D_CANVAS)
95     find_package(CairoGL 1.10.2 REQUIRED COMPONENTS cairo-egl)
96 endif ()
97
98 if (ENABLE_SUBTLE_CRYPTO)
99     find_package(Libtasn1 REQUIRED)
100     if (NOT LIBTASN1_FOUND)
101         message(FATAL_ERROR "libtasn1 is required to enable Web Crypto API support.")
102     endif ()
103     if (LIBGCRYPT_VERSION VERSION_LESS 1.7.0)
104         message(FATAL_ERROR "libgcrypt 1.7.0 is required to enable Web Crypto API support.")
105     endif ()
106 endif ()
107
108 if (ENABLE_XSLT)
109     find_package(LibXslt 1.1.7 REQUIRED)
110 endif ()
111
112 add_definitions(-DBUILDING_WPE__=1)
113 add_definitions(-DGETTEXT_PACKAGE="WPE")
114 add_definitions(-DJSC_GLIB_API_ENABLED)
115
116 SET_AND_EXPOSE_TO_BUILD(USE_CAIRO TRUE)
117 SET_AND_EXPOSE_TO_BUILD(USE_EGL TRUE)
118 SET_AND_EXPOSE_TO_BUILD(USE_GCRYPT TRUE)
119 SET_AND_EXPOSE_TO_BUILD(USE_LIBEPOXY TRUE)
120 SET_AND_EXPOSE_TO_BUILD(USE_OPENGL_ES TRUE)
121 SET_AND_EXPOSE_TO_BUILD(USE_XDGMIME TRUE)
122
123 if (WTF_CPU_ARM OR WTF_CPU_MIPS)
124     SET_AND_EXPOSE_TO_BUILD(USE_CAPSTONE ${DEVELOPER_MODE})
125 endif ()
126
127 SET_AND_EXPOSE_TO_BUILD(ENABLE_GRAPHICS_CONTEXT_3D TRUE)
128
129 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER TRUE)
130 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER_GL TRUE)
131 SET_AND_EXPOSE_TO_BUILD(USE_TILED_BACKING_STORE TRUE)
132 SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS TRUE)
133 SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS_THREADED TRUE)
134
135 set(FORWARDING_HEADERS_DIR ${DERIVED_SOURCES_DIR}/ForwardingHeaders)
136 set(FORWARDING_HEADERS_WPE_DIR ${FORWARDING_HEADERS_DIR}/wpe)
137 set(FORWARDING_HEADERS_WPE_EXTENSION_DIR ${FORWARDING_HEADERS_DIR}/wpe-webextension)
138 set(FORWARDING_HEADERS_WPE_DOM_DIR ${FORWARDING_HEADERS_DIR}/wpe-dom)
139 set(DERIVED_SOURCES_JAVASCRIPCOREWPE_DIR ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/javascriptcorewpe)
140 set(DERIVED_SOURCES_JAVASCRIPCORE_GLIB_API_DIR ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/javascriptcorewpe/jsc)
141 set(DERIVED_SOURCES_WPE_API_DIR ${DERIVED_SOURCES_WEBKIT_DIR}/wpe)
142
143 include(GStreamerChecks)