annotate CMakeLists.txt @ 188:7dd099050621

initial commit for D2 support
author eldar
date Sun, 12 Jul 2009 18:58:03 +0000
parents 973564c7e388
children ba7abb5c9e03
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
1 cmake_minimum_required(VERSION 2.6)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
2 PROJECT(qtd CXX C)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
3 FIND_PACKAGE(Qt4 REQUIRED)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
4
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
5 ##--------------------------------------------
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
6 ## Settings.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
7 ##--------------------------------------------
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
8
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
9 include_directories(${QT_INCLUDES} include ${CMAKE_CURRENT_BINARY_DIR}/include)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
10
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
11 ## Options.
136
798e54c1f66e CMake: disable building examples by default. You can use -DBUILD_EXAMPLES switch for enable that.
SokoL_SD
parents: 135
diff changeset
12 option(BUILD_EXAMPLES "Build examples" "OFF")
798e54c1f66e CMake: disable building examples by default. You can use -DBUILD_EXAMPLES switch for enable that.
SokoL_SD
parents: 135
diff changeset
13 option(BUILD_SHARED_LIBRARIES "Build shared library (very experemental and only for ldc)" "OFF")
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
14 option(BUILD_TOOLS "Build tools" "ON")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
15 #option(GENERATE_DI_FILES "Generate *.di files with DC -H command" "OFF")
136
798e54c1f66e CMake: disable building examples by default. You can use -DBUILD_EXAMPLES switch for enable that.
SokoL_SD
parents: 135
diff changeset
16 set(GENERATE_DI_FILES OFF) ## Very experemental option. Temporary disabled.
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
17
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
18 set(QTD_VERSION_STR ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
19 math(EXPR QTD_VERSION "(${QT_VERSION_MAJOR} << 16) + (${QT_VERSION_MINOR} << 8) + ${QT_VERSION_PATCH}")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
20 configure_file(qt/QGlobal.d.inc qt/QGlobal.d)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
21
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
22 set(all_packages Core Gui OpenGL Xml Svg Network WebKit)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
23
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
24 ## Init D toolkit.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
25 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
26 FIND_PACKAGE(D REQUIRED)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
27
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
28 ## Strip utility.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
29 find_program(STRIP strip)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
30
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
31 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
32 set(CMAKE_INSTALL_PREFIX
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
33 ${DC_PATH} CACHE PATH "QtD install prefix" FORCE
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
34 )
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
35 endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
36
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
37 # Check D compiler version
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
38 if(D_VERSION EQUAL "1")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
39 if (D_FRONTEND LESS "041")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
40 message(STATUS "Minimum required version of D compiler is 1.041 (or compiler based on this version)")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
41 endif(D_FRONTEND LESS "041")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
42 set(D_TARGET d1-tango)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
43 elseif(D_VERSION EQUAL "2")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
44 set(D_TARGET ) ## TODO: hm... I don`t known this parameter for D2 ^(
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
45 endif(D_VERSION EQUAL "1")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
46
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
47 # Debug and release flags.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
48 if (NOT CMAKE_BUILD_TYPE)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
49 set(CMAKE_BUILD_TYPE Release)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
50 endif (NOT CMAKE_BUILD_TYPE)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
51 if(${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG])
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
52 set(CMAKE_BUILD_TYPE Debug)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
53 #set( SUFFIXLIB "${SUFFIXLIB}-debug" )
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
54 #set( SUFFIXBIN "${SUFFIXBIN}-debug" )
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
55 add_definitions(-DDEBUG)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
56 elseif (NOT ${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS])
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
57 message(STATUS "Only debug and release configurations are supproted now. Configuration will change to 'Release'")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
58 set(CMAKE_BUILD_TYPE Release)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
59 endif (${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG])
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
60 if (${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS])
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
61 #add_definitions(-UNO_DEBUG)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
62 endif(${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS] )
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
63
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
64 # System specifc settings.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
65 if(CMAKE_HOST_WIN32)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
66 set(implib implib)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
67 find_program(IMPLIB ${implib})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
68 if (NOT IMPLIB)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
69 message(FATAL_ERROR "implib not found. You can donwload it from http://ftp.digitalmars.com/bup.zip")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
70 endif (NOT IMPLIB)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
71 if(D_IS_MARS)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
72 set(D_FLAGS ${D_FLAGS} -version=cpp_shared)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
73 set(GEN_OPT ${GEN_OPT} --cpp_shared)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
74 add_definitions(-DCPP_SHARED)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
75 endif(D_IS_MARS)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
76 string(REGEX REPLACE ".dll([A-Za-z\\.0-9]+)" "\\1" CMAKE_IMPORT_LIBRARY_SUFFIX "${CMAKE_IMPORT_LIBRARY_SUFFIX}")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
77 endif(CMAKE_HOST_WIN32)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
78
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
79 set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ./)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
80 set(GEN_OPT ${GEN_OPT} --d-target=${D_TARGET})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
81
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
82 ## Bootstrap settings for QtD.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
83 set(DRCC ${CMAKE_BINARY_DIR}/tools/drcc/drcc)
182
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
84 set(DUIC ${CMAKE_BINARY_DIR}/tools/duic/duic)
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
85 set(QTD_IMPORT_PATH ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/qt/d${D_VERSION})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
86 set(QTD_LIBRARIES_PATH ${CMAKE_BINARY_DIR}/lib)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
87
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
88 ##--------------------------------------------
182
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
89 ## Macros and functions.
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
90 ##--------------------------------------------
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
91
182
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
92 macro(qtd_add_resource output)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
93 set (params NAME OPTIONS)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
94 qtd_parse_params (RESOURCES params ${ARGN})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
95
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
96 if(NAME_tmp)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
97 set(OPTIONS_tmp ${OPTIONS_tmp} -name ${NAME_tmp})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
98 endif(NAME_tmp)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
99
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
100 qtd_command ("${output}" "${DRCC}" "${OPTIONS_tmp}" "qrc_"
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
101 "Generate" ${RESOURCES_tmp})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
102 endmacro(qtd_add_resource output)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
103
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
104 macro(qtd_wrap_ui output)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
105 set (params OPTIONS)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
106 qtd_parse_params (UI params ${ARGN})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
107 qtd_command ("${output}" "${DUIC}" "${OPTIONS_tmp}" "uic_"
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
108 "Generate" ${UI_tmp})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
109 endmacro(qtd_wrap_ui output)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
110
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
111 macro(qtd_command output command options prefix comment)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
112 foreach(file "${ARGN}")
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
113 ## Test input file exists.
182
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
114 get_filename_component(file_path ${file} PATH)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
115 get_filename_component(file_name ${file} NAME_WE)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
116 get_filename_component(file_ext ${file} EXT)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
117
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
118 set(out ${CMAKE_CURRENT_BINARY_DIR}/${file_path}${prefix}${file_name}.d)
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
119 add_custom_command(OUTPUT "${out}"
182
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
120 COMMAND "${command}"
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
121 ARGS ${options} ${file} -o ${out}
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
122 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
182
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
123 DEPENDS ${file}
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
124 COMMENT "${comment} ${file}"
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
125 )
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
126 set(${output} ${${output}} ${out})
182
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
127 endforeach(file "${ARGN}")
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
128 endmacro(qtd_command output command options files prefix comment)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
129
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
130 ## Parse the parameters list.
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
131 macro(qtd_parse_params default params)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
132 set(type_tmp ${default})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
133 set(params_tmp ${default} ${${params}})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
134 foreach(param_tmp ${params_tmp})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
135 set(${param_tmp}_tmp )
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
136 endforeach(param_tmp ${params_tmp})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
137 foreach(arg_tmp ${ARGN})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
138 set(founded_type_tmp)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
139 if(NOT founded_type_tmp)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
140 foreach(param_tmp ${params_tmp})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
141 if(arg_tmp STREQUAL param_tmp)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
142 set(type_tmp ${param_tmp})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
143 set(founded_type_tmp 1)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
144 break(param_tmp ${params_tmp})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
145 endif(arg_tmp STREQUAL param_tmp)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
146 endforeach(param_tmp ${params_tmp})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
147 endif(NOT founded_type_tmp)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
148 if(NOT founded_type_tmp)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
149 set(${type_tmp}_tmp ${${type_tmp}_tmp} ${arg_tmp})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
150 endif(NOT founded_type_tmp)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
151 endforeach(arg_tmp ${ARGN})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
152 endmacro(qtd_parse_params default)
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
153
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
154 ## Build example macro.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
155 ## name -- example name.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
156 ## Options:
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
157 ## PACKAGES -- list of packages to link to exaple (for example, QtCore QtGui QtOpenGL).
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
158 ## Default value is "QtCore QtGui".
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
159 ## params -- sources d files.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
160 ## Usage:
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
161 ## build_example(ExampleName PACKAGES QtCore QtGui QtXml main.d another_d_file.d)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
162 macro(build_example name)
182
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
163 set (params UIC RESOURCES PACKAGES)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
164 qtd_parse_params (SOURCES params ${ARGN})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
165
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
166 if(NOT PACKAGES_tmp)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
167 set(PACKAGES_tmp QtCore QtGui)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
168 endif(NOT PACKAGES_tmp)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
169
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
170 if(RESOURCES_tmp)
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
171 if(NOT BUILD_TOOLS)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
172 message(STATUS "Example '${name}' required drcc. Example will not build")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
173 return(build_example name)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
174 endif(NOT BUILD_TOOLS)
182
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
175 qtd_add_resource(res_sources ${RESOURCES_tmp} NAME ${name} )
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
176 endif(RESOURCES_tmp)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
177
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
178 if(UIC_tmp)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
179 if(NOT BUILD_TOOLS)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
180 message(STATUS "Example '${name}' required drcc. Example will not build")
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
181 return(build_example name)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
182 endif(NOT BUILD_TOOLS)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
183 qtd_wrap_ui(uic_sources ${UIC_tmp})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
184 endif(UIC_tmp)
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
185
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
186 foreach(package ${PACKAGES_tmp})
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
187 string(REGEX REPLACE "Qt([A-Za-z0-9])" "\\1" req "${package}")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
188 set(is_founded)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
189 foreach(package_big ${packages_big})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
190 string(TOLOWER ${package_big} package)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
191 if(${req} STREQUAL ${package_big})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
192 set(is_founded 1)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
193 break(package_big ${packages_big})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
194 endif(${req} STREQUAL ${package_big})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
195 endforeach(package_big ${packages_big})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
196 if(NOT is_founded)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
197 message(STATUS "Example '${name}' required package '${req}', but its not active. Example will not build")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
198 return(build_example name)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
199 else(NOT is_founded)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
200 set(qtd_libs ${${package}_lib_param} ${qtd_libs})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
201 endif(NOT is_founded)
182
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
202 endforeach(package ${PACKAGES_tmp})
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
203 add_d_program(${name} ${SOURCES_tmp} ${res_sources} ${uic_sources}
973564c7e388 CMake: add an UIC option in the build_example macro.
SokoL_SD
parents: 177
diff changeset
204 DEPENDS ${res_sources} INCLUDES ${QTD_IMPORT_PATH} ${CMAKE_CURRENT_BINARY_DIR}
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
205 LIB_PATHS ${QTD_LIBRARIES_PATH} ${CMAKE_SOURCE_DIR}/lib LIBS ${qtd_libs})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
206 ## TODO: Enable on windows too.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
207 if(STRIP AND ${CMAKE_BUILD_TYPE} EQUAL "Release" AND CMAKE_HOST_UNIX) ##
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
208 add_custom_command(TARGET example_${name} POST_BUILD COMMAND "${STRIP}" ARGS "${output}")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
209 endif(STRIP AND ${CMAKE_BUILD_TYPE} EQUAL "Release" AND CMAKE_HOST_UNIX)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
210 add_dependencies(${name} allpackages)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
211 endmacro(build_example sources)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
212
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
213 ##--------------------------------------------
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
214 ## Build and install library.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
215 ##--------------------------------------------
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
216
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
217 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
218 add_custom_target(allpackages)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
219 link_directories(${CMAKE_BINARY_DIR}/CMakeFiles)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
220
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
221 foreach(package_big ${all_packages})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
222 string(TOLOWER ${package_big} package)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
223 ## Loading settings for package.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
224 set(required)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
225 set(d_objs)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
226 set(cpp_objs)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
227 set(d_sources)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
228 set(cpp_sources)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
229 set(lib_name)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
230 set(link_cpp)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
231 set(link_d)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
232 set(cpp_files)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
233 set(d_files)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
234 set(classes)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
235 set(d_generated_files)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
236 set(d_version_files)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
237 set(link_example)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
238 include (${CMAKE_SOURCE_DIR}/build/${package}.txt)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
239
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
240 set(all_req_found 1)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
241 string(TOUPPER ${package} package_upper)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
242 option(BUILD_QT_${package_upper} "Build Qt${package_big}" "ON")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
243 if(BUILD_QT_${package_upper})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
244 foreach(req ${required})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
245 set(req_found)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
246 foreach(pack ${packages_big})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
247 if(${pack} STREQUAL ${req})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
248 set(req_found 1)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
249 endif(${pack} STREQUAL ${req})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
250 endforeach(pack ${packages})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
251 if(NOT req_found)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
252 set(req_found)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
253 foreach(pack ${all_packages})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
254 if(${pack} STREQUAL ${req})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
255 set(req_found 1)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
256 endif(${pack} STREQUAL ${req})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
257 endforeach(pack ${all_packages})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
258 if(req_found)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
259 message(STATUS "Package '${package_big}' required '${req}', but its not active")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
260 else(req_found)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
261 message(STATUS "Package '${package_big}' required '${req}', but its not found")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
262 endif(req_found)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
263 set(all_req_found)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
264 endif(NOT req_found)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
265 endforeach(req ${required})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
266 else(BUILD_QT_${package_upper})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
267 set(all_req_found)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
268 endif(BUILD_QT_${package_upper})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
269
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
270 ## TODO: cleanup.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
271 if("${all_req_found}" EQUAL 1)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
272 set(packages_big ${packages_big} ${package_big})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
273 set(packages ${packages} ${package})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
274 ## Loading package sources list.
177
69ee80d8bd10 CMake: correct ArrayOps2.d path.
SokoL_SD
parents: 175
diff changeset
275 foreach(d_source ${package}/ArrayOps2 ${d_generated_files})
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
276 set(d_sources ${d_sources} ${CMAKE_BINARY_DIR}/qt/${d_source}.d)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
277 endforeach(d_source ${d_generated_files})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
278 set(classes ArrayOps ${classes})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
279 foreach(class ${classes})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
280 set(d_sources ${d_sources} ${CMAKE_BINARY_DIR}/qt/${package}/${class}.d)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
281 set(cpp_sources ${cpp_sources} ${CMAKE_BINARY_DIR}/cpp/qt_${package}/${class}_shell.cpp)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
282 endforeach(class ${classes})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
283 set(files_for_gen ${files_for_gen} ${cpp_sources} ${d_sources})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
284
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
285 foreach (cpp_source ${cpp_files})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
286 set(cpp_sources ${cpp_sources} ${CMAKE_SOURCE_DIR}/cpp/${cpp_source}.cpp)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
287 endforeach(cpp_source)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
288 foreach(d_source ${d_version_files})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
289 set(d_sources ${d_sources} ${CMAKE_SOURCE_DIR}/qt/d${D_VERSION}/qt/${d_source}.d)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
290 endforeach(d_source ${d_version_files})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
291 foreach(d_source ${d_files})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
292 set(d_sources ${d_sources} ${CMAKE_SOURCE_DIR}/qt/${d_source}.d)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
293 endforeach(d_source ${d_files})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
294
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
295 if(NOT GENERATE_DI_FILES)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
296 foreach(d_source ${d_sources})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
297 get_filename_component(path ${d_source} PATH)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
298 get_filename_component(name ${d_source} NAME_WE)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
299 regex_safe_string(cbd_safe_tmp ${CMAKE_CURRENT_BINARY_DIR})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
300 regex_safe_string(csd_safe_tmp ${CMAKE_CURRENT_SOURCE_DIR})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
301 regex_safe_string(ver_safe_tmp ${CMAKE_CURRENT_SOURCE_DIR}/qt/d${D_VERSION})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
302 set(regexp_str_tmp "(${ver_safe_tmp}/|${cbd_safe_tmp}/|${csd_safe_tmp}/|)(.+)")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
303 string(REGEX REPLACE ${regexp_str_tmp} "\\2" ins_path "${path}")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
304 install(FILES ${d_source} DESTINATION include/d/${ins_path} COMPONENT qtd RENAME ${name}.di)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
305 install(FILES ${path}/${name}_enum.d DESTINATION include/d/${ins_path} COMPONENT qtd RENAME ${name}_enum.di OPTIONAL)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
306 endforeach(d_source ${d_sources})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
307 endif(NOT GENERATE_DI_FILES)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
308
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
309 ## Link CPP library.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
310 add_library(cpp_${package} SHARED ${cpp_sources})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
311 set_property(TARGET cpp_${package} PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
312 if(CMAKE_HOST_WIN32 AND D_IS_MARS) ## TODO: Replace by SEPAREATE_CPP_PART
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
313 else(CMAKE_HOST_WIN32 AND D_IS_MARS)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
314 foreach(cpp_source ${cpp_sources})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
315 set(cpp_source ${cpp_source})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
316 obj_path(cpp_source)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
317 set(cpp_objs ${cpp_objs} ${CMAKE_BINARY_DIR}/CMakeFiles/cpp_${package}.dir/${cpp_source}${CMAKE_CXX_OUTPUT_EXTENSION})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
318 endforeach(cpp_source ${cpp_sources})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
319 endif(CMAKE_HOST_WIN32 AND D_IS_MARS)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
320
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
321 ## Link D library.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
322 set(lib_name qtd${package})
136
798e54c1f66e CMake: disable building examples by default. You can use -DBUILD_EXAMPLES switch for enable that.
SokoL_SD
parents: 135
diff changeset
323 if(BUILD_SHARED_LIBRARIES)
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
324 set(lib lib/${CMAKE_SHARED_LIBRARY_PREFIX}${lib_name}${CMAKE_SHARED_LIBRARY_SUFFIX})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
325 set(build_type SHARED)
136
798e54c1f66e CMake: disable building examples by default. You can use -DBUILD_EXAMPLES switch for enable that.
SokoL_SD
parents: 135
diff changeset
326 else(BUILD_SHARED_LIBRARIES)
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
327 set(lib lib/${D_LIB_PREFIX}${lib_name}${D_LIB_SUFFIX})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
328 set(build_type STATIC)
136
798e54c1f66e CMake: disable building examples by default. You can use -DBUILD_EXAMPLES switch for enable that.
SokoL_SD
parents: 135
diff changeset
329 endif(BUILD_SHARED_LIBRARIES)
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
330
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
331 foreach(req ${required})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
332 set(is_found)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
333 foreach(pack ${packages_big})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
334 if("${pack}" STREQUAL "${req}")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
335 set(is_found 1)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
336 break(pack ${packages_big})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
337 endif("${pack}" STREQUAL "${req}")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
338 endforeach(pack ${packages_big})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
339 if(NOT is_found)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
340 message(FATAL_ERROR "Package ${package_big} required ${req}, but its not found")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
341 endif(NOT is_found)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
342 string(TOUPPER ${req} req_upper)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
343 string(TOLOWER ${req} req_lower)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
344 set(link_cpp ${link_cpp} cpp_${req_lower} ${QT_QT${req_upper}_LIBRARY})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
345 endforeach(req ${require})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
346 set(d_objs ${d_objs} ${objects})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
347
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
348 set_property(TARGET cpp_${package} PROPERTY RUNTIME_OUTPUT_DIRECTORY lib)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
349 set_property(TARGET cpp_${package} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
350 string(TOUPPER ${package} package_upper)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
351 set(link_cpp ${link_cpp} ${QT_QT${package_upper}_LIBRARY})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
352 target_link_libraries(cpp_${package} ${link_cpp} )
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
353 if(CMAKE_HOST_WIN32 AND D_IS_MARS) ## TODO: Replace by SEPAREATE_CPP_PART
136
798e54c1f66e CMake: disable building examples by default. You can use -DBUILD_EXAMPLES switch for enable that.
SokoL_SD
parents: 135
diff changeset
354 set(cpp_lib ${CMAKE_BINARY_DIR}/lib/libcpp_${package}.dll)
132
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
355 set(cpp_lib_native ${cpp_lib})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
356 make_native_path(cpp_lib_native)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
357 set(d_implib ${CMAKE_BINARY_DIR}/CMakeFiles/${package}.dir/cpp_${package}.lib)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
358 set(d_implib_native ${d_implib})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
359 make_native_path(d_implib_native)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
360 add_custom_command(
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
361 OUTPUT "${d_implib}"
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
362 COMMAND "${IMPLIB}"
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
363 ARGS /system /PAGESIZE:32 ${d_implib_native} ${cpp_lib_native}
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
364 DEPENDS "cpp_${package}"
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
365 COMMENT "Creating implib ${lib_name}"
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
366 )
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
367 install(FILES ${cpp_lib} COMPONENT qtd DESTINATION lib)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
368 else(CMAKE_HOST_WIN32 AND D_IS_MARS)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
369 set(${package}_lib_param Qt${package_big}) ## Paths for QtD libs. Needed by examples.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
370 endif(CMAKE_HOST_WIN32 AND D_IS_MARS)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
371 add_d_target(${lib_name} TYPE ${build_type} INCLUDES ${QTD_IMPORT_PATH} SOURCES ${d_sources} OBJECTS ${cpp_objs} ${d_implib}
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
372 OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib DEPENDS ${d_implib})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
373 install(FILES ${CMAKE_BINARY_DIR}/${lib} COMPONENT qtd DESTINATION lib)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
374
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
375 ## Paths for QtD libs. Needed by examples.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
376 set(${package}_lib_param qtd${package} ${${package}_lib_param} ${link_example})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
377
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
378 ## Dependences.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
379 add_custom_target(${package} DEPENDS ${lib})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
380 foreach(depend ${required})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
381 string(TOLOWER ${depend} depend)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
382 add_dependencies(cpp_${package} cpp_${depend})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
383 add_dependencies(${package} ${depend})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
384 endforeach(depend ${required})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
385 add_dependencies(allpackages ${package})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
386
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
387 if(GENERATE_DI_FILES)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
388 regexseafestring(cbd_safe ${CMAKE_BINARY_DIR})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
389 regexseafestring(csd_safe ${CMAKE_SOURCE_DIR})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
390 set(regexp_str "(${csd}/qt/d${D_VERSION}|${csd_safe}|${cbd_safe})/([A-Za-z0-9\\-_\\\\/]+)[/]+([A-Za-z0-9\\-_\\\\]+).d")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
391 foreach(source ${d_sources})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
392 # find_file(source ${source} PATHS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
393 # ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
394 string(REGEX REPLACE ${regexp_str} "\\2" inc_path "${source}")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
395 string(REGEX REPLACE ${regexp_str} "\\3" file_name "${source}")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
396 set(interface_file_path ${CMAKE_BINARY_DIR}/d/${inc_path})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
397 set(interface_file "${interface_file_path}/${file_name}.di")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
398 if(NOT "${file_name}" STREQUAL "QGlobal")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
399 add_custom_command(OUTPUT "${interface_file}"
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
400 COMMAND "${DC}"
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
401 ARGS ${D_FLAGS} -o- -H -Hd${interface_file_path} ${source}
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
402 COMMENT "Generating header for ${source}"
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
403 DEPENDS ${source}
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
404 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
405 )
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
406 else(NOT "${file_name}" STREQUAL "QGlobal") ## DMD frontend crash on this file.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
407 add_custom_command(OUTPUT "${interface_file}"
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
408 COMMAND ${CMAKE_COMMAND} -E make_directory ${interface_file_path}
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
409 COMMAND ${CMAKE_COMMAND} -E remove -f ${interface_file}
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
410 COMMAND ${CMAKE_COMMAND} -E copy ${source} ${interface_file}
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
411 COMMENT ""
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
412 DEPENDS ${source}
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
413 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
414 )
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
415 endif(NOT "${file_name}" STREQUAL "QGlobal" AND GENERATE_DI_FILES)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
416 set(interfaces_list ${interfaces_list} ${interface_file_path}/${file_name}.di)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
417 install(FILES ${interface_file} COMPONENT qtd DESTINATION include/d/${inc_path})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
418 endforeach(source)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
419 endif(GENERATE_DI_FILES)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
420 endif("${all_req_found}" EQUAL 1)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
421 endforeach(package_big ${packages_big})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
422 if(GENERATE_DI_FILES)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
423 add_custom_target(generate_headers ALL DEPENDS ${interfaces_list})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
424 endif(GENERATE_DI_FILES)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
425
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
426 add_subdirectory(generator)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
427 ## Dependences.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
428 foreach(package ${packages})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
429 add_dependencies(cpp_${package} dgen)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
430 endforeach(package ${packages})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
431 add_sources_for_generating(${files_for_gen})
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
432
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
433 set(CPACK_COMPONENTS_ALL qtd qtd_tools)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
434
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
435 ##--------------------------------------------
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
436 ## Build other parts of the QtD.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
437 ##--------------------------------------------
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
438 add_custom_target(tools ALL)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
439 if(BUILD_TOOLS)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
440 add_subdirectory(tools)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
441 add_dependencies(tools drcc duic)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
442 endif(BUILD_TOOLS)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
443
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
444 if(BUILD_EXAMPLES)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
445 add_subdirectory(demos)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
446 add_subdirectory(examples)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
447 endif(BUILD_EXAMPLES)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
448
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
449 ##--------------------------------------------
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
450 ## CPack.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
451 ##--------------------------------------------
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
452 set(CPACK_PACKAGE_VERSION_PATCH 1)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
453 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "QtD is a D binding to the Qt application and UI framework.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
454 QtD is a D binding to the Qt application and UI framework.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
455 This package installs binding and static library for qt port on D programming language.
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
456 ")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
457 #SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
458 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
459 set(CPACK_PACKAGE_VENDOR "QtD team")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
460 set(CPACK_PACKAGE_CONTACT "e@mail.ru" )
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
461 SET(CPACK_PACKAGE_VERSION "0.1")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
462 #set(CPACK_PACKAGE_VERSION_PATCH "${RFS_VERSION_BUILD}")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
463 set(CPACK_PACKAGE_INSTALL_DIRECTORY "qtd ${CPACK_PACKAGE_VERSION}")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
464 set(CPACK_PACKAGE_FILE_NAME "qtd-${CPACK_PACKAGE_VERSION}")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
465 set(CPACK_SOURCE_PACKAGE_FILE_NAME "qtd-${CPACK_PACKAGE_VERSION}")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
466 if(CMAKE_HOST_WIN32)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
467 set(CPACK_GENERATOR "ZIP")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
468 elseif(CMAKE_HOST_UNIX)
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
469 set(CPACK_GENERATOR "TBZ2;DEB;RPM")
a860544c5ee8 CMake: initial version of CMakeD script.
SokoL_SD
parents: 124
diff changeset
470 endif(CMAKE_HOST_WIN32)
16
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
471 include(CPack)