2010-07-30 Rafael Antognolli <antognolli@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/JITArithmetic32_64.cpp
54     jit/JITArithmetic.cpp
55     jit/JITCall32_64.cpp
56     jit/JITCall.cpp
57     jit/JIT.cpp
58     jit/JITOpcodes32_64.cpp
59     jit/JITOpcodes.cpp
60     jit/JITPropertyAccess32_64.cpp
61     jit/JITPropertyAccess.cpp
62     jit/JITStubs.cpp
63     jit/ThunkGenerators.cpp
64
65     parser/JSParser.cpp
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/JSObjectWithGlobalObject.cpp
126     runtime/JSONObject.cpp
127     runtime/JSPropertyNameIterator.cpp
128     runtime/JSStaticScopeObject.cpp
129     runtime/JSString.cpp
130     runtime/JSValue.cpp
131     runtime/JSVariableObject.cpp
132     runtime/JSWrapperObject.cpp
133     runtime/JSZombie.cpp
134     runtime/LiteralParser.cpp
135     runtime/Lookup.cpp
136     runtime/MarkStack.cpp
137     runtime/MathObject.cpp
138     runtime/NativeErrorConstructor.cpp
139     runtime/NativeErrorPrototype.cpp
140     runtime/NumberConstructor.cpp
141     runtime/NumberObject.cpp
142     runtime/NumberPrototype.cpp
143     runtime/ObjectConstructor.cpp
144     runtime/ObjectPrototype.cpp
145     runtime/Operations.cpp
146     runtime/PropertyDescriptor.cpp
147     runtime/PropertyNameArray.cpp
148     runtime/PropertySlot.cpp
149     runtime/PrototypeFunction.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/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     wtf/PageAllocation.cpp
172 )
173 SET(JavaScriptCore_HEADERS )
174
175 SET(JavaScriptCore_LUT_FILES
176     runtime/ArrayPrototype.cpp
177     runtime/DatePrototype.cpp
178     runtime/JSONObject.cpp
179     runtime/MathObject.cpp
180     runtime/NumberConstructor.cpp
181     runtime/RegExpConstructor.cpp
182     runtime/RegExpObject.cpp
183     runtime/StringPrototype.cpp
184 )
185
186 SET(JavaScriptCore_LIBRARIES
187     ${WTF_LIBRARY_NAME}
188 )
189
190
191 # GENERATOR 1-A: LUT creator
192 FOREACH (_file ${JavaScriptCore_LUT_FILES})
193     GET_FILENAME_COMPONENT(_name ${_file} NAME_WE)
194     GENERATE_HASH_LUT(${JAVASCRIPTCORE_DIR}/${_file} ${DERIVED_SOURCES_DIR}/${_name}.lut.h)
195     LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_DIR}/${_name}.lut.h)
196 ENDFOREACH ()
197
198
199 # GENERATOR 1-B: particular LUT creator (for 1 file only)
200 GENERATE_HASH_LUT(${JAVASCRIPTCORE_DIR}/parser/Keywords.table ${DERIVED_SOURCES_DIR}/Lexer.lut.h MAIN_DEPENDENCY)
201 LIST(APPEND JavaScriptCore_HEADERS ${DERIVED_SOURCES_DIR}/Lexer.lut.h)
202
203 # GENERATOR: "chartables.c": compile and execute the chartables generator (and add it to sources)
204 IF (MSVC)
205     SET(JSC_DFTABLES_PREPROCESSOR --preprocessor=cl.exe)
206 ENDIF ()
207 ADD_CUSTOM_COMMAND(
208     OUTPUT ${DERIVED_SOURCES_DIR}/chartables.c
209     MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/pcre/dftables
210     COMMAND ${PERL_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/pcre/dftables ${JSC_DFTABLES_PREPROCESSOR} ${DERIVED_SOURCES_DIR}/chartables.c
211     VERBATIM)
212 ADD_SOURCE_DEPENDENCIES(${JAVASCRIPTCORE_DIR}/pcre/pcre_tables.cpp ${DERIVED_SOURCES_DIR}/chartables.c)
213
214
215 #GENERATOR: "RegExpJitTables.h": tables used by Yarr
216 ADD_CUSTOM_COMMAND(
217     OUTPUT ${DERIVED_SOURCES_DIR}/RegExpJitTables.h
218     MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/create_regex_tables
219     COMMAND ${PYTHON_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/create_regex_tables > ${DERIVED_SOURCES_DIR}/RegExpJitTables.h
220     VERBATIM)
221 ADD_SOURCE_DEPENDENCIES(${JAVASCRIPTCORE_DIR}/yarr/RegexCompiler.cpp ${DERIVED_SOURCES_DIR}/RegExpJitTables.h)
222
223
224
225 IF (WTF_CPU_ARM)
226     LIST(APPEND JavaScriptCore_SOURCES
227         assembler/ARMAssembler.cpp
228         assembler/MacroAssemblerARM.cpp
229     )
230 ELSEIF (WTF_CPU_MIPS)
231 ELSEIF (WTF_CPU_X86)
232 ELSEIF (WTF_CPU_X86_64)
233 ELSE ()
234     MESSAGE(FATAL_ERROR "Unknown CPU")
235 ENDIF ()
236
237
238 INCLUDE_IF_EXISTS(${JAVASCRIPTCORE_DIR}/CMakeLists${PORT}.txt)
239
240
241 # Declare source groups for Visual Studio folders
242 SOURCE_GROUP(API "API/")
243 SOURCE_GROUP(assembler "assembler/")
244 SOURCE_GROUP(bytecode "bytecode/")
245 SOURCE_GROUP(bytecompiler "bytecompiler/")
246 SOURCE_GROUP(debugger "debugger/")
247 SOURCE_GROUP(bytecode "bytecode/")
248 SOURCE_GROUP(interpreter "interpreter/")
249 SOURCE_GROUP(jit "jit/")
250 SOURCE_GROUP(parser "parser/")
251 SOURCE_GROUP(pcre "pcre/")
252 SOURCE_GROUP(profiler "profiler/")
253 SOURCE_GROUP(runtime "runtime/")
254 SOURCE_GROUP(yarr "yarr/")
255 SOURCE_GROUP(wtf "wtf/")
256
257 ADD_SUBDIRECTORY(wtf)
258 ADD_SUBDIRECTORY(jsc)
259
260 WEBKIT_WRAP_SOURCELIST(${JavaScriptCore_SOURCES})
261 INCLUDE_DIRECTORIES(${JavaScriptCore_INCLUDE_DIRECTORIES})
262 ADD_DEFINITIONS(-DBUILDING_JavaScriptCore)
263 ADD_LIBRARY(${JavaScriptCore_LIBRARY_NAME} ${JavaScriptCore_LIBRARY_TYPE} ${JavaScriptCore_HEADERS} ${JavaScriptCore_SOURCES})
264 TARGET_LINK_LIBRARIES(${JavaScriptCore_LIBRARY_NAME} ${JavaScriptCore_LIBRARIES})
265 ADD_TARGET_PROPERTIES(${JavaScriptCore_LIBRARY_NAME} LINK_FLAGS ${JavaScriptCore_LINK_FLAGS})
266
267 IF (SHARED_CORE)
268     SET_TARGET_PROPERTIES(${JavaScriptCore_LIBRARY_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
269     INSTALL(TARGETS ${JavaScriptCore_LIBRARY_NAME} DESTINATION lib)
270 ENDIF ()