Mercurial > projects > qtd
comparison CMakeLists.txt @ 241:e792a5287673
fixes
author | SokoL_SD |
---|---|
date | Mon, 20 Jul 2009 08:40:33 +0000 |
parents | 8b1a982c9ac3 |
children | f2f4c9cbadc2 |
comparison
equal
deleted
inserted
replaced
240:8b1a982c9ac3 | 241:e792a5287673 |
---|---|
7 if(NOT SECOND_RUN) | 7 if(NOT SECOND_RUN) |
8 | 8 |
9 option(FORCE_IN_SOURCE_BUILD "Force the in-source building" "OFF") | 9 option(FORCE_IN_SOURCE_BUILD "Force the in-source building" "OFF") |
10 if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT FORCE_IN_SOURCE_BUILD) | 10 if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT FORCE_IN_SOURCE_BUILD) |
11 message(FATAL_ERROR "In-source builds are not allowed. | 11 message(FATAL_ERROR "In-source builds are not allowed. |
12 Please create a directory and run cmake from there, passing the path | 12 Please create a directory and run cmake from there, passing the path |
13 to this source directory as the last argument. | 13 to this source directory as the last argument. |
14 This process created the file `CMakeCache.txt` and the directory `CMakeFiles'. | 14 This process created the file `CMakeCache.txt` and the directory `CMakeFiles'. |
15 Please delete them. | 15 Please delete them. |
16 Or you can restart cmake with `-DFORCE_IN_SOURCE_BUILD=1`, but it is not | 16 |
17 Or you can restart cmake with `-DFORCE_IN_SOURCE_BUILD=1`, but it is not | |
17 recomended. | 18 recomended. |
18 ") | 19 ") |
19 endif() | 20 endif() |
20 | 21 |
21 | 22 |
40 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) | 41 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) |
41 FIND_PACKAGE(D REQUIRED) | 42 FIND_PACKAGE(D REQUIRED) |
42 | 43 |
43 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "") | 44 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "") |
44 set(CMAKE_INSTALL_PREFIX | 45 set(CMAKE_INSTALL_PREFIX |
45 ${DC_PATH} CACHE PATH "QtD install prefix" FORCE | 46 ${DC_PATH} CACHE PATH "QtD install prefix" |
46 ) | 47 ) |
47 endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "") | 48 endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "") |
48 | 49 |
49 # Check D compiler version | 50 # Check D compiler version |
50 if(D_VERSION EQUAL "1") | 51 if(D_VERSION EQUAL "1") |
138 set(CPACK_PACKAGE_VERSION_PATCH 1) | 139 set(CPACK_PACKAGE_VERSION_PATCH 1) |
139 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "QtD is a D binding to the Qt application and UI framework. | 140 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "QtD is a D binding to the Qt application and UI framework. |
140 QtD is a D binding to the Qt application and UI framework. | 141 QtD is a D binding to the Qt application and UI framework. |
141 This package installs binding and static library for qt port on D programming language. | 142 This package installs binding and static library for qt port on D programming language. |
142 ") | 143 ") |
143 #SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt") | 144 SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/changelog.txt") |
144 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt") | 145 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt") |
145 set(CPACK_PACKAGE_VENDOR "QtD team") | 146 set(CPACK_PACKAGE_VENDOR "QtD team") |
146 set(CPACK_PACKAGE_CONTACT "e@mail.ru" ) | 147 set(CPACK_PACKAGE_CONTACT "e@mail.ru" ) |
147 SET(CPACK_PACKAGE_VERSION "0.1") | 148 SET(CPACK_PACKAGE_VERSION "0.1") |
148 #set(CPACK_PACKAGE_VERSION_PATCH "${RFS_VERSION_BUILD}") | |
149 set(CPACK_PACKAGE_INSTALL_DIRECTORY "qtd ${CPACK_PACKAGE_VERSION}") | 149 set(CPACK_PACKAGE_INSTALL_DIRECTORY "qtd ${CPACK_PACKAGE_VERSION}") |
150 set(CPACK_PACKAGE_FILE_NAME "qtd-${CPACK_PACKAGE_VERSION}") | 150 set(CPACK_PACKAGE_FILE_NAME "qtd-${CPACK_PACKAGE_VERSION}") |
151 set(CPACK_SOURCE_PACKAGE_FILE_NAME "qtd-${CPACK_PACKAGE_VERSION}") | 151 set(CPACK_SOURCE_PACKAGE_FILE_NAME "qtd-${CPACK_PACKAGE_VERSION}") |
152 if(CMAKE_HOST_WIN32) | 152 if(CMAKE_HOST_WIN32) |
153 set(CPACK_GENERATOR "ZIP") | 153 set(CPACK_GENERATOR "ZIP") |
162 else(NOT SECOND_RUN) | 162 else(NOT SECOND_RUN) |
163 | 163 |
164 PROJECT(qtd CXX C) | 164 PROJECT(qtd CXX C) |
165 if(NOT ${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) | 165 if(NOT ${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) |
166 load_cache(${CMAKE_BINARY_DIR}/.. INCLUDE_INTERNALS all_packages QTD_VERSION_STR QTD_VERSION) | 166 load_cache(${CMAKE_BINARY_DIR}/.. INCLUDE_INTERNALS all_packages QTD_VERSION_STR QTD_VERSION) |
167 endif(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) | 167 endif(NOT ${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) |
168 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) | 168 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) |
169 FIND_PACKAGE(D REQUIRED) | 169 FIND_PACKAGE(D REQUIRED) |
170 FIND_PACKAGE(Qt4 REQUIRED) | 170 FIND_PACKAGE(Qt4 REQUIRED) |
171 | 171 |
172 set(QTD_VERSION_STR ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}) | 172 set(QTD_VERSION_STR ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}) |
173 math(EXPR QTD_VERSION "(${QT_VERSION_MAJOR} << 16) + (${QT_VERSION_MINOR} << 8) + ${QT_VERSION_PATCH}") | 173 math(EXPR QTD_VERSION "(${QT_VERSION_MAJOR} << 16) + (${QT_VERSION_MINOR} << 8) + ${QT_VERSION_PATCH}") |
174 | 174 |
175 include_directories(${QT_INCLUDES} ${CMAKE_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/include) | 175 include_directories(${QT_INCLUDES} ${CMAKE_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/include) |
176 | |
177 ## Strip utility. | |
178 find_program(STRIP strip) | |
179 | 176 |
180 # System specifc settings. | 177 # System specifc settings. |
181 if(CMAKE_HOST_WIN32) | 178 if(CMAKE_HOST_WIN32) |
182 string(REGEX REPLACE ".dll([A-Za-z\\.0-9]+)" "\\1" CMAKE_IMPORT_LIBRARY_SUFFIX "${CMAKE_IMPORT_LIBRARY_SUFFIX}") | 179 string(REGEX REPLACE ".dll([A-Za-z\\.0-9]+)" "\\1" CMAKE_IMPORT_LIBRARY_SUFFIX "${CMAKE_IMPORT_LIBRARY_SUFFIX}") |
183 endif(CMAKE_HOST_WIN32) | 180 endif(CMAKE_HOST_WIN32) |
206 endmacro(load_generated_classes ) | 203 endmacro(load_generated_classes ) |
207 | 204 |
208 macro(qtd_add_resource output) | 205 macro(qtd_add_resource output) |
209 set (params NAME OPTIONS) | 206 set (params NAME OPTIONS) |
210 qtd_parse_params (RESOURCES params ${ARGN}) | 207 qtd_parse_params (RESOURCES params ${ARGN}) |
211 | |
212 if(NAME_tmp) | 208 if(NAME_tmp) |
213 set(OPTIONS_tmp ${OPTIONS_tmp} -name ${NAME_tmp}) | 209 set(OPTIONS_tmp ${OPTIONS_tmp} -name ${NAME_tmp}) |
214 endif(NAME_tmp) | 210 endif(NAME_tmp) |
215 | |
216 qtd_command ("${output}" "${DRCC}" "${OPTIONS_tmp}" "qrc_" | 211 qtd_command ("${output}" "${DRCC}" "${OPTIONS_tmp}" "qrc_" |
217 "Generate" ${RESOURCES_tmp}) | 212 "Generate" ${RESOURCES_tmp}) |
218 endmacro(qtd_add_resource output) | 213 endmacro(qtd_add_resource output) |
219 | 214 |
220 macro(qtd_wrap_ui output) | 215 macro(qtd_wrap_ui output) |
224 "Generate" ${UI_tmp}) | 219 "Generate" ${UI_tmp}) |
225 endmacro(qtd_wrap_ui output) | 220 endmacro(qtd_wrap_ui output) |
226 | 221 |
227 macro(qtd_command output command options prefix comment) | 222 macro(qtd_command output command options prefix comment) |
228 foreach(file "${ARGN}") | 223 foreach(file "${ARGN}") |
229 ## Test input file exists. | 224 ## Test an exist of the input file. |
230 get_filename_component(file_path ${file} PATH) | 225 get_filename_component(file_path ${file} PATH) |
231 get_filename_component(file_name ${file} NAME_WE) | 226 get_filename_component(file_name ${file} NAME_WE) |
232 get_filename_component(file_ext ${file} EXT) | 227 get_filename_component(file_ext ${file} EXT) |
233 | 228 |
234 set(out ${CMAKE_CURRENT_BINARY_DIR}/${file_path}${prefix}${file_name}.d) | 229 set(out ${CMAKE_CURRENT_BINARY_DIR}/${file_path}${prefix}${file_name}.d) |
241 ) | 236 ) |
242 set(${output} ${${output}} ${out}) | 237 set(${output} ${${output}} ${out}) |
243 endforeach(file "${ARGN}") | 238 endforeach(file "${ARGN}") |
244 endmacro(qtd_command output command options files prefix comment) | 239 endmacro(qtd_command output command options files prefix comment) |
245 | 240 |
246 ## Parse the parameters list. | 241 ## Parsing the parameters list. |
247 macro(qtd_parse_params default params) | 242 macro(qtd_parse_params default params) |
248 set(type_tmp ${default}) | 243 set(type_tmp ${default}) |
249 set(params_tmp ${default} ${${params}}) | 244 set(params_tmp ${default} ${${params}}) |
250 foreach(param_tmp ${params_tmp}) | 245 foreach(param_tmp ${params_tmp}) |
251 set(${param_tmp}_tmp ) | 246 set(${param_tmp}_tmp ) |
252 endforeach(param_tmp ${params_tmp}) | 247 endforeach(param_tmp ${params_tmp}) |
253 foreach(arg_tmp ${ARGN}) | 248 foreach(arg_tmp ${ARGN}) |
254 set(founded_type_tmp) | 249 set(found_type_tmp) |
255 if(NOT founded_type_tmp) | 250 if(NOT found_type_tmp) |
256 foreach(param_tmp ${params_tmp}) | 251 foreach(param_tmp ${params_tmp}) |
257 if(arg_tmp STREQUAL param_tmp) | 252 if(arg_tmp STREQUAL param_tmp) |
258 set(type_tmp ${param_tmp}) | 253 set(type_tmp ${param_tmp}) |
259 set(founded_type_tmp 1) | 254 set(found_type_tmp 1) |
260 break(param_tmp ${params_tmp}) | 255 break(param_tmp ${params_tmp}) |
261 endif(arg_tmp STREQUAL param_tmp) | 256 endif(arg_tmp STREQUAL param_tmp) |
262 endforeach(param_tmp ${params_tmp}) | 257 endforeach(param_tmp ${params_tmp}) |
263 endif(NOT founded_type_tmp) | 258 endif(NOT found_type_tmp) |
264 if(NOT founded_type_tmp) | 259 if(NOT found_type_tmp) |
265 set(${type_tmp}_tmp ${${type_tmp}_tmp} ${arg_tmp}) | 260 set(${type_tmp}_tmp ${${type_tmp}_tmp} ${arg_tmp}) |
266 endif(NOT founded_type_tmp) | 261 endif(NOT found_type_tmp) |
267 endforeach(arg_tmp ${ARGN}) | 262 endforeach(arg_tmp ${ARGN}) |
268 endmacro(qtd_parse_params default) | 263 endmacro(qtd_parse_params default) |
269 | 264 |
270 ## Build example macro. | 265 ## Build example macro. |
271 ## name -- example name. | 266 ## name -- example name. |
528 ARGS ${D_FLAGS} -o- -H -Hd${interface_file_path} ${source} | 523 ARGS ${D_FLAGS} -o- -H -Hd${interface_file_path} ${source} |
529 COMMENT "Generating header for ${source}" | 524 COMMENT "Generating header for ${source}" |
530 DEPENDS ${source} | 525 DEPENDS ${source} |
531 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | 526 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
532 ) | 527 ) |
533 else(NOT "${file_name}" STREQUAL "QGlobal") ## DMD frontend crash on this file. | 528 else(NOT "${file_name}" STREQUAL "QGlobal") ## The DMD frontend crashes on this file. |
534 add_custom_command(OUTPUT "${interface_file}" | 529 add_custom_command(OUTPUT "${interface_file}" |
535 COMMAND ${CMAKE_COMMAND} -E make_directory ${interface_file_path} | 530 COMMAND ${CMAKE_COMMAND} -E make_directory ${interface_file_path} |
536 COMMAND ${CMAKE_COMMAND} -E remove -f ${interface_file} | 531 COMMAND ${CMAKE_COMMAND} -E remove -f ${interface_file} |
537 COMMAND ${CMAKE_COMMAND} -E copy ${source} ${interface_file} | 532 COMMAND ${CMAKE_COMMAND} -E copy ${source} ${interface_file} |
538 COMMENT "" | 533 COMMENT "" |
567 add_dependencies(examples allpackages tools) | 562 add_dependencies(examples allpackages tools) |
568 add_subdirectory(demos) | 563 add_subdirectory(demos) |
569 add_subdirectory(examples) | 564 add_subdirectory(examples) |
570 endif(BUILD_EXAMPLES) | 565 endif(BUILD_EXAMPLES) |
571 | 566 |
572 #execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/CMakeCache.txt) | |
573 set(SECOND_RUN 0 CACHE INTERNAL "") | 567 set(SECOND_RUN 0 CACHE INTERNAL "") |
574 | 568 |
575 endif(NOT SECOND_RUN) | 569 endif(NOT SECOND_RUN) |