178db8190878dd5ba095054bcb344e74f7faf873
[WebKit-https.git] / Source / JavaScriptCore / CMakeLists.txt
1 set(JavaScriptCore_INCLUDE_DIRECTORIES
2     "${CMAKE_BINARY_DIR}"
3     "${JAVASCRIPTCORE_DIR}"
4     "${JAVASCRIPTCORE_DIR}/API"
5     "${JAVASCRIPTCORE_DIR}/ForwardingHeaders"
6     "${JAVASCRIPTCORE_DIR}/assembler"
7     "${JAVASCRIPTCORE_DIR}/bytecode"
8     "${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}/interpreter"
15     "${JAVASCRIPTCORE_DIR}/jit"
16     "${JAVASCRIPTCORE_DIR}/llint"
17     "${JAVASCRIPTCORE_DIR}/parser"
18     "${JAVASCRIPTCORE_DIR}/profiler"
19     "${JAVASCRIPTCORE_DIR}/runtime"
20     "${JAVASCRIPTCORE_DIR}/tools"
21     "${JAVASCRIPTCORE_DIR}/yarr"
22     "${WTF_DIR}"
23     "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}"
24     "${CMAKE_SOURCE_DIR}/Source"
25 )
26
27 set(JavaScriptCore_SOURCES
28     API/JSBase.cpp
29     API/JSCTestRunnerUtils.cpp
30     API/JSCallbackConstructor.cpp
31     API/JSCallbackFunction.cpp
32     API/JSCallbackObject.cpp
33     API/JSClassRef.cpp
34     API/JSContextRef.cpp
35     API/JSObjectRef.cpp
36     API/JSProfilerPrivate.cpp
37     API/JSScriptRef.cpp
38     API/JSStringRef.cpp
39     API/JSValueRef.cpp
40     API/JSWeakObjectMapRefPrivate.cpp
41     API/OpaqueJSString.cpp
42
43     assembler/MacroAssembler.cpp
44     assembler/LinkBuffer.cpp
45     assembler/MacroAssemblerX86Common.cpp
46
47     bytecode/ArrayAllocationProfile.cpp
48     bytecode/ArrayProfile.cpp
49     bytecode/CallLinkInfo.cpp
50     bytecode/CallLinkStatus.cpp
51     bytecode/CodeBlock.cpp
52     bytecode/CodeBlockHash.cpp
53     bytecode/CodeOrigin.cpp
54     bytecode/CodeType.cpp
55     bytecode/DFGExitProfile.cpp
56     bytecode/DeferredCompilationCallback.cpp
57     bytecode/ExecutionCounter.cpp
58     bytecode/ExitKind.cpp
59     bytecode/GetByIdStatus.cpp
60     bytecode/JumpTable.cpp
61     bytecode/LazyOperandValueProfile.cpp
62     bytecode/MethodOfGettingAValueProfile.cpp
63     bytecode/Opcode.cpp
64     bytecode/PolymorphicPutByIdList.cpp
65     bytecode/PreciseJumpTargets.cpp
66     bytecode/PutByIdStatus.cpp
67     bytecode/ReduceWhitespace.cpp
68     bytecode/SamplingTool.cpp
69     bytecode/SpecialPointer.cpp
70     bytecode/SpeculatedType.cpp
71     bytecode/StructureStubClearingWatchpoint.cpp
72     bytecode/StructureStubInfo.cpp
73     bytecode/UnlinkedCodeBlock.cpp
74     bytecode/Watchpoint.cpp
75
76     bytecompiler/BytecodeGenerator.cpp
77     bytecompiler/NodesCodegen.cpp
78
79     dfg/DFGAbstractHeap.cpp
80     dfg/DFGAbstractValue.cpp
81     dfg/DFGArgumentsSimplificationPhase.cpp
82     dfg/DFGArrayMode.cpp
83     dfg/DFGAssemblyHelpers.cpp
84     dfg/DFGAtTailAbstractState.cpp
85     dfg/DFGBackwardsPropagationPhase.cpp
86     dfg/DFGBasicBlock.cpp
87     dfg/DFGBinarySwitch.cpp
88     dfg/DFGBlockInsertionSet.cpp
89     dfg/DFGByteCodeParser.cpp
90     dfg/DFGCFAPhase.cpp
91     dfg/DFGCFGSimplificationPhase.cpp
92     dfg/DFGCPSRethreadingPhase.cpp
93     dfg/DFGCSEPhase.cpp
94     dfg/DFGCapabilities.cpp
95     dfg/DFGClobberSet.cpp
96     dfg/DFGClobberize.cpp
97     dfg/DFGCommon.cpp
98     dfg/DFGCommonData.cpp
99     dfg/DFGConstantFoldingPhase.cpp
100     dfg/DFGCriticalEdgeBreakingPhase.cpp
101     dfg/DFGDCEPhase.cpp
102     dfg/DFGDesiredIdentifiers.cpp
103     dfg/DFGDesiredStructureChains.cpp
104     dfg/DFGDesiredTransitions.cpp
105     dfg/DFGDesiredWatchpoints.cpp
106     dfg/DFGDesiredWeakReferences.cpp
107     dfg/DFGDesiredWriteBarriers.cpp
108     dfg/DFGDisassembler.cpp
109     dfg/DFGDominators.cpp
110     dfg/DFGDriver.cpp
111     dfg/DFGEdge.cpp
112     dfg/DFGFailedFinalizer.cpp
113     dfg/DFGFinalizer.cpp
114     dfg/DFGFixupPhase.cpp
115     dfg/DFGFlushFormat.cpp
116     dfg/DFGFlushLivenessAnalysisPhase.cpp
117     dfg/DFGGraph.cpp
118     dfg/DFGInPlaceAbstractState.cpp
119     dfg/DFGJITCode.cpp
120     dfg/DFGJITCompiler.cpp
121     dfg/DFGJITFinalizer.cpp
122     dfg/DFGLICMPhase.cpp
123     dfg/DFGLazyJSValue.cpp
124     dfg/DFGLivenessAnalysisPhase.cpp
125     dfg/DFGLongLivedState.cpp
126     dfg/DFGLoopPreHeaderCreationPhase.cpp
127     dfg/DFGMinifiedNode.cpp
128     dfg/DFGNaturalLoops.cpp
129     dfg/DFGNode.cpp
130     dfg/DFGNodeFlags.cpp
131     dfg/DFGOSRAvailabilityAnalysisPhase.cpp
132     dfg/DFGOSREntry.cpp
133     dfg/DFGOSRExit.cpp
134     dfg/DFGOSRExitBase.cpp
135     dfg/DFGOSRExitCompiler.cpp
136     dfg/DFGOSRExitCompiler32_64.cpp
137     dfg/DFGOSRExitCompiler64.cpp
138     dfg/DFGOSRExitCompilerCommon.cpp
139     dfg/DFGOSRExitJumpPlaceholder.cpp
140     dfg/DFGOSRExitPreparation.cpp
141     dfg/DFGOperations.cpp
142     dfg/DFGPhase.cpp
143     dfg/DFGPlan.cpp
144     dfg/DFGPredictionInjectionPhase.cpp
145     dfg/DFGPredictionPropagationPhase.cpp
146     dfg/DFGRepatch.cpp
147     dfg/DFGSSAConversionPhase.cpp
148     dfg/DFGSpeculativeJIT.cpp
149     dfg/DFGSpeculativeJIT32_64.cpp
150     dfg/DFGSpeculativeJIT64.cpp
151     dfg/DFGThunks.cpp
152     dfg/DFGTypeCheckHoistingPhase.cpp
153     dfg/DFGUnificationPhase.cpp
154     dfg/DFGUseKind.cpp
155     dfg/DFGValidate.cpp
156     dfg/DFGValueSource.cpp
157     dfg/DFGVariableAccessDataDump.cpp
158     dfg/DFGVariableEvent.cpp
159     dfg/DFGVariableEventStream.cpp
160     dfg/DFGVirtualRegisterAllocationPhase.cpp
161     dfg/DFGWorklist.cpp
162
163     disassembler/ARMv7Disassembler.cpp
164     disassembler/Disassembler.cpp
165     disassembler/LLVMDisassembler.cpp
166     disassembler/UDis86Disassembler.cpp
167     disassembler/X86Disassembler.cpp
168
169     heap/BlockAllocator.cpp
170     heap/CopiedSpace.cpp
171     heap/CopyVisitor.cpp
172     heap/ConservativeRoots.cpp
173     heap/DFGCodeBlocks.cpp
174     heap/GCIncomingRefCountedSet.h
175     heap/GCIncomingRefCounted.h
176     heap/GCIncomingRefCountedSetInlines.h
177     heap/GCIncomingRefCountedInlines.h
178     heap/GCThread.cpp
179     heap/GCThreadSharedData.cpp
180     heap/HandleSet.cpp
181     heap/HandleStack.cpp
182     heap/Heap.cpp
183     heap/HeapStatistics.cpp
184     heap/HeapTimer.cpp
185     heap/IncrementalSweeper.cpp
186     heap/JITStubRoutineSet.cpp
187     heap/MachineStackMarker.cpp
188
189     heap/BlockAllocator.cpp
190     heap/ConservativeRoots.cpp
191     heap/CopiedSpace.cpp
192     heap/CopyVisitor.cpp
193     heap/DFGCodeBlocks.cpp
194     heap/GCThread.cpp
195     heap/GCThreadSharedData.cpp
196     heap/HandleSet.cpp
197     heap/HandleStack.cpp
198     heap/Heap.cpp
199     heap/HeapStatistics.cpp
200     heap/HeapTimer.cpp
201     heap/JITStubRoutineSet.cpp
202     heap/MachineStackMarker.cpp
203     heap/MarkStack.cpp
204     heap/MarkedAllocator.cpp
205     heap/MarkedBlock.cpp
206     heap/MarkedSpace.cpp
207     heap/SlotVisitor.cpp
208     heap/SuperRegion.cpp
209     heap/VTableSpectrum.cpp
210     heap/Weak.cpp
211     heap/WeakBlock.cpp
212     heap/WeakHandleOwner.cpp
213     heap/WeakSet.cpp
214     heap/WriteBarrierSupport.cpp
215
216     debugger/Debugger.cpp
217     debugger/DebuggerActivation.cpp
218     debugger/DebuggerCallFrame.cpp
219
220     interpreter/AbstractPC.cpp
221     interpreter/CallFrame.cpp
222     interpreter/Interpreter.cpp
223     interpreter/JSStack.cpp
224     interpreter/StackIterator.cpp
225     interpreter/VMInspector.cpp
226
227     jit/ClosureCallStubRoutine.cpp
228     jit/ExecutableAllocator.cpp
229     jit/ExecutableAllocatorFixedVMPool.cpp
230     jit/GCAwareJITStubRoutine.cpp
231     jit/HostCallReturnValue.cpp
232     jit/JIT.cpp
233     jit/JITArithmetic.cpp
234     jit/JITArithmetic32_64.cpp
235     jit/JITCall.cpp
236     jit/JITCall32_64.cpp
237     jit/JITCode.cpp
238     jit/JITDisassembler.cpp
239     jit/JITExceptions.cpp
240     jit/JITOpcodes.cpp
241     jit/JITOpcodes32_64.cpp
242     jit/JITPropertyAccess.cpp
243     jit/JITPropertyAccess32_64.cpp
244     jit/JITStubRoutine.cpp
245     jit/JITStubs.cpp
246     jit/JITThunks.cpp
247     jit/JITToDFGDeferredCompilationCallback.cpp
248     jit/JumpReplacementWatchpoint.cpp
249     jit/ThunkGenerators.cpp
250
251     parser/Lexer.cpp
252     parser/Nodes.cpp
253     parser/Parser.cpp
254     parser/ParserArena.cpp
255     parser/SourceCode.cpp
256     parser/SourceProvider.cpp
257     parser/SourceProviderCache.cpp
258
259     profiler/ProfilerBytecode.cpp
260     profiler/ProfilerBytecodeSequence.cpp
261     profiler/ProfilerBytecodes.cpp
262     profiler/ProfilerCompilation.cpp
263     profiler/ProfilerCompilationKind.cpp
264     profiler/ProfilerCompiledBytecode.cpp
265     profiler/ProfilerDatabase.cpp
266     profiler/ProfilerOrigin.cpp
267     profiler/ProfilerOriginStack.cpp
268     profiler/ProfilerOSRExit.cpp
269     profiler/ProfilerOSRExitSite.cpp
270     profiler/ProfilerProfiledBytecodes.cpp
271     profiler/Profile.cpp
272     profiler/ProfileGenerator.cpp
273     profiler/ProfileNode.cpp
274     profiler/LegacyProfiler.cpp
275
276     runtime/ArgList.cpp
277     runtime/Arguments.cpp
278     runtime/ArrayBuffer.cpp
279     runtime/ArrayBufferView.cpp
280     runtime/ArrayConstructor.cpp
281     runtime/ArrayPrototype.cpp
282     runtime/BooleanConstructor.cpp
283     runtime/BooleanObject.cpp
284     runtime/BooleanPrototype.cpp
285     runtime/CallData.cpp
286     runtime/CodeCache.cpp
287     runtime/CodeSpecializationKind.cpp
288     runtime/CommonIdentifiers.cpp
289     runtime/CommonSlowPaths.cpp
290     runtime/CommonSlowPathsExceptions.cpp
291     runtime/CompilationResult.cpp
292     runtime/Completion.cpp
293     runtime/ConstructData.cpp
294     runtime/DataView.cpp
295     runtime/DataView.h
296     runtime/DateConstructor.cpp
297     runtime/DateConversion.cpp
298     runtime/DateInstance.cpp
299     runtime/DatePrototype.cpp
300     runtime/DumpContext.cpp
301     runtime/Error.cpp
302     runtime/ErrorConstructor.cpp
303     runtime/ErrorInstance.cpp
304     runtime/ErrorPrototype.cpp
305     runtime/ExceptionHelpers.cpp
306     runtime/Executable.cpp
307     runtime/FunctionConstructor.cpp
308     runtime/FunctionExecutableDump.cpp
309     runtime/FunctionPrototype.cpp
310     runtime/GCActivityCallback.cpp
311     runtime/GetterSetter.cpp
312     runtime/Identifier.cpp
313     runtime/IndexingType.cpp
314     runtime/InitializeThreading.cpp
315     runtime/IntendedStructureChain.cpp
316     runtime/InternalFunction.cpp
317     runtime/JSAPIValueWrapper.cpp
318     runtime/JSActivation.cpp
319     runtime/JSArray.cpp
320     runtime/JSArrayBuffer.cpp
321     runtime/JSArrayBufferConstructor.cpp
322     runtime/JSArrayBufferPrototype.cpp
323     runtime/JSArrayBufferView.cpp
324     runtime/JSBoundFunction.cpp
325     runtime/JSCJSValue.cpp
326     runtime/JSCell.cpp
327     runtime/JSChunk.cpp
328     runtime/JSDataView.cpp
329     runtime/JSDataViewPrototype.cpp
330     runtime/JSDateMath.cpp
331     runtime/JSFunction.cpp
332     runtime/JSGlobalObject.cpp
333     runtime/JSGlobalObjectFunctions.cpp
334     runtime/JSLock.cpp
335     runtime/JSNameScope.cpp
336     runtime/JSNotAnObject.cpp
337     runtime/JSONObject.cpp
338     runtime/JSObject.cpp
339     runtime/JSPromise.cpp
340     runtime/JSPromiseCallback.cpp
341     runtime/JSPromiseConstructor.cpp
342     runtime/JSPromisePrototype.cpp
343     runtime/JSPromiseResolver.cpp
344     runtime/JSPromiseResolverConstructor.cpp
345     runtime/JSPromiseResolverPrototype.cpp
346     runtime/JSPropertyNameIterator.cpp
347     runtime/JSProxy.cpp
348     runtime/JSScope.cpp
349     runtime/JSSegmentedVariableObject.cpp
350     runtime/JSStaticScopeObject.cpp
351     runtime/JSString.cpp
352     runtime/JSStringJoiner.cpp
353     runtime/JSSymbolTableObject.cpp
354     runtime/JSTypedArrayConstructors.cpp
355     runtime/JSTypedArrayPrototypes.cpp
356     runtime/JSTypedArrays.cpp
357     runtime/JSVariableObject.cpp
358     runtime/JSWithScope.cpp
359     runtime/JSWrapperObject.cpp
360     runtime/LiteralParser.cpp
361     runtime/Lookup.cpp
362     runtime/MathObject.cpp
363     runtime/MemoryStatistics.cpp
364     runtime/NameConstructor.cpp
365     runtime/NameInstance.cpp
366     runtime/NamePrototype.cpp
367     runtime/NativeErrorConstructor.cpp
368     runtime/NativeErrorPrototype.cpp
369     runtime/NumberConstructor.cpp
370     runtime/NumberObject.cpp
371     runtime/NumberPrototype.cpp
372     runtime/ObjectConstructor.cpp
373     runtime/ObjectPrototype.cpp
374     runtime/Operations.cpp
375     runtime/Options.cpp
376     runtime/PropertyDescriptor.cpp
377     runtime/PropertyNameArray.cpp
378     runtime/PropertySlot.cpp
379     runtime/PropertyTable.cpp
380     runtime/PrototypeMap.cpp
381     runtime/RegExp.cpp
382     runtime/RegExpCache.cpp
383     runtime/RegExpCachedResult.cpp
384     runtime/RegExpConstructor.cpp
385     runtime/RegExpMatchesArray.cpp
386     runtime/RegExpObject.cpp
387     runtime/RegExpPrototype.cpp
388     runtime/SamplingCounter.cpp
389     runtime/SimpleTypedArrayController.cpp
390     runtime/SmallStrings.cpp
391     runtime/SparseArrayValueMap.cpp
392     runtime/StrictEvalActivation.cpp
393     runtime/StringConstructor.cpp
394     runtime/StringObject.cpp
395     runtime/StringPrototype.cpp
396     runtime/StringRecursionChecker.cpp
397     runtime/Structure.cpp
398     runtime/StructureChain.cpp
399     runtime/StructureRareData.cpp
400     runtime/SymbolTable.cpp
401     runtime/TypedArrayController.cpp
402     runtime/TypedArrayType.cpp
403     runtime/VM.cpp
404     runtime/Watchdog.cpp
405     runtime/WatchdogNone.cpp
406
407     tools/CodeProfile.cpp
408     tools/CodeProfiling.cpp
409
410     yarr/YarrCanonicalizeUCS2.cpp
411     yarr/YarrPattern.cpp
412     yarr/YarrInterpreter.cpp
413     yarr/YarrJIT.cpp
414     yarr/YarrSyntaxChecker.cpp
415 )
416
417 set(JavaScriptCore_LUT_FILES
418     runtime/ArrayConstructor.cpp
419     runtime/ArrayPrototype.cpp
420     runtime/BooleanPrototype.cpp
421     runtime/DateConstructor.cpp
422     runtime/DatePrototype.cpp
423     runtime/ErrorPrototype.cpp
424     runtime/JSDataViewPrototype.cpp
425     runtime/JSGlobalObject.cpp
426     runtime/JSONObject.cpp
427     runtime/JSPromiseConstructor.cpp
428     runtime/JSPromisePrototype.cpp
429     runtime/JSPromiseResolverPrototype.cpp
430     runtime/NamePrototype.cpp
431     runtime/NumberConstructor.cpp
432     runtime/NumberPrototype.cpp
433     runtime/ObjectConstructor.cpp
434     runtime/RegExpConstructor.cpp
435     runtime/RegExpObject.cpp
436     runtime/RegExpPrototype.cpp
437     runtime/StringConstructor.cpp
438 )
439
440 set(JavaScriptCore_LIBRARIES
441     WTF
442 )
443
444 if (WTF_USE_ICU_UNICODE)
445     list(APPEND JavaScriptCore_INCLUDE_DIRECTORIES
446         ${ICU_INCLUDE_DIRS}
447     )
448     list(APPEND JavaScriptCore_LIBRARIES
449         ${ICU_I18N_LIBRARIES}
450     )
451 endif ()
452
453 if (ENABLE_LLINT)
454     # We cannot check for RUBY_FOUND because it is set only when the full package is installed and
455     # the only thing we need is the interpreter. Unlike Python, cmake does not provide a macro
456     # for finding the only Ruby interpreter.
457     if (NOT RUBY_EXECUTABLE)
458         message(FATAL_ERROR "The Ruby interpreter is needed to generate LLInt files.")
459     endif ()
460
461     set(LLINT_ASM
462         llint/LowLevelInterpreter.asm
463         llint/LowLevelInterpreter32_64.asm
464         llint/LowLevelInterpreter64.asm
465     )
466
467     set(OFFLINE_ASM
468         offlineasm/arm.rb
469         offlineasm/ast.rb
470         offlineasm/backends.rb
471         offlineasm/cloop.rb
472         offlineasm/config.rb
473         offlineasm/instructions.rb
474         offlineasm/offsets.rb
475         offlineasm/opt.rb
476         offlineasm/parser.rb
477         offlineasm/registers.rb
478         offlineasm/risc.rb
479         offlineasm/self_hash.rb
480         offlineasm/settings.rb
481         offlineasm/transform.rb
482         offlineasm/x86.rb
483     )
484
485     add_custom_command(
486         OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
487         MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/offlineasm/generate_offset_extractor.rb
488         DEPENDS ${LLINT_ASM} ${OFFLINE_ASM}
489         COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/generate_offset_extractor.rb ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
490         VERBATIM)
491
492     # We add the header file directly to the ADD_EXECUTABLE call instead of setting the
493     # OBJECT_DEPENDS property in LLIntOffsetsExtractor.cpp because generate_offset_extractor.rb may
494     # not regenerate it in case the hash it calculates does not change.
495     # In this case, if some of the dependencies specified in the ADD_CUSTOM_COMMAND above have
496     # changed the command will always be called because the mtime of LLIntDesiredOffsets.h will
497     # always be older than that of its dependencies.
498     # Additionally, setting the OBJECT_DEPENDS property will make LLIntDesiredOffsets.h a Makefile
499     # dependency of both LLIntOffsetsExtractor and LLIntOffsetsExtractor.cpp, so the command will
500     # actually be run twice!
501     add_executable(LLIntOffsetsExtractor
502         ${JAVASCRIPTCORE_DIR}/llint/LLIntOffsetsExtractor.cpp
503         ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntDesiredOffsets.h
504     )
505     target_link_libraries(LLIntOffsetsExtractor WTF)
506
507     # The build system will execute asm.rb every time LLIntOffsetsExtractor's mtime is newer than
508     # LLIntAssembly.h's mtime. The problem we have here is: asm.rb has some built-in optimization
509     # that generates a checksum of the LLIntOffsetsExtractor binary, if the checksum of the new
510     # LLIntOffsetsExtractor matches, no output is generated. To make this target consistent and avoid
511     # running this command for every build, we artificially update LLIntAssembly.h's mtime (using touch)
512     # after every asm.rb run.
513     add_custom_command(
514         OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
515         MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/offlineasm/asm.rb
516         DEPENDS LLIntOffsetsExtractor ${LLINT_ASM} ${OFFLINE_ASM}
517         COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/asm.rb ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm $<TARGET_FILE:LLIntOffsetsExtractor> ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
518         COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
519         VERBATIM)
520
521     # The explanation for not making LLIntAssembly.h part of the OBJECT_DEPENDS property of some of
522     # the .cpp files below is similar to the one in the previous comment. However, since these .cpp
523     # files are used to build JavaScriptCore itself, we can just add LLIntAssembly.h to JSC_HEADERS
524     # since it is used in the add_library() call at the end of this file.
525     list(APPEND JavaScriptCore_HEADERS
526         ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/LLIntAssembly.h
527     )
528     list(APPEND JavaScriptCore_SOURCES
529         llint/LLIntCLoop.cpp
530         llint/LLIntData.cpp
531         llint/LLIntEntrypoints.cpp
532         llint/LLIntExceptions.cpp
533         llint/LLIntSlowPaths.cpp
534         llint/LLIntThunks.cpp
535         llint/LowLevelInterpreter.cpp
536     )
537 endif ()
538
539 set(HASH_LUT_GENERATOR ${CMAKE_CURRENT_SOURCE_DIR}/create_hash_table)
540 macro(GENERATE_HASH_LUT _input _output)
541     add_custom_command(
542         OUTPUT ${_output}
543         DEPENDS ${HASH_LUT_GENERATOR} ${_input}
544         COMMAND ${PERL_EXECUTABLE} ${HASH_LUT_GENERATOR} ${_input} -i > ${_output}
545         VERBATIM)
546     list(APPEND JavaScriptCore_HEADERS ${_output})
547 endmacro()
548
549 # GENERATOR 1-A: LUT creator
550 foreach (_file ${JavaScriptCore_LUT_FILES})
551     get_filename_component(_name ${_file} NAME_WE)
552     GENERATE_HASH_LUT(${CMAKE_CURRENT_SOURCE_DIR}/${_file} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${_name}.lut.h)
553 endforeach ()
554
555 set(JavaScriptCore_FORWARDING_HEADERS_DIRECTORIES
556     assembler
557     bytecode
558     collector/handles
559     debugger
560     heap
561     interpreter
562     jit
563     llint
564     parser
565     profiler
566     runtime
567     yarr
568 )
569
570 set(JavaScriptCore_FORWARDING_HEADERS_FILES
571     API/APICast.h
572     API/APIShims.h
573     API/JavaScript.h
574     API/JSBase.h
575     API/JSCTestRunnerUtils.h
576     API/JSContextRef.h
577     API/JSContextRefPrivate.h
578     API/JSObjectRef.h
579     API/JSObjectRefPrivate.h
580     API/JSScriptRefPrivate.h
581     API/JSStringRef.h
582     API/JSStringRefCF.h
583     API/JSStringRefBSTR.h
584     API/JSValueRef.h
585     API/JavaScriptCore.h
586     API/JSRetainPtr.h
587     API/JSWeakObjectMapRefInternal.h
588     API/JSWeakObjectMapRefPrivate.h
589     API/JSRetainPtr.h
590     API/OpaqueJSString.h
591     API/WebKitAvailability.h
592 )
593
594
595 # GENERATOR 1-B: particular LUT creator (for 1 file only)
596 GENERATE_HASH_LUT(${CMAKE_CURRENT_SOURCE_DIR}/parser/Keywords.table ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/Lexer.lut.h)
597
598 #GENERATOR: "RegExpJitTables.h": tables used by Yarr
599 add_custom_command(
600     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
601     MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/create_regex_tables
602     COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/create_regex_tables > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
603     VERBATIM)
604 ADD_SOURCE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/yarr/YarrPattern.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h)
605
606
607 #GENERATOR: "KeywordLookup.h": keyword decision tree used by the lexer
608 add_custom_command(
609     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h
610     MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/KeywordLookupGenerator.py
611     COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/KeywordLookupGenerator.py ${CMAKE_CURRENT_SOURCE_DIR}/parser/Keywords.table > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h
612     VERBATIM)
613 ADD_SOURCE_DEPENDENCIES(${CMAKE_CURRENT_SOURCE_DIR}/parser/Lexer.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h)
614
615 if (WTF_CPU_ARM)
616     list(APPEND JavaScriptCore_SOURCES
617         assembler/ARMAssembler.cpp
618         assembler/ARMv7Assembler.cpp
619         assembler/MacroAssemblerARM.cpp
620     )
621     if (MSVC AND ENABLE_JIT)
622         add_custom_command(
623             OUTPUT ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm
624             MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/create_jit_stubs
625             DEPENDS ${JAVASCRIPTCORE_DIR}/jit/JITStubsARM.h
626             DEPENDS ${JAVASCRIPTCORE_DIR}/jit/JITStubs.cpp
627             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
628             VERBATIM)
629
630         add_custom_command(
631             OUTPUT ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.obj
632             MAIN_DEPENDENCY ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm
633             COMMAND armasm -nologo ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.asm ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.obj
634             VERBATIM)
635
636         list(APPEND JavaScriptCore_SOURCES ${DERIVED_SOURCES_DIR}/GeneratedJITStubs.obj)
637     endif ()
638 elseif (WTF_CPU_MIPS)
639 elseif (WTF_CPU_X86)
640     list(APPEND JavaScriptCore_SOURCES
641         assembler/MacroAssemblerX86Common.cpp
642     )
643 elseif (WTF_CPU_X86_64)
644     if (MSVC AND ENABLE_JIT)
645         add_custom_command(
646             OUTPUT ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj
647             MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/jit/JITStubsMSVC64.asm
648             COMMAND ml64 -nologo -c -Fo ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj ${JAVASCRIPTCORE_DIR}/jit/JITStubsMSVC64.asm
649             VERBATIM)
650
651         list(APPEND JavaScriptCore_SOURCES ${DERIVED_SOURCES_DIR}/JITStubsMSVC64.obj)
652     endif ()
653     list(APPEND JavaScriptCore_SOURCES
654         assembler/MacroAssemblerX86Common.cpp
655     )
656 else ()
657     message(FATAL_ERROR "Unknown CPU")
658 endif ()
659
660
661 WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
662
663 WEBKIT_CREATE_FORWARDING_HEADERS(JavaScriptCore DIRECTORIES ${JavaScriptCore_FORWARDING_HEADERS_DIRECTORIES} FILES ${JavaScriptCore_FORWARDING_HEADERS_FILES})
664
665
666 add_subdirectory(shell)
667
668 WEBKIT_WRAP_SOURCELIST(${JavaScriptCore_SOURCES})
669 include_directories(${JavaScriptCore_INCLUDE_DIRECTORIES})
670 add_definitions(-DBUILDING_JavaScriptCore -DSTATICALLY_LINKED_WITH_WTF)
671 add_library(JavaScriptCore ${JavaScriptCore_LIBRARY_TYPE} ${JavaScriptCore_HEADERS} ${JavaScriptCore_SOURCES})
672 target_link_libraries(JavaScriptCore ${JavaScriptCore_LIBRARIES})
673 set_target_properties(JavaScriptCore PROPERTIES FOLDER "JavaScriptCore")
674 set_target_properties(JavaScriptCore PROPERTIES LINK_INTERFACE_LIBRARIES "")
675
676 if (JavaScriptCore_OUTPUT_NAME)
677     set_target_properties(JavaScriptCore PROPERTIES OUTPUT_NAME ${JavaScriptCore_OUTPUT_NAME})
678 endif ()
679
680 if (SHARED_CORE)
681     set_target_properties(JavaScriptCore PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
682     install(TARGETS JavaScriptCore DESTINATION "${LIB_INSTALL_DIR}")
683 endif ()