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