da7e119ba2d742f3773b2397419a60db1672b9f3
[WebKit-https.git] / 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}/debugger"
10     "${JAVASCRIPTCORE_DIR}/interpreter"
11     "${JAVASCRIPTCORE_DIR}/jit"
12     "${JAVASCRIPTCORE_DIR}/parser"
13     "${JAVASCRIPTCORE_DIR}/pcre"
14     "${JAVASCRIPTCORE_DIR}/profiler"
15     "${JAVASCRIPTCORE_DIR}/runtime"
16     "${JAVASCRIPTCORE_DIR}/yarr"
17     "${WTF_INCLUDE_DIRECTORIES}"
18     "${CMAKE_SOURCE_DIR}"
19 )
20
21 SET(JavaScriptCore_SOURCES
22     API/JSBase.cpp
23     API/JSCallbackConstructor.cpp
24     API/JSCallbackFunction.cpp
25     API/JSCallbackObject.cpp
26     API/JSClassRef.cpp
27     API/JSContextRef.cpp
28     API/JSObjectRef.cpp
29     API/JSProfilerPrivate.cpp
30     API/JSStringRef.cpp
31     API/JSValueRef.cpp
32     API/JSWeakObjectMapRefPrivate.cpp
33     API/OpaqueJSString.cpp
34
35     bytecode/CodeBlock.cpp
36     bytecode/JumpTable.cpp
37     bytecode/Opcode.cpp
38     bytecode/SamplingTool.cpp
39     bytecode/StructureStubInfo.cpp
40
41     bytecompiler/BytecodeGenerator.cpp
42     bytecompiler/NodesCodegen.cpp
43
44     debugger/Debugger.cpp
45     debugger/DebuggerActivation.cpp
46     debugger/DebuggerCallFrame.cpp
47
48     interpreter/CallFrame.cpp
49     interpreter/Interpreter.cpp
50     interpreter/RegisterFile.cpp
51
52     jit/ExecutableAllocator.cpp
53     jit/ExecutableAllocatorFixedVMPool.cpp
54     jit/ExecutableAllocatorPosix.cpp
55     jit/ExecutableAllocatorSymbian.cpp
56     jit/ExecutableAllocatorWin.cpp
57     jit/JITStubs.cpp
58     jit/JITOpcodes.cpp
59     jit/JITOpcodes32_64.cpp
60     jit/JITPropertyAccess.cpp
61     jit/JITPropertyAccess32_64.cpp
62     jit/JITArithmetic.cpp
63     jit/JITCall.cpp
64     jit/JITCall32_64.cpp
65     jit/JIT.cpp
66
67     parser/Lexer.cpp
68     parser/Nodes.cpp
69     parser/Parser.cpp
70     parser/ParserArena.cpp
71
72     pcre/pcre_compile.cpp
73     pcre/pcre_exec.cpp
74     pcre/pcre_tables.cpp
75     pcre/pcre_ucp_searchfuncs.cpp
76     pcre/pcre_xclass.cpp
77
78     profiler/Profile.cpp
79     profiler/ProfileGenerator.cpp
80     profiler/ProfileNode.cpp
81     profiler/Profiler.cpp
82
83     runtime/ArgList.cpp
84     runtime/Arguments.cpp
85     runtime/ArrayConstructor.cpp
86     runtime/ArrayPrototype.cpp
87     runtime/BooleanConstructor.cpp
88     runtime/BooleanObject.cpp
89     runtime/BooleanPrototype.cpp
90     runtime/CallData.cpp
91     runtime/Collector.cpp
92     runtime/CommonIdentifiers.cpp
93     runtime/Completion.cpp
94     runtime/ConstructData.cpp
95     runtime/DateConstructor.cpp
96     runtime/DateConversion.cpp
97     runtime/DateInstance.cpp
98     runtime/DatePrototype.cpp
99     runtime/Error.cpp
100     runtime/ErrorConstructor.cpp
101     runtime/ErrorInstance.cpp
102     runtime/ErrorPrototype.cpp
103     runtime/ExceptionHelpers.cpp
104     runtime/Executable.cpp
105     runtime/FunctionConstructor.cpp
106     runtime/FunctionPrototype.cpp
107     runtime/GetterSetter.cpp
108     runtime/GlobalEvalFunction.cpp
109     runtime/Identifier.cpp
110     runtime/InitializeThreading.cpp
111     runtime/InternalFunction.cpp
112     runtime/JSActivation.cpp
113     runtime/JSAPIValueWrapper.cpp
114     runtime/JSArray.cpp
115     runtime/JSByteArray.cpp
116     runtime/JSCell.cpp
117     runtime/JSFunction.cpp
118     runtime/JSGlobalData.cpp
119     runtime/JSGlobalObject.cpp
120     runtime/JSGlobalObjectFunctions.cpp
121     runtime/JSImmediate.cpp
122     runtime/JSLock.cpp
123     runtime/JSNotAnObject.cpp
124     runtime/JSNumberCell.cpp
125     runtime/JSObject.cpp
126     runtime/JSObjectWithGlobalObject.cpp
127     runtime/JSONObject.cpp
128     runtime/JSPropertyNameIterator.cpp
129     runtime/JSStaticScopeObject.cpp
130     runtime/JSString.cpp
131     runtime/JSValue.cpp
132     runtime/JSVariableObject.cpp
133     runtime/JSWrapperObject.cpp
134     runtime/JSZombie.cpp
135     runtime/LiteralParser.cpp
136     runtime/Lookup.cpp
137     runtime/MarkStack.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/PrototypeFunction.cpp
151     runtime/RegExp.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/StringConstructor.cpp
159     runtime/StringObject.cpp
160     runtime/StringPrototype.cpp
161     runtime/Structure.cpp
162     runtime/StructureChain.cpp
163     runtime/TimeoutChecker.cpp
164     runtime/UString.cpp
165
166     yarr/RegexCompiler.cpp
167     yarr/RegexInterpreter.cpp
168     yarr/RegexJIT.cpp
169
170     wtf/DateMath.cpp
171 )
172 SET(JavaScriptCore_HEADERS )
173
174 SET(JavaScriptCore_LUT_FILES
175     runtime/ArrayPrototype.cpp
176     runtime/DatePrototype.cpp
177     runtime/JSONObject.cpp
178     runtime/MathObject.cpp
179     runtime/NumberConstructor.cpp
180     runtime/RegExpConstructor.cpp
181     runtime/RegExpObject.cpp
182     runtime/StringPrototype.cpp
183 )
184
185 SET(JavaScriptCore_LIBRARIES
186     ${WTF_LIBRARY_NAME}
187 )
188
189
190 # GENERATOR 1-A: LUT creator
191 FOREACH (_file ${JavaScriptCore_LUT_FILES})
192     GET_FILENAME_COMPONENT(_name ${_file} NAME_WE)
193     GENERATE_HASH_LUT(${JAVASCRIPTCORE_DIR}/${_file} ${DERIVED_SOURCES_DIR}/${_name}.lut.h)
194     LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_DIR}/${_name}.lut.h)
195 ENDFOREACH ()
196
197
198 # GENERATOR 1-B: particular LUT creator (for 1 file only)
199 GENERATE_HASH_LUT(${JAVASCRIPTCORE_DIR}/parser/Keywords.table ${DERIVED_SOURCES_DIR}/Lexer.lut.h MAIN_DEPENDENCY)
200 LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_DIR}/Lexer.lut.h)
201
202 # GENERATOR 2: bison grammar
203 ADD_CUSTOM_COMMAND(
204     OUTPUT ${DERIVED_SOURCES_DIR}/Grammar.cpp ${DERIVED_SOURCES_DIR}/Grammar.h
205     MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/parser/Grammar.y
206     COMMAND ${BISON_EXECUTABLE} -d -p jscyy ${JAVASCRIPTCORE_DIR}/parser/Grammar.y -o ${DERIVED_SOURCES_DIR}/Grammar.cpp --defines=${DERIVED_SOURCES_DIR}/Grammar.h
207     COMMENT "[BISON][JSCYY] Building parser with bison"
208     VERBATIM)
209 LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_DIR}/Grammar.h)
210 LIST(APPEND JavaScriptCore_SOURCES ${DERIVED_SOURCES_DIR}/Grammar.cpp)
211
212
213 # GENERATOR: "chartables.c": compile and execute the chartables generator (and add it to sources)
214 IF (MSVC)
215     SET(JSC_DFTABLES_PREPROCESSOR --preprocessor=cl.exe)
216 ENDIF ()
217 ADD_CUSTOM_COMMAND(
218     OUTPUT ${DERIVED_SOURCES_DIR}/chartables.c
219     MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/pcre/dftables
220     COMMAND ${PERL_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/pcre/dftables ${JSC_DFTABLES_PREPROCESSOR} ${DERIVED_SOURCES_DIR}/chartables.c
221     VERBATIM)
222 ADD_SOURCE_DEPENDENCIES(${JAVASCRIPTCORE_DIR}/pcre/pcre_tables.cpp ${DERIVED_SOURCES_DIR}/chartables.c)
223
224
225 #GENERATOR: "RegExpJitTables.h": tables used by Yarr
226 ADD_CUSTOM_COMMAND(
227     OUTPUT ${DERIVED_SOURCES_DIR}/RegExpJitTables.h
228     MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/create_regex_tables
229     COMMAND ${PYTHON_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/create_regex_tables > ${DERIVED_SOURCES_DIR}/RegExpJitTables.h
230     VERBATIM)
231 ADD_SOURCE_DEPENDENCIES(${JAVASCRIPTCORE_DIR}/yarr/RegexCompiler.cpp ${DERIVED_SOURCES_DIR}/RegExpJitTables.h)
232
233
234
235 IF (WTF_CPU_ARM)
236     LIST(APPEND JavaScriptCore_SOURCES
237         assembler/ARMAssembler.cpp
238         assembler/MacroAssemblerARM.cpp
239     )
240 ELSEIF (WTF_CPU_MIPS)
241 ELSEIF (WTF_CPU_X86)
242 ELSEIF (WTF_CPU_X86_64)
243 ELSE ()
244     MESSAGE(FATAL_ERROR "Unknown CPU")
245 ENDIF ()
246
247
248 INCLUDE_IF_EXISTS(${JAVASCRIPTCORE_DIR}/CMakeLists${PORT}.txt)
249
250
251 # Declare source groups for Visual Studio folders
252 SOURCE_GROUP(API "API/")
253 SOURCE_GROUP(assembler "assembler/")
254 SOURCE_GROUP(bytecode "bytecode/")
255 SOURCE_GROUP(bytecompiler "bytecompiler/")
256 SOURCE_GROUP(debugger "debugger/")
257 SOURCE_GROUP(bytecode "bytecode/")
258 SOURCE_GROUP(interpreter "interpreter/")
259 SOURCE_GROUP(jit "jit/")
260 SOURCE_GROUP(parser "parser/")
261 SOURCE_GROUP(pcre "pcre/")
262 SOURCE_GROUP(profiler "profiler/")
263 SOURCE_GROUP(runtime "runtime/")
264 SOURCE_GROUP(yarr "yarr/")
265 SOURCE_GROUP(wtf "wtf/")
266
267 ADD_SUBDIRECTORY(wtf)
268 ADD_SUBDIRECTORY(jsc)
269
270 WEBKIT_WRAP_SOURCELIST(${JavaScriptCore_SOURCES})
271 INCLUDE_DIRECTORIES(${JavaScriptCore_INCLUDE_DIRECTORIES})
272 ADD_DEFINITIONS(-DBUILDING_JavaScriptCore)
273 ADD_LIBRARY(${JavaScriptCore_LIBRARY_NAME} ${JavaScriptCore_LIBRARY_TYPE} ${JavaScriptCore_HEADERS} ${JavaScriptCore_SOURCES})
274 TARGET_LINK_LIBRARIES(${JavaScriptCore_LIBRARY_NAME} ${JavaScriptCore_LIBRARIES})
275 ADD_TARGET_PROPERTIES(${JavaScriptCore_LIBRARY_NAME} LINK_FLAGS ${JavaScriptCore_LINK_FLAGS})
276
277 INSTALL(TARGETS ${JavaScriptCore_LIBRARY_NAME} DESTINATION lib)
278