blob: 0533cfac5da3ce233f9bf0d6cfaf972f61e74f2f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
|
set(QT_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../shared/qtscript/src/")
if (UNIX)
set(_USE_SYSTEM_MALLOC NO)
else()
set(_USE_SYSTEM_MALLOC YES)
endif (UNIX)
set(JAVASCRIPT_CORE_INCLUDES
assembler
bytecode
bytecompiler
debugger
interpreter
jit
parser
pcre
profiler
runtime
wrec
wtf
wtf/unicode
yarr
API
ForwardingHeaders
generated
)
list_transform_prepend(JAVASCRIPT_CORE_INCLUDES "${QT_SCRIPT_PATH}/3rdparty/javascriptcore/JavaScriptCore/")
set(QT_SCRIPT_PUBLIC_INCLUDES
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_BINARY_DIR}/include"
)
set(QT_SCRIPT_INCLUDES
"${QT_SCRIPT_PATH}/3rdparty/javascriptcore"
"${QT_SCRIPT_PATH}/3rdparty/javascriptcore/JavaScriptCore"
"${QT_SCRIPT_PATH}/script"
"${QT_SCRIPT_PATH}/script/api"
"${QT_SCRIPT_PATH}/script/parser"
"${CMAKE_CURRENT_BINARY_DIR}/include/QtScript/${QT_VERSION}/QtScript"
)
set(QT_SCRIPT_DEFINES
"QT_BUILD_SCRIPT_LIB"
"QT_NO_USING_NAMESPACE"
"JSC=QTJSC"
"jscyyparse=qtjscyyparse"
"jscyylex=qtjscyylex"
"jscyyerror=qtjscyyerror"
"WTF=QTWTF"
"LOG_DISABLED=1"
"WTF_USE_JAVASCRIPTCORE_BINDINGS=1"
"WTF_CHANGES=1"
"JS_NO_EXPORT"
# JavaScriptCore
"BUILDING_QT__"
"BUILDING_JavaScriptCore"
"BUILDING_WTF"
"ENABLE_JIT=0"
"ENABLE_YARR_JIT=0"
"ENABLE_YARR=0"
# WebKit
"WTF_USE_ACCELERATED_COMPOSITING"
)
if (APPLE)
list(APPEND QT_SCRIPT_DEFINES "ENABLE_JSC_MULTIPLE_THREADS=0")
elseif(WIN32)
list(APPEND QT_SCRIPT_DEFINES "NOMINMAX" "_CRT_RAND_S")
endif()
if (MSVC)
set(QT_SCRIPT_CXX_FLAGS "/wd4291" "/wd4344" "/wd4396" "/wd4503" "/wd4800" "/wd4819" "/wd4996")
else()
set(QT_SCRIPT_CXX_FLAGS "-fno-strict-aliasing" "-w"
"-Wall" "-Wreturn-type" "-Wcast-align" "-Wchar-subscripts"
"-Wformat-security" "-Wreturn-type" "-Wno-unused-parameter"
"-Wno-sign-compare" "-Wno-switch" "-Wno-switch-enum" "-Wundef"
"-Wmissing-noreturn" "-Winit-self" "-Wno-deprecated" "-Wno-suggest-attribute=noreturn"
"-Wno-nonnull-compare" "-pthread")
endif()
set(QT_SCRIPT_PUBLIC_DEPENDS Qt${QT_VERSION_MAJOR}::Core)
if (UNIX)
list(APPEND QT_SCRIPT_PUBLIC_DEPENDS "pthread")
elseif(WIN32)
list(APPEND QT_SCRIPT_PUBLIC_DEPENDS "winmm")
endif()
set(PCRE_SOURCES
pcre_compile.cpp
pcre_exec.cpp
pcre_tables.cpp
pcre_ucp_searchfuncs.cpp
pcre_xclass.cpp
)
list_transform_prepend(PCRE_SOURCES "${QT_SCRIPT_PATH}/3rdparty/javascriptcore/JavaScriptCore/pcre/")
if (NOT _USE_SYSTEM_MALLOC)
set(SYSTEM_MALLOC_SOURCES
wtf/TCSystemAlloc.cpp
)
list_transform_prepend(SYSTEM_MALLOC_SOURCES "${QT_SCRIPT_PATH}/3rdparty/javascriptcore/JavaScriptCore/")
else()
set(SYSTEM_MALLOC_SOURCES "")
list(APPEND QT_SCRIPT_DEFINES "USE_SYSTEM_MALLOC")
endif()
set(JAVASCRIPT_CORE_SOURCES
API/JSBase.cpp
API/JSCallbackConstructor.cpp
API/JSCallbackFunction.cpp
API/JSCallbackObject.cpp
API/JSClassRef.cpp
API/JSContextRef.cpp
API/JSObjectRef.cpp
API/JSStringRef.cpp
API/JSValueRef.cpp
API/OpaqueJSString.cpp
assembler/ARMAssembler.cpp
assembler/MacroAssemblerARM.cpp
bytecode/CodeBlock.cpp
bytecode/JumpTable.cpp
bytecode/Opcode.cpp
bytecode/SamplingTool.cpp
bytecode/StructureStubInfo.cpp
bytecompiler/BytecodeGenerator.cpp
bytecompiler/NodesCodegen.cpp
debugger/DebuggerActivation.cpp
debugger/DebuggerCallFrame.cpp
debugger/Debugger.cpp
generated/Grammar.cpp
interpreter/CallFrame.cpp
interpreter/Interpreter.cpp
interpreter/RegisterFile.cpp
parser/Lexer.cpp
parser/Nodes.cpp
parser/ParserArena.cpp
parser/Parser.cpp
profiler/Profile.cpp
profiler/ProfileGenerator.cpp
profiler/ProfileNode.cpp
profiler/Profiler.cpp
runtime/ArgList.cpp
runtime/Arguments.cpp
runtime/ArrayConstructor.cpp
runtime/ArrayPrototype.cpp
runtime/BooleanConstructor.cpp
runtime/BooleanObject.cpp
runtime/BooleanPrototype.cpp
runtime/CallData.cpp
runtime/Collector.cpp
runtime/CommonIdentifiers.cpp
runtime/Completion.cpp
runtime/ConstructData.cpp
runtime/DateConstructor.cpp
runtime/DateConversion.cpp
runtime/DateInstance.cpp
runtime/DatePrototype.cpp
runtime/ErrorConstructor.cpp
runtime/Error.cpp
runtime/ErrorInstance.cpp
runtime/ErrorPrototype.cpp
runtime/ExceptionHelpers.cpp
runtime/Executable.cpp
runtime/FunctionConstructor.cpp
runtime/FunctionPrototype.cpp
runtime/GetterSetter.cpp
runtime/GlobalEvalFunction.cpp
runtime/Identifier.cpp
runtime/InitializeThreading.cpp
runtime/InternalFunction.cpp
runtime/JSActivation.cpp
runtime/JSAPIValueWrapper.cpp
runtime/JSArray.cpp
runtime/JSByteArray.cpp
runtime/JSCell.cpp
runtime/JSFunction.cpp
runtime/JSGlobalData.cpp
runtime/JSGlobalObject.cpp
runtime/JSGlobalObjectFunctions.cpp
runtime/JSImmediate.cpp
runtime/JSLock.cpp
runtime/JSNotAnObject.cpp
runtime/JSNumberCell.cpp
runtime/JSObject.cpp
runtime/JSONObject.cpp
runtime/JSPropertyNameIterator.cpp
runtime/JSStaticScopeObject.cpp
runtime/JSString.cpp
runtime/JSValue.cpp
runtime/JSVariableObject.cpp
runtime/JSWrapperObject.cpp
runtime/LiteralParser.cpp
runtime/Lookup.cpp
runtime/MarkStackPosix.cpp
runtime/MarkStackSymbian.cpp
runtime/MarkStackWin.cpp
runtime/MarkStack.cpp
runtime/MathObject.cpp
runtime/NativeErrorConstructor.cpp
runtime/NativeErrorPrototype.cpp
runtime/NumberConstructor.cpp
runtime/NumberObject.cpp
runtime/NumberPrototype.cpp
runtime/ObjectConstructor.cpp
runtime/ObjectPrototype.cpp
runtime/Operations.cpp
runtime/PropertyDescriptor.cpp
runtime/PropertyNameArray.cpp
runtime/PropertySlot.cpp
runtime/PrototypeFunction.cpp
runtime/RegExpConstructor.cpp
runtime/RegExp.cpp
runtime/RegExpObject.cpp
runtime/RegExpPrototype.cpp
runtime/ScopeChain.cpp
runtime/SmallStrings.cpp
runtime/StringConstructor.cpp
runtime/StringObject.cpp
runtime/StringPrototype.cpp
runtime/StructureChain.cpp
runtime/Structure.cpp
runtime/TimeoutChecker.cpp
runtime/UString.cpp
runtime/UStringImpl.cpp
wtf/Assertions.cpp
wtf/ByteArray.cpp
wtf/CurrentTime.cpp
wtf/DateMath.cpp
wtf/dtoa.cpp
wtf/FastMalloc.cpp
wtf/HashTable.cpp
wtf/MainThread.cpp
wtf/qt/MainThreadQt.cpp
wtf/qt/ThreadingQt.cpp
wtf/RandomNumber.cpp
wtf/RefCountedLeakCounter.cpp
wtf/ThreadingNone.cpp
wtf/Threading.cpp
wtf/TypeTraits.cpp
wtf/unicode/CollatorDefault.cpp
wtf/unicode/icu/CollatorICU.cpp
wtf/unicode/UTF8.cpp
)
list_transform_prepend(JAVASCRIPT_CORE_SOURCES "${QT_SCRIPT_PATH}/3rdparty/javascriptcore/JavaScriptCore/")
set(API_SOURCES
qscriptable.cpp
qscriptable.h
qscriptable_p.h
qscriptclass.cpp
qscriptclass.h
qscriptclasspropertyiterator.cpp
qscriptclasspropertyiterator.h
qscriptcontext.cpp
qscriptcontext.h
qscriptcontextinfo.cpp
qscriptcontextinfo.h
qscriptcontext_p.h
qscriptengineagent.cpp
qscriptengineagent.h
qscriptengineagent_p.h
qscriptengine.cpp
qscriptengine.h
qscriptengine_p.h
qscriptextensioninterface.h
qscriptextensionplugin.cpp
qscriptextensionplugin.h
qscriptprogram.cpp
qscriptprogram.h
qscriptprogram_p.h
qscriptstring.cpp
qscriptstring.h
qscriptstring_p.h
qscriptvalue.cpp
qscriptvalue.h
qscriptvalueiterator.cpp
qscriptvalueiterator.h
qscriptvalue_p.h
qtscriptglobal.h
)
list_transform_prepend(API_SOURCES "${QT_SCRIPT_PATH}/script/api/")
set(BRIDGE_SOURCES
qscriptactivationobject.cpp
qscriptactivationobject_p.h
qscriptclassobject.cpp
qscriptclassobject_p.h
qscriptfunction.cpp
qscriptfunction_p.h
qscriptglobalobject.cpp
qscriptglobalobject_p.h
qscriptobject.cpp
qscriptobject_p.h
qscriptqobject.cpp
qscriptqobject_p.h
qscriptstaticscopeobject.cpp
qscriptstaticscopeobject_p.h
qscriptvariant.cpp
qscriptvariant_p.h
)
list_transform_prepend(BRIDGE_SOURCES "${QT_SCRIPT_PATH}/script/bridge/")
set(PARSER_SOURCES
qscriptast.cpp
qscriptastfwd_p.h
qscriptast_p.h
qscriptastvisitor.cpp
qscriptastvisitor_p.h
qscriptgrammar.cpp
qscriptgrammar_p.h
qscriptlexer.cpp
qscriptlexer_p.h
qscriptsyntaxchecker.cpp
qscriptsyntaxchecker_p.h
)
list_transform_prepend(PARSER_SOURCES "${QT_SCRIPT_PATH}/script/parser/")
find_package(Perl)
get_target_property(_QT_MOC_EXECUTABLE Qt${QT_VERSION_MAJOR}::moc IMPORTED_LOCATION)
get_filename_component(_QT_LIBEXEC_DIRECTORY ${_QT_MOC_EXECUTABLE} DIRECTORY)
file(GLOB API_HEADERS "${QT_SCRIPT_PATH}/script/api/*.h")
set(EXTERNAL_DEPENDS "")
if(APPLE)
set(EXTERNAL_DEPENDS "-framework CoreFoundation")
endif()
if(WIN32)
set(EXTERNAL_DEPENDS "winmm")
endif()
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/include/QtScript/qscriptengine.h"
COMMAND ${PERL_EXECUTABLE} "${_QT_LIBEXEC_DIRECTORY}/syncqt.pl"
-minimal
-version "${QT_VERSION}"
-outdir ${CMAKE_CURRENT_BINARY_DIR}
"${QT_SCRIPT_PATH}/.."
BYPRODUCTS
DEPENDS ${API_HEADERS}
)
add_qbs_library(qbsscriptengine
DEFINES ${QT_SCRIPT_DEFINES}
DEPENDS Qt${QT_VERSION_MAJOR}::CorePrivate Qt6Core5Compat ${EXTERNAL_DEPENDS}
PUBLIC_DEPENDS ${QT_SCRIPT_PUBLIC_DEPENDS}
INCLUDES ${QT_SCRIPT_PUBLIC_INCLUDES} ${QT_SCRIPT_INCLUDES} ${JAVASCRIPT_CORE_INCLUDES}
PUBLIC_INCLUDES ${QT_SCRIPT_PUBLIC_INCLUDES}
SOURCES
"${CMAKE_CURRENT_BINARY_DIR}/include/QtScript/qscriptengine.h"
${PCRE_SOURCES}
${SYSTEM_MALLOC_SOURCES}
${JAVASCRIPT_CORE_SOURCES}
${API_SOURCES}
${BRIDGE_SOURCES}
${PARSER_SOURCES}
)
target_compile_options(qbsscriptengine PRIVATE ${QT_SCRIPT_CXX_FLAGS})
|