Mercurial > projects > qtd
comparison generator/CMakeLists.txt @ 384:d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
author | Max Samukha <maxter@spambox.com> |
---|---|
date | Fri, 16 Jul 2010 20:04:29 +0300 |
parents | 7341c47790d4 |
children | aa08a72d480a |
comparison
equal
deleted
inserted
replaced
383:bd7f485e3573 | 384:d2f48c4cb3e3 |
---|---|
2 cmake_minimum_required(VERSION 2.6) | 2 cmake_minimum_required(VERSION 2.6) |
3 find_package(Qt4 REQUIRED) | 3 find_package(Qt4 REQUIRED) |
4 | 4 |
5 ## Hack for msvc: force Release settings | 5 ## Hack for msvc: force Release settings |
6 string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type_upper) | 6 string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type_upper) |
7 set(CMAKE_CXX_FLAGS_${build_type_upper} ${CMAKE_CXX_FLAGS_RELEASE}) | 7 set(CMAKE_CXX_FLAGS_${build_type_upper} ${CMAKE_CXX_FLAGS_RELEASE}) |
8 get_property(dir_prop DIRECTORY | 8 get_property(dir_prop DIRECTORY |
9 PROPERTY COMPILE_DEFINITIONS_RELEASE) | 9 PROPERTY COMPILE_DEFINITIONS_RELEASE) |
10 set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS_${build_type_upper} ${dir_prop}) | 10 set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS_${build_type_upper} ${dir_prop}) |
11 | 11 |
12 ## Sources | 12 ## Sources |
13 set(srcs | 13 set(srcs |
14 global.cpp | |
14 classlistgenerator.cpp | 15 classlistgenerator.cpp |
15 cppgenerator.cpp | 16 cppgenerator.cpp |
16 cppheadergenerator.cpp | 17 cppheadergenerator.cpp |
17 cppimplgenerator.cpp | 18 cppimplgenerator.cpp |
18 docparser.cpp | 19 docparser.cpp |
22 metainfogenerator.cpp | 23 metainfogenerator.cpp |
23 metajavabuilder.cpp | 24 metajavabuilder.cpp |
24 qdocgenerator.cpp | 25 qdocgenerator.cpp |
25 uiconverter.cpp | 26 uiconverter.cpp |
26 containergenerator.cpp | 27 containergenerator.cpp |
27 | 28 |
28 generator.cpp | 29 generator.cpp |
29 main.cpp | 30 main.cpp |
30 reporthandler.cpp | 31 reporthandler.cpp |
31 typeparser.cpp | 32 typeparser.cpp |
32 typesystem.cpp | 33 typesystem.cpp |
36 metajava.cpp | 37 metajava.cpp |
37 customtypes.cpp | 38 customtypes.cpp |
38 abstractmetabuilder.cpp | 39 abstractmetabuilder.cpp |
39 abstractmetalang.cpp | 40 abstractmetalang.cpp |
40 prigenerator.cpp | 41 prigenerator.cpp |
41 | 42 |
42 # rxx | 43 # rxx |
43 parser/ast.cpp | 44 parser/ast.cpp |
44 parser/lexer.cpp | 45 parser/lexer.cpp |
45 parser/list.cpp | 46 parser/list.cpp |
46 parser/parser.cpp | 47 parser/parser.cpp |
56 parser/name_compiler.cpp | 57 parser/name_compiler.cpp |
57 parser/declarator_compiler.cpp | 58 parser/declarator_compiler.cpp |
58 parser/class_compiler.cpp | 59 parser/class_compiler.cpp |
59 parser/codemodel_finder.cpp | 60 parser/codemodel_finder.cpp |
60 parser/compiler_utils.cpp | 61 parser/compiler_utils.cpp |
61 | 62 |
62 ## rpp | 63 ## rpp |
63 parser/rpp/preprocessor.cpp | 64 parser/rpp/preprocessor.cpp |
64 ) | 65 ) |
65 ## Moc headers | 66 ## Moc headers |
66 set(moc_hdrs | 67 set(moc_hdrs |
88 #metajava.h | 89 #metajava.h |
89 #customtypes.h | 90 #customtypes.h |
90 #abstractmetabuilder.h | 91 #abstractmetabuilder.h |
91 #abstractmetalang.h | 92 #abstractmetalang.h |
92 prigenerator.h | 93 prigenerator.h |
93 | 94 |
94 ## rxx | 95 ## rxx |
95 #parser/ast.h | 96 #parser/ast.h |
96 #parser/lexer.h | 97 #parser/lexer.h |
97 #parser/list.h | 98 #parser/list.h |
98 #parser/parser.h | 99 #parser/parser.h |
113 #parser/name_compiler.h | 114 #parser/name_compiler.h |
114 #parser/declarator_compiler.h | 115 #parser/declarator_compiler.h |
115 #parser/class_compiler.h | 116 #parser/class_compiler.h |
116 #parser/codemodel_finder.h | 117 #parser/codemodel_finder.h |
117 #parser/compiler_utils.h | 118 #parser/compiler_utils.h |
118 | 119 |
119 # rpp | 120 # rpp |
120 #parser/rpp/pp-cctype.h | 121 #parser/rpp/pp-cctype.h |
121 #parser/rpp/pp-engine-bits.h | 122 #parser/rpp/pp-engine-bits.h |
122 #parser/rpp/pp-engine.h | 123 #parser/rpp/pp-engine.h |
123 #parser/rpp/pp-environment.h | 124 #parser/rpp/pp-environment.h |
129 #parser/rpp/pp-scanner.h | 130 #parser/rpp/pp-scanner.h |
130 #parser/rpp/pp-string.h | 131 #parser/rpp/pp-string.h |
131 #parser/rpp/pp-symbol.h | 132 #parser/rpp/pp-symbol.h |
132 #parser/rpp/pp.h | 133 #parser/rpp/pp.h |
133 #parser/rpp/preprocessor.h | 134 #parser/rpp/preprocessor.h |
134 | 135 |
135 ) | 136 ) |
136 | 137 |
137 ## Resources. | 138 ## Resources. |
138 set(res_files | 139 set(res_files |
139 generator.qrc | 140 generator.qrc |
140 ) | 141 ) |
141 | 142 |
142 ## Includes path. | 143 ## Includes path. |
143 set(inc_paths_for_build | 144 set(inc_paths_for_build |
144 ${CMAKE_CURRENT_SOURCE_DIR}/../common | 145 ${CMAKE_CURRENT_SOURCE_DIR}/../common |
145 ${CMAKE_CURRENT_SOURCE_DIR}/parser | 146 ${CMAKE_CURRENT_SOURCE_DIR}/parser |
146 ${CMAKE_CURRENT_SOURCE_DIR} | 147 ${CMAKE_CURRENT_SOURCE_DIR} |
147 ${CMAKE_CURRENT_SOURCE_DIR}/parser/rpp | 148 ${CMAKE_CURRENT_SOURCE_DIR}/parser/rpp |
148 #${CMAKE_CURRENT_SOURCE_DIR}/parser/include | 149 #${CMAKE_CURRENT_SOURCE_DIR}/parser/include |
149 ) | 150 ) |
150 | 151 |
151 add_definitions(-DRXX_ALLOCATOR_INIT_0) | 152 add_definitions(-DRXX_ALLOCATOR_INIT_0) |
152 | 153 |
153 ## Build project | 154 ## Build project |
154 find_package (Qt4 REQUIRED) | 155 find_package (Qt4 REQUIRED) |
155 set (QT_USE_QTMAIN true) | 156 set (QT_USE_QTMAIN true) |
156 set (QT_USE_QTGUI false) | 157 set (QT_USE_QTGUI false) |
157 set (QT_USE_QTXML true) | 158 set (QT_USE_QTXML true) |
158 | 159 |
159 include(${QT_USE_FILE} ${CMAKE_CURRENT_SOURCE_DIR}) | 160 include(${QT_USE_FILE} ${CMAKE_CURRENT_SOURCE_DIR}) |
160 | 161 |
161 set(inc_paths_for_build | 162 set(inc_paths_for_build |
162 ${inc_paths_for_build} | 163 ${inc_paths_for_build} |
163 ${QT_INCLUDES} | 164 ${QT_INCLUDES} |
164 ) | 165 ) |
165 set(lib_paths | 166 set(lib_paths |
166 ${lib_paths} | 167 ${lib_paths} |
167 ${QT_LIBRARY_DIR} | 168 ${QT_LIBRARY_DIR} |
168 ) | 169 ) |
169 set(libs | 170 set(libs |
170 ${QT_LIBRARIES} | 171 ${QT_LIBRARIES} |
171 ) | 172 ) |
172 | 173 |
173 qt4_wrap_cpp(moc_srcs ${moc_hdrs}) | 174 qt4_wrap_cpp(moc_srcs ${moc_hdrs}) |
174 qt4_add_resources(res_wrapped_files ${res_files}) | 175 qt4_add_resources(res_wrapped_files ${res_files}) |
175 | 176 |
176 set (all_srcs | 177 set (all_srcs |
177 ${srcs} ${moc_srcs} | 178 ${srcs} ${moc_srcs} |
178 ${res_wrapped_files}) | 179 ${res_wrapped_files}) |
179 include_directories(${inc_paths_for_build}) | 180 include_directories(${inc_paths_for_build}) |
180 add_executable(generator ${all_srcs} ) | 181 add_executable(generator ${all_srcs} ) |
181 target_link_libraries(generator ${libs}) | 182 target_link_libraries(generator ${libs}) |
182 | 183 |
183 ## TODO: Precompilated header works well, but I don't know a license of PCHSupport_26.cmake which | 184 ## TODO: Precompilated header works well, but I don't know a license of PCHSupport_26.cmake which |
184 ## was downloaded from http://www.vtk.org/Bug/view.php?id=1260. | 185 ## was downloaded from http://www.vtk.org/Bug/view.php?id=1260. |
185 #OPTION(USEPCH "Build the project with precompiled-headers" ON) | 186 #OPTION(USEPCH "Build the project with precompiled-headers" ON) |
186 #include(../cmake/PCHSupport_26.cmake) | 187 #include(../cmake/PCHSupport_26.cmake) |
187 # | 188 # |
188 #IF(NOT USEPCH) | 189 #IF(NOT USEPCH) |
189 # MESSAGE(STATUS "NOT using precompiled-header") | 190 # MESSAGE(STATUS "NOT using precompiled-header") |
190 #ELSE(NOT USEPCH) | 191 #ELSE(NOT USEPCH) |
191 # MESSAGE(STATUS "Using precompiled-header") | 192 # MESSAGE(STATUS "Using precompiled-header") |
192 # add_precompiled_header(generator ${CMAKE_CURRENT_SOURCE_DIR}/generator_pch.h) | 193 # add_precompiled_header(generator ${CMAKE_CURRENT_SOURCE_DIR}/generator_pch.h) |
193 #ENDIF(NOT USEPCH) | 194 #ENDIF(NOT USEPCH) |
194 | 195 |
195 set(dgen_build_conf ${CMAKE_BINARY_DIR}/CMakeFiles/build.txt) | 196 set(dgen_build_conf ${CMAKE_BINARY_DIR}/CMakeFiles/build.txt) |
196 set(jambi_inc ${CMAKE_BINARY_DIR}/CMakeFiles/qtjambi_masterinclude.h) | 197 set(jambi_inc ${CMAKE_BINARY_DIR}/CMakeFiles/qtjambi_masterinclude.h) |
197 if( NOT "${packages_in_build_txt}" STREQUAL "${packages}" | 198 if( NOT "${packages_in_build_txt}" STREQUAL "${packages}" |
198 OR NOT EXISTS ${dgen_build_conf} | 199 OR NOT EXISTS ${dgen_build_conf} |
199 OR NOT EXISTS ${jambi_inc}) | 200 OR NOT EXISTS ${jambi_inc}) |
200 file(REMOVE ${dgen_build_conf}) | 201 file(REMOVE ${dgen_build_conf}) |
201 file(REMOVE ${jambi_inc}) | 202 file(REMOVE ${jambi_inc}) |
202 file(APPEND ${dgen_build_conf} "<typesystem>\n") | 203 file(APPEND ${dgen_build_conf} "<typesystem>\n") |
203 foreach(package_normal ${packages}) | 204 foreach(package_normal ${packages}) |
204 string(TOLOWER ${package_normal} package) | 205 string(TOLOWER ${package_normal} package) |
205 string(TOUPPER ${package_normal} package_upper) | 206 string(TOUPPER ${package_normal} package_upper) |
206 file(APPEND ${dgen_build_conf} " <load-typesystem name=\"typesystem_${package}.xml\" generate=\"yes\" />\n") | 207 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 # 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 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 file(APPEND ${jambi_inc} "#include <${QT_QT${package_upper}_INCLUDE_DIR}/Qt${package_normal}>\n") |
210 endif() | 211 endif() |
215 if(BUILD_QT_QWT) | 216 if(BUILD_QT_QWT) |
216 file(READ "${CMAKE_SOURCE_DIR}/include/qwt_masterinclude.h" jambi_inc_qwt) | 217 file(READ "${CMAKE_SOURCE_DIR}/include/qwt_masterinclude.h" jambi_inc_qwt) |
217 file(APPEND ${jambi_inc} ${jambi_inc_qwt}) | 218 file(APPEND ${jambi_inc} ${jambi_inc_qwt}) |
218 endif() | 219 endif() |
219 endif() | 220 endif() |
220 | 221 |
221 set(gen_sources) | 222 set(gen_sources) |
222 foreach(package_normal ${packages}) | 223 foreach(package_normal ${packages}) |
223 string(TOLOWER ${package_normal} package) | 224 string(TOLOWER ${package_normal} package) |
224 set(gen_sources ${gen_sources} ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_${package}.xml) | 225 set(gen_sources ${gen_sources} ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_${package}.xml) |
225 set(d_inc_file_found d_inc_file_found-NOTFOUND) | 226 set(d_inc_file_found d_inc_file_found-NOTFOUND) |
226 find_file(d_inc_file_found typesystem_${package}-java.java PATHS ${CMAKE_CURRENT_SOURCE_DIR}/) | 227 find_file(d_inc_file_found typesystem_${package}-java.java PATHS ${CMAKE_CURRENT_SOURCE_DIR}/) |
227 if(d_inc_file_found) | 228 if(d_inc_file_found) |
228 set(gen_sources ${gen_sources} ${d_inc_file_found}) | 229 set(gen_sources ${gen_sources} ${d_inc_file_found}) |
229 endif() | 230 endif() |
230 endforeach() | 231 endforeach() |
231 mark_as_advanced(d_inc_file_found) | 232 mark_as_advanced(d_inc_file_found) |
232 set(d_inc_file_found 1) | 233 set(d_inc_file_found 1) |
233 | 234 |
234 foreach(path ${QT_INCLUDES}) | 235 foreach(path ${QT_INCLUDES}) |
235 set(inc_paths_tmp ${path}${sep}) | 236 set(inc_paths_tmp ${path}${sep}) |
236 endforeach() | 237 endforeach() |
237 set(inc_paths ${inc_paths}${sep}${inc_paths_tmp}) | 238 set(inc_paths ${inc_paths}${sep}${inc_paths_tmp}) |
238 | 239 |
245 add_custom_command(OUTPUT ${dgen_impl} | 246 add_custom_command(OUTPUT ${dgen_impl} |
246 COMMAND ${CMAKE_COMMAND} -E remove -f ${dgen_impl} | 247 COMMAND ${CMAKE_COMMAND} -E remove -f ${dgen_impl} |
247 COMMAND "generator" | 248 COMMAND "generator" |
248 ARGS ${GEN_OPT} --include-paths=${inc_paths} | 249 ARGS ${GEN_OPT} --include-paths=${inc_paths} |
249 --output-directory=${out_dir} | 250 --output-directory=${out_dir} |
250 --source-directory=${CMAKE_CURRENT_SOURCE_DIR} | 251 --source-directory=${CMAKE_CURRENT_SOURCE_DIR} |
251 ${CMAKE_BINARY_DIR}/CMakeFiles/qtjambi_masterinclude.h | 252 ${CMAKE_BINARY_DIR}/CMakeFiles/qtjambi_masterinclude.h |
252 ${CMAKE_BINARY_DIR}/CMakeFiles/build.txt | 253 ${CMAKE_BINARY_DIR}/CMakeFiles/build.txt |
253 COMMENT "Generating binding..." | 254 COMMENT "Generating binding..." |
254 DEPENDS generator ${gen_sources} ${CMAKE_BINARY_DIR}/CMakeFiles/build.txt | 255 DEPENDS generator ${gen_sources} ${CMAKE_BINARY_DIR}/CMakeFiles/build.txt |
255 ) | 256 ) |
256 add_custom_target(dgen ALL DEPENDS ${dgen_impl} COMMENT "") | 257 add_custom_target(dgen ALL DEPENDS ${dgen_impl} COMMENT "") |