annotate CMakeLists.txt @ 379:a795eeb3b21f

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