fbc2e8c15b6832f7c28595defbdc9ae73d9b7cb1
[WebKit-https.git] / JavaScriptCore / CMakeLists.txt
1
2 project(kjs-unity)
3
4 MESSAGE(STATUS "Missing CMakeFiles.txt into wtf directory")
5 add_subdirectory( wtf )
6 add_subdirectory( pcre )
7
8 # Configuration checks
9 check_library_exists(pthread pthread_attr_get_np "" HAVE_PTHREAD_ATTR_GET_NP)
10 check_library_exists(pthread pthread_getattr_np "" HAVE_PTHREAD_GETATTR_NP)
11
12 include_directories(
13     ${CMAKE_CURRENT_SOURCE_DIR}/pcre
14     ${CMAKE_CURRENT_BINARY_DIR}/kjs
15     ${CMAKE_CURRENT_SOURCE_DIR}/kjs
16
17     ${QT_INCLUDES}
18 )
19
20 if(WIN32)
21   include_directories( ${KDEWIN32_INCLUDES} )
22 endif(WIN32)
23
24 set(CREATE_HASH_TABLE ${CMAKE_CURRENT_SOURCE_DIR}/kjs/create_hash_table )
25
26 macro(CREATE_LUT _srcs_LIST _in_FILE _out_FILE _dep_FILE)
27
28    add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE}
29       COMMAND ${PERL_EXECUTABLE} ${CREATE_HASH_TABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} -i > ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE}
30       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${_dep_FILE} )
31    set( ${_srcs_LIST}  ${${_srcs_LIST}} ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE})
32 endmacro(CREATE_LUT)
33
34 create_lut(kjs-unity_LIB_SRCS kjs/date_object.cpp kjs/date_object.lut.h kjs/date_object.cpp)
35 create_lut(kjs-unity_LIB_SRCS kjs/number_object.cpp kjs/number_object.lut.h kjs/number_object.cpp)
36 create_lut(kjs-unity_LIB_SRCS kjs/string_object.cpp kjs/string_object.lut.h kjs/string_object.cpp)
37 create_lut(kjs-unity_LIB_SRCS kjs/array_object.cpp kjs/array_object.lut.h kjs/array_object.cpp)
38 create_lut(kjs-unity_LIB_SRCS kjs/math_object.cpp kjs/math_object.lut.h kjs/math_object.cpp)
39 create_lut(kjs-unity_LIB_SRCS kjs/regexp_object.cpp kjs/regexp_object.lut.h kjs/regexp_object.cpp)
40 create_lut(kjs-unity_LIB_SRCS kjs/keywords.table kjs/lexer.lut.h kjs/lexer.cpp)
41 create_lut(kjs-unity_LIB_SRCS kjs/keywords.table kjs/lexer.lut.h kjs/lexer.cpp)
42
43 add_custom_command(
44   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.cpp ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.h
45   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
46
47   COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/kjs
48   COMMAND ${BISON_EXECUTABLE} -d -p kjsyy ${CMAKE_CURRENT_SOURCE_DIR}/kjs/grammar.y
49   COMMAND mv grammar.tab.c ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.cpp
50   COMMAND mv grammar.tab.h ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.h
51   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/kjs/grammar.y
52 )
53
54 ########### next target ###############
55
56 kde4_add_library(wtf-unity SHARED
57     wtf/TCSystemAlloc.cpp
58     wtf/Assertions.cpp
59     wtf/HashTable.cpp
60     wtf/FastMalloc.cpp
61 )
62
63 set(kjs-unity_LIB_SRCS
64     ${kjs-unity_LIB_SRCS}
65     wtf/unicode/qt4/UnicodeQt4.cpp
66     kjs/JSWrapperObject.cpp
67         kjs/PropertyNameArray.cpp
68         kjs/array_object.cpp
69         kjs/bool_object.cpp
70         kjs/collector.cpp
71         kjs/Context.cpp
72         kjs/date_object.cpp
73         kjs/debugger.cpp
74         kjs/dtoa.cpp
75         kjs/error_object.cpp
76         kjs/fpconst.cpp
77         kjs/function.cpp
78         kjs/function_object.cpp
79     ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.cpp
80         kjs/identifier.cpp
81         kjs/internal.cpp
82         kjs/interpreter.cpp
83     kjs/JSImmediate.cpp
84         kjs/JSLock.cpp 
85         kjs/lexer.cpp
86         kjs/list.cpp
87         kjs/lookup.cpp
88         kjs/math_object.cpp
89         kjs/nodes.cpp
90         kjs/nodes2string.cpp
91         kjs/number_object.cpp
92         kjs/object.cpp
93         kjs/object_object.cpp
94         kjs/operations.cpp
95         kjs/Parser.cpp
96         kjs/property_map.cpp
97         kjs/property_slot.cpp
98         kjs/regexp.cpp
99         kjs/regexp_object.cpp
100         kjs/scope_chain.cpp
101         kjs/string_object.cpp
102         kjs/ustring.cpp
103         kjs/value.cpp
104         kjs/ExecState.cpp
105 )
106
107 kde4_add_library(kjs-unity STATIC ${kjs-unity_LIB_SRCS})
108
109 if(UNIX)
110    target_link_libraries(kjs-unity  ${KDE4_KDECORE_LIBS} m )
111 else(UNIX)
112    target_link_libraries(kjs-unity  ${KDE4_KDECORE_LIBS})
113 endif(UNIX)
114
115 target_link_libraries(kjs-unity wtf-unity)
116 set_target_properties(kjs-unity PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
117 install(TARGETS kjs-unity  DESTINATION ${LIB_INSTALL_DIR} )
118
119 project(kjs-unity)
120
121 MESSAGE(STATUS "Missing CMakeFiles.txt into wtf directory")
122 add_subdirectory( wtf )
123 add_subdirectory( pcre )
124
125 # Configuration checks
126 check_library_exists(pthread pthread_attr_get_np "" HAVE_PTHREAD_ATTR_GET_NP)
127 check_library_exists(pthread pthread_getattr_np "" HAVE_PTHREAD_GETATTR_NP)
128
129 include_directories(
130     ${CMAKE_CURRENT_SOURCE_DIR}/pcre
131     ${CMAKE_CURRENT_BINARY_DIR}/kjs
132     ${CMAKE_CURRENT_SOURCE_DIR}/kjs
133
134     ${QT_INCLUDES}
135 )
136
137 if(WIN32)
138   include_directories( ${KDEWIN32_INCLUDES} )
139 endif(WIN32)
140
141 set(CREATE_HASH_TABLE ${CMAKE_CURRENT_SOURCE_DIR}/kjs/create_hash_table )
142
143 macro(CREATE_LUT _srcs_LIST _in_FILE _out_FILE _dep_FILE)
144
145    add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE}
146       COMMAND ${PERL_EXECUTABLE} ${CREATE_HASH_TABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} -i > ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE}
147       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${_dep_FILE} )
148    set( ${_srcs_LIST}  ${${_srcs_LIST}} ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE})
149 endmacro(CREATE_LUT)
150
151 create_lut(kjs-unity_LIB_SRCS kjs/date_object.cpp kjs/date_object.lut.h kjs/date_object.cpp)
152 create_lut(kjs-unity_LIB_SRCS kjs/number_object.cpp kjs/number_object.lut.h kjs/number_object.cpp)
153 create_lut(kjs-unity_LIB_SRCS kjs/string_object.cpp kjs/string_object.lut.h kjs/string_object.cpp)
154 create_lut(kjs-unity_LIB_SRCS kjs/array_object.cpp kjs/array_object.lut.h kjs/array_object.cpp)
155 create_lut(kjs-unity_LIB_SRCS kjs/math_object.cpp kjs/math_object.lut.h kjs/math_object.cpp)
156 create_lut(kjs-unity_LIB_SRCS kjs/regexp_object.cpp kjs/regexp_object.lut.h kjs/regexp_object.cpp)
157 create_lut(kjs-unity_LIB_SRCS kjs/keywords.table kjs/lexer.lut.h kjs/lexer.cpp)
158 create_lut(kjs-unity_LIB_SRCS kjs/keywords.table kjs/lexer.lut.h kjs/lexer.cpp)
159
160 add_custom_command(
161   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.cpp ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.h
162   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
163
164   COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/kjs
165   COMMAND ${BISON_EXECUTABLE} -d -p kjsyy ${CMAKE_CURRENT_SOURCE_DIR}/kjs/grammar.y
166   COMMAND mv grammar.tab.c ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.cpp
167   COMMAND mv grammar.tab.h ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.h
168   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/kjs/grammar.y
169 )
170
171 ########### next target ###############
172
173 kde4_add_library(wtf-unity SHARED
174     wtf/TCSystemAlloc.cpp
175     wtf/Assertions.cpp
176     wtf/HashTable.cpp
177     wtf/FastMalloc.cpp
178 )
179
180 set(kjs-unity_LIB_SRCS
181     ${kjs-unity_LIB_SRCS}
182     wtf/unicode/qt4/UnicodeQt4.cpp
183     kjs/JSWrapperObject.cpp
184         kjs/PropertyNameArray.cpp
185         kjs/array_object.cpp
186         kjs/bool_object.cpp
187         kjs/collector.cpp
188         kjs/Context.cpp
189         kjs/date_object.cpp
190         kjs/debugger.cpp
191         kjs/dtoa.cpp
192         kjs/error_object.cpp
193         kjs/fpconst.cpp
194         kjs/function.cpp
195         kjs/function_object.cpp
196     ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.cpp
197         kjs/identifier.cpp
198         kjs/internal.cpp
199         kjs/interpreter.cpp
200     kjs/JSImmediate.cpp
201         kjs/JSLock.cpp 
202         kjs/lexer.cpp
203         kjs/list.cpp
204         kjs/lookup.cpp
205         kjs/math_object.cpp
206         kjs/nodes.cpp
207         kjs/nodes2string.cpp
208         kjs/number_object.cpp
209         kjs/object.cpp
210         kjs/object_object.cpp
211         kjs/operations.cpp
212         kjs/Parser.cpp
213         kjs/property_map.cpp
214         kjs/property_slot.cpp
215         kjs/regexp.cpp
216         kjs/regexp_object.cpp
217         kjs/scope_chain.cpp
218         kjs/string_object.cpp
219         kjs/ustring.cpp
220         kjs/value.cpp
221         kjs/ExecState.cpp
222 )
223
224 kde4_add_library(kjs-unity STATIC ${kjs-unity_LIB_SRCS})
225
226 if(UNIX)
227    target_link_libraries(kjs-unity  ${KDE4_KDECORE_LIBS} m )
228 else(UNIX)
229    target_link_libraries(kjs-unity  ${KDE4_KDECORE_LIBS})
230 endif(UNIX)
231
232 target_link_libraries(kjs-unity wtf-unity)
233 set_target_properties(kjs-unity PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
234 install(TARGETS kjs-unity  DESTINATION ${LIB_INSTALL_DIR} )