CMakeLists.txt 23.7 KB
Newer Older
1
set(JavaScriptCore_INCLUDE_DIRECTORIES
2 3 4 5 6 7 8
    "${CMAKE_BINARY_DIR}"
    "${JAVASCRIPTCORE_DIR}"
    "${JAVASCRIPTCORE_DIR}/API"
    "${JAVASCRIPTCORE_DIR}/ForwardingHeaders"
    "${JAVASCRIPTCORE_DIR}/assembler"
    "${JAVASCRIPTCORE_DIR}/bytecode"
    "${JAVASCRIPTCORE_DIR}/bytecompiler"
9
    "${JAVASCRIPTCORE_DIR}/dfg"
10
    "${JAVASCRIPTCORE_DIR}/disassembler"
11
    "${JAVASCRIPTCORE_DIR}/ftl"
12
    "${JAVASCRIPTCORE_DIR}/heap"
13
    "${JAVASCRIPTCORE_DIR}/debugger"
14
    "${JAVASCRIPTCORE_DIR}/inspector"
15 16
    "${JAVASCRIPTCORE_DIR}/interpreter"
    "${JAVASCRIPTCORE_DIR}/jit"
17
    "${JAVASCRIPTCORE_DIR}/llint"
18 19 20
    "${JAVASCRIPTCORE_DIR}/parser"
    "${JAVASCRIPTCORE_DIR}/profiler"
    "${JAVASCRIPTCORE_DIR}/runtime"
21
    "${JAVASCRIPTCORE_DIR}/tools"
22
    "${JAVASCRIPTCORE_DIR}/yarr"
23
    "${WTF_DIR}"
24
    "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}"
25
    "${CMAKE_SOURCE_DIR}/Source"
26 27
)

28
set(JavaScriptCore_SOURCES
29
    API/JSBase.cpp
30
    API/JSCTestRunnerUtils.cpp
31 32 33 34 35 36 37
    API/JSCallbackConstructor.cpp
    API/JSCallbackFunction.cpp
    API/JSCallbackObject.cpp
    API/JSClassRef.cpp
    API/JSContextRef.cpp
    API/JSObjectRef.cpp
    API/JSProfilerPrivate.cpp
38
    API/JSScriptRef.cpp
39 40 41 42
    API/JSStringRef.cpp
    API/JSValueRef.cpp
    API/JSWeakObjectMapRefPrivate.cpp
    API/OpaqueJSString.cpp
43

44
    assembler/LinkBuffer.cpp
45
    assembler/MacroAssembler.cpp
46
    assembler/MacroAssemblerX86Common.cpp
47

48
    bytecode/ArrayAllocationProfile.cpp
49
    bytecode/ArrayProfile.cpp
50 51
    bytecode/BytecodeBasicBlock.cpp
    bytecode/BytecodeLivenessAnalysis.cpp
52
    bytecode/CallLinkInfo.cpp
53
    bytecode/CallLinkStatus.cpp
54
    bytecode/CodeBlock.cpp
55
    bytecode/CodeBlockHash.cpp
56
    bytecode/CodeBlockJettisoningWatchpoint.cpp
57 58
    bytecode/CodeOrigin.cpp
    bytecode/CodeType.cpp
59
    bytecode/DFGExitProfile.cpp
60
    bytecode/DeferredCompilationCallback.cpp
61
    bytecode/ExecutionCounter.cpp
62
    bytecode/ExitKind.cpp
63
    bytecode/GetByIdStatus.cpp
64
    bytecode/InlineCallFrameSet.cpp
65
    bytecode/JumpTable.cpp
66 67
    bytecode/LazyOperandValueProfile.cpp
    bytecode/MethodOfGettingAValueProfile.cpp
68
    bytecode/Opcode.cpp
69
    bytecode/PolymorphicPutByIdList.cpp
70
    bytecode/PreciseJumpTargets.cpp
71
    bytecode/ProfiledCodeBlockJettisoningWatchpoint.cpp
72
    bytecode/PutByIdStatus.cpp
73
    bytecode/ReduceWhitespace.cpp
74
    bytecode/SamplingTool.cpp
75
    bytecode/SpecialPointer.cpp
76
    bytecode/SpeculatedType.cpp
77
    bytecode/StructureStubClearingWatchpoint.cpp
78
    bytecode/StructureStubInfo.cpp
79
    bytecode/UnlinkedCodeBlock.cpp
80
    bytecode/ValueRecovery.cpp
81
    bytecode/Watchpoint.cpp
82 83 84 85

    bytecompiler/BytecodeGenerator.cpp
    bytecompiler/NodesCodegen.cpp

86 87 88 89
    debugger/Debugger.cpp
    debugger/DebuggerActivation.cpp
    debugger/DebuggerCallFrame.cpp

90 91
    dfg/DFGAbstractHeap.cpp
    dfg/DFGAbstractValue.cpp
92
    dfg/DFGArgumentsSimplificationPhase.cpp
93
    dfg/DFGArrayMode.cpp
94
    dfg/DFGAtTailAbstractState.cpp
95
    dfg/DFGAvailability.cpp
96
    dfg/DFGBackwardsPropagationPhase.cpp
97 98 99
    dfg/DFGBasicBlock.cpp
    dfg/DFGBinarySwitch.cpp
    dfg/DFGBlockInsertionSet.cpp
100
    dfg/DFGByteCodeParser.cpp
101
    dfg/DFGCFAPhase.cpp
102
    dfg/DFGCFGSimplificationPhase.cpp
103
    dfg/DFGCPSRethreadingPhase.cpp
104
    dfg/DFGCSEPhase.cpp
105 106 107 108 109
    dfg/DFGCapabilities.cpp
    dfg/DFGClobberSet.cpp
    dfg/DFGClobberize.cpp
    dfg/DFGCommon.cpp
    dfg/DFGCommonData.cpp
110 111
    dfg/DFGCompilationKey.cpp
    dfg/DFGCompilationMode.cpp
112 113
    dfg/DFGConstantFoldingPhase.cpp
    dfg/DFGCriticalEdgeBreakingPhase.cpp
114
    dfg/DFGDCEPhase.cpp
115 116
    dfg/DFGDesiredIdentifiers.cpp
    dfg/DFGDesiredStructureChains.cpp
117
    dfg/DFGDesiredTransitions.cpp
118
    dfg/DFGDesiredWatchpoints.cpp
119 120
    dfg/DFGDesiredWeakReferences.cpp
    dfg/DFGDesiredWriteBarriers.cpp
121
    dfg/DFGDisassembler.cpp
122
    dfg/DFGDominators.cpp
123
    dfg/DFGDriver.cpp
124
    dfg/DFGEdge.cpp
125 126
    dfg/DFGFailedFinalizer.cpp
    dfg/DFGFinalizer.cpp
127
    dfg/DFGFixupPhase.cpp
128 129
    dfg/DFGFlushFormat.cpp
    dfg/DFGFlushLivenessAnalysisPhase.cpp
fpizlo@apple.com's avatar
fpizlo@apple.com committed
130
    dfg/DFGFlushedAt.cpp
131
    dfg/DFGGraph.cpp
132
    dfg/DFGInPlaceAbstractState.cpp
133
    dfg/DFGInvalidationPointInjectionPhase.cpp
134
    dfg/DFGJITCode.cpp
135
    dfg/DFGJITCompiler.cpp
136
    dfg/DFGJITFinalizer.cpp
137
    dfg/DFGJumpReplacement.cpp
138 139 140
    dfg/DFGLICMPhase.cpp
    dfg/DFGLazyJSValue.cpp
    dfg/DFGLivenessAnalysisPhase.cpp
141
    dfg/DFGLongLivedState.cpp
142
    dfg/DFGLoopPreHeaderCreationPhase.cpp
143
    dfg/DFGMinifiedNode.cpp
144
    dfg/DFGNaturalLoops.cpp
145
    dfg/DFGNode.cpp
146
    dfg/DFGNodeFlags.cpp
147
    dfg/DFGOSRAvailabilityAnalysisPhase.cpp
148
    dfg/DFGOSREntry.cpp
149
    dfg/DFGOSREntrypointCreationPhase.cpp
150
    dfg/DFGOSRExit.cpp
151
    dfg/DFGOSRExitBase.cpp
152 153 154
    dfg/DFGOSRExitCompiler.cpp
    dfg/DFGOSRExitCompiler32_64.cpp
    dfg/DFGOSRExitCompiler64.cpp
155
    dfg/DFGOSRExitCompilerCommon.cpp
156
    dfg/DFGOSRExitJumpPlaceholder.cpp
157
    dfg/DFGOSRExitPreparation.cpp
158
    dfg/DFGOperations.cpp
159
    dfg/DFGPhase.cpp
160
    dfg/DFGPlan.cpp
161
    dfg/DFGPredictionInjectionPhase.cpp
162
    dfg/DFGPredictionPropagationPhase.cpp
163
    dfg/DFGResurrectionForValidationPhase.cpp
164
    dfg/DFGSSAConversionPhase.cpp
165 166 167
    dfg/DFGSpeculativeJIT.cpp
    dfg/DFGSpeculativeJIT32_64.cpp
    dfg/DFGSpeculativeJIT64.cpp
fpizlo@apple.com's avatar
fpizlo@apple.com committed
168
    dfg/DFGStackLayoutPhase.cpp
169
    dfg/DFGThunks.cpp
170
    dfg/DFGTierUpCheckInjectionPhase.cpp
171
    dfg/DFGTypeCheckHoistingPhase.cpp
172
    dfg/DFGUnificationPhase.cpp
173
    dfg/DFGUseKind.cpp
174
    dfg/DFGValidate.cpp
175
    dfg/DFGValueSource.cpp
176
    dfg/DFGVariableAccessDataDump.cpp
177 178
    dfg/DFGVariableEvent.cpp
    dfg/DFGVariableEventStream.cpp
179
    dfg/DFGVirtualRegisterAllocationPhase.cpp
180
    dfg/DFGWatchpointCollectionPhase.cpp
181
    dfg/DFGWorklist.cpp
182

183
    disassembler/ARMv7Disassembler.cpp
184
    disassembler/Disassembler.cpp
185 186 187
    disassembler/LLVMDisassembler.cpp
    disassembler/UDis86Disassembler.cpp
    disassembler/X86Disassembler.cpp
188

189
    heap/BlockAllocator.cpp
190
    heap/CodeBlockSet.cpp
191 192 193
    heap/ConservativeRoots.cpp
    heap/CopiedSpace.cpp
    heap/CopyVisitor.cpp
194
    heap/DeferGC.cpp
195 196 197 198 199 200 201
    heap/GCThread.cpp
    heap/GCThreadSharedData.cpp
    heap/HandleSet.cpp
    heap/HandleStack.cpp
    heap/Heap.cpp
    heap/HeapStatistics.cpp
    heap/HeapTimer.cpp
202
    heap/IncrementalSweeper.cpp
203 204 205
    heap/JITStubRoutineSet.cpp
    heap/MachineStackMarker.cpp
    heap/MarkStack.cpp
206
    heap/MarkedAllocator.cpp
207
    heap/MarkedBlock.cpp
208
    heap/MarkedSpace.cpp
209
    heap/SlotVisitor.cpp
210
    heap/SuperRegion.cpp
211
    heap/Weak.cpp
212
    heap/WeakBlock.cpp
213 214
    heap/WeakHandleOwner.cpp
    heap/WeakSet.cpp
215
    heap/WriteBarrierSupport.cpp
216

217
    interpreter/AbstractPC.cpp
218 219
    interpreter/CallFrame.cpp
    interpreter/Interpreter.cpp
220
    interpreter/JSStack.cpp
221
    interpreter/ProtoCallFrame.cpp
222
    interpreter/StackVisitor.cpp
223
    interpreter/VMInspector.cpp
224

225
    jit/AssemblyHelpers.cpp
226
    jit/ClosureCallStubRoutine.cpp
227
    jit/ExecutableAllocator.cpp
228
    jit/ExecutableAllocatorFixedVMPool.cpp
229
    jit/GCAwareJITStubRoutine.cpp
230 231
    jit/HostCallReturnValue.cpp
    jit/JIT.cpp
232
    jit/JITArithmetic.cpp
233
    jit/JITArithmetic32_64.cpp
234
    jit/JITCall.cpp
235
    jit/JITCall32_64.cpp
236
    jit/JITCode.cpp
237
    jit/JITDisassembler.cpp
238
    jit/JITExceptions.cpp
239
    jit/JITInlineCacheGenerator.cpp
240
    jit/JITOpcodes.cpp
241
    jit/JITOpcodes32_64.cpp
242
    jit/JITOperations.cpp
243
    jit/JITPropertyAccess.cpp
244
    jit/JITPropertyAccess32_64.cpp
245
    jit/JITStubRoutine.cpp
246
    jit/JITStubs.cpp
247
    jit/JITThunks.cpp
248
    jit/JITToDFGDeferredCompilationCallback.cpp
249
    jit/RegisterSet.cpp
250
    jit/Repatch.cpp
251
    jit/TempRegisterSet.cpp
252
    jit/ThunkGenerators.cpp
253 254 255 256 257

    parser/Lexer.cpp
    parser/Nodes.cpp
    parser/Parser.cpp
    parser/ParserArena.cpp
258
    parser/SourceCode.cpp
259
    parser/SourceProvider.cpp
260
    parser/SourceProviderCache.cpp
261

262 263 264 265
    profiler/LegacyProfiler.cpp
    profiler/Profile.cpp
    profiler/ProfileGenerator.cpp
    profiler/ProfileNode.cpp
266
    profiler/ProfilerBytecode.cpp
267
    profiler/ProfilerBytecodeSequence.cpp
268 269 270 271 272
    profiler/ProfilerBytecodes.cpp
    profiler/ProfilerCompilation.cpp
    profiler/ProfilerCompilationKind.cpp
    profiler/ProfilerCompiledBytecode.cpp
    profiler/ProfilerDatabase.cpp
273 274
    profiler/ProfilerOSRExit.cpp
    profiler/ProfilerOSRExitSite.cpp
275 276
    profiler/ProfilerOrigin.cpp
    profiler/ProfilerOriginStack.cpp
277
    profiler/ProfilerProfiledBytecodes.cpp
278 279 280

    runtime/ArgList.cpp
    runtime/Arguments.cpp
281 282
    runtime/ArgumentsIteratorConstructor.cpp
    runtime/ArgumentsIteratorPrototype.cpp
283
    runtime/ArrayBuffer.cpp
fpizlo@apple.com's avatar
fpizlo@apple.com committed
284
    runtime/ArrayBufferNeuteringWatchpoint.cpp
285
    runtime/ArrayBufferView.cpp
286
    runtime/ArrayConstructor.cpp
287 288
    runtime/ArrayIteratorConstructor.cpp
    runtime/ArrayIteratorPrototype.cpp
289 290 291 292 293
    runtime/ArrayPrototype.cpp
    runtime/BooleanConstructor.cpp
    runtime/BooleanObject.cpp
    runtime/BooleanPrototype.cpp
    runtime/CallData.cpp
294
    runtime/CodeCache.cpp
295
    runtime/CodeSpecializationKind.cpp
296
    runtime/CommonIdentifiers.cpp
297
    runtime/CommonSlowPaths.cpp
298
    runtime/CommonSlowPathsExceptions.cpp
299
    runtime/CompilationResult.cpp
300 301
    runtime/Completion.cpp
    runtime/ConstructData.cpp
302 303
    runtime/DataView.cpp
    runtime/DataView.h
304 305 306 307
    runtime/DateConstructor.cpp
    runtime/DateConversion.cpp
    runtime/DateInstance.cpp
    runtime/DatePrototype.cpp
308
    runtime/DumpContext.cpp
309 310 311 312 313 314 315
    runtime/Error.cpp
    runtime/ErrorConstructor.cpp
    runtime/ErrorInstance.cpp
    runtime/ErrorPrototype.cpp
    runtime/ExceptionHelpers.cpp
    runtime/Executable.cpp
    runtime/FunctionConstructor.cpp
316
    runtime/FunctionExecutableDump.cpp
317
    runtime/FunctionPrototype.cpp
318
    runtime/GCActivityCallback.cpp
319 320
    runtime/GetterSetter.cpp
    runtime/Identifier.cpp
321
    runtime/IndexingType.cpp
322
    runtime/InitializeThreading.cpp
323
    runtime/IntendedStructureChain.cpp
324 325
    runtime/InternalFunction.cpp
    runtime/JSAPIValueWrapper.cpp
326
    runtime/JSActivation.cpp
327
    runtime/JSArgumentsIterator.cpp
328
    runtime/JSArray.cpp
329 330 331 332
    runtime/JSArrayBuffer.cpp
    runtime/JSArrayBufferConstructor.cpp
    runtime/JSArrayBufferPrototype.cpp
    runtime/JSArrayBufferView.cpp
333
    runtime/JSArrayIterator.cpp
334 335
    runtime/JSBoundFunction.cpp
    runtime/JSCJSValue.cpp
336
    runtime/JSCell.cpp
337 338
    runtime/JSDataView.cpp
    runtime/JSDataViewPrototype.cpp
339
    runtime/JSDateMath.cpp
340 341 342 343
    runtime/JSFunction.cpp
    runtime/JSGlobalObject.cpp
    runtime/JSGlobalObjectFunctions.cpp
    runtime/JSLock.cpp
oliver@apple.com's avatar
oliver@apple.com committed
344
    runtime/JSMap.cpp
oliver@apple.com's avatar
oliver@apple.com committed
345
    runtime/JSMapIterator.cpp
346
    runtime/JSNameScope.cpp
347 348
    runtime/JSNotAnObject.cpp
    runtime/JSONObject.cpp
349
    runtime/JSObject.cpp
weinig@apple.com's avatar
weinig@apple.com committed
350 351 352 353 354 355 356
    runtime/JSPromise.cpp
    runtime/JSPromiseCallback.cpp
    runtime/JSPromiseConstructor.cpp
    runtime/JSPromisePrototype.cpp
    runtime/JSPromiseResolver.cpp
    runtime/JSPromiseResolverConstructor.cpp
    runtime/JSPromiseResolverPrototype.cpp
357
    runtime/JSPropertyNameIterator.cpp
358
    runtime/JSProxy.cpp
359
    runtime/JSScope.cpp
360
    runtime/JSSegmentedVariableObject.cpp
oliver@apple.com's avatar
oliver@apple.com committed
361
    runtime/JSSet.cpp
oliver@apple.com's avatar
oliver@apple.com committed
362
    runtime/JSSetIterator.cpp
363
    runtime/JSStaticScopeObject.cpp
364
    runtime/JSString.cpp
365
    runtime/JSStringJoiner.cpp
366
    runtime/JSSymbolTableObject.cpp
367 368 369
    runtime/JSTypedArrayConstructors.cpp
    runtime/JSTypedArrayPrototypes.cpp
    runtime/JSTypedArrays.cpp
370
    runtime/JSVariableObject.cpp
oliver@apple.com's avatar
oliver@apple.com committed
371
    runtime/JSWeakMap.cpp
372
    runtime/JSWithScope.cpp
373 374 375
    runtime/JSWrapperObject.cpp
    runtime/LiteralParser.cpp
    runtime/Lookup.cpp
376
    runtime/MapConstructor.cpp
oliver@apple.com's avatar
oliver@apple.com committed
377
    runtime/MapData.cpp
oliver@apple.com's avatar
oliver@apple.com committed
378 379
    runtime/MapIteratorConstructor.cpp
    runtime/MapIteratorPrototype.cpp
380
    runtime/MapPrototype.cpp
381
    runtime/MathObject.cpp
382
    runtime/MemoryStatistics.cpp
383 384 385
    runtime/NameConstructor.cpp
    runtime/NameInstance.cpp
    runtime/NamePrototype.cpp
386 387 388 389 390 391 392 393
    runtime/NativeErrorConstructor.cpp
    runtime/NativeErrorPrototype.cpp
    runtime/NumberConstructor.cpp
    runtime/NumberObject.cpp
    runtime/NumberPrototype.cpp
    runtime/ObjectConstructor.cpp
    runtime/ObjectPrototype.cpp
    runtime/Operations.cpp
394
    runtime/Options.cpp
395 396 397
    runtime/PropertyDescriptor.cpp
    runtime/PropertyNameArray.cpp
    runtime/PropertySlot.cpp
398
    runtime/PropertyTable.cpp
399
    runtime/PrototypeMap.cpp
400
    runtime/RegExp.cpp
401
    runtime/RegExpCache.cpp
402
    runtime/RegExpCachedResult.cpp
403
    runtime/RegExpConstructor.cpp
404
    runtime/RegExpMatchesArray.cpp
405 406
    runtime/RegExpObject.cpp
    runtime/RegExpPrototype.cpp
407
    runtime/SamplingCounter.cpp
oliver@apple.com's avatar
oliver@apple.com committed
408
    runtime/SetConstructor.cpp
oliver@apple.com's avatar
oliver@apple.com committed
409 410
    runtime/SetIteratorConstructor.cpp
    runtime/SetIteratorPrototype.cpp
oliver@apple.com's avatar
oliver@apple.com committed
411
    runtime/SetPrototype.cpp
412
    runtime/SimpleTypedArrayController.cpp
413
    runtime/SmallStrings.cpp
414
    runtime/SparseArrayValueMap.cpp
415
    runtime/StrictEvalActivation.cpp
416 417 418
    runtime/StringConstructor.cpp
    runtime/StringObject.cpp
    runtime/StringPrototype.cpp
419
    runtime/StringRecursionChecker.cpp
420 421
    runtime/Structure.cpp
    runtime/StructureChain.cpp
422
    runtime/StructureRareData.cpp
423
    runtime/SymbolTable.cpp
424
    runtime/TestRunnerUtils.cpp
425 426
    runtime/TypedArrayController.cpp
    runtime/TypedArrayType.cpp
427
    runtime/VM.cpp
428
    runtime/VMEntryScope.cpp
429 430
    runtime/Watchdog.cpp
    runtime/WatchdogNone.cpp
oliver@apple.com's avatar
oliver@apple.com committed
431 432 433
    runtime/WeakMapConstructor.cpp
    runtime/WeakMapData.cpp
    runtime/WeakMapPrototype.cpp
434

435 436 437
    tools/CodeProfile.cpp
    tools/CodeProfiling.cpp

438
    yarr/YarrCanonicalizeUCS2.cpp
439 440
    yarr/YarrInterpreter.cpp
    yarr/YarrJIT.cpp
441
    yarr/YarrPattern.cpp
442
    yarr/YarrSyntaxChecker.cpp
443 444
)

445
set(JavaScriptCore_LUT_FILES
446
    runtime/ArrayConstructor.cpp
447
    runtime/ArrayPrototype.cpp
448 449
    runtime/BooleanPrototype.cpp
    runtime/DateConstructor.cpp
450
    runtime/DatePrototype.cpp
451
    runtime/ErrorPrototype.cpp
452
    runtime/JSDataViewPrototype.cpp
453
    runtime/JSGlobalObject.cpp
454
    runtime/JSONObject.cpp
weinig@apple.com's avatar
weinig@apple.com committed
455 456 457
    runtime/JSPromiseConstructor.cpp
    runtime/JSPromisePrototype.cpp
    runtime/JSPromiseResolverPrototype.cpp
458
    runtime/NamePrototype.cpp
459
    runtime/NumberConstructor.cpp
460
    runtime/NumberPrototype.cpp
barraclough@apple.com's avatar
barraclough@apple.com committed
461
    runtime/ObjectConstructor.cpp
462 463
    runtime/RegExpConstructor.cpp
    runtime/RegExpObject.cpp
464 465
    runtime/RegExpPrototype.cpp
    runtime/StringConstructor.cpp
466 467
)

468
set(JavaScriptCore_LIBRARIES
469
    WTF
470 471
)

472 473 474 475 476 477 478 479 480
if (WTF_USE_ICU_UNICODE)
    list(APPEND JavaScriptCore_INCLUDE_DIRECTORIES
        ${ICU_INCLUDE_DIRS}
    )
    list(APPEND JavaScriptCore_LIBRARIES
        ${ICU_I18N_LIBRARIES}
    )
endif ()

481
if (ENABLE_LLINT)
482 483 484
    # We cannot check for RUBY_FOUND because it is set only when the full package is installed and
    # the only thing we need is the interpreter. Unlike Python, cmake does not provide a macro
    # for finding the only Ruby interpreter.
485 486 487
    if (NOT RUBY_EXECUTABLE)
        message(FATAL_ERROR "The Ruby interpreter is needed to generate LLInt files.")
    endif ()
488

489
    set(LLINT_ASM
490 491 492 493 494
        llint/LowLevelInterpreter.asm
        llint/LowLevelInterpreter32_64.asm
        llint/LowLevelInterpreter64.asm
    )

495
    set(OFFLINE_ASM
496
        offlineasm/arm.rb
497 498 499 500 501 502 503 504 505
        offlineasm/ast.rb
        offlineasm/backends.rb
        offlineasm/cloop.rb
        offlineasm/config.rb
        offlineasm/instructions.rb
        offlineasm/offsets.rb
        offlineasm/opt.rb
        offlineasm/parser.rb
        offlineasm/registers.rb
506
        offlineasm/risc.rb
507 508 509 510 511 512
        offlineasm/self_hash.rb
        offlineasm/settings.rb
        offlineasm/transform.rb
        offlineasm/x86.rb
    )

513
    add_custom_command(
514 515 516 517 518 519
        OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
        MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/offlineasm/generate_offset_extractor.rb
        DEPENDS ${LLINT_ASM} ${OFFLINE_ASM}
        COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/generate_offset_extractor.rb ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
        VERBATIM)

520 521 522 523 524 525 526 527 528
    # We add the header file directly to the ADD_EXECUTABLE call instead of setting the
    # OBJECT_DEPENDS property in LLIntOffsetsExtractor.cpp because generate_offset_extractor.rb may
    # not regenerate it in case the hash it calculates does not change.
    # In this case, if some of the dependencies specified in the ADD_CUSTOM_COMMAND above have
    # changed the command will always be called because the mtime of LLIntDesiredOffsets.h will
    # always be older than that of its dependencies.
    # Additionally, setting the OBJECT_DEPENDS property will make LLIntDesiredOffsets.h a Makefile
    # dependency of both LLIntOffsetsExtractor and LLIntOffsetsExtractor.cpp, so the command will
    # actually be run twice!
529
    add_executable(LLIntOffsetsExtractor
530 531 532
        ${JAVASCRIPTCORE_DIR}/llint/LLIntOffsetsExtractor.cpp
        ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
    )
533
    target_link_libraries(LLIntOffsetsExtractor WTF)
534

535 536 537 538 539 540
    # The build system will execute asm.rb every time LLIntOffsetsExtractor's mtime is newer than
    # LLIntAssembly.h's mtime. The problem we have here is: asm.rb has some built-in optimization
    # that generates a checksum of the LLIntOffsetsExtractor binary, if the checksum of the new
    # LLIntOffsetsExtractor matches, no output is generated. To make this target consistent and avoid
    # running this command for every build, we artificially update LLIntAssembly.h's mtime (using touch)
    # after every asm.rb run.
541
    add_custom_command(
542 543 544 545
        OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
        MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/offlineasm/asm.rb
        DEPENDS LLIntOffsetsExtractor ${LLINT_ASM} ${OFFLINE_ASM}
        COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/asm.rb ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm $<TARGET_FILE:LLIntOffsetsExtractor> ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
546
        COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
547 548
        VERBATIM)

549 550 551
    # The explanation for not making LLIntAssembly.h part of the OBJECT_DEPENDS property of some of
    # the .cpp files below is similar to the one in the previous comment. However, since these .cpp
    # files are used to build JavaScriptCore itself, we can just add LLIntAssembly.h to JSC_HEADERS
552 553
    # since it is used in the add_library() call at the end of this file.
    list(APPEND JavaScriptCore_HEADERS
554 555
        ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
    )
556
    list(APPEND JavaScriptCore_SOURCES
557 558
        llint/LLIntCLoop.cpp
        llint/LLIntData.cpp
559
        llint/LLIntEntrypoint.cpp
560 561 562 563 564
        llint/LLIntExceptions.cpp
        llint/LLIntSlowPaths.cpp
        llint/LLIntThunks.cpp
        llint/LowLevelInterpreter.cpp
    )
565
endif ()
566

567 568 569 570 571 572 573 574 575 576
set(HASH_LUT_GENERATOR ${CMAKE_CURRENT_SOURCE_DIR}/create_hash_table)
macro(GENERATE_HASH_LUT _input _output)
    add_custom_command(
        OUTPUT ${_output}
        DEPENDS ${HASH_LUT_GENERATOR} ${_input}
        COMMAND ${PERL_EXECUTABLE} ${HASH_LUT_GENERATOR} ${_input} -i > ${_output}
        VERBATIM)
    list(APPEND JavaScriptCore_HEADERS ${_output})
endmacro()

577
# GENERATOR 1-A: LUT creator
578 579
foreach (_file ${JavaScriptCore_LUT_FILES})
    get_filename_component(_name ${_file} NAME_WE)
580
    GENERATE_HASH_LUT(${CMAKE_CURRENT_SOURCE_DIR}/${_file} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${_name}.lut.h)
581
endforeach ()
582

583
set(JavaScriptCore_FORWARDING_HEADERS_DIRECTORIES
584 585 586 587 588
    assembler
    bytecode
    collector/handles
    debugger
    heap
589
    inspector
590 591 592 593 594 595 596 597 598
    interpreter
    jit
    llint
    parser
    profiler
    runtime
    yarr
)

599
set(JavaScriptCore_FORWARDING_HEADERS_FILES
600 601 602
    API/APICast.h
    API/APIShims.h
    API/JSBase.h
603
    API/JSCTestRunnerUtils.h
604 605 606 607
    API/JSContextRef.h
    API/JSContextRefPrivate.h
    API/JSObjectRef.h
    API/JSObjectRefPrivate.h
608
    API/JSRetainPtr.h
609
    API/JSScriptRefPrivate.h
610 611
    API/JSStringRef.h
    API/JSStringRefBSTR.h
612
    API/JSStringRefCF.h
613 614 615
    API/JSValueRef.h
    API/JSWeakObjectMapRefInternal.h
    API/JSWeakObjectMapRefPrivate.h
616 617
    API/JavaScript.h
    API/JavaScriptCore.h
618 619 620 621
    API/OpaqueJSString.h
    API/WebKitAvailability.h
)

622 623

# GENERATOR 1-B: particular LUT creator (for 1 file only)
624
GENERATE_HASH_LUT(${CMAKE_CURRENT_SOURCE_DIR}/parser/Keywords.table ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/Lexer.lut.h)
625 626

#GENERATOR: "RegExpJitTables.h": tables used by Yarr
627
add_custom_command(
628
    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
629 630
    MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/create_regex_tables
    COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/create_regex_tables > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
631
    VERBATIM)
632
ADD_SOURCE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/yarr/YarrPattern.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h)
633 634


635
#GENERATOR: "KeywordLookup.h": keyword decision tree used by the lexer
636
add_custom_command(
637
    OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h
638 639
    MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/KeywordLookupGenerator.py
    COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/KeywordLookupGenerator.py ${CMAKE_CURRENT_SOURCE_DIR}/parser/Keywords.table > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h
640
    VERBATIM)
641
ADD_SOURCE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/parser/Lexer.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h)
642

643 644
if (WTF_CPU_ARM)
    list(APPEND JavaScriptCore_SOURCES
645
        assembler/ARMAssembler.cpp
646
        assembler/ARMv7Assembler.cpp
647 648
        assembler/MacroAssemblerARM.cpp
    )
649 650 651 652
    if (MSVC AND ENABLE_JIT)
        add_custom_command(
            OUTPUT ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm
            MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/create_jit_stubs
653
            DEPENDS ${JAVASCRIPTCORE_DIR}/jit/JITStubsARM.h
654
            DEPENDS ${JAVASCRIPTCORE_DIR}/jit/JITStubs.cpp
655
            COMMAND ${PERL_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/create_jit_stubs --prefix=MSVC --header ${JAVASCRIPTCORE_DIR}/jit/JITStubsARM.h ${JAVASCRIPTCORE_DIR}/jit/JITStubs.cpp > ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm
656 657 658 659 660 661 662 663 664 665
            VERBATIM)

        add_custom_command(
            OUTPUT ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.obj
            MAIN_DEPENDENCY ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm
            COMMAND armasm -nologo ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.obj
            VERBATIM)

        list(APPEND JavaScriptCore_SOURCES ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.obj)
    endif ()
666
elseif (WTF_CPU_MIPS)
667
elseif (WTF_CPU_SH4)
668
elseif (WTF_CPU_X86)
669 670 671
    list(APPEND JavaScriptCore_SOURCES
        assembler/MacroAssemblerX86Common.cpp
    )
672
elseif (WTF_CPU_X86_64)
673 674 675 676 677 678 679 680 681
    if (MSVC AND ENABLE_JIT)
        add_custom_command(
            OUTPUT ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj
            MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/jit/JITStubsMSVC64.asm
            COMMAND ml64 -nologo -c -Fo ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj ${JAVASCRIPTCORE_DIR}/jit/JITStubsMSVC64.asm
            VERBATIM)

        list(APPEND JavaScriptCore_SOURCES ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj)
    endif ()
682 683 684
    list(APPEND JavaScriptCore_SOURCES
        assembler/MacroAssemblerX86Common.cpp
    )
685 686 687
else ()
    message(FATAL_ERROR "Unknown CPU")
endif ()
688 689


690
WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
691

692 693
WEBKIT_CREATE_FORWARDING_HEADERS(JavaScriptCore DIRECTORIES ${JavaScriptCore_FORWARDING_HEADERS_DIRECTORIES} FILES ${JavaScriptCore_FORWARDING_HEADERS_FILES})

694

695
add_subdirectory(shell)
696 697

WEBKIT_WRAP_SOURCELIST(${JavaScriptCore_SOURCES})
698
include_directories(${JavaScriptCore_INCLUDE_DIRECTORIES})
699
add_definitions(-DSTATICALLY_LINKED_WITH_WTF)
700 701
add_library(JavaScriptCore ${JavaScriptCore_LIBRARY_TYPE} ${JavaScriptCore_HEADERS} ${JavaScriptCore_SOURCES})
target_link_libraries(JavaScriptCore ${JavaScriptCore_LIBRARIES})
702
set_target_properties(JavaScriptCore PROPERTIES COMPILE_DEFINITIONS "BUILDING_JavaScriptCore")
703 704 705 706 707 708
set_target_properties(JavaScriptCore PROPERTIES FOLDER "JavaScriptCore")
set_target_properties(JavaScriptCore PROPERTIES LINK_INTERFACE_LIBRARIES "")

if (JavaScriptCore_OUTPUT_NAME)
    set_target_properties(JavaScriptCore PROPERTIES OUTPUT_NAME ${JavaScriptCore_OUTPUT_NAME})
endif ()
709 710

if (SHARED_CORE)
711 712
    set_target_properties(JavaScriptCore PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
    install(TARGETS JavaScriptCore DESTINATION "${LIB_INSTALL_DIR}")
713
endif ()