Mercurial > projects > qtd
annotate generator/CMakeLists.txt @ 399:e40f33cc0bf5
Explicitly include qglobal.h before all the ?master includes?.
This makes sure that macros like Q_CORE_EXPORT are already defined for all parsed header files.
Starting with this commit, QtD should build successfully against the pre-built Cocoa packages on OS X 10.6.
author | David Nadlinger <code@klickverbot.at> |
---|---|
date | Sun, 16 Jan 2011 00:56:21 +0100 |
parents | aa08a72d480a |
children | a81c53f7b83b |
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) |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
7 set(CMAKE_CXX_FLAGS_${build_type_upper} ${CMAKE_CXX_FLAGS_RELEASE}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
8 get_property(dir_prop DIRECTORY |
132 | 9 PROPERTY COMPILE_DEFINITIONS_RELEASE) |
10 set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS_${build_type_upper} ${dir_prop}) | |
11 | |
12 ## Sources | |
13 set(srcs | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
14 global.cpp |
132 | 15 classlistgenerator.cpp |
16 cppgenerator.cpp | |
17 cppheadergenerator.cpp | |
18 cppimplgenerator.cpp | |
19 docparser.cpp | |
20 generatorsetd.cpp | |
21 dgenerator.cpp | |
22 jumptable.cpp | |
23 metainfogenerator.cpp | |
24 metajavabuilder.cpp | |
25 qdocgenerator.cpp | |
26 uiconverter.cpp | |
27 containergenerator.cpp | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
28 |
132 | 29 generator.cpp |
30 main.cpp | |
31 reporthandler.cpp | |
32 typeparser.cpp | |
33 typesystem.cpp | |
34 asttoxml.cpp | |
35 fileout.cpp | |
36 generatorset.cpp | |
37 metajava.cpp | |
38 customtypes.cpp | |
39 abstractmetabuilder.cpp | |
40 abstractmetalang.cpp | |
41 prigenerator.cpp | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
42 |
132 | 43 # rxx |
44 parser/ast.cpp | |
45 parser/lexer.cpp | |
46 parser/list.cpp | |
47 parser/parser.cpp | |
48 parser/smallobject.cpp | |
49 parser/control.cpp | |
50 parser/visitor.cpp | |
51 parser/default_visitor.cpp | |
52 parser/dumptree.cpp | |
53 parser/tokens.cpp | |
54 parser/binder.cpp | |
55 parser/codemodel.cpp | |
56 parser/type_compiler.cpp | |
57 parser/name_compiler.cpp | |
58 parser/declarator_compiler.cpp | |
59 parser/class_compiler.cpp | |
60 parser/codemodel_finder.cpp | |
61 parser/compiler_utils.cpp | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
62 |
132 | 63 ## rpp |
64 parser/rpp/preprocessor.cpp | |
65 ) | |
66 ## Moc headers | |
67 set(moc_hdrs | |
68 #classlistgenerator.h | |
69 cppgenerator.h | |
70 cppheadergenerator.h | |
71 cppimplgenerator.h | |
72 #docparser.h | |
73 generatorsetd.h | |
74 dgenerator.h | |
75 jumptable.h | |
76 #metainfogenerator.h | |
77 #metajavabuilder.h | |
78 #qdocgenerator.h | |
79 #uiconverter.h | |
80 containergenerator.h | |
81 generator.h | |
82 #main.h | |
83 #reporthandler.h | |
84 #typeparser.h | |
85 #typesystem.h | |
86 #asttoxml.h | |
87 fileout.h | |
88 generatorset.h | |
89 #metajava.h | |
90 #customtypes.h | |
91 #abstractmetabuilder.h | |
92 #abstractmetalang.h | |
93 prigenerator.h | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
94 |
132 | 95 ## rxx |
96 #parser/ast.h | |
97 #parser/lexer.h | |
98 #parser/list.h | |
99 #parser/parser.h | |
100 #parser/rxx_allocator.h | |
101 #parser/rpp-allocator.h | |
102 #parser/smallobject.h | |
103 #parser/tokens.h | |
104 #parser/symbol.h | |
105 #parser/control.h | |
106 #parser/visitor.h | |
107 #parser/default_visitor.h | |
108 #parser/dumptree.h | |
109 #parser/binder.h | |
110 #parser/codemodel.h | |
111 #parser/codemodel_pointer.h | |
112 #parser/codemodel_fwd.h | |
113 #parser/type_compiler.h | |
114 #parser/name_compiler.h | |
115 #parser/declarator_compiler.h | |
116 #parser/class_compiler.h | |
117 #parser/codemodel_finder.h | |
118 #parser/compiler_utils.h | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
119 |
132 | 120 # rpp |
121 #parser/rpp/pp-cctype.h | |
122 #parser/rpp/pp-engine-bits.h | |
123 #parser/rpp/pp-engine.h | |
124 #parser/rpp/pp-environment.h | |
125 #parser/rpp/pp-fwd.h | |
126 #parser/rpp/pp-internal.h | |
127 #parser/rpp/pp-iterator.h | |
128 #parser/rpp/pp-macro-expander.h | |
129 #parser/rpp/pp-macro.h | |
130 #parser/rpp/pp-scanner.h | |
131 #parser/rpp/pp-string.h | |
132 #parser/rpp/pp-symbol.h | |
133 #parser/rpp/pp.h | |
134 #parser/rpp/preprocessor.h | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
135 |
132 | 136 ) |
137 | |
138 ## Resources. | |
139 set(res_files | |
140 generator.qrc | |
141 ) | |
142 | |
143 ## Includes path. | |
378 | 144 set(inc_paths_for_build |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
145 ${CMAKE_CURRENT_SOURCE_DIR}/../common |
132 | 146 ${CMAKE_CURRENT_SOURCE_DIR}/parser |
147 ${CMAKE_CURRENT_SOURCE_DIR} | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
148 ${CMAKE_CURRENT_SOURCE_DIR}/parser/rpp |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
149 #${CMAKE_CURRENT_SOURCE_DIR}/parser/include |
132 | 150 ) |
151 | |
152 add_definitions(-DRXX_ALLOCATOR_INIT_0) | |
153 | |
154 ## Build project | |
155 find_package (Qt4 REQUIRED) | |
156 set (QT_USE_QTMAIN true) | |
157 set (QT_USE_QTGUI false) | |
158 set (QT_USE_QTXML true) | |
159 | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
160 include(${QT_USE_FILE} ${CMAKE_CURRENT_SOURCE_DIR}) |
132 | 161 |
378 | 162 set(inc_paths_for_build |
163 ${inc_paths_for_build} | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
164 ${QT_INCLUDES} |
132 | 165 ) |
166 set(lib_paths | |
167 ${lib_paths} | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
168 ${QT_LIBRARY_DIR} |
132 | 169 ) |
170 set(libs | |
171 ${QT_LIBRARIES} | |
172 ) | |
173 | |
174 qt4_wrap_cpp(moc_srcs ${moc_hdrs}) | |
175 qt4_add_resources(res_wrapped_files ${res_files}) | |
176 | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
177 set (all_srcs |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
178 ${srcs} ${moc_srcs} |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
179 ${res_wrapped_files}) |
378 | 180 include_directories(${inc_paths_for_build}) |
132 | 181 add_executable(generator ${all_srcs} ) |
182 target_link_libraries(generator ${libs}) | |
183 | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
184 ## TODO: Precompilated header works well, but I don't know a license of PCHSupport_26.cmake which |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
185 ## was downloaded from http://www.vtk.org/Bug/view.php?id=1260. |
132 | 186 #OPTION(USEPCH "Build the project with precompiled-headers" ON) |
187 #include(../cmake/PCHSupport_26.cmake) | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
188 # |
132 | 189 #IF(NOT USEPCH) |
190 # MESSAGE(STATUS "NOT using precompiled-header") | |
191 #ELSE(NOT USEPCH) | |
192 # MESSAGE(STATUS "Using precompiled-header") | |
193 # add_precompiled_header(generator ${CMAKE_CURRENT_SOURCE_DIR}/generator_pch.h) | |
194 #ENDIF(NOT USEPCH) | |
195 | |
265 | 196 set(dgen_build_conf ${CMAKE_BINARY_DIR}/CMakeFiles/build.txt) |
197 set(jambi_inc ${CMAKE_BINARY_DIR}/CMakeFiles/qtjambi_masterinclude.h) | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
198 if( NOT "${packages_in_build_txt}" STREQUAL "${packages}" |
265 | 199 OR NOT EXISTS ${dgen_build_conf} |
200 OR NOT EXISTS ${jambi_inc}) | |
132 | 201 file(REMOVE ${dgen_build_conf}) |
265 | 202 file(REMOVE ${jambi_inc}) |
399
e40f33cc0bf5
Explicitly include qglobal.h before all the ?master includes?.
David Nadlinger <code@klickverbot.at>
parents:
398
diff
changeset
|
203 |
e40f33cc0bf5
Explicitly include qglobal.h before all the ?master includes?.
David Nadlinger <code@klickverbot.at>
parents:
398
diff
changeset
|
204 # Explicitly include qglobal.h before all the »master includes« to make |
e40f33cc0bf5
Explicitly include qglobal.h before all the ?master includes?.
David Nadlinger <code@klickverbot.at>
parents:
398
diff
changeset
|
205 # sure Q_CORE_EXPORT and other macros are already defined for all |
e40f33cc0bf5
Explicitly include qglobal.h before all the ?master includes?.
David Nadlinger <code@klickverbot.at>
parents:
398
diff
changeset
|
206 # processed headers. Otherwise, the parser would choke on classes in files |
e40f33cc0bf5
Explicitly include qglobal.h before all the ?master includes?.
David Nadlinger <code@klickverbot.at>
parents:
398
diff
changeset
|
207 # included before "qglobal.h" in <QtCore/QtCore> using one of these macros |
e40f33cc0bf5
Explicitly include qglobal.h before all the ?master includes?.
David Nadlinger <code@klickverbot.at>
parents:
398
diff
changeset
|
208 # (e.g. QXmlStreamReader). |
e40f33cc0bf5
Explicitly include qglobal.h before all the ?master includes?.
David Nadlinger <code@klickverbot.at>
parents:
398
diff
changeset
|
209 file(APPEND ${jambi_inc} "#include <${QT_QTCORE_INCLUDE_DIR}/qglobal.h>") |
e40f33cc0bf5
Explicitly include qglobal.h before all the ?master includes?.
David Nadlinger <code@klickverbot.at>
parents:
398
diff
changeset
|
210 |
132 | 211 file(APPEND ${dgen_build_conf} "<typesystem>\n") |
265 | 212 foreach(package_normal ${packages}) |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
213 string(TOLOWER ${package_normal} package) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
214 string(TOUPPER ${package_normal} package_upper) |
378 | 215 file(APPEND ${dgen_build_conf} " <load-typesystem name=\"typesystem_${package}.xml\" generate=\"yes\" />\n") |
216 # only append include if we have QT_QT${MODULE}_INCLUDE_DIR defined, otherwise handle customly | |
217 if(NOT ${QT_QT${package_upper}_INCLUDE_DIR} STREQUAL "") | |
218 file(APPEND ${jambi_inc} "#include <${QT_QT${package_upper}_INCLUDE_DIR}/Qt${package_normal}>\n") | |
219 endif() | |
220 endforeach() | |
132 | 221 file(APPEND ${dgen_build_conf} "</typesystem>\n") |
237 | 222 set(packages_in_build_txt ${packages} CACHE INTERNAL "") |
378 | 223 # merge include file for Qwt |
224 if(BUILD_QT_QWT) | |
225 file(READ "${CMAKE_SOURCE_DIR}/include/qwt_masterinclude.h" jambi_inc_qwt) | |
226 file(APPEND ${jambi_inc} ${jambi_inc_qwt}) | |
227 endif() | |
228 endif() | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
229 |
132 | 230 set(gen_sources) |
265 | 231 foreach(package_normal ${packages}) |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
232 string(TOLOWER ${package_normal} package) |
283 | 233 set(gen_sources ${gen_sources} ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_${package}.xml) |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
234 set(d_inc_file_found d_inc_file_found-NOTFOUND) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
235 find_file(d_inc_file_found typesystem_${package}-java.java PATHS ${CMAKE_CURRENT_SOURCE_DIR}/) |
132 | 236 if(d_inc_file_found) |
378 | 237 set(gen_sources ${gen_sources} ${d_inc_file_found}) |
238 endif() | |
239 endforeach() | |
132 | 240 mark_as_advanced(d_inc_file_found) |
241 set(d_inc_file_found 1) | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
242 |
232 | 243 foreach(path ${QT_INCLUDES}) |
398
aa08a72d480a
Fixed construction of the ?--include-paths? generation argument in the build system.
David Nadlinger <code@klickverbot.at>
parents:
384
diff
changeset
|
244 set(inc_paths_tmp ${path}${sep}${inc_paths_tmp}) |
378 | 245 endforeach() |
246 set(inc_paths ${inc_paths}${sep}${inc_paths_tmp}) | |
247 | |
239 | 248 if(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) |
249 set(out_dir ${CMAKE_SOURCE_DIR}) | |
378 | 250 else() |
239 | 251 set(out_dir ${CMAKE_BINARY_DIR}/build) |
378 | 252 endif() |
239 | 253 set(dgen_impl ${out_dir}/cpp/qt_core/ArrayOps_shell.cpp) |
132 | 254 add_custom_command(OUTPUT ${dgen_impl} |
255 COMMAND ${CMAKE_COMMAND} -E remove -f ${dgen_impl} | |
256 COMMAND "generator" | |
236 | 257 ARGS ${GEN_OPT} --include-paths=${inc_paths} |
239 | 258 --output-directory=${out_dir} |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
259 --source-directory=${CMAKE_CURRENT_SOURCE_DIR} |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
260 ${CMAKE_BINARY_DIR}/CMakeFiles/qtjambi_masterinclude.h |
132 | 261 ${CMAKE_BINARY_DIR}/CMakeFiles/build.txt |
262 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
|
263 DEPENDS generator ${gen_sources} ${CMAKE_BINARY_DIR}/CMakeFiles/build.txt |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
264 ) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
378
diff
changeset
|
265 add_custom_target(dgen ALL DEPENDS ${dgen_impl} COMMENT "") |