comparison CMakeLists.txt @ 55:63c31e221118

CMake: Add forgotten files to install.
author SokoL_SD
date Mon, 18 May 2009 19:03:06 +0000
parents 2bd596a4b984
children 17165763b300
comparison
equal deleted inserted replaced
54:a68b2a7e9b85 55:63c31e221118
177 # quotes once here, i.e. with \" 177 # quotes once here, i.e. with \"
178 set(${pathname} \"${${pathname}}\") 178 set(${pathname} \"${${pathname}}\")
179 endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows) 179 endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows)
180 endmacro(MAKE_NATIVE_PATH) 180 endmacro(MAKE_NATIVE_PATH)
181 181
182 macro(regexseafestring outvariable) 182 ##
183 ## Example:
184 ## set(path 24.3+23.bin)
185 ## obj_path(path)
186 ## message(STATUS ${path})
187 ## Example output:
188 ## -- 24\.3\+23\.bin
189 macro(regex_safe_string outvariable)
183 set(${outvariable} ${ARGN}) 190 set(${outvariable} ${ARGN})
184 set(__regex_chars__ ^ $ . ] [ - * + ? | \( \)) 191 set(__regex_chars__ ^ $ . ] [ - * + ? | \( \))
185 foreach(__regex_char__ ${__regex_chars__}) 192 foreach(__regex_char__ ${__regex_chars__})
186 string(REPLACE "${__regex_char__}" 193 string(REPLACE "${__regex_char__}"
187 "\\${__regex_char__}" ${outvariable} ${${outvariable}} 194 "\\${__regex_char__}" ${outvariable} ${${outvariable}}
188 ) 195 )
189 endforeach(__regex_char__ ${__regex_chars__}) 196 endforeach(__regex_char__ ${__regex_chars__})
190 endmacro(regexseafestring outvariable) 197 endmacro(regex_safe_string outvariable)
191 198
192 ## Remove unnecessary travel to the object file. 199 ## Remove unnecessary path to the object file.
193 ## path -- path to object file. 200 ## path -- path to object file.
194 ## Example: 201 ## Example:
195 ## set(path ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/target.dir/main.d.obj) 202 ## set(path ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/target.dir/main.d.obj)
196 ## obj_path(path) 203 ## obj_path(path)
197 ## message(STATUS ${path}) 204 ## message(STATUS ${path})
198 ## Example output: 205 ## Example output:
199 ## -- CMakeFiles/target.dir/main.d.obj 206 ## -- CMakeFiles/target.dir/main.d.obj
200 macro(OBJ_PATH path) 207 macro(OBJ_PATH path)
201 regexseafestring(__cbd_safe__ ${CMAKE_CURRENT_BINARY_DIR}) 208 regex_safe_string(__cbd_safe__ ${CMAKE_CURRENT_BINARY_DIR})
202 regexseafestring(__csd_safe__ ${CMAKE_CURRENT_SOURCE_DIR}) 209 regex_safe_string(__csd_safe__ ${CMAKE_CURRENT_SOURCE_DIR})
203 set(regexp_str "(${__cbd_safe__}/|${__csd_safe__}/|)(.+)") 210 set(regexp_str "(${__cbd_safe__}/|${__csd_safe__}/|)(.+)")
204 string(REGEX REPLACE ${regexp_str} "\\2" ${path} "${${path}}") 211 string(REGEX REPLACE ${regexp_str} "\\2" ${path} "${${path}}")
205 endmacro(OBJ_PATH) 212 endmacro(OBJ_PATH)
206
207 213
208 ## Compile d files. 214 ## Compile d files.
209 ## target -- name of a new target. 215 ## target -- name of a new target.
210 ## objects_list -- created object files. 216 ## objects_list -- created object files.
211 ## params -- sources files. 217 ## params -- sources files.
387 endif(NOT req_found) 393 endif(NOT req_found)
388 endforeach(req ${required}) 394 endforeach(req ${required})
389 else(BUILD_QT_${package_upper}) 395 else(BUILD_QT_${package_upper})
390 set(all_req_found) 396 set(all_req_found)
391 endif(BUILD_QT_${package_upper}) 397 endif(BUILD_QT_${package_upper})
392 398
399 ## TODO: cleanup.
393 if("${all_req_found}" EQUAL 1) 400 if("${all_req_found}" EQUAL 1)
394 set(packages_big ${packages_big} ${package_big}) 401 set(packages_big ${packages_big} ${package_big})
395 set(packages ${packages} ${package}) 402 set(packages ${packages} ${package})
396 ## Loading package sources list. 403 ## Loading package sources list.
397 foreach(d_source ${d_version_files}) 404 foreach(d_source ${d_version_files})
398 set(d_sources ${d_sources} ${CMAKE_SOURCE_DIR}/qt/d${D_VERSION}/qt/${d_source}.d) 405 set(d_sources ${d_sources} ${CMAKE_SOURCE_DIR}/qt/d${D_VERSION}/qt/${d_source}.d)
399 if(NOT GENERATE_DI_FILES) 406 if(NOT GENERATE_DI_FILES)
400 get_filename_component(path ${d_source}.d PATH) 407 get_filename_component(path ${d_source}.d PATH)
401 get_filename_component(name ${d_source}.d NAME_WE) 408 get_filename_component(name ${d_source}.d NAME_WE)
402 install(FILES ${CMAKE_SOURCE_DIR}/qt/d${D_VERSION}/qt/${d_source}.d DESTINATION include/d/qt/${path} RENAME ${name}.di) 409 install(FILES ${CMAKE_SOURCE_DIR}/qt/d${D_VERSION}/qt/${d_source}.d COMPONENT qtd DESTINATION include/d/qt/${path} RENAME ${name}.di)
410 install(FILES ${CMAKE_SOURCE_DIR}/qt/d${D_VERSION}/qt/${d_source}_enum.d COMPONENT qtd DESTINATION include/d/qt/${path} RENAME ${name}_enum.di OPTIONAL)
403 endif(NOT GENERATE_DI_FILES) 411 endif(NOT GENERATE_DI_FILES)
404 endforeach(d_source) 412 endforeach(d_source)
405 foreach(d_source ${d_files}) 413 foreach(d_source ${d_files})
406 set(d_sources ${d_sources} ${CMAKE_SOURCE_DIR}/qt/${d_source}.d) 414 set(d_sources ${d_sources} ${CMAKE_SOURCE_DIR}/qt/${d_source}.d)
407 if(NOT GENERATE_DI_FILES) 415 if(NOT GENERATE_DI_FILES)
408 get_filename_component(path ${d_source}.d PATH) 416 get_filename_component(path ${d_source}.d PATH)
409 get_filename_component(name ${d_source}.d NAME_WE) 417 get_filename_component(name ${d_source}.d NAME_WE)
410 install(FILES ${CMAKE_SOURCE_DIR}/qt/${d_source}.d DESTINATION include/d/qt/${path} RENAME ${name}.di) 418 install(FILES ${CMAKE_SOURCE_DIR}/qt/${d_source}.d DESTINATION include/d/qt/${path} COMPONENT qtd RENAME ${name}.di)
419 install(FILES ${CMAKE_SOURCE_DIR}/qt/${d_source}_enum.d DESTINATION include/d/qt/${path} COMPONENT qtd RENAME ${name}_enum.di OPTIONAL)
411 endif(NOT GENERATE_DI_FILES) 420 endif(NOT GENERATE_DI_FILES)
412 endforeach(d_source) 421 endforeach(d_source)
413 foreach(d_source ${d_generated_files}) 422 foreach(d_source ${d_generated_files})
414 set(d_sources ${d_sources} ${CMAKE_BINARY_DIR}/qt/${d_source}.d) 423 set(d_sources ${d_sources} ${CMAKE_BINARY_DIR}/qt/${d_source}.d)
415 if(NOT GENERATE_DI_FILES) 424 if(NOT GENERATE_DI_FILES)
416 get_filename_component(path ${d_source}.d PATH) 425 get_filename_component(path ${d_source}.d PATH)
417 get_filename_component(name ${d_source}.d NAME_WE) 426 get_filename_component(name ${d_source}.d NAME_WE)
418 install(FILES ${CMAKE_BINARY_DIR}/qt/${d_source}.d DESTINATION include/d/qt/${path} RENAME ${name}.di) 427 install(FILES ${CMAKE_BINARY_DIR}/qt/${d_source}.d DESTINATION include/d/qt/${path} COMPONENT qtd RENAME ${name}.di)
428 install(FILES ${CMAKE_BINARY_DIR}/qt/${d_source}_enum.d DESTINATION include/d/qt/${path} COMPONENT qtd RENAME ${name}_enum.di OPTIONAL)
419 endif(NOT GENERATE_DI_FILES) 429 endif(NOT GENERATE_DI_FILES)
420 endforeach(d_source) 430 endforeach(d_source)
421 foreach (cpp_source ${cpp_files}) 431 foreach (cpp_source ${cpp_files})
422 set(cpp_sources ${cpp_sources} ${CMAKE_SOURCE_DIR}/cpp/${cpp_source}.cpp) 432 set(cpp_sources ${cpp_sources} ${CMAKE_SOURCE_DIR}/cpp/${cpp_source}.cpp)
423 endforeach(cpp_source) 433 endforeach(cpp_source)
426 set(d_sources ${d_sources} ${CMAKE_BINARY_DIR}/qt/${package}/${class}.d) 436 set(d_sources ${d_sources} ${CMAKE_BINARY_DIR}/qt/${package}/${class}.d)
427 set(cpp_sources ${cpp_sources} ${CMAKE_BINARY_DIR}/cpp/qt_${package}/${class}_shell.cpp) 437 set(cpp_sources ${cpp_sources} ${CMAKE_BINARY_DIR}/cpp/qt_${package}/${class}_shell.cpp)
428 set(files_for_gen ${files_for_gen} ${CMAKE_BINARY_DIR}/cpp/qt_${package}/${class}_shell.cpp 438 set(files_for_gen ${files_for_gen} ${CMAKE_BINARY_DIR}/cpp/qt_${package}/${class}_shell.cpp
429 ${CMAKE_BINARY_DIR}/qt/${package}/${class}.d) 439 ${CMAKE_BINARY_DIR}/qt/${package}/${class}.d)
430 if(NOT GENERATE_DI_FILES) 440 if(NOT GENERATE_DI_FILES)
431 install(FILES ${CMAKE_BINARY_DIR}/qt/${package}/${class}.d DESTINATION include/d/qt/${package} RENAME ${class}.di) 441 install(FILES ${CMAKE_BINARY_DIR}/qt/${package}/${class}.d DESTINATION include/d/qt/${package} COMPONENT qtd RENAME ${class}.di)
432 install(FILES ${CMAKE_BINARY_DIR}/qt/${package}/${class}_enum.d DESTINATION include/d/qt/${package} RENAME ${class}_enum.di OPTIONAL) 442 install(FILES ${CMAKE_BINARY_DIR}/qt/${package}/${class}_enum.d DESTINATION include/d/qt/${package} COMPONENT qtd RENAME ${class}_enum.di OPTIONAL)
433 endif(NOT GENERATE_DI_FILES) 443 endif(NOT GENERATE_DI_FILES)
434 endforeach(class) 444 endforeach(class)
435 445
436 ## Link CPP library. 446 ## Link CPP library.
437 add_library(cpp_${package} SHARED ${cpp_sources}) 447 add_library(cpp_${package} SHARED ${cpp_sources})
480 COMMAND "${DC}" 490 COMMAND "${DC}"
481 ARGS -lib ${d_objs} ${d_implib} -of${lib} 491 ARGS -lib ${d_objs} ${d_implib} -of${lib}
482 DEPENDS ${d_objs} ${d_implib} 492 DEPENDS ${d_objs} ${d_implib}
483 COMMENT "Linking ${lib_name}" 493 COMMENT "Linking ${lib_name}"
484 ) 494 )
485 install(FILES ${cpp_lib} DESTINATION lib) 495 install(FILES ${cpp_lib} COMPONENT qtd DESTINATION lib)
486 else(${CMAKE_SYSTEM_NAME} STREQUAL Linux) 496 else(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
487 set_property(TARGET cpp_${package} PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles) 497 set_property(TARGET cpp_${package} PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles)
488 foreach(cpp_source ${cpp_sources}) 498 foreach(cpp_source ${cpp_sources})
489 set(cpp_source ${cpp_source}) 499 set(cpp_source ${cpp_source})
490 obj_path(cpp_source) 500 obj_path(cpp_source)
491 set(cpp_objs ${cpp_objs} CMakeFiles/cpp_${package}.dir/${cpp_source}${CMAKE_CXX_OUTPUT_EXTENSION}) 501 set(cpp_objs ${cpp_objs} CMakeFiles/cpp_${package}.dir/${cpp_source}${CMAKE_CXX_OUTPUT_EXTENSION})
492 endforeach(cpp_source) 502 endforeach(cpp_source)
493 add_custom_command( 503 add_custom_command(
494 OUTPUT "${lib}" 504 OUTPUT "${lib}"
495 COMMAND "${CMAKE_AR}" 505 COMMAND "${CMAKE_AR}"
496 ARGS rcs ${lib} ${d_objs} ${cpp_objs} 506 ARGS rcs ${lib} ${d_objs} ${cpp_objs}
497 DEPENDS ${d_objs} cpp_${package} 507 DEPENDS ${d_objs} cpp_${package}
498 COMMENT "Linking ${lib_name}" 508 COMMENT "Linking ${lib_name}"
499 ) 509 )
500 endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows) 510 endif(${CMAKE_SYSTEM_NAME} STREQUAL Windows)
501 install(FILES ${CMAKE_BINARY_DIR}/${lib} DESTINATION lib) 511 install(FILES ${CMAKE_BINARY_DIR}/${lib} COMPONENT qtd DESTINATION lib)
502 512
503 ## Dependences. 513 ## Dependences.
504 add_custom_target(${package} DEPENDS ${lib}) 514 add_custom_target(${package} DEPENDS ${lib})
505 foreach(depend ${required}) 515 foreach(depend ${required})
506 string(TOLOWER ${depend} depend) 516 string(TOLOWER ${depend} depend)
555 DEPENDS ${source} 565 DEPENDS ${source}
556 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 566 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
557 ) 567 )
558 endif(NOT "${file_name}" STREQUAL "QGlobal" AND GENERATE_DI_FILES) 568 endif(NOT "${file_name}" STREQUAL "QGlobal" AND GENERATE_DI_FILES)
559 set(interfaces_list ${interfaces_list} ${interface_file_path}/${file_name}.di) 569 set(interfaces_list ${interfaces_list} ${interface_file_path}/${file_name}.di)
560 install(FILES ${interface_file} DESTINATION include/d/${inc_path}) 570 install(FILES ${interface_file} COMPONENT qtd DESTINATION include/d/${inc_path})
561 endforeach(source) 571 endforeach(source)
562 endif(GENERATE_DI_FILES) 572 endif(GENERATE_DI_FILES)
563 endif("${all_req_found}" EQUAL 1) 573 endif("${all_req_found}" EQUAL 1)
564 endforeach(package_big ${packages_big}) 574 endforeach(package_big ${packages_big})
565 if(GENERATE_DI_FILES) 575 if(GENERATE_DI_FILES)
571 foreach(package ${packages}) 581 foreach(package ${packages})
572 add_dependencies(cpp_${package} dgen) 582 add_dependencies(cpp_${package} dgen)
573 endforeach(package ${packages}) 583 endforeach(package ${packages})
574 add_sources_for_generating(${files_for_gen}) 584 add_sources_for_generating(${files_for_gen})
575 585
586 set(CPACK_COMPONENTS_ALL qtd)
587
588
576 ##-------------------------------------------- 589 ##--------------------------------------------
577 ## Build other parts of the QtD. 590 ## Build other parts of the QtD.
578 ##-------------------------------------------- 591 ##--------------------------------------------
579 if(BUILD_EXAMPLES) 592 if(BUILD_EXAMPLES)
580 add_subdirectory(demos) 593 add_subdirectory(demos)
581 add_subdirectory(examples) 594 add_subdirectory(examples)
582 endif(BUILD_EXAMPLES) 595 endif(BUILD_EXAMPLES)
583 596
584 597
598
585 ##-------------------------------------------- 599 ##--------------------------------------------
586 ## CPack. 600 ## CPack.
587 ##-------------------------------------------- 601 ##--------------------------------------------
588 set(CPACK_PACKAGE_VERSION_PATCH 1) 602 set(CPACK_PACKAGE_VERSION_PATCH 1)
589 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "QtD is a D binding to the Qt") 603 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "QtD is a D binding to the Qt application and UI framework.
604 QtD is a D binding to the Qt application and UI framework.
605 This package installs binding and static library for qt port on D programming language.
606 ")
607 #SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
608 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt")
590 set(CPACK_PACKAGE_VENDOR "QtD team") 609 set(CPACK_PACKAGE_VENDOR "QtD team")
591 set(CPACK_PACKAGE_CONTACT "e@mail.ru" ) 610 set(CPACK_PACKAGE_CONTACT "e@mail.ru" )
592 SET(CPACK_PACKAGE_VERSION "0.1") 611 SET(CPACK_PACKAGE_VERSION "0.1")
593 #set(CPACK_PACKAGE_VERSION_PATCH "${RFS_VERSION_BUILD}") 612 #set(CPACK_PACKAGE_VERSION_PATCH "${RFS_VERSION_BUILD}")
594 set(CPACK_PACKAGE_INSTALL_DIRECTORY "qtd ${CPACK_PACKAGE_VERSION}") 613 set(CPACK_PACKAGE_INSTALL_DIRECTORY "qtd ${CPACK_PACKAGE_VERSION}")