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