2010-06-24 Leandro Pereira <leandro@profusion.mobi>
[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/JSParser.cpp
68     parser/Lexer.cpp
69     parser/Nodes.cpp
70     parser/Parser.cpp
71     parser/ParserArena.cpp
72
73     pcre/pcre_compile.cpp
74     pcre/pcre_exec.cpp
75     pcre/pcre_tables.cpp
76     pcre/pcre_ucp_searchfuncs.cpp
77     pcre/pcre_xclass.cpp
78
79     profiler/Profile.cpp
80     profiler/ProfileGenerator.cpp
81     profiler/ProfileNode.cpp
82     profiler/Profiler.cpp
83
84     runtime/ArgList.cpp
85     runtime/Arguments.cpp
86     runtime/ArrayConstructor.cpp
87     runtime/ArrayPrototype.cpp
88     runtime/BooleanConstructor.cpp
89     runtime/BooleanObject.cpp
90     runtime/BooleanPrototype.cpp
91     runtime/CallData.cpp
92     runtime/Collector.cpp
93     runtime/CommonIdentifiers.cpp
94     runtime/Completion.cpp
95     runtime/ConstructData.cpp
96     runtime/DateConstructor.cpp
97     runtime/DateConversion.cpp
98     runtime/DateInstance.cpp
99     runtime/DatePrototype.cpp
100     runtime/Error.cpp
101     runtime/ErrorConstructor.cpp
102     runtime/ErrorInstance.cpp
103     runtime/ErrorPrototype.cpp
104     runtime/ExceptionHelpers.cpp
105     runtime/Executable.cpp
106     runtime/FunctionConstructor.cpp
107     runtime/FunctionPrototype.cpp
108     runtime/GetterSetter.cpp
109     runtime/GlobalEvalFunction.cpp
110     runtime/Identifier.cpp
111     runtime/InitializeThreading.cpp
112     runtime/InternalFunction.cpp
113     runtime/JSActivation.cpp
114     runtime/JSAPIValueWrapper.cpp
115     runtime/JSArray.cpp
116     runtime/JSByteArray.cpp
117     runtime/JSCell.cpp
118     runtime/JSFunction.cpp
119     runtime/JSGlobalData.cpp
120     runtime/JSGlobalObject.cpp
121     runtime/JSGlobalObjectFunctions.cpp
122     runtime/JSImmediate.cpp
123     runtime/JSLock.cpp
124     runtime/JSNotAnObject.cpp
125     runtime/JSNumberCell.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/MarkStack.cpp
139     runtime/MathObject.cpp
140     runtime/NativeErrorConstructor.cpp
141     runtime/NativeErrorPrototype.cpp
142     runtime/NumberConstructor.cpp
143     runtime/NumberObject.cpp
144     runtime/NumberPrototype.cpp
145     runtime/ObjectConstructor.cpp
146     runtime/ObjectPrototype.cpp
147     runtime/Operations.cpp
148     runtime/PropertyDescriptor.cpp
149     runtime/PropertyNameArray.cpp
150     runtime/PropertySlot.cpp
151     runtime/PrototypeFunction.cpp
152     runtime/RegExp.cpp
153     runtime/RegExpCache.cpp
154     runtime/RegExpConstructor.cpp
155     runtime/RegExpObject.cpp
156     runtime/RegExpPrototype.cpp
157     runtime/RopeImpl.cpp
158     runtime/ScopeChain.cpp
159     runtime/SmallStrings.cpp
160     runtime/StringConstructor.cpp
161     runtime/StringObject.cpp
162     runtime/StringPrototype.cpp
163     runtime/Structure.cpp
164     runtime/StructureChain.cpp
165     runtime/TimeoutChecker.cpp
166     runtime/UString.cpp
167
168     yarr/RegexCompiler.cpp
169     yarr/RegexInterpreter.cpp
170     yarr/RegexJIT.cpp
171
172     wtf/DateMath.cpp
173 )
174 SET(JavaScriptCore_HEADERS )
175
176 SET(JavaScriptCore_LUT_FILES
177     runtime/ArrayPrototype.cpp
178     runtime/DatePrototype.cpp
179     runtime/JSONObject.cpp
180     runtime/MathObject.cpp
181     runtime/NumberConstructor.cpp
182     runtime/RegExpConstructor.cpp
183     runtime/RegExpObject.cpp
184     runtime/StringPrototype.cpp
185 )
186
187 SET(JavaScriptCore_LIBRARIES
188     ${WTF_LIBRARY_NAME}
189 )
190
191
192 # GENERATOR 1-A: LUT creator
193 FOREACH (_file ${JavaScriptCore_LUT_FILES})
194     GET_FILENAME_COMPONENT(_name ${_file} NAME_WE)
195     GENERATE_HASH_LUT(${JAVASCRIPTCORE_DIR}/${_file} ${DERIVED_SOURCES_DIR}/${_name}.lut.h)
196     LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_DIR}/${_name}.lut.h)
197 ENDFOREACH ()
198
199
200 # GENERATOR 1-B: particular LUT creator (for 1 file only)
201 GENERATE_HASH_LUT(${JAVASCRIPTCORE_DIR}/parser/Keywords.table ${DERIVED_SOURCES_DIR}/Lexer.lut.h MAIN_DEPENDENCY)
202 LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_DIR}/Lexer.lut.h)
203
204 # GENERATOR 2: bison grammar
205 ADD_CUSTOM_COMMAND(
206     OUTPUT ${DERIVED_SOURCES_DIR}/Grammar.cpp ${DERIVED_SOURCES_DIR}/Grammar.h
207     MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/parser/Grammar.y
208     COMMAND ${BISON_EXECUTABLE} -d -p jscyy ${JAVASCRIPTCORE_DIR}/parser/Grammar.y -o ${DERIVED_SOURCES_DIR}/Grammar.cpp --defines=${DERIVED_SOURCES_DIR}/Grammar.h
209     COMMENT "[BISON][JSCYY] Building parser with bison"
210     VERBATIM)
211 LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_DIR}/Grammar.h)
212 LIST(APPEND JavaScriptCore_SOURCES ${DERIVED_SOURCES_DIR}/Grammar.cpp)
213
214
215 # GENERATOR: "chartables.c": compile and execute the chartables generator (and add it to sources)
216 IF (MSVC)
217     SET(JSC_DFTABLES_PREPROCESSOR --preprocessor=cl.exe)
218 ENDIF ()
219 ADD_CUSTOM_COMMAND(
220     OUTPUT ${DERIVED_SOURCES_DIR}/chartables.c
221     MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/pcre/dftables
222     COMMAND ${PERL_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/pcre/dftables ${JSC_DFTABLES_PREPROCESSOR} ${DERIVED_SOURCES_DIR}/chartables.c
223     VERBATIM)
224 ADD_SOURCE_DEPENDENCIES(${JAVASCRIPTCORE_DIR}/pcre/pcre_tables.cpp ${DERIVED_SOURCES_DIR}/chartables.c)
225
226
227 #GENERATOR: "RegExpJitTables.h": tables used by Yarr
228 ADD_CUSTOM_COMMAND(
229     OUTPUT ${DERIVED_SOURCES_DIR}/RegExpJitTables.h
230     MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/create_regex_tables
231     COMMAND ${PYTHON_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/create_regex_tables > ${DERIVED_SOURCES_DIR}/RegExpJitTables.h
232     VERBATIM)
233 ADD_SOURCE_DEPENDENCIES(${JAVASCRIPTCORE_DIR}/yarr/RegexCompiler.cpp ${DERIVED_SOURCES_DIR}/RegExpJitTables.h)
234
235
236
237 IF (WTF_CPU_ARM)
238     LIST(APPEND JavaScriptCore_SOURCES
239         assembler/ARMAssembler.cpp
240         assembler/MacroAssemblerARM.cpp
241     )
242 ELSEIF (WTF_CPU_MIPS)
243 ELSEIF (WTF_CPU_X86)
244 ELSEIF (WTF_CPU_X86_64)
245 ELSE ()
246     MESSAGE(FATAL_ERROR "Unknown CPU")
247 ENDIF ()
248
249
250 INCLUDE_IF_EXISTS(${JAVASCRIPTCORE_DIR}/CMakeLists${PORT}.txt)
251
252
253 # Declare source groups for Visual Studio folders
254 SOURCE_GROUP(API "API/")
255 SOURCE_GROUP(assembler "assembler/")
256 SOURCE_GROUP(bytecode "bytecode/")
257 SOURCE_GROUP(bytecompiler "bytecompiler/")
258 SOURCE_GROUP(debugger "debugger/")
259 SOURCE_GROUP(bytecode "bytecode/")
260 SOURCE_GROUP(interpreter "interpreter/")
261 SOURCE_GROUP(jit "jit/")
262 SOURCE_GROUP(parser "parser/")
263 SOURCE_GROUP(pcre "pcre/")
264 SOURCE_GROUP(profiler "profiler/")
265 SOURCE_GROUP(runtime "runtime/")
266 SOURCE_GROUP(yarr "yarr/")
267 SOURCE_GROUP(wtf "wtf/")
268
269 ADD_SUBDIRECTORY(wtf)
270 ADD_SUBDIRECTORY(jsc)
271
272 WEBKIT_WRAP_SOURCELIST(${JavaScriptCore_SOURCES})
273 INCLUDE_DIRECTORIES(${JavaScriptCore_INCLUDE_DIRECTORIES})
274 ADD_DEFINITIONS(-DBUILDING_JavaScriptCore)
275 ADD_LIBRARY(${JavaScriptCore_LIBRARY_NAME} ${JavaScriptCore_LIBRARY_TYPE} ${JavaScriptCore_HEADERS} ${JavaScriptCore_SOURCES})
276 TARGET_LINK_LIBRARIES(${JavaScriptCore_LIBRARY_NAME} ${JavaScriptCore_LIBRARIES})
277 ADD_TARGET_PROPERTIES(${JavaScriptCore_LIBRARY_NAME} LINK_FLAGS ${JavaScriptCore_LINK_FLAGS})
278
279 IF (SHARED_CORE)
280     INSTALL(TARGETS ${JavaScriptCore_LIBRARY_NAME} DESTINATION lib)
281 ENDIF ()