Mercurial > projects > qtd
annotate generator/CMakeLists.txt @ 91:100d72cf4b81
didn't want to overwrite build_all.txt
author | eldar |
---|---|
date | Wed, 27 May 2009 13:02:58 +0000 |
parents | eb3b5bbffc8f |
children | a860544c5ee8 |
rev | line source |
---|---|
4 | 1 PROJECT(generator CXX C) |
2 cmake_minimum_required(VERSION 2.6) | |
3 FIND_PACKAGE(Qt4 REQUIRED) | |
4 | |
5 ## Sources | |
6 set(srcs | |
7 classlistgenerator.cpp | |
8 cppgenerator.cpp | |
9 cppheadergenerator.cpp | |
10 cppimplgenerator.cpp | |
11 docparser.cpp | |
12 generatorsetd.cpp | |
13 dgenerator.cpp | |
14 jumptable.cpp | |
15 metainfogenerator.cpp | |
16 metajavabuilder.cpp | |
17 qdocgenerator.cpp | |
18 uiconverter.cpp | |
19 containergenerator.cpp | |
20 | |
21 generator.cpp | |
22 main.cpp | |
23 reporthandler.cpp | |
24 typeparser.cpp | |
25 typesystem.cpp | |
26 asttoxml.cpp | |
27 fileout.cpp | |
28 generatorset.cpp | |
29 metajava.cpp | |
30 customtypes.cpp | |
31 abstractmetabuilder.cpp | |
32 abstractmetalang.cpp | |
33 prigenerator.cpp | |
34 | |
35 # rxx | |
36 parser/ast.cpp | |
37 parser/lexer.cpp | |
38 parser/list.cpp | |
39 parser/parser.cpp | |
40 parser/smallobject.cpp | |
41 parser/control.cpp | |
42 parser/visitor.cpp | |
43 parser/default_visitor.cpp | |
44 parser/dumptree.cpp | |
45 parser/tokens.cpp | |
46 parser/binder.cpp | |
47 parser/codemodel.cpp | |
48 parser/type_compiler.cpp | |
49 parser/name_compiler.cpp | |
50 parser/declarator_compiler.cpp | |
51 parser/class_compiler.cpp | |
52 parser/codemodel_finder.cpp | |
53 parser/compiler_utils.cpp | |
54 | |
55 ## rpp | |
56 parser/rpp/preprocessor.cpp | |
57 ) | |
58 ## Moc headers | |
59 set(moc_hdrs | |
60 classlistgenerator.h | |
61 cppgenerator.h | |
62 cppheadergenerator.h | |
63 cppimplgenerator.h | |
64 docparser.h | |
65 generatorsetd.h | |
66 dgenerator.h | |
67 jumptable.h | |
68 metainfogenerator.h | |
69 metajavabuilder.h | |
70 qdocgenerator.h | |
71 uiconverter.h | |
72 containergenerator.h | |
73 generator.h | |
74 main.h | |
75 reporthandler.h | |
76 typeparser.h | |
77 typesystem.h | |
78 asttoxml.h | |
79 fileout.h | |
80 generatorset.h | |
81 metajava.h | |
82 customtypes.h | |
83 abstractmetabuilder.h | |
84 abstractmetalang.h | |
85 prigenerator.h | |
86 | |
87 ## rxx | |
88 parser/ast.h | |
89 parser/lexer.h | |
90 parser/list.h | |
91 parser/parser.h | |
92 parser/rxx_allocator.h | |
93 parser/rpp-allocator.h | |
94 parser/smallobject.h | |
95 parser/tokens.h | |
96 parser/symbol.h | |
97 parser/control.h | |
98 parser/visitor.h | |
99 parser/default_visitor.h | |
100 parser/dumptree.h | |
101 parser/binder.h | |
102 parser/codemodel.h | |
103 parser/codemodel_pointer.h | |
104 parser/codemodel_fwd.h | |
105 parser/type_compiler.h | |
106 parser/name_compiler.h | |
107 parser/declarator_compiler.h | |
108 parser/class_compiler.h | |
109 parser/codemodel_finder.h | |
110 parser/compiler_utils.h | |
111 | |
112 # rpp | |
113 parser/rpp/pp-cctype.h | |
114 parser/rpp/pp-engine-bits.h | |
115 parser/rpp/pp-engine.h | |
116 parser/rpp/pp-environment.h | |
117 parser/rpp/pp-fwd.h | |
118 parser/rpp/pp-internal.h | |
119 parser/rpp/pp-iterator.h | |
120 parser/rpp/pp-macro-expander.h | |
121 parser/rpp/pp-macro.h | |
122 parser/rpp/pp-scanner.h | |
123 parser/rpp/pp-string.h | |
124 parser/rpp/pp-symbol.h | |
125 parser/rpp/pp.h | |
126 parser/rpp/preprocessor.h | |
127 | |
128 ) | |
129 | |
130 ## Resources. | |
131 set(res_files | |
132 generator.qrc | |
133 ) | |
134 | |
135 #win32-msvc2005:{ | |
136 # QMAKE_CXXFLAGS += -wd4996 | |
137 # QMAKE_CFLAGS += -wd4996 | |
138 #} | |
139 | |
140 #win32-msvc.net { | |
141 # QMAKE_CXXFLAGS += /Zm500 | |
142 # QMAKE_CXXFLAGS -= -Zm200 | |
143 # QMAKE_CFLAGS -= -Zm200 | |
144 #} | |
145 | |
146 ## Includes path. | |
147 set(inc_paths | |
23 | 148 ${CMAKE_CURRENT_SOURCE_DIR}/../common |
4 | 149 ${CMAKE_CURRENT_SOURCE_DIR}/parser |
23 | 150 ${CMAKE_CURRENT_SOURCE_DIR} |
151 ${CMAKE_CURRENT_SOURCE_DIR}/parser/rpp | |
152 #${CMAKE_CURRENT_SOURCE_DIR}/parser/include | |
4 | 153 ) |
154 | |
155 add_definitions(-DRXX_ALLOCATOR_INIT_0) | |
156 | |
157 ## Build project | |
158 find_package (Qt4 REQUIRED) | |
159 set (QT_USE_QTMAIN true) | |
160 set (QT_USE_QTGUI false) | |
161 set (QT_USE_QTXML true) | |
162 include(${QT_USE_FILE} ${CMAKE_CURRENT_SOURCE_DIR}) | |
163 | |
164 set(inc_paths | |
165 ${inc_paths} | |
166 ${QT_INCLUDES} | |
167 ) | |
168 set(lib_paths | |
169 ${lib_paths} | |
170 ${QT_LIBRARY_DIR} | |
171 ) | |
172 set(libs | |
173 ${QT_LIBRARIES} | |
174 ) | |
175 | |
176 qt4_wrap_cpp(moc_srcs ${moc_hdrs}) | |
177 qt4_add_resources(res_wrapped_files ${res_files}) | |
178 | |
179 set (all_srcs | |
180 ${srcs} ${moc_srcs} | |
181 ${res_wrapped_files}) | |
182 include_directories(${inc_paths}) | |
183 add_executable(generator ${all_srcs} ) | |
184 target_link_libraries(generator ${libs}) | |
185 | |
27
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
186 macro(add_dgen_target package) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
187 string(TOLOWER ${package} package) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
188 set(dgen_build_conf ${CMAKE_BINARY_DIR}/CMakeFiles/built_${package}.txt) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
189 set(dgen_build_conf_req ${CMAKE_BINARY_DIR}/CMakeFiles/built_${package}_with_req.txt) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
190 file(REMOVE ${dgen_build_conf}) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
191 file(REMOVE ${dgen_build_conf_req}) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
192 file(APPEND ${dgen_build_conf} "<typesystem>\n") |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
193 file(APPEND ${dgen_build_conf_req} "<typesystem>\n") |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
194 foreach(req ${ARGN}) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
195 string(TOLOWER ${req} req_lower) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
196 file(APPEND ${dgen_build_conf} " <load-typesystem name=\"typesystem_${req_lower}.xml\" generate=\"no\" />\n") |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
197 file(APPEND ${dgen_build_conf_req} " <load-typesystem name=\"typesystem_${req_lower}.xml\" generate=\"yes\" />\n") |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
198 endforeach(req ${ARGN}) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
199 |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
200 if(${package} STREQUAL "all") |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
201 foreach(pack ${ARGN}) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
202 set(dgen_impl ${CMAKE_BINARY_DIR}/cpp/qt_${pack}/metainfo.cpp) ## Temporary |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
203 break(pack ${ARGN}) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
204 endforeach(pack ${ARGN}) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
205 else(${package} STREQUAL "all") |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
206 set(dgen_impl ${CMAKE_BINARY_DIR}/cpp/qt_${package}/qt_${package}.pri) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
207 set(gen_sources ${gen_sources} ${CMAKE_SOURCE_DIR}/generator/typesystem_${package}.xml |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
208 ${CMAKE_SOURCE_DIR}/generator/typesystem_${package}-java.java) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
209 file(APPEND ${dgen_build_conf} " <load-typesystem name=\"typesystem_${package}.xml\" generate=\"yes\" />\n") |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
210 file(APPEND ${dgen_build_conf_req} " <load-typesystem name=\"typesystem_${package}.xml\" generate=\"yes\" />\n") |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
211 endif(${package} STREQUAL "all") |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
212 |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
213 file(APPEND ${dgen_build_conf} "</typesystem>\n") |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
214 file(APPEND ${dgen_build_conf_req} "</typesystem>\n") |
4 | 215 |
27
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
216 foreach(pack ${ARGN}) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
217 string(TOLOWER ${pack} pack_lower) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
218 set(gen_sources ${gen_sources} ${CMAKE_SOURCE_DIR}/generator/typesystem_${pack_lower}.xml |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
219 ${CMAKE_SOURCE_DIR}/generator/typesystem_${pack_lower}-java.java) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
220 endforeach(pack ${ARGN}) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
221 |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
222 add_custom_command(OUTPUT ${dgen_impl} |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
223 COMMAND ${CMAKE_COMMAND} -E remove -f ${dgen_impl} |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
224 COMMAND "generator" |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
225 ARGS ${GEN_OPT} --no-repreprocess --qt-include-directory=${QT_INCLUDE_DIR} --output-directory=./ |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
226 --source-directory=${CMAKE_SOURCE_DIR}/generator |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
227 qtjambi_masterinclude.h |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
228 ${dgen_build_conf} |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
229 COMMENT "Generating binding..." |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
230 DEPENDS generator ${gen_sources} |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
231 ) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
232 add_custom_target(dgen_${package} DEPENDS ${dgen_impl} COMMENT "") |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
233 endmacro(add_dgen_target target package required) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
234 |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
235 foreach(pack ${packages}) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
236 set(gen_typesystem ${gen_typesystem} ${CMAKE_SOURCE_DIR}/generator/typesystem_${pack}.xml) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
237 set(gen_sources ${gen_sources} ${CMAKE_SOURCE_DIR}/generator/typesystem_${pack}-java.java) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
238 endforeach(pack ${packages}) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
239 |
31 | 240 set(dgen_build_conf ${CMAKE_BINARY_DIR}/CMakeFiles/build.txt) |
27
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
241 file(REMOVE ${dgen_build_conf}) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
242 file(APPEND ${dgen_build_conf} "<typesystem>\n") |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
243 foreach(package ${packages}) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
244 file(APPEND ${dgen_build_conf} " <load-typesystem name=\"typesystem_${package}.xml\" generate=\"yes\" />\n") |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
245 endforeach(package ${packages}) |
a9626891eca6
CMake: generator will work only for needed packages.
SokoL_SD
parents:
23
diff
changeset
|
246 file(APPEND ${dgen_build_conf} "</typesystem>\n") |
4 | 247 |
42 | 248 # macro(add_sources_for_generating) |
249 # set(parameters_list_file ${CMAKE_BINARY_DIR}/CMakeFiles/dgen_parameters) | |
250 # if(${CMAKE_SYSTEM_NAME} STREQUAL Windows) | |
251 # file(REMOVE ${parameters_list_file}) | |
252 # foreach(arg ${ARGN}) | |
253 # file(APPEND ${parameters_list_file} "${arg}\n") | |
254 # endforeach(arg) | |
255 # set(param @${parameters_list_file}) | |
256 # elseif(${CMAKE_SYSTEM_NAME} STREQUAL Linux) | |
257 # set(param ${parameters}) | |
258 # endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows) | |
259 # foreach(dgen_impl ${ARGN}) | |
260 # add_custom_command(OUTPUT ${dgen_impl} | |
261 # COMMAND ${CMAKE_COMMAND} -E remove -f ${param} | |
262 # COMMAND "generator" | |
263 # ARGS ${GEN_OPT} --qt-include-directory=${QT_INCLUDE_DIR} --output-directory=${CMAKE_BINARY_DIR} | |
264 # --source-directory=${CMAKE_SOURCE_DIR}/generator | |
265 # qtjambi_masterinclude.h | |
266 # ${CMAKE_BINARY_DIR}/CMakeFiles/build.txt | |
267 # COMMENT "Generating binding..." | |
268 # DEPENDS generator ${gen_typesystem} ${gen_sources} | |
269 # ) | |
270 # endforeach(dgen_impl ${ARGN}) | |
271 # add_custom_target(dgen DEPENDS ${ARGN}) | |
272 # endmacro(add_sources_for_generating) | |
4 | 273 |
42 | 274 set(gen_sources) |
275 foreach(package ${packages}) | |
276 set(gen_sources ${gen_sources} ${CMAKE_SOURCE_DIR}/generator/typesystem_${package}.xml) | |
277 find_file(d_inc_file_found typesystem_${package}-java.java PATHS ${CMAKE_SOURCE_DIR}/generator/) | |
278 if(d_inc_file_found) | |
279 set(${CMAKE_SOURCE_DIR}/generator/typesystem_${package}-java.java) | |
280 endif(d_inc_file_found) | |
281 endforeach(package ${packages}) | |
282 mark_as_advanced(d_inc_file_found) | |
283 set(d_inc_file_found 1) | |
284 | |
285 foreach(package ${packages}) | |
286 set(dgen_impl ${CMAKE_BINARY_DIR}/cpp/qt_${package}/qt_${package}.pri) | |
287 break(package ${packages}) | |
288 endforeach(package ${packages}) | |
32
a293cd68d56c
CMake: correctly fix of the regression on windows (rev. 34).
SokoL_SD
parents:
31
diff
changeset
|
289 |
42 | 290 add_custom_command(OUTPUT ${dgen_impl} |
291 COMMAND ${CMAKE_COMMAND} -E remove -f ${dgen_impl} | |
292 COMMAND "generator" | |
293 ARGS ${GEN_OPT} --qt-include-directory=${QT_INCLUDE_DIR} --output-directory=${CMAKE_BINARY_DIR} | |
294 --source-directory=${CMAKE_SOURCE_DIR}/generator | |
295 qtjambi_masterinclude.h | |
296 ${CMAKE_BINARY_DIR}/CMakeFiles/build.txt | |
297 COMMENT "Generating binding..." | |
298 DEPENDS generator ${gen_sources} | |
299 ) | |
300 add_custom_target(dgen DEPENDS ${dgen_impl} COMMENT "") | |
301 | |
302 macro(add_sources_for_generating) | |
303 foreach(source ${ARGN}) | |
304 add_custom_command(OUTPUT "${source}" | |
305 COMMAND "" | |
306 ARGS "" | |
307 DEPENDS ${dgen_impl} | |
308 COMMENT "" | |
309 ) | |
310 endforeach(source ${ARGN}) | |
4 | 311 endmacro(add_sources_for_generating) |