Mercurial > projects > qtd
annotate generator/CMakeLists.txt @ 304:04b52676b45f signals
fixed compiling all packages
author | eldar_ins@eldar-laptop |
---|---|
date | Sun, 13 Dec 2009 06:24:55 +0500 |
parents | b61a413fc2f5 |
children | b460cd08041f |
rev | line source |
---|---|
132 | 1 PROJECT(generator CXX C) |
2 cmake_minimum_required(VERSION 2.6) | |
283 | 3 find_package(Qt4 REQUIRED) |
132 | 4 |
264
da7c867ef2ef
1) A bug is fixed when the generator doesn't restart if typesystem_${package}-java.java has been changed.
SokoL_SD
parents:
239
diff
changeset
|
5 ## Hack for msvc: force Release settings |
283 | 6 string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type_upper) |
132 | 7 set(CMAKE_CXX_FLAGS_${build_type_upper} ${CMAKE_CXX_FLAGS_RELEASE}) |
8 get_property(dir_prop DIRECTORY | |
9 PROPERTY COMPILE_DEFINITIONS_RELEASE) | |
10 set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS_${build_type_upper} ${dir_prop}) | |
11 | |
12 ## Sources | |
13 set(srcs | |
14 classlistgenerator.cpp | |
15 cppgenerator.cpp | |
16 cppheadergenerator.cpp | |
17 cppimplgenerator.cpp | |
18 docparser.cpp | |
19 generatorsetd.cpp | |
20 dgenerator.cpp | |
21 jumptable.cpp | |
22 metainfogenerator.cpp | |
23 metajavabuilder.cpp | |
24 qdocgenerator.cpp | |
25 uiconverter.cpp | |
26 containergenerator.cpp | |
27 | |
28 generator.cpp | |
29 main.cpp | |
30 reporthandler.cpp | |
31 typeparser.cpp | |
32 typesystem.cpp | |
33 asttoxml.cpp | |
34 fileout.cpp | |
35 generatorset.cpp | |
36 metajava.cpp | |
37 customtypes.cpp | |
38 abstractmetabuilder.cpp | |
39 abstractmetalang.cpp | |
40 prigenerator.cpp | |
41 | |
42 # rxx | |
43 parser/ast.cpp | |
44 parser/lexer.cpp | |
45 parser/list.cpp | |
46 parser/parser.cpp | |
47 parser/smallobject.cpp | |
48 parser/control.cpp | |
49 parser/visitor.cpp | |
50 parser/default_visitor.cpp | |
51 parser/dumptree.cpp | |
52 parser/tokens.cpp | |
53 parser/binder.cpp | |
54 parser/codemodel.cpp | |
55 parser/type_compiler.cpp | |
56 parser/name_compiler.cpp | |
57 parser/declarator_compiler.cpp | |
58 parser/class_compiler.cpp | |
59 parser/codemodel_finder.cpp | |
60 parser/compiler_utils.cpp | |
61 | |
62 ## rpp | |
63 parser/rpp/preprocessor.cpp | |
64 ) | |
65 ## Moc headers | |
66 set(moc_hdrs | |
67 #classlistgenerator.h | |
68 cppgenerator.h | |
69 cppheadergenerator.h | |
70 cppimplgenerator.h | |
71 #docparser.h | |
72 generatorsetd.h | |
73 dgenerator.h | |
74 jumptable.h | |
75 #metainfogenerator.h | |
76 #metajavabuilder.h | |
77 #qdocgenerator.h | |
78 #uiconverter.h | |
79 containergenerator.h | |
80 generator.h | |
81 #main.h | |
82 #reporthandler.h | |
83 #typeparser.h | |
84 #typesystem.h | |
85 #asttoxml.h | |
86 fileout.h | |
87 generatorset.h | |
88 #metajava.h | |
89 #customtypes.h | |
90 #abstractmetabuilder.h | |
91 #abstractmetalang.h | |
92 prigenerator.h | |
93 | |
94 ## rxx | |
95 #parser/ast.h | |
96 #parser/lexer.h | |
97 #parser/list.h | |
98 #parser/parser.h | |
99 #parser/rxx_allocator.h | |
100 #parser/rpp-allocator.h | |
101 #parser/smallobject.h | |
102 #parser/tokens.h | |
103 #parser/symbol.h | |
104 #parser/control.h | |
105 #parser/visitor.h | |
106 #parser/default_visitor.h | |
107 #parser/dumptree.h | |
108 #parser/binder.h | |
109 #parser/codemodel.h | |
110 #parser/codemodel_pointer.h | |
111 #parser/codemodel_fwd.h | |
112 #parser/type_compiler.h | |
113 #parser/name_compiler.h | |
114 #parser/declarator_compiler.h | |
115 #parser/class_compiler.h | |
116 #parser/codemodel_finder.h | |
117 #parser/compiler_utils.h | |
118 | |
119 # rpp | |
120 #parser/rpp/pp-cctype.h | |
121 #parser/rpp/pp-engine-bits.h | |
122 #parser/rpp/pp-engine.h | |
123 #parser/rpp/pp-environment.h | |
124 #parser/rpp/pp-fwd.h | |
125 #parser/rpp/pp-internal.h | |
126 #parser/rpp/pp-iterator.h | |
127 #parser/rpp/pp-macro-expander.h | |
128 #parser/rpp/pp-macro.h | |
129 #parser/rpp/pp-scanner.h | |
130 #parser/rpp/pp-string.h | |
131 #parser/rpp/pp-symbol.h | |
132 #parser/rpp/pp.h | |
133 #parser/rpp/preprocessor.h | |
134 | |
135 ) | |
136 | |
137 ## Resources. | |
138 set(res_files | |
139 generator.qrc | |
140 ) | |
141 | |
142 #win32-msvc2005:{ | |
143 # QMAKE_CXXFLAGS += -wd4996 | |
144 # QMAKE_CFLAGS += -wd4996 | |
145 #} | |
146 | |
147 #if(MSVC) | |
148 # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm500 /Zc:wchar_t-") | |
149 #endif(MSVC) | |
150 | |
151 #win32-msvc.net { | |
152 # QMAKE_CXXFLAGS += /Zm500 | |
153 # QMAKE_CXXFLAGS -= -Zm200 | |
154 # QMAKE_CFLAGS -= -Zm200 | |
155 #} | |
156 | |
157 ## Includes path. | |
158 set(inc_paths | |
159 ${CMAKE_CURRENT_SOURCE_DIR}/../common | |
160 ${CMAKE_CURRENT_SOURCE_DIR}/parser | |
161 ${CMAKE_CURRENT_SOURCE_DIR} | |
162 ${CMAKE_CURRENT_SOURCE_DIR}/parser/rpp | |
163 #${CMAKE_CURRENT_SOURCE_DIR}/parser/include | |
164 ) | |
165 | |
166 add_definitions(-DRXX_ALLOCATOR_INIT_0) | |
167 | |
168 ## Build project | |
169 find_package (Qt4 REQUIRED) | |
170 set (QT_USE_QTMAIN true) | |
171 set (QT_USE_QTGUI false) | |
172 set (QT_USE_QTXML true) | |
173 | |
174 include(${QT_USE_FILE} ${CMAKE_CURRENT_SOURCE_DIR}) | |
175 | |
176 set(inc_paths | |
177 ${inc_paths} | |
178 ${QT_INCLUDES} | |
179 ) | |
180 set(lib_paths | |
181 ${lib_paths} | |
182 ${QT_LIBRARY_DIR} | |
183 ) | |
184 set(libs | |
185 ${QT_LIBRARIES} | |
186 ) | |
187 | |
188 qt4_wrap_cpp(moc_srcs ${moc_hdrs}) | |
189 qt4_add_resources(res_wrapped_files ${res_files}) | |
190 | |
191 set (all_srcs | |
192 ${srcs} ${moc_srcs} | |
193 ${res_wrapped_files}) | |
194 include_directories(${inc_paths}) | |
195 add_executable(generator ${all_srcs} ) | |
196 target_link_libraries(generator ${libs}) | |
197 | |
264
da7c867ef2ef
1) A bug is fixed when the generator doesn't restart if typesystem_${package}-java.java has been changed.
SokoL_SD
parents:
239
diff
changeset
|
198 ## TODO: Precompilated header works well, but I don't know a license of PCHSupport_26.cmake which |
da7c867ef2ef
1) A bug is fixed when the generator doesn't restart if typesystem_${package}-java.java has been changed.
SokoL_SD
parents:
239
diff
changeset
|
199 ## was downloaded from http://www.vtk.org/Bug/view.php?id=1260. |
132 | 200 #OPTION(USEPCH "Build the project with precompiled-headers" ON) |
201 #include(../cmake/PCHSupport_26.cmake) | |
202 # | |
203 #IF(NOT USEPCH) | |
204 # MESSAGE(STATUS "NOT using precompiled-header") | |
205 #ELSE(NOT USEPCH) | |
206 # MESSAGE(STATUS "Using precompiled-header") | |
207 # add_precompiled_header(generator ${CMAKE_CURRENT_SOURCE_DIR}/generator_pch.h) | |
208 #ENDIF(NOT USEPCH) | |
209 | |
265 | 210 set(dgen_build_conf ${CMAKE_BINARY_DIR}/CMakeFiles/build.txt) |
211 set(jambi_inc ${CMAKE_BINARY_DIR}/CMakeFiles/qtjambi_masterinclude.h) | |
212 if( NOT "${packages_in_build_txt}" STREQUAL "${packages}" | |
213 OR NOT EXISTS ${dgen_build_conf} | |
214 OR NOT EXISTS ${jambi_inc}) | |
132 | 215 file(REMOVE ${dgen_build_conf}) |
265 | 216 file(REMOVE ${jambi_inc}) |
132 | 217 file(APPEND ${dgen_build_conf} "<typesystem>\n") |
265 | 218 foreach(package_normal ${packages}) |
219 string(TOLOWER ${package_normal} package) | |
220 string(TOUPPER ${package_normal} package_upper) | |
132 | 221 file(APPEND ${dgen_build_conf} " <load-typesystem name=\"typesystem_${package}.xml\" generate=\"yes\" />\n") |
265 | 222 file(APPEND ${jambi_inc} "#include <${QT_QT${package_upper}_INCLUDE_DIR}/Qt${package_normal}>\n") |
223 endforeach(package_normal ${packages}) | |
132 | 224 file(APPEND ${dgen_build_conf} "</typesystem>\n") |
237 | 225 set(packages_in_build_txt ${packages} CACHE INTERNAL "") |
265 | 226 endif( NOT "${packages_in_build_txt}" STREQUAL "${packages}" |
227 OR NOT EXISTS ${dgen_build_conf} | |
228 OR NOT EXISTS ${jambi_inc}) | |
132 | 229 |
230 set(gen_sources) | |
265 | 231 foreach(package_normal ${packages}) |
266
5134552d97f6
Bug fix for http://www.dsource.org/forums/viewtopic.php?t=4713
SokoL_SD
parents:
265
diff
changeset
|
232 string(TOLOWER ${package_normal} package) |
283 | 233 set(gen_sources ${gen_sources} ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_${package}.xml) |
266
5134552d97f6
Bug fix for http://www.dsource.org/forums/viewtopic.php?t=4713
SokoL_SD
parents:
265
diff
changeset
|
234 set(d_inc_file_found d_inc_file_found-NOTFOUND) |
283 | 235 find_file(d_inc_file_found typesystem_${package}-java.java PATHS ${CMAKE_CURRENT_SOURCE_DIR}/) |
132 | 236 if(d_inc_file_found) |
266
5134552d97f6
Bug fix for http://www.dsource.org/forums/viewtopic.php?t=4713
SokoL_SD
parents:
265
diff
changeset
|
237 set(gen_sources ${gen_sources} ${d_inc_file_found}) |
132 | 238 endif(d_inc_file_found) |
265 | 239 endforeach(package_normal ${packages}) |
132 | 240 mark_as_advanced(d_inc_file_found) |
241 set(d_inc_file_found 1) | |
242 | |
232 | 243 if(CMAKE_HOST_WIN32) |
244 set(sep ";") | |
245 else(CMAKE_HOST_WIN32) | |
246 set(sep ":") | |
247 endif(CMAKE_HOST_WIN32) | |
248 foreach(path ${QT_INCLUDES}) | |
249 set(inc_paths ${path}${sep}) | |
250 endforeach(path ${QT_INCLUDES}) | |
239 | 251 if(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) |
252 set(out_dir ${CMAKE_SOURCE_DIR}) | |
253 else(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) | |
254 set(out_dir ${CMAKE_BINARY_DIR}/build) | |
255 endif(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) | |
256 set(dgen_impl ${out_dir}/cpp/qt_core/ArrayOps_shell.cpp) | |
132 | 257 add_custom_command(OUTPUT ${dgen_impl} |
258 COMMAND ${CMAKE_COMMAND} -E remove -f ${dgen_impl} | |
259 COMMAND "generator" | |
236 | 260 ARGS ${GEN_OPT} --include-paths=${inc_paths} |
239 | 261 --output-directory=${out_dir} |
283 | 262 --source-directory=${CMAKE_CURRENT_SOURCE_DIR} |
265 | 263 ${CMAKE_BINARY_DIR}/CMakeFiles/qtjambi_masterinclude.h |
132 | 264 ${CMAKE_BINARY_DIR}/CMakeFiles/build.txt |
265 COMMENT "Generating binding..." | |
264
da7c867ef2ef
1) A bug is fixed when the generator doesn't restart if typesystem_${package}-java.java has been changed.
SokoL_SD
parents:
239
diff
changeset
|
266 DEPENDS generator ${gen_sources} ${CMAKE_BINARY_DIR}/CMakeFiles/build.txt |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
232
diff
changeset
|
267 ) |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
232
diff
changeset
|
268 add_custom_target(dgen ALL DEPENDS ${dgen_impl} COMMENT "") |