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