Mercurial > projects > qtd
comparison CMakeLists.txt @ 375:c429854a40c0
fix indentation and cpack
author | Eldar Insafutdinov |
---|---|
date | Fri, 09 Jul 2010 20:24:24 +0100 |
parents | 681af90e1d53 |
children | 06d8188a23e3 7341c47790d4 |
comparison
equal
deleted
inserted
replaced
374:681af90e1d53 | 375:c429854a40c0 |
---|---|
1 cmake_minimum_required(VERSION 2.6) | 1 cmake_minimum_required(VERSION 2.8) |
2 PROJECT(qtd CXX C) | 2 PROJECT(qtd CXX C) |
3 | 3 |
4 # Debug and release flags. | 4 # Debug and release flags. |
5 if (NOT CMAKE_BUILD_TYPE) | 5 if (NOT CMAKE_BUILD_TYPE) |
6 set(CMAKE_BUILD_TYPE Release) | 6 set(CMAKE_BUILD_TYPE Release) |
7 endif (NOT CMAKE_BUILD_TYPE) | 7 endif () |
8 | 8 |
9 if(${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG]) | 9 if(${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG]) |
10 set(CMAKE_BUILD_TYPE Debug) | 10 set(CMAKE_BUILD_TYPE Debug) |
11 #set( SUFFIXLIB "${SUFFIXLIB}-debug" ) | 11 #set( SUFFIXLIB "${SUFFIXLIB}-debug" ) |
12 #set( SUFFIXBIN "${SUFFIXBIN}-debug" ) | 12 #set( SUFFIXBIN "${SUFFIXBIN}-debug" ) |
13 add_definitions(-DDEBUG) | 13 add_definitions(-DDEBUG) |
14 elseif (NOT ${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS]) | 14 elseif (NOT ${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS]) |
15 message(STATUS "Only debug and release configurations are supported. The configuration is changed to 'Release'") | 15 message(STATUS "Only debug and release configurations are supported. The configuration is changed to 'Release'") |
16 set(CMAKE_BUILD_TYPE Release) | 16 set(CMAKE_BUILD_TYPE Release) |
17 endif (${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG]) | 17 endif () |
18 | 18 |
19 if (${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS]) | 19 if (${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS]) |
20 #add_definitions(-UNO_DEBUG) | 20 #add_definitions(-UNO_DEBUG) |
21 endif(${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS] ) | 21 endif() |
22 | 22 |
23 ########################################################## | 23 ########################################################## |
24 ## Build generator. | 24 ## Build generator. |
25 ########################################################## | 25 ########################################################## |
26 if (NOT SECOND_RUN) | 26 if (NOT SECOND_RUN) |
31 "Please create a directory and run cmake from there, passing the path " | 31 "Please create a directory and run cmake from there, passing the path " |
32 "to this source directory as the last argument. " | 32 "to this source directory as the last argument. " |
33 "This process created the file `CMakeCache.txt` and the directory `CMakeFiles'. Please delete them. " | 33 "This process created the file `CMakeCache.txt` and the directory `CMakeFiles'. Please delete them. " |
34 "Or you can restart cmake with `-DALLOW_IN_SOURCE_BUILDS=1`, but it is not recommended." | 34 "Or you can restart cmake with `-DALLOW_IN_SOURCE_BUILDS=1`, but it is not recommended." |
35 ) | 35 ) |
36 endif (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT ALLOW_IN_SOURCE_BUILDS) | 36 endif () |
37 | 37 |
38 FIND_PACKAGE(Qt4 REQUIRED) | 38 FIND_PACKAGE(Qt4 REQUIRED) |
39 set(QT_USE_QTMAIN false) | 39 set(QT_USE_QTMAIN false) |
40 set(QT_USE_QTGUI false) | 40 set(QT_USE_QTGUI false) |
41 | 41 |
59 | 59 |
60 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "") | 60 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "") |
61 set(CMAKE_INSTALL_PREFIX | 61 set(CMAKE_INSTALL_PREFIX |
62 ${DC_PATH} CACHE PATH "QtD install prefix" | 62 ${DC_PATH} CACHE PATH "QtD install prefix" |
63 ) | 63 ) |
64 endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "") | 64 endif() |
65 | 65 |
66 # Check D compiler version | 66 # Check D compiler version |
67 if(D_VERSION EQUAL "1") | 67 if(D_VERSION EQUAL "1") |
68 if (D_FRONTEND LESS "050") | 68 if (D_FRONTEND LESS "050") |
69 message(STATUS "Minimum required version of D compiler is 1.050 (or compiler based on this version)") | 69 message(STATUS "Minimum required version of D compiler is 1.050 (or compiler based on this version)") |
70 endif(D_FRONTEND LESS "050") | 70 endif(D_FRONTEND LESS "050") |
71 set(D_TARGET d1-tango CACHE INTERNAL "") | 71 set(D_TARGET d1-tango CACHE INTERNAL "") |
72 elseif(D_VERSION EQUAL "2") | 72 elseif(D_VERSION EQUAL "2") |
73 set(D_TARGET d2-phobos CACHE INTERNAL "") | 73 set(D_TARGET d2-phobos CACHE INTERNAL "") |
74 endif(D_VERSION EQUAL "1") | 74 endif() |
75 | 75 |
76 # System specific settings. | 76 # System specific settings. |
77 if(CMAKE_HOST_WIN32) | 77 if(CMAKE_HOST_WIN32) |
78 set(implib implib) | 78 set(implib implib) |
79 find_program(IMPLIB ${implib}) | 79 find_program(IMPLIB ${implib}) |
80 if (NOT IMPLIB) | 80 if (NOT IMPLIB) |
81 message(FATAL_ERROR "implib is not found. You can donwload it from http://ftp.digitalmars.com/bup.zip") | 81 message(FATAL_ERROR "implib is not found. You can donwload it from http://ftp.digitalmars.com/bup.zip") |
82 endif (NOT IMPLIB) | 82 endif () |
83 if(D_IS_MARS) | 83 if(D_IS_MARS) |
84 set(GEN_OPT ${GEN_OPT} --cpp_shared) | 84 set(GEN_OPT ${GEN_OPT} --cpp_shared) |
85 endif(D_IS_MARS) | 85 endif() |
86 endif(CMAKE_HOST_WIN32) | 86 endif() |
87 add_definitions(-DCPP_SHARED) | 87 add_definitions(-DCPP_SHARED) |
88 | 88 |
89 set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ./) | 89 set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ./) |
90 set(GEN_OPT ${GEN_OPT} --d-target=${D_TARGET}) | 90 set(GEN_OPT ${GEN_OPT} --d-target=${D_TARGET}) |
91 | 91 |
92 set(packages CACHE INTERNAL "") | 92 set(packages CACHE INTERNAL "") |
93 foreach(package_big ${all_packages}) | 93 foreach(package_big ${all_packages}) |
94 string(TOLOWER ${package_big} package) | 94 string(TOLOWER ${package_big} package) |
95 string(TOUPPER ${package_big} package_upper) | 95 string(TOUPPER ${package_big} package_upper) |
96 option(BUILD_QT_${package_upper} "Build Qt${package_big}" "ON") | 96 option(BUILD_QT_${package_upper} "Build Qt${package_big}" "ON") |
97 if(BUILD_QT_${package_upper}) | 97 if(BUILD_QT_${package_upper}) |
98 set(packages ${packages} ${package_big}) | 98 set(packages ${packages} ${package_big}) |
99 endif(BUILD_QT_${package_upper}) | 99 endif() |
100 endforeach(package_big ${all_packages}) | 100 endforeach() |
101 | 101 |
102 add_subdirectory(generator) | 102 add_subdirectory(generator) |
103 | 103 |
104 add_custom_target(main ALL) | 104 add_custom_target(main ALL) |
105 add_dependencies(main dgen) | 105 add_dependencies(main dgen) |
107 if(${CMAKE_GENERATOR} STREQUAL "NMake Makefiles") | 107 if(${CMAKE_GENERATOR} STREQUAL "NMake Makefiles") |
108 set(make_util nmake) | 108 set(make_util nmake) |
109 elseif(${CMAKE_GENERATOR} STREQUAL "MinGW Makefiles" OR | 109 elseif(${CMAKE_GENERATOR} STREQUAL "MinGW Makefiles" OR |
110 ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles") | 110 ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles") |
111 set(make_util $(MAKE)) | 111 set(make_util $(MAKE)) |
112 else(${CMAKE_GENERATOR} STREQUAL "NMake Makefiles") | 112 else() |
113 message(FATAL_ERROR "${CMAKE_GENERATOR} is not supported") | 113 message(FATAL_ERROR "${CMAKE_GENERATOR} is not supported") |
114 endif(${CMAKE_GENERATOR} STREQUAL "NMake Makefiles") | 114 endif() |
115 | 115 |
116 if(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) | 116 if(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) |
117 set(cd_path ${CMAKE_SOURCE_DIR}) | 117 set(cd_path ${CMAKE_SOURCE_DIR}) |
118 else(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) | 118 else() |
119 set(cd_path ${CMAKE_BINARY_DIR}/build) | 119 set(cd_path ${CMAKE_BINARY_DIR}/build) |
120 endif(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) | 120 endif() |
121 | 121 |
122 make_native_path(cd_path) | 122 make_native_path(cd_path) |
123 add_custom_command(TARGET main POST_BUILD | 123 add_custom_command(TARGET main POST_BUILD |
124 COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${CMAKE_BINARY_DIR}/build | 124 COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${CMAKE_BINARY_DIR}/build |
125 COMMAND cd ARGS ${cd_path} && ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} -DSECOND_RUN=1 ${CMAKE_SOURCE_DIR} && ${make_util} | 125 COMMAND cd ARGS ${cd_path} && ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} -DSECOND_RUN=1 ${CMAKE_SOURCE_DIR} && ${make_util} |
132 COMMAND cd ${CMAKE_BINARY_DIR}/build && ${make_util} install | 132 COMMAND cd ${CMAKE_BINARY_DIR}/build && ${make_util} install |
133 COMMENT "" | 133 COMMENT "" |
134 ) | 134 ) |
135 add_dependencies(install preinstall) | 135 add_dependencies(install preinstall) |
136 | 136 |
137 ##-------------------------------------------- | |
138 ## CPack. | |
139 ##-------------------------------------------- | |
140 set(CPACK_PACKAGE_VERSION_PATCH 1) | |
141 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "QtD is a D binding to the Qt application and UI framework.") | |
142 SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/changelog.txt") | |
143 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt") | |
144 set(CPACK_PACKAGE_VENDOR "QtD team") | |
145 set(CPACK_PACKAGE_CONTACT "e@mail.ru") | |
146 SET(CPACK_PACKAGE_VERSION "0.1") | |
147 set(CPACK_PACKAGE_INSTALL_DIRECTORY "qtd ${CPACK_PACKAGE_VERSION}") | |
148 set(CPACK_PACKAGE_FILE_NAME "qtd-${CPACK_PACKAGE_VERSION}") | |
149 set(CPACK_SOURCE_PACKAGE_FILE_NAME "qtd-${CPACK_PACKAGE_VERSION}") | |
150 if(CMAKE_HOST_WIN32) | |
151 set(CPACK_GENERATOR "ZIP") | |
152 elseif(CMAKE_HOST_UNIX) | |
153 set(CPACK_GENERATOR "TBZ2;DEB;RPM") | |
154 endif(CMAKE_HOST_WIN32) | |
155 include(CPack) | |
156 | |
157 ########################################################## | 137 ########################################################## |
158 ## Build QtD. | 138 ## Build QtD. |
159 ########################################################## | 139 ########################################################## |
160 else(NOT SECOND_RUN) | 140 else(NOT SECOND_RUN) |
161 | 141 |
162 PROJECT(qtd CXX C) | 142 PROJECT(qtd CXX C) |
163 if(NOT ${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) | 143 if(NOT ${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) |
164 load_cache(${CMAKE_BINARY_DIR}/.. INCLUDE_INTERNALS all_packages QTD_VERSION_STR QTD_VERSION) | 144 load_cache(${CMAKE_BINARY_DIR}/.. INCLUDE_INTERNALS all_packages QTD_VERSION_STR QTD_VERSION) |
165 endif(NOT ${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) | 145 endif() |
166 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) | 146 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) |
167 FIND_PACKAGE(D REQUIRED) | 147 FIND_PACKAGE(D REQUIRED) |
168 FIND_PACKAGE(Qt4 REQUIRED) | 148 FIND_PACKAGE(Qt4 REQUIRED) |
169 | 149 |
170 set(QTD_VERSION_STR ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}) | 150 set(QTD_VERSION_STR ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}) |
173 include_directories(${QT_INCLUDES} ${CMAKE_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/include) | 153 include_directories(${QT_INCLUDES} ${CMAKE_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/include) |
174 | 154 |
175 # System specifc settings. | 155 # System specifc settings. |
176 if(CMAKE_HOST_WIN32) | 156 if(CMAKE_HOST_WIN32) |
177 string(REGEX REPLACE ".dll([A-Za-z\\.0-9]+)" "\\1" CMAKE_IMPORT_LIBRARY_SUFFIX "${CMAKE_IMPORT_LIBRARY_SUFFIX}") | 157 string(REGEX REPLACE ".dll([A-Za-z\\.0-9]+)" "\\1" CMAKE_IMPORT_LIBRARY_SUFFIX "${CMAKE_IMPORT_LIBRARY_SUFFIX}") |
178 endif(CMAKE_HOST_WIN32) | 158 endif() |
179 | 159 |
180 if(CMAKE_HOST_WIN32 AND D_IS_MARS) | 160 if(CMAKE_HOST_WIN32 AND D_IS_MARS) |
181 set(D_FLAGS -version=cpp_shared) | 161 set(D_FLAGS -version=cpp_shared) |
182 endif(CMAKE_HOST_WIN32 AND D_IS_MARS) | 162 endif() |
183 add_definitions(-DCPP_SHARED) | 163 add_definitions(-DCPP_SHARED) |
184 set(CPP_SHARED 1 CACHE INTERNAL "") | 164 set(CPP_SHARED 1 CACHE INTERNAL "") |
185 | 165 |
186 | 166 |
187 if(UNITTEST) | 167 if(UNITTEST) |
188 add_d_versions(QtdUnittest) | 168 add_d_versions(QtdUnittest) |
189 set(D_FLAGS ${D_FLAGS} -unittest) | 169 set(D_FLAGS ${D_FLAGS} -unittest) |
190 endif(UNITTEST) | 170 endif() |
191 | 171 |
192 if(VERBOSE_DEBUG) | 172 if(VERBOSE_DEBUG) |
193 add_d_debugs(QtdVerbose) | 173 add_d_debugs(QtdVerbose) |
194 endif(VERBOSE_DEBUG) | 174 endif() |
195 | 175 |
196 if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") | 176 if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") |
197 add_d_debugs(QtdDebug) | 177 add_d_debugs(QtdDebug) |
198 endif(${CMAKE_BUILD_TYPE} STREQUAL "Debug") | 178 endif() |
199 | 179 |
200 ## Bootstrap settings for QtD. | 180 ## Bootstrap settings for QtD. |
201 set(DRCC ${CMAKE_BINARY_DIR}/tools/drcc/drcc CACHE INTERNAL "") | 181 set(DRCC ${CMAKE_BINARY_DIR}/tools/drcc/drcc CACHE INTERNAL "") |
202 set(DUIC ${CMAKE_BINARY_DIR}/tools/duic/duic CACHE INTERNAL "") | 182 set(DUIC ${CMAKE_BINARY_DIR}/tools/duic/duic CACHE INTERNAL "") |
203 set(QTD_IMPORT_PATH ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/d${D_VERSION} CACHE INTERNAL "") | 183 set(QTD_IMPORT_PATH ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/d${D_VERSION} CACHE INTERNAL "") |
207 ## Macros and functions. | 187 ## Macros and functions. |
208 ##-------------------------------------------- | 188 ##-------------------------------------------- |
209 | 189 |
210 macro(load_generated_classes ) | 190 macro(load_generated_classes ) |
211 include(${CMAKE_BINARY_DIR}/cpp/qt_${package}/qt_${package}.txt) | 191 include(${CMAKE_BINARY_DIR}/cpp/qt_${package}/qt_${package}.txt) |
212 endmacro(load_generated_classes ) | 192 endmacro() |
213 | 193 |
214 macro(qtd_add_resource output) | 194 macro(qtd_add_resource output) |
215 set (params NAME OPTIONS) | 195 set (params NAME OPTIONS) |
216 qtd_parse_params (RESOURCES params ${ARGN}) | 196 qtd_parse_params (RESOURCES params ${ARGN}) |
217 if(NAME_tmp) | 197 if(NAME_tmp) |
218 set(OPTIONS_tmp ${OPTIONS_tmp} -name ${NAME_tmp}) | 198 set(OPTIONS_tmp ${OPTIONS_tmp} -name ${NAME_tmp}) |
219 endif(NAME_tmp) | 199 endif(NAME_tmp) |
220 qtd_command ("${output}" "${DRCC}" "${OPTIONS_tmp}" "qrc_" | 200 qtd_command ("${output}" "${DRCC}" "${OPTIONS_tmp}" "qrc_" |
221 "Generate" ${RESOURCES_tmp}) | 201 "Generate" ${RESOURCES_tmp}) |
222 endmacro(qtd_add_resource output) | 202 endmacro() |
223 | 203 |
224 macro(qtd_wrap_ui output) | 204 macro(qtd_wrap_ui output) |
225 set (params OPTIONS) | 205 set (params OPTIONS) |
226 qtd_parse_params (UI params ${ARGN}) | 206 qtd_parse_params (UI params ${ARGN}) |
227 qtd_command ("${output}" "${DUIC}" "${OPTIONS_tmp}" "uic_" | 207 qtd_command ("${output}" "${DUIC}" "${OPTIONS_tmp}" "uic_" |
228 "Generate" ${UI_tmp}) | 208 "Generate" ${UI_tmp}) |
229 endmacro(qtd_wrap_ui output) | 209 endmacro() |
230 | 210 |
231 macro(qtd_command output command options prefix comment) | 211 macro(qtd_command output command options prefix comment) |
232 foreach(file "${ARGN}") | 212 foreach(file "${ARGN}") |
233 ## Test if the input file exists | 213 ## Test if the input file exists |
234 get_filename_component(file_path ${file} PATH) | 214 get_filename_component(file_path ${file} PATH) |
235 get_filename_component(file_name ${file} NAME_WE) | 215 get_filename_component(file_name ${file} NAME_WE) |
236 get_filename_component(file_ext ${file} EXT) | 216 get_filename_component(file_ext ${file} EXT) |
237 | 217 |
238 set(out ${CMAKE_CURRENT_BINARY_DIR}/${file_path}${prefix}${file_name}.d) | 218 set(out ${CMAKE_CURRENT_BINARY_DIR}/${file_path}${prefix}${file_name}.d) |
239 add_custom_command(OUTPUT "${out}" | 219 add_custom_command(OUTPUT "${out}" |
240 COMMAND "${command}" | 220 COMMAND "${command}" |
241 ARGS ${options} ${file} -o ${out} | 221 ARGS ${options} ${file} -o ${out} |
242 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | 222 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
243 DEPENDS ${file} | 223 DEPENDS ${file} |
244 COMMENT "${comment} ${file}" | 224 COMMENT "${comment} ${file}" |
245 ) | 225 ) |
246 set(${output} ${${output}} ${out}) | 226 set(${output} ${${output}} ${out}) |
247 endforeach(file "${ARGN}") | 227 endforeach() |
248 endmacro(qtd_command output command options files prefix comment) | 228 endmacro() |
249 | 229 |
250 ## Parses the parameters list. | 230 ## Parses the parameters list. |
251 macro(qtd_parse_params default params) | 231 macro(qtd_parse_params default params) |
252 set(type_tmp ${default}) | 232 set(type_tmp ${default}) |
253 set(params_tmp ${default} ${${params}}) | 233 set(params_tmp ${default} ${${params}}) |
254 foreach(param_tmp ${params_tmp}) | 234 foreach(param_tmp ${params_tmp}) |
255 set(${param_tmp}_tmp ) | 235 set(${param_tmp}_tmp ) |
256 endforeach(param_tmp ${params_tmp}) | 236 endforeach() |
257 foreach(arg_tmp ${ARGN}) | 237 foreach(arg_tmp ${ARGN}) |
258 set(found_type_tmp) | 238 set(found_type_tmp) |
259 if(NOT found_type_tmp) | 239 if(NOT found_type_tmp) |
260 foreach(param_tmp ${params_tmp}) | 240 foreach(param_tmp ${params_tmp}) |
261 if(arg_tmp STREQUAL param_tmp) | 241 if(arg_tmp STREQUAL param_tmp) |
262 set(type_tmp ${param_tmp}) | 242 set(type_tmp ${param_tmp}) |
263 set(found_type_tmp 1) | 243 set(found_type_tmp 1) |
264 break(param_tmp ${params_tmp}) | 244 break(param_tmp ${params_tmp}) |
265 endif(arg_tmp STREQUAL param_tmp) | 245 endif() |
266 endforeach(param_tmp ${params_tmp}) | 246 endforeach() |
267 endif(NOT found_type_tmp) | 247 endif() |
268 if(NOT found_type_tmp) | 248 if(NOT found_type_tmp) |
269 set(${type_tmp}_tmp ${${type_tmp}_tmp} ${arg_tmp}) | 249 set(${type_tmp}_tmp ${${type_tmp}_tmp} ${arg_tmp}) |
270 endif(NOT found_type_tmp) | 250 endif() |
271 endforeach(arg_tmp ${ARGN}) | 251 endforeach() |
272 endmacro(qtd_parse_params default) | 252 endmacro() |
273 | 253 |
274 ## Adds a new example. | 254 ## Adds a new example. |
275 ## name -- example name. | 255 ## name -- example name. |
276 ## Options: | 256 ## Options: |
277 ## PACKAGES -- list of packages for link to example (for example, QtCore QtGui QtOpenGL). | 257 ## PACKAGES -- list of packages for link to example (for example, QtCore QtGui QtOpenGL). |
282 macro(build_example name) | 262 macro(build_example name) |
283 set (params UIC RESOURCES PACKAGES) | 263 set (params UIC RESOURCES PACKAGES) |
284 qtd_parse_params (SOURCES params ${ARGN}) | 264 qtd_parse_params (SOURCES params ${ARGN}) |
285 | 265 |
286 if(NOT PACKAGES_tmp) | 266 if(NOT PACKAGES_tmp) |
287 set(PACKAGES_tmp QtCore QtGui) | 267 set(PACKAGES_tmp QtCore QtGui) |
288 endif(NOT PACKAGES_tmp) | 268 endif() |
289 | 269 |
290 if(RESOURCES_tmp) | 270 if(RESOURCES_tmp) |
291 if(NOT BUILD_TOOLS) | 271 if(NOT BUILD_TOOLS) |
292 message(STATUS "Example '${name}' requires drcc. Example will not be built") | 272 message(STATUS "Example '${name}' requires drcc. Example will not be built") |
293 return(build_example name) | 273 return(build_example name) |
294 endif(NOT BUILD_TOOLS) | 274 endif() |
295 qtd_add_resource(res_sources ${RESOURCES_tmp} NAME ${name} ) | 275 qtd_add_resource(res_sources ${RESOURCES_tmp} NAME ${name} ) |
296 endif(RESOURCES_tmp) | 276 endif() |
297 | 277 |
298 if(UIC_tmp) | 278 if(UIC_tmp) |
299 if(NOT BUILD_TOOLS) | 279 if(NOT BUILD_TOOLS) |
300 message(STATUS "Example '${name}' requires drcc. Example will not be built") | 280 message(STATUS "Example '${name}' requires drcc. Example will not be built") |
301 return(build_example name) | 281 return(build_example name) |
302 endif(NOT BUILD_TOOLS) | 282 endif() |
303 qtd_wrap_ui(uic_sources ${UIC_tmp}) | 283 qtd_wrap_ui(uic_sources ${UIC_tmp}) |
304 endif(UIC_tmp) | 284 endif() |
305 | 285 |
306 foreach(package ${PACKAGES_tmp}) | 286 foreach(package ${PACKAGES_tmp}) |
307 string(REGEX REPLACE "Qt([A-Za-z0-9])" "\\1" req "${package}") | 287 string(REGEX REPLACE "Qt([A-Za-z0-9])" "\\1" req "${package}") |
308 set(is_found) | 288 set(is_found) |
309 foreach(package_big ${packages_big}) | 289 foreach(package_big ${packages_big}) |
327 #if(STRIP AND ${CMAKE_BUILD_TYPE} EQUAL "Release" AND CMAKE_HOST_UNIX) ## | 307 #if(STRIP AND ${CMAKE_BUILD_TYPE} EQUAL "Release" AND CMAKE_HOST_UNIX) ## |
328 # add_custom_command(TARGET example_${name} POST_BUILD COMMAND "${STRIP}" ARGS "${output}") | 308 # add_custom_command(TARGET example_${name} POST_BUILD COMMAND "${STRIP}" ARGS "${output}") |
329 #endif(STRIP AND ${CMAKE_BUILD_TYPE} EQUAL "Release" AND CMAKE_HOST_UNIX) | 309 #endif(STRIP AND ${CMAKE_BUILD_TYPE} EQUAL "Release" AND CMAKE_HOST_UNIX) |
330 add_dependencies(examples ${name}) | 310 add_dependencies(examples ${name}) |
331 add_dependencies(${name} allpackages tools) | 311 add_dependencies(${name} allpackages tools) |
332 endmacro(build_example sources) | 312 endmacro() |
333 | 313 |
334 ##-------------------------------------------- | 314 ##-------------------------------------------- |
335 ## Build and install the QtD libraries. | 315 ## Build and install the QtD libraries. |
336 ##-------------------------------------------- | 316 ##-------------------------------------------- |
337 | 317 |
598 endif(BUILD_EXAMPLES) | 578 endif(BUILD_EXAMPLES) |
599 | 579 |
600 set(SECOND_RUN 0 CACHE INTERNAL "") | 580 set(SECOND_RUN 0 CACHE INTERNAL "") |
601 | 581 |
602 endif(NOT SECOND_RUN) | 582 endif(NOT SECOND_RUN) |
583 | |
584 ##-------------------------------------------- | |
585 ## CPack. | |
586 ##-------------------------------------------- | |
587 set(CPACK_PACKAGE_VERSION_PATCH 1) | |
588 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "QtD is a D binding to the Qt application and UI framework.") | |
589 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/changelog.txt") | |
590 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt") | |
591 set(CPACK_PACKAGE_VENDOR "QtD team") | |
592 set(CPACK_PACKAGE_CONTACT "e@mail.com") | |
593 set(CPACK_PACKAGE_VERSION "0.2") | |
594 set(CPACK_PACKAGE_INSTALL_DIRECTORY "qtd ${CPACK_PACKAGE_VERSION}") | |
595 set(CPACK_PACKAGE_FILE_NAME "qtd-${CPACK_PACKAGE_VERSION}") | |
596 set(CPACK_SOURCE_PACKAGE_FILE_NAME "qtd-${CPACK_PACKAGE_VERSION}") | |
597 if(CMAKE_HOST_WIN32) | |
598 set(CPACK_GENERATOR "ZIP") | |
599 elseif(CMAKE_HOST_UNIX) | |
600 set(CPACK_GENERATOR "TBZ2;DEB") | |
601 endif() | |
602 include(CPack) |