befe1c76f6d9935552b37f297cd3f4df4dd5a2f7
[WebKit-https.git] / Source / WebCore / UseV8.cmake
1 ADD_DEFINITIONS(-DUSING_V8_SHARED)
2 ADD_DEFINITIONS(-DWTF_CHANGES=1)
3
4 LIST(APPEND WebCore_INCLUDE_DIRECTORIES
5     "${WEBCORE_DIR}/bindings/v8"
6     "${WEBCORE_DIR}/bindings/v8/custom"
7     "${WEBCORE_DIR}/bindings/v8/specialization"
8     "${JAVASCRIPTCORE_DIR}/runtime"
9 )
10
11 LIST(APPEND WebCore_IDL_INCLUDES
12     bindings/v8
13 )
14
15 LIST(APPEND WebCore_SOURCES
16     bindings/v8/DOMData.cpp
17     bindings/v8/DOMDataStore.cpp
18     bindings/v8/DOMWrapperWorld.cpp
19     bindings/v8/DateExtension.cpp
20     bindings/v8/IDBBindingUtilities.cpp
21     bindings/v8/IsolatedWorld.cpp
22     bindings/v8/OptionsObject.cpp
23     bindings/v8/PageScriptDebugServer.cpp
24     bindings/v8/RetainedDOMInfo.cpp
25     bindings/v8/ScheduledAction.cpp
26     bindings/v8/ScopedDOMDataStore.cpp
27     bindings/v8/ScriptCachedFrameData.cpp
28     bindings/v8/ScriptCallStackFactory.cpp
29     bindings/v8/ScriptController.cpp
30     bindings/v8/ScriptEventListener.cpp
31     bindings/v8/ScriptFunctionCall.cpp
32     bindings/v8/ScriptGCEvent.cpp
33     bindings/v8/ScriptInstance.cpp
34     bindings/v8/ScriptObject.cpp
35     bindings/v8/ScriptScope.cpp
36     bindings/v8/ScriptState.cpp
37     bindings/v8/ScriptValue.cpp
38     bindings/v8/SerializedScriptValue.cpp
39     bindings/v8/StaticDOMDataStore.cpp
40     bindings/v8/V8AbstractEventListener.cpp
41     bindings/v8/V8Binding.cpp
42     bindings/v8/V8Collection.cpp
43     bindings/v8/V8DOMMap.cpp
44     bindings/v8/V8DOMWindowShell.cpp
45     bindings/v8/V8DOMWrapper.cpp
46     bindings/v8/V8EventListener.cpp
47     bindings/v8/V8EventListenerList.cpp
48     bindings/v8/V8GCController.cpp
49     bindings/v8/V8GCForContextDispose.cpp
50     bindings/v8/V8Helpers.cpp
51     bindings/v8/V8HiddenPropertyName.cpp
52     bindings/v8/V8IsolatedContext.cpp
53     bindings/v8/V8LazyEventListener.cpp
54     bindings/v8/V8NodeFilterCondition.cpp
55     bindings/v8/V8Proxy.cpp
56     bindings/v8/V8RecursionScope.cpp
57     bindings/v8/V8Utilities.cpp
58     bindings/v8/V8WindowErrorHandler.cpp
59     bindings/v8/V8WorkerContextErrorHandler.cpp
60     bindings/v8/V8WorkerContextEventListener.cpp
61     bindings/v8/WorkerContextExecutionProxy.cpp
62     bindings/v8/WorkerScriptController.cpp
63     bindings/v8/WorkerScriptDebugServer.cpp
64     bindings/v8/WorldContextHandle.cpp
65     bindings/v8/npruntime.cpp
66
67     bindings/v8/custom/V8ArrayBufferCustom.cpp
68     bindings/v8/custom/V8ArrayBufferViewCustom.cpp
69     bindings/v8/custom/V8AudioContextCustom.cpp
70     bindings/v8/custom/V8CSSRuleCustom.cpp
71     bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp
72     bindings/v8/custom/V8CSSStyleSheetCustom.cpp
73     bindings/v8/custom/V8CSSValueCustom.cpp
74     bindings/v8/custom/V8CanvasPixelArrayCustom.cpp
75     bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
76     bindings/v8/custom/V8ClipboardCustom.cpp
77     bindings/v8/custom/V8ConsoleCustom.cpp
78     bindings/v8/custom/V8CoordinatesCustom.cpp
79     bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
80     bindings/v8/custom/V8CustomVoidCallback.cpp
81     bindings/v8/custom/V8CustomXPathNSResolver.cpp
82     bindings/v8/custom/V8DOMFormDataCustom.cpp
83     bindings/v8/custom/V8DOMStringMapCustom.cpp
84     bindings/v8/custom/V8DOMTokenListCustom.cpp
85     bindings/v8/custom/V8DOMWindowCustom.cpp
86     bindings/v8/custom/V8DataViewCustom.cpp
87     bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp
88     bindings/v8/custom/V8DeviceMotionEventCustom.cpp
89     bindings/v8/custom/V8DeviceOrientationEventCustom.cpp
90     bindings/v8/custom/V8DirectoryEntryCustom.cpp
91     bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp
92     bindings/v8/custom/V8DocumentCustom.cpp
93     bindings/v8/custom/V8DocumentLocationCustom.cpp
94     bindings/v8/custom/V8ElementCustom.cpp
95     bindings/v8/custom/V8EntrySyncCustom.cpp
96     bindings/v8/custom/V8EventConstructors.cpp
97     bindings/v8/custom/V8EventCustom.cpp
98     bindings/v8/custom/V8FileReaderCustom.cpp
99     bindings/v8/custom/V8Float32ArrayCustom.cpp
100     bindings/v8/custom/V8Float64ArrayCustom.cpp
101     bindings/v8/custom/V8GeolocationCustom.cpp
102     bindings/v8/custom/V8HTMLAllCollectionCustom.cpp
103     bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
104     bindings/v8/custom/V8HTMLCollectionCustom.cpp
105     bindings/v8/custom/V8HTMLDocumentCustom.cpp
106     bindings/v8/custom/V8HTMLElementCustom.cpp
107     bindings/v8/custom/V8HTMLFormElementCustom.cpp
108     bindings/v8/custom/V8HTMLFrameElementCustom.cpp
109     bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp
110     bindings/v8/custom/V8HTMLImageElementConstructor.cpp
111     bindings/v8/custom/V8HTMLInputElementCustom.cpp
112     bindings/v8/custom/V8HTMLLinkElementCustom.cpp
113     bindings/v8/custom/V8HTMLOptionElementConstructor.cpp
114     bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp
115     bindings/v8/custom/V8HTMLOutputElementCustom.cpp
116     bindings/v8/custom/V8HTMLPlugInElementCustom.cpp
117     bindings/v8/custom/V8HTMLSelectElementCustom.cpp
118     bindings/v8/custom/V8HistoryCustom.cpp
119     bindings/v8/custom/V8IDBAnyCustom.cpp
120     bindings/v8/custom/V8IDBKeyCustom.cpp
121     bindings/v8/custom/V8ImageDataCustom.cpp
122     bindings/v8/custom/V8InjectedScriptHostCustom.cpp
123     bindings/v8/custom/V8InjectedScriptManager.cpp
124     bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
125     bindings/v8/custom/V8Int16ArrayCustom.cpp
126     bindings/v8/custom/V8Int32ArrayCustom.cpp
127     bindings/v8/custom/V8Int8ArrayCustom.cpp
128     bindings/v8/custom/V8LocationCustom.cpp
129     bindings/v8/custom/V8MessageChannelConstructor.cpp
130     bindings/v8/custom/V8MessageEventCustom.cpp
131     bindings/v8/custom/V8MessagePortCustom.cpp
132     bindings/v8/custom/V8MutationCallbackCustom.cpp
133     bindings/v8/custom/V8NamedNodeMapCustom.cpp
134     bindings/v8/custom/V8NamedNodesCollection.cpp
135     bindings/v8/custom/V8NodeCustom.cpp
136     bindings/v8/custom/V8NodeListCustom.cpp
137     bindings/v8/custom/V8NotificationCenterCustom.cpp
138     bindings/v8/custom/V8PerformanceCustom.cpp
139     bindings/v8/custom/V8PopStateEventCustom.cpp
140     bindings/v8/custom/V8SQLResultSetRowListCustom.cpp
141     bindings/v8/custom/V8SQLTransactionCustom.cpp
142     bindings/v8/custom/V8SQLTransactionSyncCustom.cpp
143     bindings/v8/custom/V8StorageCustom.cpp
144     bindings/v8/custom/V8StyleSheetCustom.cpp
145     bindings/v8/custom/V8StyleSheetListCustom.cpp
146     bindings/v8/custom/V8Uint16ArrayCustom.cpp
147     bindings/v8/custom/V8Uint32ArrayCustom.cpp
148     bindings/v8/custom/V8Uint8ArrayCustom.cpp
149     bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
150     bindings/v8/custom/V8WebKitAnimationCustom.cpp
151     bindings/v8/custom/V8WebKitMutationObserverCustom.cpp
152     bindings/v8/custom/V8WebKitPointConstructor.cpp
153     bindings/v8/custom/V8WebSocketCustom.cpp
154     bindings/v8/custom/V8WorkerContextCustom.cpp
155     bindings/v8/custom/V8WorkerCustom.cpp
156     bindings/v8/custom/V8XMLHttpRequestConstructor.cpp
157     bindings/v8/custom/V8XMLHttpRequestCustom.cpp
158     bindings/v8/custom/V8XSLTProcessorCustom.cpp
159
160     bindings/v8/specialization/V8BindingState.cpp
161 )
162
163 LIST(APPEND WebCore_SOURCES
164     ${JAVASCRIPTCORE_DIR}/yarr/YarrInterpreter.cpp
165     ${JAVASCRIPTCORE_DIR}/yarr/YarrJIT.cpp
166     ${JAVASCRIPTCORE_DIR}/yarr/YarrPattern.cpp
167     ${JAVASCRIPTCORE_DIR}/yarr/YarrSyntaxChecker.cpp
168 )
169
170 IF (ENABLE_JAVASCRIPT_DEBUGGER)
171     LIST(APPEND WebCore_SOURCES
172         bindings/v8/JavaScriptCallFrame.cpp
173         bindings/v8/ScriptDebugServer.cpp
174         bindings/v8/ScriptHeapSnapshot.cpp
175         bindings/v8/ScriptProfile.cpp
176         bindings/v8/ScriptProfileNode.cpp
177         bindings/v8/ScriptProfiler.cpp
178
179         bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp
180         bindings/v8/custom/V8ScriptProfileCustom.cpp
181         bindings/v8/custom/V8ScriptProfileNodeCustom.cpp
182     )
183 ENDIF ()
184
185 IF (ENABLE_NETSCAPE_PLUGIN_API)
186     LIST(APPEND WebCore_SOURCES
187         bindings/v8/NPV8Object.cpp
188         bindings/v8/V8NPObject.cpp
189         bindings/v8/V8NPUtils.cpp
190     )
191 ENDIF()
192
193 IF (ENABLE_VIDEO)
194     LIST(APPEND WebCore_SOURCES
195         bindings/v8/custom/V8HTMLAudioElementConstructor.cpp
196     )
197 ENDIF ()
198
199 IF (ENABLE_SVG)
200     LIST(APPEND WebCore_SOURCES
201         bindings/v8/custom/V8SVGDocumentCustom.cpp
202         bindings/v8/custom/V8SVGElementCustom.cpp
203         bindings/v8/custom/V8SVGLengthCustom.cpp
204         bindings/v8/custom/V8SVGPathSegCustom.cpp
205     )
206 ENDIF ()
207
208 LIST(APPEND SCRIPTS_BINDINGS
209     ${WEBCORE_DIR}/bindings/scripts/CodeGenerator.pm
210 )
211
212 SET(IDL_INCLUDES "")
213 FOREACH (_include ${WebCore_IDL_INCLUDES})
214     LIST(APPEND IDL_INCLUDES --include=${WEBCORE_DIR}/${_include})
215 ENDFOREACH ()
216
217 SET(FEATURE_DEFINES_JAVASCRIPT "LANGUAGE_JAVASCRIPT=1 V8_BINDING=1")
218 FOREACH (_feature ${FEATURE_DEFINES})
219     SET(FEATURE_DEFINES_JAVASCRIPT "${FEATURE_DEFINES_JAVASCRIPT} ${_feature}")
220 ENDFOREACH ()
221
222 # Generate DebuggerScriptSource.h
223 ADD_CUSTOM_COMMAND(
224     OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/DebuggerScriptSource.h
225     MAIN_DEPENDENCY ${WEBCORE_DIR}/bindings/v8/DebuggerScript.js
226     DEPENDS ${WEBCORE_DIR}/inspector/xxd.pl
227     COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/inspector/xxd.pl DebuggerScriptSource_js ${WEBCORE_DIR}/bindings/v8/DebuggerScript.js ${DERIVED_SOURCES_WEBCORE_DIR}/DebuggerScriptSource.h
228     VERBATIM)
229 LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/DebuggerScriptSource.h)
230
231 #GENERATOR: "RegExpJitTables.h": tables used by Yarr
232 ADD_CUSTOM_COMMAND(
233     OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/RegExpJitTables.h
234     MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/create_regex_tables
235     COMMAND ${PYTHON_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/create_regex_tables > ${DERIVED_SOURCES_WEBCORE_DIR}/RegExpJitTables.h
236     VERBATIM)
237 ADD_SOURCE_DEPENDENCIES(${JAVASCRIPTCORE_DIR}/yarr/YarrPattern.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/RegExpJitTables.h)
238
239 # Generate V8ArrayBufferViewCustomScript.h
240 ADD_CUSTOM_COMMAND(
241     OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/V8ArrayBufferViewCustomScript.h
242     MAIN_DEPENDENCY ${WEBCORE_DIR}/bindings/v8/custom/V8ArrayBufferViewCustomScript.js
243     DEPENDS ${WEBCORE_DIR}/inspector/xxd.pl
244     COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/inspector/xxd.pl V8ArrayBufferViewCustomScript_js ${WEBCORE_DIR}/bindings/v8/custom/V8ArrayBufferViewCustomScript.js ${DERIVED_SOURCES_WEBCORE_DIR}/V8ArrayBufferViewCustomScript.h
245     VERBATIM)
246 LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/V8ArrayBufferViewCustomScript.h)
247
248 # Create JavaScript C++ code given an IDL input
249 FOREACH (_idl ${WebCore_IDL_FILES})
250     SET(IDL_FILES_LIST "${IDL_FILES_LIST}${WEBCORE_DIR}/${_idl}\n")
251 ENDFOREACH ()
252 FILE(WRITE ${IDL_FILES_TMP} ${IDL_FILES_LIST})
253
254 ADD_CUSTOM_COMMAND(
255     OUTPUT ${SUPPLEMENTAL_DEPENDENCY_FILE}
256     DEPENDS ${WEBCORE_DIR}/bindings/scripts/resolve-supplemental.pl ${SCRIPTS_RESOLVE_SUPPLEMENTAL} ${WebCore_IDL_FILES} ${IDL_ATTRIBUTES_FILE}
257     COMMAND ${PERL_EXECUTABLE} -I${WEBCORE_DIR}/bindings/scripts ${WEBCORE_DIR}/bindings/scripts/resolve-supplemental.pl --defines "${FEATURE_DEFINES_JAVASCRIPT}" --idlFilesList ${IDL_FILES_TMP} --preprocessor "${CODE_GENERATOR_PREPROCESSOR}" --supplementalDependencyFile ${SUPPLEMENTAL_DEPENDENCY_FILE} --idlAttributesFile ${IDL_ATTRIBUTES_FILE}
258     VERBATIM)
259
260 FOREACH (_file ${WebCore_IDL_FILES})
261     GET_FILENAME_COMPONENT (_name ${_file} NAME_WE)
262     ADD_CUSTOM_COMMAND(
263         OUTPUT  ${DERIVED_SOURCES_WEBCORE_DIR}/V8${_name}.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/V8${_name}.h
264         MAIN_DEPENDENCY ${_file}
265         DEPENDS ${WEBCORE_DIR}/bindings/scripts/generate-bindings.pl ${SCRIPTS_BINDINGS} ${WEBCORE_DIR}/bindings/scripts/CodeGeneratorV8.pm ${SUPPLEMENTAL_DEPENDENCY_FILE}
266         COMMAND ${PERL_EXECUTABLE} -I${WEBCORE_DIR}/bindings/scripts ${WEBCORE_DIR}/bindings/scripts/generate-bindings.pl --defines "${FEATURE_DEFINES_JAVASCRIPT}" --generator V8 ${IDL_INCLUDES} --outputDir "${DERIVED_SOURCES_WEBCORE_DIR}" --preprocessor "${CODE_GENERATOR_PREPROCESSOR}" --supplementalDependencyFile ${SUPPLEMENTAL_DEPENDENCY_FILE} ${WEBCORE_DIR}/${_file}
267         VERBATIM)
268     LIST(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/V8${_name}.cpp)
269 ENDFOREACH ()