[Curl] Add TLS debugging feature to log encryption keys
[WebKit.git] / Source / cmake / OptionsPlayStation.cmake
1 set(PORT PlayStation)
2
3 include(Sign)
4
5 add_definitions(-DWTF_PLATFORM_PLAYSTATION=1)
6 add_definitions(-DBPLATFORM_PLAYSTATION=1)
7
8 add_definitions(-DSCE_LIBC_DISABLE_CPP14_HEADER_WARNING= -DSCE_LIBC_DISABLE_CPP17_HEADER_WARNING=)
9
10 set(ENABLE_API_TESTS ON CACHE BOOL "Build API Tests")
11 set(ENABLE_WEBCORE ON CACHE BOOL "Build WebCore")
12 set(ENABLE_WEBKIT ON CACHE BOOL "Build WebKit")
13 set(ENABLE_WEBKIT_LEGACY OFF)
14
15 if (NOT ENABLE_WEBCORE)
16     set(ENABLE_WEBKIT OFF)
17 endif ()
18
19 WEBKIT_OPTION_BEGIN()
20
21 # Turn off JIT
22 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_JIT PRIVATE OFF)
23 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTL_JIT PRIVATE OFF)
24 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DFG_JIT PRIVATE OFF)
25
26 # Enabled features
27 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCESSIBILITY PRIVATE OFF)
28 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ASYNC_SCROLLING PRIVATE ON)
29 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SMOOTH_SCROLLING PRIVATE ON)
30
31 # Experimental features
32 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_APPLICATION_MANIFEST PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
33 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_PAINTING_API PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
34 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_TYPED_OM PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
35 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FILTERS_LEVEL_2 PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
36 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_LAYOUT_FORMATTING_CONTEXT PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
37 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REMOTE_INSPECTOR PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
38 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SERVICE_WORKER PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
39 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
40 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_CRYPTO PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
41
42 # Features to investigate
43 #
44 # Features that are temporarily turned off because an implementation is not
45 # present at this time
46 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GAMEPAD PRIVATE OFF)
47 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_AUDIO PRIVATE OFF)
48
49 # TLS debugging feature
50 WEBKIT_OPTION_DEFINE(ENABLE_TLS_DEBUG "Enable TLS key log support" PRIVATE OFF)
51
52 # Reenable after updating fontconfig
53 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_VARIATION_FONTS PRIVATE OFF)
54
55 # No support planned
56 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTPDIR PRIVATE OFF)
57 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_GEOLOCATION PRIVATE OFF)
58 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MATHML PRIVATE OFF)
59 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_METER_ELEMENT PRIVATE OFF)
60 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETSCAPE_PLUGIN_API PRIVATE OFF)
61 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NOTIFICATIONS PRIVATE OFF)
62 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_SVG_FONTS PRIVATE OFF)
63 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USERSELECT_ALL PRIVATE OFF)
64 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_USER_MESSAGE_HANDLERS PRIVATE OFF)
65 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XSLT PRIVATE OFF)
66
67 WEBKIT_OPTION_END()
68
69 if (DEFINED ENV{WEBKIT_IGNORE_PATH})
70     set(CMAKE_IGNORE_PATH $ENV{WEBKIT_IGNORE_PATH})
71 endif ()
72
73 # Do not use a separate directory based on configuration when building
74 # with the Visual Studio generator
75 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
76 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
77 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
78 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
79 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
80 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
81
82 # Specify third party library directory
83 if (NOT WEBKIT_LIBRARIES_DIR)
84     if (DEFINED ENV{WEBKIT_LIBRARIES})
85         set(WEBKIT_LIBRARIES_DIR "$ENV{WEBKIT_LIBRARIES}" CACHE PATH "Path to PlayStationRequirements")
86     else ()
87         set(WEBKIT_LIBRARIES_DIR "${CMAKE_SOURCE_DIR}/WebKitLibraries/playstation" CACHE PATH "Path to PlayStationRequirements")
88     endif ()
89 endif ()
90
91 list(APPEND CMAKE_PREFIX_PATH ${WEBKIT_LIBRARIES_DIR})
92
93 find_library(C_STD_LIBRARY c)
94 find_library(KERNEL_LIBRARY kernel)
95
96 find_package(Cairo REQUIRED)
97 find_package(CURL REQUIRED)
98 find_package(EGL REQUIRED)
99 find_package(Fontconfig REQUIRED)
100 find_package(Freetype REQUIRED)
101 find_package(HarfBuzz REQUIRED COMPONENTS ICU)
102 find_package(ICU REQUIRED COMPONENTS data i18n uc)
103 find_package(JPEG REQUIRED)
104 find_package(LibPSL REQUIRED)
105 find_package(LibXml2 REQUIRED)
106 find_package(OpenSSL REQUIRED)
107 find_package(PNG REQUIRED)
108 find_package(SQLite3 REQUIRED)
109 find_package(Threads REQUIRED)
110 find_package(WebP REQUIRED COMPONENTS demux)
111 find_package(WPE REQUIRED)
112 find_package(ZLIB REQUIRED)
113
114 # TODO: Add a check for HAVE_RSA_PSS for support of CryptoAlgorithmRSA_PSS
115 # https://bugs.webkit.org/show_bug.cgi?id=206635
116
117 SET_AND_EXPOSE_TO_BUILD(HAVE_PTHREAD_SETNAME_NP ON)
118
119 SET_AND_EXPOSE_TO_BUILD(USE_EXPORT_MACROS ON)
120
121 SET_AND_EXPOSE_TO_BUILD(USE_CAIRO ON)
122 SET_AND_EXPOSE_TO_BUILD(USE_CURL ON)
123 SET_AND_EXPOSE_TO_BUILD(USE_FREETYPE ON)
124 SET_AND_EXPOSE_TO_BUILD(USE_HARFBUZZ ON)
125 SET_AND_EXPOSE_TO_BUILD(USE_LIBWPE ON)
126 SET_AND_EXPOSE_TO_BUILD(USE_OPENSSL ON)
127 SET_AND_EXPOSE_TO_BUILD(USE_WPE_RENDERER ON)
128
129 SET_AND_EXPOSE_TO_BUILD(USE_INSPECTOR_SOCKET_SERVER ${ENABLE_REMOTE_INSPECTOR})
130 SET_AND_EXPOSE_TO_BUILD(USE_UNIX_DOMAIN_SOCKETS ON)
131
132 # Rendering options
133 SET_AND_EXPOSE_TO_BUILD(ENABLE_GRAPHICS_CONTEXT_GL ON)
134 SET_AND_EXPOSE_TO_BUILD(USE_COORDINATED_GRAPHICS ON)
135 SET_AND_EXPOSE_TO_BUILD(USE_EGL ON)
136 SET_AND_EXPOSE_TO_BUILD(USE_NICOSIA TRUE)
137 SET_AND_EXPOSE_TO_BUILD(USE_OPENGL_ES ON)
138 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER ON)
139 SET_AND_EXPOSE_TO_BUILD(USE_TEXTURE_MAPPER_GL ON)
140 SET_AND_EXPOSE_TO_BUILD(USE_TILED_BACKING_STORE ON)
141
142 # Override headers directories
143 set(ANGLE_FRAMEWORK_HEADERS_DIR ${CMAKE_BINARY_DIR}/ANGLE/Headers)
144 set(WTF_FRAMEWORK_HEADERS_DIR ${CMAKE_BINARY_DIR}/WTF/Headers)
145 set(JavaScriptCore_FRAMEWORK_HEADERS_DIR ${CMAKE_BINARY_DIR}/JavaScriptCore/Headers)
146 set(JavaScriptCore_PRIVATE_FRAMEWORK_HEADERS_DIR ${CMAKE_BINARY_DIR}/JavaScriptCore/PrivateHeaders)
147 set(PAL_FRAMEWORK_HEADERS_DIR ${CMAKE_BINARY_DIR}/PAL/Headers)
148 set(WebCore_PRIVATE_FRAMEWORK_HEADERS_DIR ${CMAKE_BINARY_DIR}/WebCore/PrivateHeaders)
149 set(WebKitLegacy_FRAMEWORK_HEADERS_DIR ${CMAKE_BINARY_DIR}/WebKitLegacy/Headers)
150 set(WebKit_FRAMEWORK_HEADERS_DIR ${CMAKE_BINARY_DIR}/WebKit/Headers)
151 set(WebKit_PRIVATE_FRAMEWORK_HEADERS_DIR ${CMAKE_BINARY_DIR}/WebKit/PrivateHeaders)
152
153 # Override derived sources directories
154 set(WTF_DERIVED_SOURCES_DIR ${CMAKE_BINARY_DIR}/WTF/DerivedSources)
155 set(JavaScriptCore_DERIVED_SOURCES_DIR ${CMAKE_BINARY_DIR}/JavaScriptCore/DerivedSources)
156 set(WebCore_DERIVED_SOURCES_DIR ${CMAKE_BINARY_DIR}/WebCore/DerivedSources)
157 set(WebKitLegacy_DERIVED_SOURCES_DIR ${CMAKE_BINARY_DIR}/WebKitLegacy/DerivedSources)
158 set(WebKit_DERIVED_SOURCES_DIR ${CMAKE_BINARY_DIR}/WebKit/DerivedSources)
159
160 # Override scripts directories
161 set(WTF_SCRIPTS_DIR ${CMAKE_BINARY_DIR}/WTF/Scripts)
162 set(JavaScriptCore_SCRIPTS_DIR ${CMAKE_BINARY_DIR}/JavaScriptCore/Scripts)
163
164 # Create a shared JavaScriptCore with WTF and bmalloc exposed through it.
165 #
166 # Use OBJECT libraries for bmalloc and WTF. This is the modern CMake way to emulate
167 # the behavior of --whole-archive. If this is not done then all the exports will
168 # not be exposed.
169 set(bmalloc_LIBRARY_TYPE OBJECT)
170 set(WTF_LIBRARY_TYPE OBJECT)
171 set(JavaScriptCore_LIBRARY_TYPE SHARED)
172
173 # For the shared WebKit just link a STATIC WebCore since the exports from WebCore
174 # and PAL are not needed.
175 set(PAL_LIBRARY_TYPE STATIC)
176 set(WebCore_LIBRARY_TYPE STATIC)
177 set(WebKit_LIBRARY_TYPE SHARED)
178
179 # Enable multi process builds for Visual Studio
180 if (NOT ${CMAKE_GENERATOR} MATCHES "Ninja")
181     add_definitions(/MP)
182 endif ()
183
184 find_library(DL_LIBRARY NAMES dl PATHS ${WEBKIT_LIBRARIES_DIR}/lib)
185 if (DL_LIBRARY)
186     add_link_options("$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:${DL_LIBRARY}>")
187     add_link_options("$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-Wl,--wrap=dlopen>")
188     add_link_options("$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-Wl,--wrap=dlclose>")
189     add_link_options("$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-Wl,--wrap=dlerror>")
190     add_link_options("$<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>:-Wl,--wrap=dlsym>")
191 endif ()
192
193 function(add_library target type)
194     _add_library(${ARGV})
195     if ("${type}" STREQUAL "SHARED")
196         sign(${target})
197     endif ()
198 endfunction()
199
200 macro(WEBKIT_EXECUTABLE _target)
201     _WEBKIT_EXECUTABLE(${_target})
202     playstation_setup_libc(${_target})
203     playstation_setup_fp(${_target})
204     if (NOT ${_target} MATCHES "^LLInt")
205         sign(${_target})
206     endif ()
207     if (PLAYSTATION_${_target}_WRAP)
208         foreach (WRAP ${PLAYSTATION_${_target}_WRAP})
209             target_link_options(${_target} PRIVATE -Wl,--wrap=${WRAP})
210         endforeach ()
211     endif ()
212 endmacro()