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