Mercurial > projects > qtd
annotate CMakeLists.txt @ 387:b13910fdd739
-m32
author | Max Samukha <maxter@spambox.com> |
---|---|
date | Fri, 23 Jul 2010 11:12:10 +0300 |
parents | d2f48c4cb3e3 |
children | 6bd75093d3bb |
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 |
387 | 4 # Everything is in 32-bit mode for now. |
5 set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -m32) | |
6 | |
344 | 7 # Debug and release flags. |
8 if (NOT CMAKE_BUILD_TYPE) | |
9 set(CMAKE_BUILD_TYPE Release) | |
375 | 10 endif () |
344 | 11 |
12 if(${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG]) | |
13 set(CMAKE_BUILD_TYPE Debug) | |
14 #set( SUFFIXLIB "${SUFFIXLIB}-debug" ) | |
15 #set( SUFFIXBIN "${SUFFIXBIN}-debug" ) | |
16 add_definitions(-DDEBUG) | |
17 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
|
18 message(STATUS "Only debug and release configurations are supported. The configuration is changed to 'Release'") |
344 | 19 set(CMAKE_BUILD_TYPE Release) |
375 | 20 endif () |
344 | 21 |
22 if (${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS]) | |
23 #add_definitions(-UNO_DEBUG) | |
375 | 24 endif() |
344 | 25 |
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
|
26 ########################################################## |
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
|
27 ## 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
|
28 ########################################################## |
344 | 29 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
|
30 |
242 | 31 option(ALLOW_IN_SOURCE_BUILDS "Allow in-source builds" "OFF") |
344 | 32 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT ALLOW_IN_SOURCE_BUILDS) |
33 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
|
34 "Please create a directory and run cmake from there, passing the path " |
344 | 35 "to this source directory as the last argument. " |
36 "This process created the file `CMakeCache.txt` and the directory `CMakeFiles'. Please delete them. " | |
37 "Or you can restart cmake with `-DALLOW_IN_SOURCE_BUILDS=1`, but it is not recommended." | |
38 ) | |
375 | 39 endif () |
239 | 40 |
132 | 41 FIND_PACKAGE(Qt4 REQUIRED) |
344 | 42 set(QT_USE_QTMAIN false) |
43 set(QT_USE_QTGUI false) | |
132 | 44 |
45 ##-------------------------------------------- | |
46 ## Settings. | |
47 ##-------------------------------------------- | |
48 | |
49 ## Options. | |
136
798e54c1f66e
CMake: disable building examples by default. You can use -DBUILD_EXAMPLES switch for enable that.
SokoL_SD
parents:
135
diff
changeset
|
50 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
|
51 # 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
|
52 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
53 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
|
54 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
|
55 else() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
56 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
|
57 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
58 |
132 | 59 option(BUILD_TOOLS "Build tools" "ON") |
60 #option(GENERATE_DI_FILES "Generate *.di files with DC -H command" "OFF") | |
344 | 61 set(GENERATE_DI_FILES OFF) ## Very experimental option. Temporarily disabled. |
274 | 62 option(VERBOSE_DEBUG "Verbose debug" "OFF") |
273 | 63 |
378 | 64 set(all_packages Core Gui OpenGL Xml Svg Network WebKit Qwt CACHE INTERNAL "") |
132 | 65 |
66 ## Init D toolkit. | |
67 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) | |
68 FIND_PACKAGE(D REQUIRED) | |
69 | |
70 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "") | |
71 set(CMAKE_INSTALL_PREFIX | |
344 | 72 ${DC_PATH} CACHE PATH "QtD install prefix" |
132 | 73 ) |
375 | 74 endif() |
132 | 75 |
76 # Check D compiler version | |
77 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
|
78 if (D_FRONTEND LESS "050") |
344 | 79 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
|
80 endif(D_FRONTEND LESS "050") |
344 | 81 set(D_TARGET d1-tango CACHE INTERNAL "") |
132 | 82 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
|
83 set(D_TARGET d2-phobos CACHE INTERNAL "") |
375 | 84 endif() |
132 | 85 |
237 | 86 # System specific settings. |
132 | 87 if(CMAKE_HOST_WIN32) |
88 set(implib implib) | |
89 find_program(IMPLIB ${implib}) | |
90 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
|
91 message(FATAL_ERROR "implib is not found. You can donwload it from http://ftp.digitalmars.com/bup.zip") |
375 | 92 endif () |
93 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
|
94 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
95 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
|
96 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
|
97 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
|
98 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
|
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(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
|
101 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
|
102 |
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
|
103 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
|
104 foreach(package_big ${all_packages}) |
344 | 105 string(TOLOWER ${package_big} package) |
106 string(TOUPPER ${package_big} package_upper) | |
378 | 107 set(package_default_option "ON") |
108 if(${package_big} STREQUAL "Qwt") | |
109 set(package_default_option "OFF") | |
110 endif() | |
111 option(BUILD_QT_${package_upper} "Build Qt${package_big}" ${package_default_option}) | |
243 | 112 if(BUILD_QT_${package_upper}) |
375 | 113 set(packages ${packages} ${package_big}) |
114 endif() | |
115 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
|
116 |
378 | 117 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
|
118 if(CMAKE_HOST_WIN32) |
347e4c7a9ba1
make QwtD compile on Windows@
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
379
diff
changeset
|
119 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
|
120 endif() |
378 | 121 set(inc_paths "") |
122 | |
123 if(CMAKE_HOST_WIN32) | |
381
347e4c7a9ba1
make QwtD compile on Windows@
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
379
diff
changeset
|
124 set(sep "*") |
378 | 125 else() |
126 set(sep ":") | |
127 endif() | |
128 | |
129 if(BUILD_QT_QWT) | |
381
347e4c7a9ba1
make QwtD compile on Windows@
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
379
diff
changeset
|
130 set(inc_paths ${inc_paths}${sep}${QWT_INCLUDE_PATH}${sep}) |
378 | 131 endif() |
132 | |
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
|
133 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
|
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 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
|
136 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
|
137 |
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 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
|
139 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
|
140 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
|
141 ${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
|
142 set(make_util $(MAKE)) |
375 | 143 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
|
144 message(FATAL_ERROR "${CMAKE_GENERATOR} is not supported") |
375 | 145 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
|
146 |
239 | 147 if(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) |
148 set(cd_path ${CMAKE_SOURCE_DIR}) | |
375 | 149 else() |
239 | 150 set(cd_path ${CMAKE_BINARY_DIR}/build) |
375 | 151 endif() |
239 | 152 |
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
|
153 make_native_path(cd_path) |
344 | 154 add_custom_command(TARGET main POST_BUILD |
155 COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${CMAKE_BINARY_DIR}/build | |
156 COMMAND cd ARGS ${cd_path} && ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} -DSECOND_RUN=1 ${CMAKE_SOURCE_DIR} && ${make_util} | |
157 COMMENT "" | |
158 ) | |
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
|
159 |
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
|
160 ## "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
|
161 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
|
162 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
163 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
|
164 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
|
165 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
|
166 COMMAND cd ${native_build_path} && ${make_util} install |
344 | 167 COMMENT "" |
168 ) | |
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
|
169 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
|
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 ########################################################## |
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
|
172 ## 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
|
173 ########################################################## |
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
|
174 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
|
175 |
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
|
176 PROJECT(qtd CXX C) |
240 | 177 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
|
178 load_cache(${CMAKE_BINARY_DIR}/.. INCLUDE_INTERNALS all_packages QTD_VERSION_STR QTD_VERSION CPP_SHARED) |
375 | 179 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
|
180 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
|
181 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
|
182 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
|
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 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
|
185 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
|
186 |
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
|
187 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
|
188 if(BUILD_QT_QWT) |
378 | 189 include_directories(${QWT_INCLUDE_PATH}) |
190 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
|
191 |
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
|
192 # 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
|
193 if(CMAKE_HOST_WIN32) |
132 | 194 string(REGEX REPLACE ".dll([A-Za-z\\.0-9]+)" "\\1" CMAKE_IMPORT_LIBRARY_SUFFIX "${CMAKE_IMPORT_LIBRARY_SUFFIX}") |
375 | 195 endif() |
132 | 196 |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
197 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
|
198 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
|
199 add_definitions(-DCPP_SHARED) |
375 | 200 endif() |
229 | 201 |
273 | 202 if(UNITTEST) |
203 add_d_versions(QtdUnittest) | |
344 | 204 set(D_FLAGS ${D_FLAGS} -unittest) |
375 | 205 endif() |
273 | 206 |
274 | 207 if(VERBOSE_DEBUG) |
208 add_d_debugs(QtdVerbose) | |
375 | 209 endif() |
274 | 210 |
344 | 211 if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") |
212 add_d_debugs(QtdDebug) | |
375 | 213 endif() |
344 | 214 |
132 | 215 ## 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
|
216 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
|
217 set(DUIC ${CMAKE_BINARY_DIR}/tools/duic/duic CACHE INTERNAL "") |
344 | 218 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
|
219 set(QTD_LIBRARIES_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "") |
132 | 220 |
221 ##-------------------------------------------- | |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
222 ## Macros and functions. |
132 | 223 ##-------------------------------------------- |
224 | |
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 macro(load_generated_classes ) |
237 | 226 include(${CMAKE_BINARY_DIR}/cpp/qt_${package}/qt_${package}.txt) |
375 | 227 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
|
228 |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
229 macro(qtd_add_resource output) |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
230 set (params NAME OPTIONS) |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
231 qtd_parse_params (RESOURCES params ${ARGN}) |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
232 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
|
233 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
|
234 endif() |
344 | 235 qtd_command ("${output}" "${DRCC}" "${OPTIONS_tmp}" "qrc_" |
236 "Generate" ${RESOURCES_tmp}) | |
375 | 237 endmacro() |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
238 |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
239 macro(qtd_wrap_ui output) |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
240 set (params OPTIONS) |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
241 qtd_parse_params (UI params ${ARGN}) |
344 | 242 qtd_command ("${output}" "${DUIC}" "${OPTIONS_tmp}" "uic_" |
243 "Generate" ${UI_tmp}) | |
375 | 244 endmacro() |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
245 |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
246 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
|
247 foreach(file "${ARGN}") |
375 | 248 ## Test if the input file exists |
249 get_filename_component(file_path ${file} PATH) | |
250 get_filename_component(file_name ${file} NAME_WE) | |
251 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
|
252 |
375 | 253 set(out ${CMAKE_CURRENT_BINARY_DIR}/${file_path}${prefix}${file_name}.d) |
254 add_custom_command(OUTPUT "${out}" | |
344 | 255 COMMAND "${command}" |
256 ARGS ${options} ${file} -o ${out} | |
257 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | |
258 DEPENDS ${file} | |
259 COMMENT "${comment} ${file}" | |
260 ) | |
375 | 261 set(${output} ${${output}} ${out}) |
262 endforeach() | |
263 endmacro() | |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
264 |
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
|
265 ## Parses the parameters list. |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
266 macro(qtd_parse_params default params) |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
267 set(type_tmp ${default}) |
344 | 268 set(params_tmp ${default} ${${params}}) |
269 foreach(param_tmp ${params_tmp}) | |
375 | 270 set(${param_tmp}_tmp ) |
271 endforeach() | |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
272 foreach(arg_tmp ${ARGN}) |
375 | 273 set(found_type_tmp) |
274 if(NOT found_type_tmp) | |
275 foreach(param_tmp ${params_tmp}) | |
276 if(arg_tmp STREQUAL param_tmp) | |
277 set(type_tmp ${param_tmp}) | |
278 set(found_type_tmp 1) | |
279 break(param_tmp ${params_tmp}) | |
280 endif() | |
281 endforeach() | |
282 endif() | |
283 if(NOT found_type_tmp) | |
284 set(${type_tmp}_tmp ${${type_tmp}_tmp} ${arg_tmp}) | |
285 endif() | |
286 endforeach() | |
287 endmacro() | |
132 | 288 |
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
|
289 ## Adds a new example. |
132 | 290 ## name -- example name. |
291 ## Options: | |
344 | 292 ## PACKAGES -- list of packages for link to example (for example, QtCore QtGui QtOpenGL). |
293 ## Default value is "QtCore QtGui". | |
132 | 294 ## params -- sources d files. |
295 ## Usage: | |
344 | 296 ## build_example(ExampleName PACKAGES QtCore QtGui QtXml main.d another_d_file.d) |
132 | 297 macro(build_example name) |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
298 set (params UIC RESOURCES PACKAGES) |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
299 qtd_parse_params (SOURCES params ${ARGN}) |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
300 |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
301 if(NOT PACKAGES_tmp) |
375 | 302 set(PACKAGES_tmp QtCore QtGui) |
303 endif() | |
344 | 304 |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
305 if(RESOURCES_tmp) |
375 | 306 if(NOT BUILD_TOOLS) |
307 message(STATUS "Example '${name}' requires drcc. Example will not be built") | |
308 return(build_example name) | |
309 endif() | |
310 qtd_add_resource(res_sources ${RESOURCES_tmp} NAME ${name} ) | |
311 endif() | |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
312 |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
313 if(UIC_tmp) |
375 | 314 if(NOT BUILD_TOOLS) |
315 message(STATUS "Example '${name}' requires drcc. Example will not be built") | |
316 return(build_example name) | |
317 endif() | |
318 qtd_wrap_ui(uic_sources ${UIC_tmp}) | |
319 endif() | |
182
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
320 |
973564c7e388
CMake: add an UIC option in the build_example macro.
SokoL_SD
parents:
177
diff
changeset
|
321 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
|
322 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
|
323 set(is_found) |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
324 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
|
325 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
|
326 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
|
327 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
|
328 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
|
329 endif() |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
330 endforeach() |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
331 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
|
332 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
|
333 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
|
334 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
|
335 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
|
336 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
|
337 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
|
338 endif() |
370
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
339 endif() |
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
340 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
|
341 add_d_program(${name} ${SOURCES_tmp} NO_DEPS_SOURCES ${res_sources} ${uic_sources} |
344 | 342 DEPENDS ${res_sources} INCLUDES ${QTD_IMPORT_PATH} ${CMAKE_CURRENT_BINARY_DIR} |
343 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
|
344 ## 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
|
345 #if(STRIP AND ${CMAKE_BUILD_TYPE} EQUAL "Release" AND CMAKE_HOST_UNIX) ## |
344 | 346 # 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
|
347 #endif(STRIP AND ${CMAKE_BUILD_TYPE} EQUAL "Release" AND CMAKE_HOST_UNIX) |
237 | 348 add_dependencies(examples ${name}) |
349 add_dependencies(${name} allpackages tools) | |
375 | 350 endmacro() |
132 | 351 |
352 ##-------------------------------------------- | |
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
|
353 ## Build and install the QtD libraries. |
132 | 354 ##-------------------------------------------- |
355 | |
356 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | |
357 add_custom_target(allpackages) | |
358 link_directories(${CMAKE_BINARY_DIR}/CMakeFiles) | |
359 | |
360 foreach(package_big ${all_packages}) | |
344 | 361 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
|
362 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
|
363 ## Load settings for the package. |
132 | 364 set(required) |
365 set(d_objs) | |
366 set(cpp_objs) | |
367 set(d_sources) | |
368 set(cpp_sources) | |
369 set(lib_name) | |
370 set(link_cpp) | |
371 set(link_d) | |
372 set(cpp_files) | |
227 | 373 set(cpp_generated_files) |
344 | 374 set(d_qt_files) |
375 set(d_qtd_files) | |
132 | 376 set(classes) |
377 set(d_generated_files) | |
378 set(link_example) | |
344 | 379 include (${CMAKE_SOURCE_DIR}/build/${package}.txt) |
132 | 380 |
381 set(all_req_found 1) | |
382 if(BUILD_QT_${package_upper}) | |
378 | 383 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
|
384 set(req_found) |
378 | 385 foreach(pack ${packages_big}) |
386 if(${pack} STREQUAL ${req}) | |
387 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
|
388 endif() |
378 | 389 endforeach(pack ${packages}) |
390 if(NOT req_found) | |
391 set(req_found) | |
392 foreach(pack ${all_packages}) | |
393 if(${pack} STREQUAL ${req}) | |
394 set(req_found 1) | |
395 endif(${pack} STREQUAL ${req}) | |
396 endforeach(pack ${all_packages}) | |
397 if(req_found) | |
398 message(STATUS "Package '${package_big}' requires '${req}', but it is not active") | |
399 else() | |
400 message(STATUS "Package '${package_big}' requires '${req}', but it is not found") | |
401 endif() | |
402 set(all_req_found) | |
403 endif() | |
404 endforeach(req ${required}) | |
132 | 405 else(BUILD_QT_${package_upper}) |
378 | 406 set(all_req_found) |
132 | 407 endif(BUILD_QT_${package_upper}) |
344 | 408 |
132 | 409 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
|
410 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
|
411 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
|
412 ## 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
|
413 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
|
414 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
|
415 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
|
416 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
|
417 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
418 endforeach() |
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(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
|
420 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
|
421 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
|
422 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
|
423 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
|
424 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
|
425 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
426 endforeach() |
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(files_for_gen ${files_for_gen} ${cpp_sources} ${d_sources}) |
132 | 428 |
384
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_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_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
|
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 (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
|
433 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
|
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_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
|
436 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
|
437 endforeach() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
438 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
|
439 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
|
440 endforeach() |
132 | 441 |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
442 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
|
443 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
|
444 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
|
445 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
|
446 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
|
447 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
|
448 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
|
449 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
|
450 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
|
451 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
|
452 endforeach() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
453 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
|
454 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
455 ### 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
|
456 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
|
457 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
|
458 else() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
459 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
|
460 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
461 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
|
462 |
370
7fd4b69378bf
move cpp part of QtD into shared libs on linux to reduce binaries size
Eldar Insafutdinov
parents:
363
diff
changeset
|
463 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
|
464 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
|
465 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
|
466 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
|
467 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
|
468 ) |
372
a032df77b6ab
Simple debug helper. Unittests. Meta-object for polymorphic non-QObjects
Max Samukha <maxter@spambox.com>
parents:
370
diff
changeset
|
469 |
a032df77b6ab
Simple debug helper. Unittests. Meta-object for polymorphic non-QObjects
Max Samukha <maxter@spambox.com>
parents:
370
diff
changeset
|
470 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
|
471 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
|
472 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
|
473 ) |
372
a032df77b6ab
Simple debug helper. Unittests. Meta-object for polymorphic non-QObjects
Max Samukha <maxter@spambox.com>
parents:
370
diff
changeset
|
474 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
|
475 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
476 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
|
477 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
|
478 ## 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
|
479 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
|
480 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
|
481 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
|
482 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
|
483 endforeach() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
484 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
485 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
486 ## 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
|
487 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
|
488 # 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
|
489 # 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
|
490 # 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
|
491 # else() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
492 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
|
493 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
|
494 # endif() |
372
a032df77b6ab
Simple debug helper. Unittests. Meta-object for polymorphic non-QObjects
Max Samukha <maxter@spambox.com>
parents:
370
diff
changeset
|
495 |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
496 ## 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
|
497 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
|
498 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
|
499 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
|
500 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
|
501 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
|
502 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
|
503 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
504 endforeach() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
505 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
|
506 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
|
507 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
508 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
|
509 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
|
510 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
|
511 endforeach() |
132 | 512 |
384
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(${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
|
514 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
|
515 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
|
516 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
|
517 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
|
518 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
|
519 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
|
520 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
521 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
|
522 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
|
523 |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
524 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
|
525 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
|
526 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
527 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
|
528 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
|
529 install(FILES ${cpp_lib} COMPONENT qtd DESTINATION lib) |
344 | 530 |
384
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
531 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
|
532 ## 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
|
533 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
|
534 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
|
535 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
|
536 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
|
537 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
|
538 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
|
539 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
|
540 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
|
541 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
|
542 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
|
543 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
|
544 ) |
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 else() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
547 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
|
548 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
549 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
550 ## 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
|
551 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
|
552 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
|
553 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
|
554 ## 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
|
555 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
|
556 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
557 ## 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
|
558 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
|
559 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
|
560 |
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(${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
|
562 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
|
563 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
|
564 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
|
565 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
|
566 endforeach() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
567 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
|
568 |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
569 ## 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
|
570 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
|
571 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
|
572 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
|
573 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
|
574 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
|
575 # 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
|
576 # ${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
|
577 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
|
578 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
|
579 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
|
580 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
|
581 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
|
582 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
|
583 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
|
584 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
|
585 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
|
586 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
|
587 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
|
588 ) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
589 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
|
590 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
|
591 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
|
592 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
|
593 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
|
594 COMMENT "" |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
595 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
|
596 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
|
597 ) |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
598 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
|
599 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
|
600 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
|
601 endforeach() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
602 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
603 endif() |
d2f48c4cb3e3
Same behavior of shared libs on linux and windows. Minor build script fixes.
Max Samukha <maxter@spambox.com>
parents:
381
diff
changeset
|
604 endforeach() |
344 | 605 if(GENERATE_DI_FILES) |
132 | 606 add_custom_target(generate_headers ALL DEPENDS ${interfaces_list}) |
607 endif(GENERATE_DI_FILES) | |
608 | |
609 set(CPACK_COMPONENTS_ALL qtd qtd_tools) | |
610 | |
611 ##-------------------------------------------- | |
612 ## Build other parts of the QtD. | |
613 ##-------------------------------------------- | |
237 | 614 |
132 | 615 if(BUILD_TOOLS) |
237 | 616 add_custom_target(tools ALL) |
132 | 617 add_subdirectory(tools) |
618 add_dependencies(tools drcc duic) | |
619 endif(BUILD_TOOLS) | |
620 | |
621 if(BUILD_EXAMPLES) | |
237 | 622 add_custom_target(examples ALL) |
623 add_dependencies(examples allpackages tools) | |
132 | 624 add_subdirectory(demos) |
625 add_subdirectory(examples) | |
626 endif(BUILD_EXAMPLES) | |
627 | |
239 | 628 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
|
629 |
344 | 630 endif(NOT SECOND_RUN) |
375 | 631 |
632 ##-------------------------------------------- | |
633 ## CPack. | |
634 ##-------------------------------------------- | |
635 set(CPACK_PACKAGE_VERSION_PATCH 1) | |
636 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "QtD is a D binding to the Qt application and UI framework.") | |
637 set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/changelog.txt") | |
638 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt") | |
639 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
|
640 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
|
641 set(CPACK_PACKAGE_VERSION "0.6") |
375 | 642 set(CPACK_PACKAGE_INSTALL_DIRECTORY "qtd ${CPACK_PACKAGE_VERSION}") |
643 set(CPACK_PACKAGE_FILE_NAME "qtd-${CPACK_PACKAGE_VERSION}") | |
644 set(CPACK_SOURCE_PACKAGE_FILE_NAME "qtd-${CPACK_PACKAGE_VERSION}") | |
645 if(CMAKE_HOST_WIN32) | |
646 set(CPACK_GENERATOR "ZIP") | |
647 elseif(CMAKE_HOST_UNIX) | |
648 set(CPACK_GENERATOR "TBZ2;DEB") | |
649 endif() | |
650 include(CPack) |