Mercurial > projects > qtd
annotate CMakeLists.txt @ 385:e700fa4916e4
Added missing files
author | Max Samukha <maxter@spambox.com> |
---|---|
date | Fri, 16 Jul 2010 20:11:14 +0300 |
parents | d2f48c4cb3e3 |
children | b13910fdd739 |
rev | line source |
---|---|
376
06d8188a23e3
Revert requirement of cmake 2.8@
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
375
diff
changeset
|
1 cmake_minimum_required(VERSION 2.6) |
132 | 2 PROJECT(qtd CXX C) |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
3 |
344 | 4 # Debug and release flags. |
5 if (NOT CMAKE_BUILD_TYPE) | |
6 set(CMAKE_BUILD_TYPE Release) | |
375 | 7 endif () |
344 | 8 |
9 if(${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG]) | |
10 set(CMAKE_BUILD_TYPE Debug) | |
11 #set( SUFFIXLIB "${SUFFIXLIB}-debug" ) | |
12 #set( SUFFIXBIN "${SUFFIXBIN}-debug" ) | |
13 add_definitions(-DDEBUG) | |
14 elseif (NOT ${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS]) | |
357
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
344
diff
changeset
|
15 message(STATUS "Only debug and release configurations are supported. The configuration is changed to 'Release'") |
344 | 16 set(CMAKE_BUILD_TYPE Release) |
375 | 17 endif () |
344 | 18 |
19 if (${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS]) | |
20 #add_definitions(-UNO_DEBUG) | |
375 | 21 endif() |
344 | 22 |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
23 ########################################################## |
264
da7c867ef2ef
1) A bug is fixed when the generator doesn't restart if typesystem_${package}-java.java has been changed.
SokoL_SD
parents:
254
diff
changeset
|
24 ## Build generator. |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
25 ########################################################## |
344 | 26 if (NOT SECOND_RUN) |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
27 |
242 | 28 option(ALLOW_IN_SOURCE_BUILDS "Allow in-source builds" "OFF") |
344 | 29 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT ALLOW_IN_SOURCE_BUILDS) |
30 message(FATAL_ERROR "In-source builds are not allowed. " | |
357
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
344
diff
changeset
|
31 "Please create a directory and run cmake from there, passing the path " |
344 | 32 "to this source directory as the last argument. " |
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." | |
35 ) | |
375 | 36 endif () |
239 | 37 |
132 | 38 FIND_PACKAGE(Qt4 REQUIRED) |
344 | 39 set(QT_USE_QTMAIN false) |
40 set(QT_USE_QTGUI false) | |
132 | 41 |
42 ##-------------------------------------------- | |
43 ## Settings. | |
44 ##-------------------------------------------- | |
45 | |
46 ## Options. | |
136
798e54c1f66e
CMake: disable building examples by default. You can use -DBUILD_EXAMPLES switch for enable that.
SokoL_SD
parents:
135
diff
changeset
|
47 option(BUILD_EXAMPLES "Build examples" "OFF") |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
48 # option(BUILD_SHARED_LIBRARIES "Build shared library (very experemental and only for ldc)" "OFF") |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
49 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
50 if (CMAKE_HOST_WIN32) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
51 set(CPP_SHARED true CACHE INTERNAL "") |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
52 else() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
53 option(CPP_SHARED "Build C++ part into shared libraries" "ON") |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
54 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
55 |
132 | 56 option(BUILD_TOOLS "Build tools" "ON") |
57 #option(GENERATE_DI_FILES "Generate *.di files with DC -H command" "OFF") | |
344 | 58 set(GENERATE_DI_FILES OFF) ## Very experimental option. Temporarily disabled. |
274 | 59 option(VERBOSE_DEBUG "Verbose debug" "OFF") |
273 | 60 |
378 | 61 set(all_packages Core Gui OpenGL Xml Svg Network WebKit Qwt CACHE INTERNAL "") |
132 | 62 |
63 ## Init D toolkit. | |
64 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) | |
65 FIND_PACKAGE(D REQUIRED) | |
66 | |
67 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "") | |
68 set(CMAKE_INSTALL_PREFIX | |
344 | 69 ${DC_PATH} CACHE PATH "QtD install prefix" |
132 | 70 ) |
375 | 71 endif() |
132 | 72 |
73 # Check D compiler version | |
74 if(D_VERSION EQUAL "1") | |
282
256ab6cb8e85
Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents:
280
diff
changeset
|
75 if (D_FRONTEND LESS "050") |
344 | 76 message(STATUS "Minimum required version of D compiler is 1.050 (or compiler based on this version)") |
282
256ab6cb8e85
Signals look-up andNew syntax for connect. The old one will not work from now on. This will allow for the signals overload. Although changes are done for both D1 and D2 versions, D1 won't work because of compiler bugs. I am tired of waiting for fixes.
eldar
parents:
280
diff
changeset
|
77 endif(D_FRONTEND LESS "050") |
344 | 78 set(D_TARGET d1-tango CACHE INTERNAL "") |
132 | 79 elseif(D_VERSION EQUAL "2") |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
80 set(D_TARGET d2-phobos CACHE INTERNAL "") |
375 | 81 endif() |
132 | 82 |
237 | 83 # System specific settings. |
132 | 84 if(CMAKE_HOST_WIN32) |
85 set(implib implib) | |
86 find_program(IMPLIB ${implib}) | |
87 if (NOT IMPLIB) | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
88 message(FATAL_ERROR "implib is not found. You can donwload it from http://ftp.digitalmars.com/bup.zip") |
375 | 89 endif () |
90 endif() | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
91 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
92 if(CPP_SHARED) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
93 set(GEN_OPT ${GEN_OPT} --cpp-shared) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
94 add_definitions(-DCPP_SHARED) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
95 endif() |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
96 |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
97 set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ./) |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
98 set(GEN_OPT ${GEN_OPT} --d-target=${D_TARGET}) |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
99 |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
100 set(packages CACHE INTERNAL "") |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
101 foreach(package_big ${all_packages}) |
344 | 102 string(TOLOWER ${package_big} package) |
103 string(TOUPPER ${package_big} package_upper) | |
378 | 104 set(package_default_option "ON") |
105 if(${package_big} STREQUAL "Qwt") | |
106 set(package_default_option "OFF") | |
107 endif() | |
108 option(BUILD_QT_${package_upper} "Build Qt${package_big}" ${package_default_option}) | |
243 | 109 if(BUILD_QT_${package_upper}) |
375 | 110 set(packages ${packages} ${package_big}) |
111 endif() | |
112 endforeach() | |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
113 |
378 | 114 set(QWT_INCLUDE_PATH "/usr/include/qwt-qt4" CACHE STRING "Qwt include path") |
381
347e4c7a9ba1
make QwtD compile on Windows@
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
379
diff
changeset
|
115 if(CMAKE_HOST_WIN32) |
347e4c7a9ba1
make QwtD compile on Windows@
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
379
diff
changeset
|
116 set(QWT_LIB_PATH "" CACHE STRING "Qwt lib path") |
347e4c7a9ba1
make QwtD compile on Windows@
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
379
diff
changeset
|
117 endif() |
378 | 118 set(inc_paths "") |
119 | |
120 if(CMAKE_HOST_WIN32) | |
381
347e4c7a9ba1
make QwtD compile on Windows@
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
379
diff
changeset
|
121 set(sep "*") |
378 | 122 else() |
123 set(sep ":") | |
124 endif() | |
125 | |
126 if(BUILD_QT_QWT) | |
381
347e4c7a9ba1
make QwtD compile on Windows@
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
379
diff
changeset
|
127 set(inc_paths ${inc_paths}${sep}${QWT_INCLUDE_PATH}${sep}) |
378 | 128 endif() |
129 | |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
130 add_subdirectory(generator) |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
131 |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
132 add_custom_target(main ALL) |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
133 add_dependencies(main dgen) |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
134 |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
135 if(${CMAKE_GENERATOR} STREQUAL "NMake Makefiles") |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
136 set(make_util nmake) |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
137 elseif(${CMAKE_GENERATOR} STREQUAL "MinGW Makefiles" OR |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
138 ${CMAKE_GENERATOR} STREQUAL "Unix Makefiles") |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
139 set(make_util $(MAKE)) |
375 | 140 else() |
264
da7c867ef2ef
1) A bug is fixed when the generator doesn't restart if typesystem_${package}-java.java has been changed.
SokoL_SD
parents:
254
diff
changeset
|
141 message(FATAL_ERROR "${CMAKE_GENERATOR} is not supported") |
375 | 142 endif() |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
143 |
239 | 144 if(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) |
145 set(cd_path ${CMAKE_SOURCE_DIR}) | |
375 | 146 else() |
239 | 147 set(cd_path ${CMAKE_BINARY_DIR}/build) |
375 | 148 endif() |
239 | 149 |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
150 make_native_path(cd_path) |
344 | 151 add_custom_command(TARGET main POST_BUILD |
152 COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${CMAKE_BINARY_DIR}/build | |
153 COMMAND cd ARGS ${cd_path} && ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} -DSECOND_RUN=1 ${CMAKE_SOURCE_DIR} && ${make_util} | |
154 COMMENT "" | |
155 ) | |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
156 |
264
da7c867ef2ef
1) A bug is fixed when the generator doesn't restart if typesystem_${package}-java.java has been changed.
SokoL_SD
parents:
254
diff
changeset
|
157 ## "Make install" command. |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
158 set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_BINARY_DIR}/build) |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
159 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
160 set(native_build_path ${CMAKE_BINARY_DIR}/build) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
161 make_native_path(native_build_path) |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
162 add_custom_target(install |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
163 COMMAND cd ${native_build_path} && ${make_util} install |
344 | 164 COMMENT "" |
165 ) | |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
166 add_dependencies(install preinstall) |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
167 |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
168 ########################################################## |
264
da7c867ef2ef
1) A bug is fixed when the generator doesn't restart if typesystem_${package}-java.java has been changed.
SokoL_SD
parents:
254
diff
changeset
|
169 ## Build QtD. |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
170 ########################################################## |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
171 else(NOT SECOND_RUN) |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
172 |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
173 PROJECT(qtd CXX C) |
240 | 174 if(NOT ${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
175 load_cache(${CMAKE_BINARY_DIR}/.. INCLUDE_INTERNALS all_packages QTD_VERSION_STR QTD_VERSION CPP_SHARED) |
375 | 176 endif() |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
177 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
178 FIND_PACKAGE(D REQUIRED) |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
179 FIND_PACKAGE(Qt4 REQUIRED) |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
180 |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
181 set(QTD_VERSION_STR ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}) |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
182 math(EXPR QTD_VERSION "(${QT_VERSION_MAJOR} << 16) + (${QT_VERSION_MINOR} << 8) + ${QT_VERSION_PATCH}") |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
183 |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
184 include_directories(${QT_INCLUDES} ${CMAKE_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/include) |
381
347e4c7a9ba1
make QwtD compile on Windows@
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
379
diff
changeset
|
185 if(BUILD_QT_QWT) |
378 | 186 include_directories(${QWT_INCLUDE_PATH}) |
187 endif() | |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
188 |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
189 # System specifc settings. |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
190 if(CMAKE_HOST_WIN32) |
132 | 191 string(REGEX REPLACE ".dll([A-Za-z\\.0-9]+)" "\\1" CMAKE_IMPORT_LIBRARY_SUFFIX "${CMAKE_IMPORT_LIBRARY_SUFFIX}") |
375 | 192 endif() |
132 | 193 |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
194 if(CPP_SHARED) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
195 set(D_FLAGS -version=QtdCppShared) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
196 add_definitions(-DCPP_SHARED) |
375 | 197 endif() |
229 | 198 |
273 | 199 if(UNITTEST) |
200 add_d_versions(QtdUnittest) | |
344 | 201 set(D_FLAGS ${D_FLAGS} -unittest) |
375 | 202 endif() |
273 | 203 |
274 | 204 if(VERBOSE_DEBUG) |
205 add_d_debugs(QtdVerbose) | |
375 | 206 endif() |
274 | 207 |
344 | 208 if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") |
209 add_d_debugs(QtdDebug) | |
375 | 210 endif() |
344 | 211 |
132 | 212 ## Bootstrap settings for QtD. |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
213 set(DRCC ${CMAKE_BINARY_DIR}/tools/drcc/drcc CACHE INTERNAL "") |
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
214 set(DUIC ${CMAKE_BINARY_DIR}/tools/duic/duic CACHE INTERNAL "") |
344 | 215 set(QTD_IMPORT_PATH ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/d${D_VERSION} CACHE INTERNAL "") |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
216 set(QTD_LIBRARIES_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "") |
132 | 217 |
218 ##-------------------------------------------- | |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
219 ## Macros and functions. |
132 | 220 ##-------------------------------------------- |
221 | |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
222 macro(load_generated_classes ) |
237 | 223 include(${CMAKE_BINARY_DIR}/cpp/qt_${package}/qt_${package}.txt) |
375 | 224 endmacro() |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
225 |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
226 macro(qtd_add_resource output) |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
227 set (params NAME OPTIONS) |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
228 qtd_parse_params (RESOURCES params ${ARGN}) |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
229 if(NAME_tmp) |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
230 set(OPTIONS_tmp ${OPTIONS_tmp} -name ${NAME_tmp}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
231 endif() |
344 | 232 qtd_command ("${output}" "${DRCC}" "${OPTIONS_tmp}" "qrc_" |
233 "Generate" ${RESOURCES_tmp}) | |
375 | 234 endmacro() |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
235 |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
236 macro(qtd_wrap_ui output) |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
237 set (params OPTIONS) |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
238 qtd_parse_params (UI params ${ARGN}) |
344 | 239 qtd_command ("${output}" "${DUIC}" "${OPTIONS_tmp}" "uic_" |
240 "Generate" ${UI_tmp}) | |
375 | 241 endmacro() |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
242 |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
243 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
|
244 foreach(file "${ARGN}") |
375 | 245 ## Test if the input file exists |
246 get_filename_component(file_path ${file} PATH) | |
247 get_filename_component(file_name ${file} NAME_WE) | |
248 get_filename_component(file_ext ${file} EXT) | |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
249 |
375 | 250 set(out ${CMAKE_CURRENT_BINARY_DIR}/${file_path}${prefix}${file_name}.d) |
251 add_custom_command(OUTPUT "${out}" | |
344 | 252 COMMAND "${command}" |
253 ARGS ${options} ${file} -o ${out} | |
254 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | |
255 DEPENDS ${file} | |
256 COMMENT "${comment} ${file}" | |
257 ) | |
375 | 258 set(${output} ${${output}} ${out}) |
259 endforeach() | |
260 endmacro() | |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
261 |
264
da7c867ef2ef
1) A bug is fixed when the generator doesn't restart if typesystem_${package}-java.java has been changed.
SokoL_SD
parents:
254
diff
changeset
|
262 ## Parses the parameters list. |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
263 macro(qtd_parse_params default params) |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
264 set(type_tmp ${default}) |
344 | 265 set(params_tmp ${default} ${${params}}) |
266 foreach(param_tmp ${params_tmp}) | |
375 | 267 set(${param_tmp}_tmp ) |
268 endforeach() | |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
269 foreach(arg_tmp ${ARGN}) |
375 | 270 set(found_type_tmp) |
271 if(NOT found_type_tmp) | |
272 foreach(param_tmp ${params_tmp}) | |
273 if(arg_tmp STREQUAL param_tmp) | |
274 set(type_tmp ${param_tmp}) | |
275 set(found_type_tmp 1) | |
276 break(param_tmp ${params_tmp}) | |
277 endif() | |
278 endforeach() | |
279 endif() | |
280 if(NOT found_type_tmp) | |
281 set(${type_tmp}_tmp ${${type_tmp}_tmp} ${arg_tmp}) | |
282 endif() | |
283 endforeach() | |
284 endmacro() | |
132 | 285 |
264
da7c867ef2ef
1) A bug is fixed when the generator doesn't restart if typesystem_${package}-java.java has been changed.
SokoL_SD
parents:
254
diff
changeset
|
286 ## Adds a new example. |
132 | 287 ## name -- example name. |
288 ## Options: | |
344 | 289 ## PACKAGES -- list of packages for link to example (for example, QtCore QtGui QtOpenGL). |
290 ## Default value is "QtCore QtGui". | |
132 | 291 ## params -- sources d files. |
292 ## Usage: | |
344 | 293 ## build_example(ExampleName PACKAGES QtCore QtGui QtXml main.d another_d_file.d) |
132 | 294 macro(build_example name) |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
295 set (params UIC RESOURCES PACKAGES) |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
296 qtd_parse_params (SOURCES params ${ARGN}) |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
297 |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
298 if(NOT PACKAGES_tmp) |
375 | 299 set(PACKAGES_tmp QtCore QtGui) |
300 endif() | |
344 | 301 |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
302 if(RESOURCES_tmp) |
375 | 303 if(NOT BUILD_TOOLS) |
304 message(STATUS "Example '${name}' requires drcc. Example will not be built") | |
305 return(build_example name) | |
306 endif() | |
307 qtd_add_resource(res_sources ${RESOURCES_tmp} NAME ${name} ) | |
308 endif() | |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
309 |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
310 if(UIC_tmp) |
375 | 311 if(NOT BUILD_TOOLS) |
312 message(STATUS "Example '${name}' requires drcc. Example will not be built") | |
313 return(build_example name) | |
314 endif() | |
315 qtd_wrap_ui(uic_sources ${UIC_tmp}) | |
316 endif() | |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
317 |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
318 foreach(package ${PACKAGES_tmp}) |
370
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
319 string(REGEX REPLACE "Qt([A-Za-z0-9])" "\\1" req "${package}") |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
320 set(is_found) |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
321 foreach(package_big ${packages_big}) |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
322 string(TOLOWER ${package_big} package) |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
323 if(${req} STREQUAL ${package_big}) |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
324 set(is_found 1) |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
325 break(package_big ${packages_big}) |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
326 endif() |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
327 endforeach() |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
328 if(NOT is_found) |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
329 message(STATUS "Example '${name}' requires the package '${req}', but it is not active. Example will not be built") |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
330 return(build_example name) |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
331 else() |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
332 set(qtd_libs ${${package}_lib_param} ${qtd_libs}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
333 if(CPP_SHARED AND CMAKE_HOST_UNIX) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
334 set(qtd_libs cpp_${package} ${qtd_libs}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
335 endif() |
370
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
336 endif() |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
337 endforeach() |
203
d3383b16f1d7
Add a 'NO_DEPS_SOURCES' option to the 'add_d_target' macro. And use it for resources and forms in QtD examples.
SokoL_SD
parents:
195
diff
changeset
|
338 add_d_program(${name} ${SOURCES_tmp} NO_DEPS_SOURCES ${res_sources} ${uic_sources} |
344 | 339 DEPENDS ${res_sources} INCLUDES ${QTD_IMPORT_PATH} ${CMAKE_CURRENT_BINARY_DIR} |
340 LIB_PATHS ${QTD_LIBRARIES_PATH} ${CMAKE_SOURCE_DIR}/lib ${QT_LIBRARY_DIR} LIBS ${qtd_libs}) | |
264
da7c867ef2ef
1) A bug is fixed when the generator doesn't restart if typesystem_${package}-java.java has been changed.
SokoL_SD
parents:
254
diff
changeset
|
341 ## TODO: Uncomment. |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
342 #if(STRIP AND ${CMAKE_BUILD_TYPE} EQUAL "Release" AND CMAKE_HOST_UNIX) ## |
344 | 343 # add_custom_command(TARGET example_${name} POST_BUILD COMMAND "${STRIP}" ARGS "${output}") |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
344 #endif(STRIP AND ${CMAKE_BUILD_TYPE} EQUAL "Release" AND CMAKE_HOST_UNIX) |
237 | 345 add_dependencies(examples ${name}) |
346 add_dependencies(${name} allpackages tools) | |
375 | 347 endmacro() |
132 | 348 |
349 ##-------------------------------------------- | |
264
da7c867ef2ef
1) A bug is fixed when the generator doesn't restart if typesystem_${package}-java.java has been changed.
SokoL_SD
parents:
254
diff
changeset
|
350 ## Build and install the QtD libraries. |
132 | 351 ##-------------------------------------------- |
352 | |
353 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | |
354 add_custom_target(allpackages) | |
355 link_directories(${CMAKE_BINARY_DIR}/CMakeFiles) | |
356 | |
357 foreach(package_big ${all_packages}) | |
344 | 358 string(TOLOWER ${package_big} package) |
264
da7c867ef2ef
1) A bug is fixed when the generator doesn't restart if typesystem_${package}-java.java has been changed.
SokoL_SD
parents:
254
diff
changeset
|
359 string(TOUPPER ${package} package_upper) |
da7c867ef2ef
1) A bug is fixed when the generator doesn't restart if typesystem_${package}-java.java has been changed.
SokoL_SD
parents:
254
diff
changeset
|
360 ## Load settings for the package. |
132 | 361 set(required) |
362 set(d_objs) | |
363 set(cpp_objs) | |
364 set(d_sources) | |
365 set(cpp_sources) | |
366 set(lib_name) | |
367 set(link_cpp) | |
368 set(link_d) | |
369 set(cpp_files) | |
227 | 370 set(cpp_generated_files) |
344 | 371 set(d_qt_files) |
372 set(d_qtd_files) | |
132 | 373 set(classes) |
374 set(d_generated_files) | |
375 set(link_example) | |
344 | 376 include (${CMAKE_SOURCE_DIR}/build/${package}.txt) |
132 | 377 |
378 set(all_req_found 1) | |
379 if(BUILD_QT_${package_upper}) | |
378 | 380 foreach(req ${required}) |
370
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
381 set(req_found) |
378 | 382 foreach(pack ${packages_big}) |
383 if(${pack} STREQUAL ${req}) | |
384 set(req_found 1) | |
370
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
385 endif() |
378 | 386 endforeach(pack ${packages}) |
387 if(NOT req_found) | |
388 set(req_found) | |
389 foreach(pack ${all_packages}) | |
390 if(${pack} STREQUAL ${req}) | |
391 set(req_found 1) | |
392 endif(${pack} STREQUAL ${req}) | |
393 endforeach(pack ${all_packages}) | |
394 if(req_found) | |
395 message(STATUS "Package '${package_big}' requires '${req}', but it is not active") | |
396 else() | |
397 message(STATUS "Package '${package_big}' requires '${req}', but it is not found") | |
398 endif() | |
399 set(all_req_found) | |
400 endif() | |
401 endforeach(req ${required}) | |
132 | 402 else(BUILD_QT_${package_upper}) |
378 | 403 set(all_req_found) |
132 | 404 endif(BUILD_QT_${package_upper}) |
344 | 405 |
132 | 406 if("${all_req_found}" EQUAL 1) |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
407 set(packages_big ${packages_big} ${package_big}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
408 set(packages ${packages} ${package}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
409 ## Load a package sources list. |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
410 foreach(d_source ${package}/ArrayOps2 ${d_generated_files}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
411 set(d_sources ${d_sources} ${CMAKE_BINARY_DIR}/qt/${d_source}.d) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
412 if(EXISTS ${CMAKE_BINARY_DIR}/qt/${d_source}_aux.d) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
413 set(d_sources ${d_sources} ${CMAKE_BINARY_DIR}/qt/${d_source}_aux.d) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
414 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
415 endforeach() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
416 set(classes ArrayOps ${classes}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
417 foreach(class ${classes}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
418 set(d_sources ${d_sources} ${CMAKE_BINARY_DIR}/qt/${package}/${class}.d) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
419 set(cpp_sources ${cpp_sources} ${CMAKE_BINARY_DIR}/cpp/qt_${package}/${class}_shell.cpp) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
420 if(EXISTS ${CMAKE_BINARY_DIR}/qt/${package}/${class}_aux.d) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
421 set(d_sources ${d_sources} ${CMAKE_BINARY_DIR}/qt/${package}/${class}_aux.d) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
422 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
423 endforeach() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
424 set(files_for_gen ${files_for_gen} ${cpp_sources} ${d_sources}) |
132 | 425 |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
426 foreach (cpp_source ${cpp_files}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
427 set(cpp_sources ${cpp_sources} ${CMAKE_SOURCE_DIR}/cpp/${cpp_source}.cpp) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
428 endforeach() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
429 foreach (cpp_source ${cpp_generated_files}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
430 set(cpp_sources ${cpp_sources} ${CMAKE_BINARY_DIR}/cpp/${cpp_source}.cpp) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
431 endforeach() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
432 foreach(d_source ${d_qt_files}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
433 set(d_sources ${d_sources} ${CMAKE_SOURCE_DIR}/d${D_VERSION}/qt/${d_source}.d) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
434 endforeach() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
435 foreach(d_source ${d_qtd_files}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
436 set(d_sources ${d_sources} ${CMAKE_SOURCE_DIR}/d${D_VERSION}/qtd/${d_source}.d) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
437 endforeach() |
132 | 438 |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
439 if(NOT GENERATE_DI_FILES) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
440 foreach(d_source ${d_sources}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
441 get_filename_component(path ${d_source} PATH) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
442 get_filename_component(name ${d_source} NAME_WE) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
443 regex_safe_string(cbd_safe_tmp ${CMAKE_CURRENT_BINARY_DIR}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
444 regex_safe_string(csd_safe_tmp ${CMAKE_CURRENT_SOURCE_DIR}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
445 regex_safe_string(ver_safe_tmp ${CMAKE_CURRENT_SOURCE_DIR}/d${D_VERSION}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
446 set(regexp_str_tmp "(${ver_safe_tmp}/|${cbd_safe_tmp}/|${csd_safe_tmp}/|)(.+)") |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
447 string(REGEX REPLACE ${regexp_str_tmp} "\\2" ins_path "${path}") |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
448 install(FILES ${d_source} DESTINATION include/d/${ins_path} COMPONENT qtd RENAME ${name}.di) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
449 endforeach() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
450 endif(NOT GENERATE_DI_FILES) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
451 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
452 ### Build the CPP part. |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
453 if(CPP_SHARED) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
454 set(cpp_method SHARED) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
455 else() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
456 set(cpp_method STATIC) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
457 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
458 add_library(cpp_${package} ${cpp_method} ${cpp_sources}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
459 |
370
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
460 set_target_properties(cpp_${package} PROPERTIES |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
461 LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
462 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib |
370
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
463 ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
464 COMPILE_DEFINITIONS QTD_${package_upper} |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
465 ) |
372
a032df77b6ab
Simple debug helper. Unittests. Meta-object for polymorphic non-QObjects
Max Samukha <maxter@spambox.com>
parents:
370
diff
changeset
|
466 |
a032df77b6ab
Simple debug helper. Unittests. Meta-object for polymorphic non-QObjects
Max Samukha <maxter@spambox.com>
parents:
370
diff
changeset
|
467 if(CMAKE_HOST_WIN32) |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
468 set_target_properties(cpp_${package} PROPERTIES |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
469 LINK_FLAGS -Wl,-enable-auto-import |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
470 ) |
372
a032df77b6ab
Simple debug helper. Unittests. Meta-object for polymorphic non-QObjects
Max Samukha <maxter@spambox.com>
parents:
370
diff
changeset
|
471 endif() |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
472 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
473 set(link_cpp ${link_cpp} ${QT_QT${package_upper}_LIBRARY}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
474 if(NOT CPP_SHARED) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
475 ## Get an objects list. It will be used in building the D part. |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
476 foreach(cpp_source ${cpp_sources}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
477 set(cpp_source ${cpp_source}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
478 obj_path(cpp_source) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
479 set(cpp_objs ${cpp_objs} ${CMAKE_BINARY_DIR}/CMakeFiles/cpp_${package}.dir/${cpp_source}${CMAKE_CXX_OUTPUT_EXTENSION}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
480 endforeach() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
481 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
482 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
483 ## Settings for the D part. |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
484 set(lib_name qtd${package}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
485 # if(BUILD_SHARED_LIBRARIES) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
486 # set(lib lib/${CMAKE_SHARED_LIBRARY_PREFIX}${lib_name}${CMAKE_SHARED_LIBRARY_SUFFIX}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
487 # set(build_type SHARED) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
488 # else() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
489 set(lib lib/${D_LIB_PREFIX}${lib_name}${D_LIB_SUFFIX}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
490 set(build_type STATIC) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
491 # endif() |
372
a032df77b6ab
Simple debug helper. Unittests. Meta-object for polymorphic non-QObjects
Max Samukha <maxter@spambox.com>
parents:
370
diff
changeset
|
492 |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
493 ## Package dependencies. |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
494 foreach(req ${required}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
495 set(is_found) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
496 foreach(pack ${packages_big}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
497 if("${pack}" STREQUAL "${req}") |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
498 set(is_found 1) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
499 break(pack ${packages_big}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
500 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
501 endforeach() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
502 if(NOT is_found) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
503 message(FATAL_ERROR "Package ${package_big} requires ${req}, but it is not found") |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
504 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
505 string(TOUPPER ${req} req_upper) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
506 string(TOLOWER ${req} req_lower) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
507 set(link_cpp ${link_cpp} cpp_${req_lower} ${QT_QT${req_upper}_LIBRARY}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
508 endforeach() |
132 | 509 |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
510 if(${package_big} STREQUAL "Qwt" AND CMAKE_HOST_WIN32) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
511 set(qwt_release_lib ${QWT_LIB_PATH}/libqwt5.a) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
512 set(qwt_debug_lib ${QWT_LIB_PATH}/libqwtd5.a) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
513 if(EXISTS ${qwt_release_lib}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
514 set(qwt_lib ${qwt_release_lib}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
515 elseif(EXISTS ${qwt_debug_lib}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
516 set(qwt_lib ${qwt_debug_lib}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
517 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
518 set(link_cpp ${link_cpp} ${qwt_lib}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
519 endif() |
357
9784459f0750
An attempt (failed due to optlink) to improve locality of declarations exported from QtD executables
Max Samukha <maxter@spambox.com>
parents:
344
diff
changeset
|
520 |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
521 target_link_libraries(cpp_${package} ${link_cpp} ) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
522 set(d_objs ${d_objs} ${objects}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
523 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
524 if(CPP_SHARED) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
525 set(cpp_lib ${CMAKE_BINARY_DIR}/lib/libcpp_${package}${CMAKE_SHARED_LIBRARY_SUFFIX}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
526 install(FILES ${cpp_lib} COMPONENT qtd DESTINATION lib) |
344 | 527 |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
528 if(CMAKE_HOST_WIN32) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
529 ## Create an implib library which will be linked to the D part. |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
530 set(cpp_lib_native ${cpp_lib}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
531 make_native_path(cpp_lib_native) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
532 set(d_implib ${CMAKE_BINARY_DIR}/CMakeFiles/${package}.dir/cpp_${package}.lib) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
533 set(d_implib_native ${d_implib}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
534 make_native_path(d_implib_native) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
535 add_custom_command( |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
536 OUTPUT "${d_implib}" |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
537 COMMAND "${IMPLIB}" |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
538 ARGS /system /PAGESIZE:64 ${d_implib_native} ${cpp_lib_native} |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
539 DEPENDS "cpp_${package}" |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
540 COMMENT "Creating implib ${lib_name}" |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
541 ) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
542 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
543 else() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
544 set(${package}_lib_param Qt${package_big}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
545 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
546 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
547 ## Link the D part. |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
548 add_d_target(${lib_name} NOT_DETECT_DEPENDS TYPE ${build_type} INCLUDES ${QTD_IMPORT_PATH} SOURCES ${d_sources} OBJECTS ${cpp_objs} ${d_implib} |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
549 OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib DEPENDS ${d_implib} ) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
550 install(FILES ${CMAKE_BINARY_DIR}/${lib} COMPONENT qtd DESTINATION lib) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
551 ## Paths for the QtD libs. It is necessary for examples. |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
552 set(${package}_lib_param qtd${package} ${${package}_lib_param} ${link_example}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
553 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
554 ## Generate dependences for make (or nmake). |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
555 add_custom_target(${package}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
556 add_dependencies(${package} ${lib_name}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
557 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
558 add_dependencies(${lib_name} cpp_${package}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
559 foreach(depend ${required}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
560 string(TOLOWER ${depend} depend) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
561 add_dependencies(cpp_${package} cpp_${depend}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
562 add_dependencies(${package} ${depend}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
563 endforeach() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
564 add_dependencies(allpackages ${package}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
565 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
566 ## TODO: Do we need to generate *.di files? |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
567 if(GENERATE_DI_FILES) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
568 regexseafestring(cbd_safe ${CMAKE_BINARY_DIR}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
569 regexseafestring(csd_safe ${CMAKE_SOURCE_DIR}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
570 set(regexp_str "(${csd}/qt/d${D_VERSION}|${csd_safe}|${cbd_safe})/([A-Za-z0-9\\-_\\\\/]+)[/]+([A-Za-z0-9\\-_\\\\]+).d") |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
571 foreach(source ${d_sources}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
572 # find_file(source ${source} PATHS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
573 # ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
574 string(REGEX REPLACE ${regexp_str} "\\2" inc_path "${source}") |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
575 string(REGEX REPLACE ${regexp_str} "\\3" file_name "${source}") |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
576 set(interface_file_path ${CMAKE_BINARY_DIR}/d/${inc_path}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
577 set(interface_file "${interface_file_path}/${file_name}.di") |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
578 if(NOT "${file_name}" STREQUAL "QGlobal") |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
579 add_custom_command(OUTPUT "${interface_file}" |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
580 COMMAND "${DC}" |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
581 ARGS ${D_FLAGS} -o- -H -Hd${interface_file_path} ${source} |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
582 COMMENT "Generating header for ${source}" |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
583 DEPENDS ${source} |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
584 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
585 ) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
586 else(NOT "${file_name}" STREQUAL "QGlobal") ## The DMD frontend crashes on this file. |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
587 add_custom_command(OUTPUT "${interface_file}" |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
588 COMMAND ${CMAKE_COMMAND} -E make_directory ${interface_file_path} |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
589 COMMAND ${CMAKE_COMMAND} -E remove -f ${interface_file} |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
590 COMMAND ${CMAKE_COMMAND} -E copy ${source} ${interface_file} |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
591 COMMENT "" |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
592 DEPENDS ${source} |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
593 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
594 ) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
595 endif(NOT "${file_name}" STREQUAL "QGlobal" AND GENERATE_DI_FILES) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
596 set(interfaces_list ${interfaces_list} ${interface_file_path}/${file_name}.di) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
597 install(FILES ${interface_file} COMPONENT qtd DESTINATION include/d/${inc_path}) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
598 endforeach() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
599 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
600 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
601 endforeach() |
344 | 602 if(GENERATE_DI_FILES) |
132 | 603 add_custom_target(generate_headers ALL DEPENDS ${interfaces_list}) |
604 endif(GENERATE_DI_FILES) | |
605 | |
606 set(CPACK_COMPONENTS_ALL qtd qtd_tools) | |
607 | |
608 ##-------------------------------------------- | |
609 ## Build other parts of the QtD. | |
610 ##-------------------------------------------- | |
237 | 611 |
132 | 612 if(BUILD_TOOLS) |
237 | 613 add_custom_target(tools ALL) |
132 | 614 add_subdirectory(tools) |
615 add_dependencies(tools drcc duic) | |
616 endif(BUILD_TOOLS) | |
617 | |
618 if(BUILD_EXAMPLES) | |
237 | 619 add_custom_target(examples ALL) |
620 add_dependencies(examples allpackages tools) | |
132 | 621 add_subdirectory(demos) |
622 add_subdirectory(examples) | |
623 endif(BUILD_EXAMPLES) | |
624 | |
239 | 625 set(SECOND_RUN 0 CACHE INTERNAL "") |
235
b796329e8c38
We need to start cmake twice. It is necessary for getting a class list from the generator and using this list for building other parts of QtD.
SokoL_SD
parents:
229
diff
changeset
|
626 |
344 | 627 endif(NOT SECOND_RUN) |
375 | 628 |
629 ##-------------------------------------------- | |
630 ## CPack. | |
631 ##-------------------------------------------- | |
632 set(CPACK_PACKAGE_VERSION_PATCH 1) | |
633 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "QtD is a D binding to the Qt application and UI framework.") | |
634 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/changelog.txt") | |
635 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt") | |
636 set(CPACK_PACKAGE_VENDOR "QtD team") | |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
637 set(CPACK_PACKAGE_CONTACT "qtd@qtd.org") |
376
06d8188a23e3
Revert requirement of cmake 2.8@
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
375
diff
changeset
|
638 set(CPACK_PACKAGE_VERSION "0.6") |
375 | 639 set(CPACK_PACKAGE_INSTALL_DIRECTORY "qtd ${CPACK_PACKAGE_VERSION}") |
640 set(CPACK_PACKAGE_FILE_NAME "qtd-${CPACK_PACKAGE_VERSION}") | |
641 set(CPACK_SOURCE_PACKAGE_FILE_NAME "qtd-${CPACK_PACKAGE_VERSION}") | |
642 if(CMAKE_HOST_WIN32) | |
643 set(CPACK_GENERATOR "ZIP") | |
644 elseif(CMAKE_HOST_UNIX) | |
645 set(CPACK_GENERATOR "TBZ2;DEB") | |
646 endif() | |
647 include(CPack) |