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