d9d6231d787a1875b329697770f62c534d3cfc22
[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}/heap"
11     "${JAVASCRIPTCORE_DIR}/debugger"
12     "${JAVASCRIPTCORE_DIR}/interpreter"
13     "${JAVASCRIPTCORE_DIR}/jit"
14     "${JAVASCRIPTCORE_DIR}/llint"
15     "${JAVASCRIPTCORE_DIR}/parser"
16     "${JAVASCRIPTCORE_DIR}/profiler"
17     "${JAVASCRIPTCORE_DIR}/runtime"
18     "${JAVASCRIPTCORE_DIR}/tools"
19     "${JAVASCRIPTCORE_DIR}/yarr"
20     "${JAVASCRIPTCORE_DIR}/wtf"
21     "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}"
22     "${CMAKE_SOURCE_DIR}/Source"
23 )
24
25 SET(JavaScriptCore_SOURCES
26     API/JSBase.cpp
27     API/JSCallbackConstructor.cpp
28     API/JSCallbackFunction.cpp
29     API/JSCallbackObject.cpp
30     API/JSClassRef.cpp
31     API/JSContextRef.cpp
32     API/JSObjectRef.cpp
33     API/JSProfilerPrivate.cpp
34     API/JSStringRef.cpp
35     API/JSValueRef.cpp
36     API/JSWeakObjectMapRefPrivate.cpp
37     API/OpaqueJSString.cpp
38
39     bytecode/CallLinkInfo.cpp
40     bytecode/CallLinkStatus.cpp
41     bytecode/CodeBlock.cpp
42     bytecode/DFGExitProfile.cpp
43     bytecode/GetByIdStatus.cpp
44     bytecode/JumpTable.cpp
45     bytecode/MethodCallLinkInfo.cpp
46     bytecode/MethodCallLinkStatus.cpp
47     bytecode/Opcode.cpp
48     bytecode/PolymorphicPutByIdList.cpp
49     bytecode/PredictedType.cpp
50     bytecode/PutByIdStatus.cpp
51     bytecode/SamplingTool.cpp
52     bytecode/StructureStubInfo.cpp
53     bytecode/ValueProfile.cpp
54
55     bytecompiler/BytecodeGenerator.cpp
56     bytecompiler/NodesCodegen.cpp
57
58     dfg/DFGAbstractState.cpp
59     dfg/DFGArithNodeFlagsInferencePhase.cpp
60     dfg/DFGAssemblyHelpers.cpp
61     dfg/DFGByteCodeParser.cpp
62     dfg/DFGCapabilities.cpp
63     dfg/DFGCFAPhase.cpp
64     dfg/DFGCorrectableJumpPoint.cpp
65     dfg/DFGCSEPhase.cpp
66     dfg/DFGDriver.cpp
67     dfg/DFGGraph.cpp
68     dfg/DFGJITCompiler.cpp
69     dfg/DFGOSREntry.cpp
70     dfg/DFGOSRExit.cpp
71     dfg/DFGOSRExitCompiler.cpp
72     dfg/DFGOSRExitCompiler32_64.cpp
73     dfg/DFGOSRExitCompiler64.cpp
74     dfg/DFGOperations.cpp
75     dfg/DFGPhase.cpp
76     dfg/DFGPredictionPropagationPhase.cpp
77     dfg/DFGRepatch.cpp
78     dfg/DFGSpeculativeJIT.cpp
79     dfg/DFGSpeculativeJIT32_64.cpp
80     dfg/DFGSpeculativeJIT64.cpp
81     dfg/DFGThunks.cpp
82     dfg/DFGVirtualRegisterAllocationPhase.cpp
83
84     heap/CopiedSpace.cpp
85     heap/DFGCodeBlocks.cpp
86     heap/Heap.cpp
87     heap/HandleHeap.cpp
88     heap/HandleStack.cpp
89     heap/MachineStackMarker.cpp
90     heap/MarkedAllocator.cpp
91     heap/MarkedBlock.cpp
92     heap/MarkedSpace.cpp
93     heap/ConservativeRoots.cpp
94     heap/MarkStack.cpp
95
96     debugger/Debugger.cpp
97     debugger/DebuggerActivation.cpp
98     debugger/DebuggerCallFrame.cpp
99     
100     interpreter/AbstractPC.cpp
101     interpreter/CallFrame.cpp
102     interpreter/Interpreter.cpp
103     interpreter/RegisterFile.cpp
104
105     jit/ExecutableAllocator.cpp
106     jit/HostCallReturnValue.cpp
107     jit/JITArithmetic32_64.cpp
108     jit/JITArithmetic.cpp
109     jit/JITCall32_64.cpp
110     jit/JITCall.cpp
111     jit/JIT.cpp
112     jit/JITExceptions.cpp
113     jit/JITOpcodes32_64.cpp
114     jit/JITOpcodes.cpp
115     jit/JITPropertyAccess32_64.cpp
116     jit/JITPropertyAccess.cpp
117     jit/JITStubs.cpp
118     jit/ThunkGenerators.cpp
119
120     parser/Lexer.cpp
121     parser/Nodes.cpp
122     parser/Parser.cpp
123     parser/ParserArena.cpp
124     parser/SourceProviderCache.cpp
125
126     profiler/Profile.cpp
127     profiler/ProfileGenerator.cpp
128     profiler/ProfileNode.cpp
129     profiler/Profiler.cpp
130
131     runtime/ArgList.cpp
132     runtime/Arguments.cpp
133     runtime/ArrayConstructor.cpp
134     runtime/ArrayPrototype.cpp
135     runtime/BooleanConstructor.cpp
136     runtime/BooleanObject.cpp
137     runtime/BooleanPrototype.cpp
138     runtime/CallData.cpp
139     runtime/CommonIdentifiers.cpp
140     runtime/Completion.cpp
141     runtime/ConstructData.cpp
142     runtime/DateConstructor.cpp
143     runtime/DateConversion.cpp
144     runtime/DateInstance.cpp
145     runtime/DatePrototype.cpp
146     runtime/Error.cpp
147     runtime/ErrorConstructor.cpp
148     runtime/ErrorInstance.cpp
149     runtime/ErrorPrototype.cpp
150     runtime/ExceptionHelpers.cpp
151     runtime/Executable.cpp
152     runtime/FunctionConstructor.cpp
153     runtime/FunctionPrototype.cpp
154     runtime/GCActivityCallback.cpp
155     runtime/GetterSetter.cpp
156     runtime/Identifier.cpp
157     runtime/InitializeThreading.cpp
158     runtime/InternalFunction.cpp
159     runtime/JSActivation.cpp
160     runtime/JSAPIValueWrapper.cpp
161     runtime/JSArray.cpp
162     runtime/JSByteArray.cpp
163     runtime/JSCell.cpp
164     runtime/JSDateMath.cpp
165     runtime/JSFunction.cpp
166     runtime/JSBoundFunction.cpp
167     runtime/JSGlobalData.cpp
168     runtime/JSGlobalObject.cpp
169     runtime/JSGlobalObjectFunctions.cpp
170     runtime/JSGlobalThis.cpp
171     runtime/JSLock.cpp
172     runtime/JSNotAnObject.cpp
173     runtime/JSObject.cpp
174     runtime/JSONObject.cpp
175     runtime/JSPropertyNameIterator.cpp
176     runtime/JSStaticScopeObject.cpp
177     runtime/JSString.cpp
178     runtime/JSValue.cpp
179     runtime/JSVariableObject.cpp
180     runtime/JSWrapperObject.cpp
181     runtime/LiteralParser.cpp
182     runtime/Lookup.cpp
183     runtime/MathObject.cpp
184     runtime/NativeErrorConstructor.cpp
185     runtime/NativeErrorPrototype.cpp
186     runtime/NumberConstructor.cpp
187     runtime/NumberObject.cpp
188     runtime/NumberPrototype.cpp
189     runtime/ObjectConstructor.cpp
190     runtime/ObjectPrototype.cpp
191     runtime/Operations.cpp
192     runtime/Options.cpp
193     runtime/PropertyDescriptor.cpp
194     runtime/PropertyNameArray.cpp
195     runtime/PropertySlot.cpp
196     runtime/RegExp.cpp
197     runtime/RegExpCache.cpp
198     runtime/RegExpConstructor.cpp
199     runtime/RegExpObject.cpp
200     runtime/RegExpPrototype.cpp
201     runtime/ScopeChain.cpp
202     runtime/SmallStrings.cpp
203     runtime/StrictEvalActivation.cpp
204     runtime/StringConstructor.cpp
205     runtime/StringObject.cpp
206     runtime/StringPrototype.cpp
207     runtime/StringRecursionChecker.cpp
208     runtime/Structure.cpp
209     runtime/StructureChain.cpp
210     runtime/TimeoutChecker.cpp
211     runtime/UString.cpp
212
213     tools/CodeProfile.cpp
214     tools/CodeProfiling.cpp
215
216     yarr/YarrPattern.cpp
217     yarr/YarrInterpreter.cpp
218     yarr/YarrJIT.cpp
219     yarr/YarrSyntaxChecker.cpp
220 )
221
222 SET(JavaScriptCore_LUT_FILES
223     runtime/ArrayConstructor.cpp
224     runtime/ArrayPrototype.cpp
225     runtime/BooleanPrototype.cpp
226     runtime/DateConstructor.cpp
227     runtime/DatePrototype.cpp
228     runtime/ErrorPrototype.cpp
229     runtime/JSGlobalObject.cpp
230     runtime/JSONObject.cpp
231     runtime/MathObject.cpp
232     runtime/NumberConstructor.cpp
233     runtime/NumberPrototype.cpp
234     runtime/ObjectConstructor.cpp
235     runtime/ObjectPrototype.cpp
236     runtime/RegExpConstructor.cpp
237     runtime/RegExpObject.cpp
238     runtime/RegExpPrototype.cpp
239     runtime/StringConstructor.cpp
240     runtime/StringPrototype.cpp
241 )
242
243 SET(JavaScriptCore_LIBRARIES
244     ${WTF_LIBRARY_NAME}
245 )
246
247
248 # GENERATOR 1-A: LUT creator
249 FOREACH (_file ${JavaScriptCore_LUT_FILES})
250     GET_FILENAME_COMPONENT(_name ${_file} NAME_WE)
251     GENERATE_HASH_LUT(${JAVASCRIPTCORE_DIR}/${_file} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${_name}.lut.h)
252     LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${_name}.lut.h)
253 ENDFOREACH ()
254
255
256 # GENERATOR 1-B: particular LUT creator (for 1 file only)
257 GENERATE_HASH_LUT(${JAVASCRIPTCORE_DIR}/parser/Keywords.table ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/Lexer.lut.h MAIN_DEPENDENCY)
258 LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/Lexer.lut.h)
259
260 #GENERATOR: "RegExpJitTables.h": tables used by Yarr
261 ADD_CUSTOM_COMMAND(
262     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
263     MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/create_regex_tables
264     COMMAND ${PYTHON_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/create_regex_tables > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h
265     VERBATIM)
266 ADD_SOURCE_DEPENDENCIES(${JAVASCRIPTCORE_DIR}/yarr/YarrPattern.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/RegExpJitTables.h)
267
268
269 #GENERATOR: "KeywordLookup.h": keyword decision tree used by the lexer
270 ADD_CUSTOM_COMMAND(
271     OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h
272     MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/KeywordLookupGenerator.py
273     COMMAND ${PYTHON_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/KeywordLookupGenerator.py ${JAVASCRIPTCORE_DIR}/parser/Keywords.table > ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h
274     VERBATIM)
275 ADD_SOURCE_DEPENDENCIES(${JAVASCRIPTCORE_DIR}/parser/Lexer.cpp ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/KeywordLookup.h)
276
277 IF (WTF_CPU_ARM)
278     LIST(APPEND JavaScriptCore_SOURCES
279         assembler/ARMAssembler.cpp
280         assembler/ARMv7Assembler.cpp
281         assembler/MacroAssemblerARM.cpp
282     )
283 ELSEIF (WTF_CPU_MIPS)
284 ELSEIF (WTF_CPU_X86)
285 ELSEIF (WTF_CPU_X86_64)
286 ELSE ()
287     MESSAGE(FATAL_ERROR "Unknown CPU")
288 ENDIF ()
289
290
291 INCLUDE_IF_EXISTS(${JAVASCRIPTCORE_DIR}/Platform${PORT}.cmake)
292
293
294 ADD_SUBDIRECTORY(wtf)
295 ADD_SUBDIRECTORY(shell)
296
297 WEBKIT_WRAP_SOURCELIST(${JavaScriptCore_SOURCES})
298 INCLUDE_DIRECTORIES(${JavaScriptCore_INCLUDE_DIRECTORIES})
299 ADD_DEFINITIONS(-DBUILDING_JavaScriptCore)
300 ADD_LIBRARY(${JavaScriptCore_LIBRARY_NAME} ${JavaScriptCore_LIBRARY_TYPE} ${JavaScriptCore_HEADERS} ${JavaScriptCore_SOURCES})
301 TARGET_LINK_LIBRARIES(${JavaScriptCore_LIBRARY_NAME} ${JavaScriptCore_LIBRARIES})
302
303 IF (JavaScriptCore_LINK_FLAGS)
304     ADD_TARGET_PROPERTIES(${JavaScriptCore_LIBRARY_NAME} LINK_FLAGS "${JavaScriptCore_LINK_FLAGS}")
305 ENDIF ()
306
307 IF (SHARED_CORE)
308     SET_TARGET_PROPERTIES(${JavaScriptCore_LIBRARY_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
309     INSTALL(TARGETS ${JavaScriptCore_LIBRARY_NAME} DESTINATION lib)
310 ENDIF ()