Mercurial > projects > qtd
annotate generator/CMakeLists.txt @ 378:7341c47790d4
binding of qwt
author | Eldar Insafutdinov |
---|---|
date | Sat, 10 Jul 2010 21:54:44 +0100 |
parents | b460cd08041f |
children | d2f48c4cb3e3 |
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 ## Includes path. | |
378 | 143 set(inc_paths_for_build |
132 | 144 ${CMAKE_CURRENT_SOURCE_DIR}/../common |
145 ${CMAKE_CURRENT_SOURCE_DIR}/parser | |
146 ${CMAKE_CURRENT_SOURCE_DIR} | |
147 ${CMAKE_CURRENT_SOURCE_DIR}/parser/rpp | |
148 #${CMAKE_CURRENT_SOURCE_DIR}/parser/include | |
149 ) | |
150 | |
151 add_definitions(-DRXX_ALLOCATOR_INIT_0) | |
152 | |
153 ## Build project | |
154 find_package (Qt4 REQUIRED) | |
155 set (QT_USE_QTMAIN true) | |
156 set (QT_USE_QTGUI false) | |
157 set (QT_USE_QTXML true) | |
158 | |
159 include(${QT_USE_FILE} ${CMAKE_CURRENT_SOURCE_DIR}) | |
160 | |
378 | 161 set(inc_paths_for_build |
162 ${inc_paths_for_build} | |
132 | 163 ${QT_INCLUDES} |
164 ) | |
165 set(lib_paths | |
166 ${lib_paths} | |
167 ${QT_LIBRARY_DIR} | |
168 ) | |
169 set(libs | |
170 ${QT_LIBRARIES} | |
171 ) | |
172 | |
173 qt4_wrap_cpp(moc_srcs ${moc_hdrs}) | |
174 qt4_add_resources(res_wrapped_files ${res_files}) | |
175 | |
176 set (all_srcs | |
177 ${srcs} ${moc_srcs} | |
178 ${res_wrapped_files}) | |
378 | 179 include_directories(${inc_paths_for_build}) |
132 | 180 add_executable(generator ${all_srcs} ) |
181 target_link_libraries(generator ${libs}) | |
182 | |
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
|
183 ## 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
|
184 ## was downloaded from http://www.vtk.org/Bug/view.php?id=1260. |
132 | 185 #OPTION(USEPCH "Build the project with precompiled-headers" ON) |
186 #include(../cmake/PCHSupport_26.cmake) | |
187 # | |
188 #IF(NOT USEPCH) | |
189 # MESSAGE(STATUS "NOT using precompiled-header") | |
190 #ELSE(NOT USEPCH) | |
191 # MESSAGE(STATUS "Using precompiled-header") | |
192 # add_precompiled_header(generator ${CMAKE_CURRENT_SOURCE_DIR}/generator_pch.h) | |
193 #ENDIF(NOT USEPCH) | |
194 | |
265 | 195 set(dgen_build_conf ${CMAKE_BINARY_DIR}/CMakeFiles/build.txt) |
196 set(jambi_inc ${CMAKE_BINARY_DIR}/CMakeFiles/qtjambi_masterinclude.h) | |
197 if( NOT "${packages_in_build_txt}" STREQUAL "${packages}" | |
198 OR NOT EXISTS ${dgen_build_conf} | |
199 OR NOT EXISTS ${jambi_inc}) | |
132 | 200 file(REMOVE ${dgen_build_conf}) |
265 | 201 file(REMOVE ${jambi_inc}) |
132 | 202 file(APPEND ${dgen_build_conf} "<typesystem>\n") |
265 | 203 foreach(package_normal ${packages}) |
378 | 204 string(TOLOWER ${package_normal} package) |
205 string(TOUPPER ${package_normal} package_upper) | |
206 file(APPEND ${dgen_build_conf} " <load-typesystem name=\"typesystem_${package}.xml\" generate=\"yes\" />\n") | |
207 # only append include if we have QT_QT${MODULE}_INCLUDE_DIR defined, otherwise handle customly | |
208 if(NOT ${QT_QT${package_upper}_INCLUDE_DIR} STREQUAL "") | |
209 file(APPEND ${jambi_inc} "#include <${QT_QT${package_upper}_INCLUDE_DIR}/Qt${package_normal}>\n") | |
210 endif() | |
211 endforeach() | |
132 | 212 file(APPEND ${dgen_build_conf} "</typesystem>\n") |
237 | 213 set(packages_in_build_txt ${packages} CACHE INTERNAL "") |
378 | 214 # merge include file for Qwt |
215 if(BUILD_QT_QWT) | |
216 file(READ "${CMAKE_SOURCE_DIR}/include/qwt_masterinclude.h" jambi_inc_qwt) | |
217 file(APPEND ${jambi_inc} ${jambi_inc_qwt}) | |
218 endif() | |
219 endif() | |
220 | |
132 | 221 set(gen_sources) |
265 | 222 foreach(package_normal ${packages}) |
266
5134552d97f6
Bug fix for http://www.dsource.org/forums/viewtopic.php?t=4713
SokoL_SD
parents:
265
diff
changeset
|
223 string(TOLOWER ${package_normal} package) |
283 | 224 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
|
225 set(d_inc_file_found d_inc_file_found-NOTFOUND) |
283 | 226 find_file(d_inc_file_found typesystem_${package}-java.java PATHS ${CMAKE_CURRENT_SOURCE_DIR}/) |
132 | 227 if(d_inc_file_found) |
378 | 228 set(gen_sources ${gen_sources} ${d_inc_file_found}) |
229 endif() | |
230 endforeach() | |
132 | 231 mark_as_advanced(d_inc_file_found) |
232 set(d_inc_file_found 1) | |
233 | |
232 | 234 foreach(path ${QT_INCLUDES}) |
378 | 235 set(inc_paths_tmp ${path}${sep}) |
236 endforeach() | |
237 set(inc_paths ${inc_paths}${sep}${inc_paths_tmp}) | |
238 | |
239 | 239 if(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) |
240 set(out_dir ${CMAKE_SOURCE_DIR}) | |
378 | 241 else() |
239 | 242 set(out_dir ${CMAKE_BINARY_DIR}/build) |
378 | 243 endif() |
239 | 244 set(dgen_impl ${out_dir}/cpp/qt_core/ArrayOps_shell.cpp) |
132 | 245 add_custom_command(OUTPUT ${dgen_impl} |
246 COMMAND ${CMAKE_COMMAND} -E remove -f ${dgen_impl} | |
247 COMMAND "generator" | |
236 | 248 ARGS ${GEN_OPT} --include-paths=${inc_paths} |
239 | 249 --output-directory=${out_dir} |
283 | 250 --source-directory=${CMAKE_CURRENT_SOURCE_DIR} |
265 | 251 ${CMAKE_BINARY_DIR}/CMakeFiles/qtjambi_masterinclude.h |
132 | 252 ${CMAKE_BINARY_DIR}/CMakeFiles/build.txt |
253 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
|
254 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
|
255 ) |
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
|
256 add_custom_target(dgen ALL DEPENDS ${dgen_impl} COMMENT "") |