annotate CMakeLists.txt @ 109:08135aa00cc9

CMake: ldc support option SINGLE_D_OBJECT now. See http://www.dsource.org/projects/ldc/ticket/309.
author SokoL_SD
date Mon, 01 Jun 2009 07:15:52 +0000
parents 8a4e85876ea8
children 547cd31fa12a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
1 cmake_minimum_required(VERSION 2.6)
1
e78566595089 initial import
mandel
parents:
diff changeset
2 PROJECT(qtd CXX C)
e78566595089 initial import
mandel
parents:
diff changeset
3 FIND_PACKAGE(Qt4 REQUIRED)
e78566595089 initial import
mandel
parents:
diff changeset
4
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
5 ##--------------------------------------------
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
6 ## Settings.
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
7 ##--------------------------------------------
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
8
5
834feae7809b Fix include paths in CMake script.
SokoL_SD
parents: 4
diff changeset
9 include_directories(${QT_INCLUDES} include ${CMAKE_CURRENT_BINARY_DIR}/include)
1
e78566595089 initial import
mandel
parents:
diff changeset
10
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
11 ## Options.
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
12 option(BUILD_EXAMPLES "Build examples" "ON")
59
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
13 option(BUILD_TOOLS "Build tools" "ON")
9
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
14 option(GENERATE_DI_FILES "Generate *.di files with DC -H command" "OFF")
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
15
39
a5cba313c924 network and webkit are wrapped now
eldar
parents: 37
diff changeset
16 set(all_packages Core Gui OpenGL Xml Svg Network WebKit) ## TODO: Loading.
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
17
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
18
23
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
19 ## Strip utility.
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
20 find_program(STRIP strip)
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
21
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
22 ## Find D compiler and parsing its version.
49
e00776053828 CMake: command "cmake -DDC=compiler_name" work correctly now.
SokoL_SD
parents: 44
diff changeset
23
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
24 find_program(DC dmd ldc)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
25 if (DC)
49
e00776053828 CMake: command "cmake -DDC=compiler_name" work correctly now.
SokoL_SD
parents: 44
diff changeset
26 get_filename_component(dc_path ${DC} PATH)
e00776053828 CMake: command "cmake -DDC=compiler_name" work correctly now.
SokoL_SD
parents: 44
diff changeset
27 if("${dc_path}" STREQUAL ${CMAKE_BINARY_DIR})
e00776053828 CMake: command "cmake -DDC=compiler_name" work correctly now.
SokoL_SD
parents: 44
diff changeset
28 get_filename_component(DC ${DC} NAME)
e00776053828 CMake: command "cmake -DDC=compiler_name" work correctly now.
SokoL_SD
parents: 44
diff changeset
29 endif("${dc_path}" STREQUAL ${CMAKE_BINARY_DIR})
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
30 exec_program(${DC} ARGS "" OUTPUT_VARIABLE d_output)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
31 string(REGEX MATCH "Digital Mars D Compiler v[0-9]\\.[0-9]+" dmd_version "${d_output}")
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
32 if (dmd_version)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
33 set(D_IS_MARS true)
16
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
34 set(D_IS_DMD true)
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
35 set(D_COMPILER_NAME "Digital Mars D Compiler")
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
36 string(REGEX REPLACE "Digital Mars D Compiler v([0-9])\\.[0-9]+" "\\1" D_VERSION "${dmd_version}")
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
37 string(REGEX REPLACE "Digital Mars D Compiler v[0-9]\\.([0-9]+)" "\\1" D_FRONTEND "${dmd_version}")
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
38 else (dmd_version)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
39 string(REGEX MATCH "LLVM-based D Compiler" is_ldc "${d_output}")
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
40 if (is_ldc)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
41 exec_program(${DC} ARGS "--version" OUTPUT_VARIABLE d_output)
11
28c9f8f8f34b Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents: 10
diff changeset
42 string(REGEX MATCH "based on DMD v[0-9]\\.[0-9]+" ldc_version "${d_output}")
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
43 set(D_IS_LLVM true)
16
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
44 set(D_IS_LDC true)
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
45 if(ldc_version)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
46 set(D_IS_LLVM true)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
47 set(D_COMPILER_NAME "LLVM-based D Compiler")
11
28c9f8f8f34b Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents: 10
diff changeset
48 string(REGEX REPLACE "based on DMD v([0-9])\\.[0-9]+" "\\1" D_VERSION "${ldc_version}")
28c9f8f8f34b Another small fix: correctly processing version of ldc based on llvm from trunk.
SokoL_SD
parents: 10
diff changeset
49 string(REGEX REPLACE "based on DMD v[0-9]\\.([0-9]+)" "\\1" D_FRONTEND "${ldc_version}")
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
50 else(ldc_version)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
51 message(FATAL_ERROR "LDC compiler was found, but the version can not be processed")
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
52 endif(ldc_version)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
53 else (is_ldc)
86
bee1446909c5 minor spelling fix
maxter
parents: 60
diff changeset
54 message(FATAL_ERROR "D compliler not found")
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
55 endif(is_ldc)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
56 endif(dmd_version)
86
bee1446909c5 minor spelling fix
maxter
parents: 60
diff changeset
57 message(STATUS "D compiler found -- ${D_COMPILER_NAME} v${D_VERSION}.${D_FRONTEND}")
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
58 else (DC)
86
bee1446909c5 minor spelling fix
maxter
parents: 60
diff changeset
59 message(FATAL_ERROR "D compliler not found")
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
60 endif (DC)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
61
43
bfc76a437a62 CMake: autodetection of CMAKE_INSTALL_PREFIX. By default, command install will copy data to compiler directory.
SokoL_SD
parents: 42
diff changeset
62 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "")
bfc76a437a62 CMake: autodetection of CMAKE_INSTALL_PREFIX. By default, command install will copy data to compiler directory.
SokoL_SD
parents: 42
diff changeset
63 get_filename_component(dc_path ${DC} PATH)
bfc76a437a62 CMake: autodetection of CMAKE_INSTALL_PREFIX. By default, command install will copy data to compiler directory.
SokoL_SD
parents: 42
diff changeset
64 if("${dc_path}" STREQUAL "")
bfc76a437a62 CMake: autodetection of CMAKE_INSTALL_PREFIX. By default, command install will copy data to compiler directory.
SokoL_SD
parents: 42
diff changeset
65 find_program(dc_path_tmp ${DC})
bfc76a437a62 CMake: autodetection of CMAKE_INSTALL_PREFIX. By default, command install will copy data to compiler directory.
SokoL_SD
parents: 42
diff changeset
66 get_filename_component(dc_path ${dc_path_tmp} PATH)
bfc76a437a62 CMake: autodetection of CMAKE_INSTALL_PREFIX. By default, command install will copy data to compiler directory.
SokoL_SD
parents: 42
diff changeset
67 mark_as_advanced(dc_path_tmp)
bfc76a437a62 CMake: autodetection of CMAKE_INSTALL_PREFIX. By default, command install will copy data to compiler directory.
SokoL_SD
parents: 42
diff changeset
68 endif("${dc_path}" STREQUAL "")
bfc76a437a62 CMake: autodetection of CMAKE_INSTALL_PREFIX. By default, command install will copy data to compiler directory.
SokoL_SD
parents: 42
diff changeset
69 get_filename_component(dc_parent_dir ${dc_path} NAME)
bfc76a437a62 CMake: autodetection of CMAKE_INSTALL_PREFIX. By default, command install will copy data to compiler directory.
SokoL_SD
parents: 42
diff changeset
70 if("${dc_parent_dir}" STREQUAL "bin")
bfc76a437a62 CMake: autodetection of CMAKE_INSTALL_PREFIX. By default, command install will copy data to compiler directory.
SokoL_SD
parents: 42
diff changeset
71 get_filename_component(dc_path ${dc_path} PATH)
bfc76a437a62 CMake: autodetection of CMAKE_INSTALL_PREFIX. By default, command install will copy data to compiler directory.
SokoL_SD
parents: 42
diff changeset
72 endif("${dc_parent_dir}" STREQUAL "bin")
bfc76a437a62 CMake: autodetection of CMAKE_INSTALL_PREFIX. By default, command install will copy data to compiler directory.
SokoL_SD
parents: 42
diff changeset
73 set(CMAKE_INSTALL_PREFIX
bfc76a437a62 CMake: autodetection of CMAKE_INSTALL_PREFIX. By default, command install will copy data to compiler directory.
SokoL_SD
parents: 42
diff changeset
74 ${dc_path} CACHE PATH "QtD install prefix" FORCE
bfc76a437a62 CMake: autodetection of CMAKE_INSTALL_PREFIX. By default, command install will copy data to compiler directory.
SokoL_SD
parents: 42
diff changeset
75 )
bfc76a437a62 CMake: autodetection of CMAKE_INSTALL_PREFIX. By default, command install will copy data to compiler directory.
SokoL_SD
parents: 42
diff changeset
76 endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR "${CMAKE_INSTALL_PREFIX}" STREQUAL "")
bfc76a437a62 CMake: autodetection of CMAKE_INSTALL_PREFIX. By default, command install will copy data to compiler directory.
SokoL_SD
parents: 42
diff changeset
77
109
08135aa00cc9 CMake: ldc support option SINGLE_D_OBJECT now.
SokoL_SD
parents: 89
diff changeset
78 ## TODO: disable this option for ldc < rev. 1433.
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
79 if(D_IS_MARS)
9
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
80 option(SINGLE_D_OBJECT "Build all d sources to one object file" "ON")
109
08135aa00cc9 CMake: ldc support option SINGLE_D_OBJECT now.
SokoL_SD
parents: 89
diff changeset
81 elseif(D_IS_LLVM)
9
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
82 option(SINGLE_D_OBJECT "Build all d sources to one object file" "OFF")
109
08135aa00cc9 CMake: ldc support option SINGLE_D_OBJECT now.
SokoL_SD
parents: 89
diff changeset
83 endif(D_IS_MARS)
08135aa00cc9 CMake: ldc support option SINGLE_D_OBJECT now.
SokoL_SD
parents: 89
diff changeset
84
08135aa00cc9 CMake: ldc support option SINGLE_D_OBJECT now.
SokoL_SD
parents: 89
diff changeset
85 if(SINGLE_D_OBJECT AND D_IS_LLVM)
08135aa00cc9 CMake: ldc support option SINGLE_D_OBJECT now.
SokoL_SD
parents: 89
diff changeset
86 set(D_FLAGS ${D_FLAGS} -singleobj)
08135aa00cc9 CMake: ldc support option SINGLE_D_OBJECT now.
SokoL_SD
parents: 89
diff changeset
87 endif(SINGLE_D_OBJECT AND D_IS_LLVM)
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
88
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
89 # Check D compiler version
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
90 if(D_VERSION EQUAL "1")
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
91 if (D_FRONTEND LESS "041")
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
92 message(STATUS "Minimum required version of D compiler is 1.041 (or compiler based on this version)")
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
93 endif(D_FRONTEND LESS "041")
16
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
94 set(D_TARGET d1-tango)
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
95 elseif(D_VERSION EQUAL "2")
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
96 set(D_TARGET ) ## TODO: hm... I don`t known this parameter for D2 ^(
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
97 endif(D_VERSION EQUAL "1")
16
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
98 set(D_FLAGS ${D_FLAGS} -I${CMAKE_SOURCE_DIR}/qt/d${D_VERSION})
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
99
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
100 # Debug and release flags.
23
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
101 if (NOT CMAKE_BUILD_TYPE)
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
102 set(CMAKE_BUILD_TYPE Release)
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
103 endif (NOT CMAKE_BUILD_TYPE)
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
104 if(${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG])
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
105 set(CMAKE_BUILD_TYPE Debug)
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
106 #set( SUFFIXLIB "${SUFFIXLIB}-debug" )
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
107 #set( SUFFIXBIN "${SUFFIXBIN}-debug" )
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
108 add_definitions(-DDEBUG)
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
109 set(D_FLAGS ${D_FLAGS} -g -gc -debug)
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
110 elseif (NOT ${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS])
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
111 message(STATUS "Only debug and release configuration are now supproted. Configuration changed to 'Release'")
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
112 set(CMAKE_BUILD_TYPE Release)
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
113 endif (${CMAKE_BUILD_TYPE} MATCHES [dD][eE][bB][uU][gG])
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
114 if (${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS])
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
115 #add_definitions(-UNO_DEBUG)
88
201684eb20ee -O is back
maxter
parents: 86
diff changeset
116 set(D_FLAGS ${D_FLAGS} -O -release)
16
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
117 if(D_IS_MARS)
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
118 set(D_FLAGS ${D_FLAGS} -inline)
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
119 elseif(D_IS_LLVM)
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
120 set(D_FLAGS ${D_FLAGS} -enable-inlining)
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
121 endif(D_IS_MARS)
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
122 if(CMAKE_HOST_WIN32)
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
123 set(D_FLAGS ${D_FLAGS} -L/subsystem:windows)
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
124 endif(CMAKE_HOST_WIN32)
23
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
125 endif(${CMAKE_BUILD_TYPE} MATCHES [rR][eE][lL][eE][aA][sS] )
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
126
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
127 set(D_FLAGS ${D_FLAGS} -I${CMAKE_BINARY_DIR} -I${CMAKE_SOURCE_DIR})
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
128 if(D_IS_MARS AND CMAKE_HOST_WIN32)
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
129 else(D_IS_MARS AND CMAKE_HOST_WIN32)
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
130 set(D_FLAGS ${D_FLAGS} -L-L${CMAKE_BINARY_DIR}/lib)
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
131 endif(D_IS_MARS AND CMAKE_HOST_WIN32)
10
390725da0980 Trivial fix in cmake.
SokoL_SD
parents: 9
diff changeset
132
9
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
133 # System specifc settings.
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
134 if(CMAKE_HOST_WIN32)
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
135 set(implib implib)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
136 find_program(IMPLIB ${implib})
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
137 if (NOT IMPLIB)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
138 message(FATAL_ERROR "implib not found. You can donwload it from http://ftp.digitalmars.com/bup.zip")
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
139 endif (NOT IMPLIB)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
140 set(D_OBJECT_SUFFIX .obj)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
141 if(D_IS_MARS)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
142 set(D_LIB_SUFFIX .lib)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
143 set(D_LIB_PREFIX )
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
144 elseif(D_IS_LDC)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
145 set(D_LIB_SUFFIX .a)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
146 set(D_LIB_PREFIX lib)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
147 endif(D_IS_MARS)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
148 set(GEN_OPT ${GEN_OPT} --cpp_shared)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
149 add_definitions(-DCPP_SHARED)
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
150 string(REGEX REPLACE ".dll([A-Za-z\\.0-9]+)" "\\1" CMAKE_IMPORT_LIBRARY_SUFFIX "${CMAKE_IMPORT_LIBRARY_SUFFIX}")
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
151 elseif(CMAKE_HOST_UNIX)
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
152 set(D_LIB_SUFFIX .a)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
153 set(D_LIB_PREFIX lib)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
154 set(D_OBJECT_SUFFIX .o)
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
155 endif(CMAKE_HOST_WIN32)
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
156
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
157 set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ./)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
158 set(GEN_OPT ${GEN_OPT} --d-target=${D_TARGET})
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
159
59
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
160 ## Bootstrap settings for tools.
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
161 set(DRCC ${CMAKE_BINARY_DIR}/tools/drcc/drcc)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
162
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
163 ##--------------------------------------------
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
164 ## Macroses and functions.
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
165 ##--------------------------------------------
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
166
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
167 ## Make native path.
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
168 ## Usage:
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
169 ## set(path c:/file_path/file_name.cpp)
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
170 ## make_native_path(path)
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
171 ## message(STATUS ${path})
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
172 ## Output:
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
173 ## -- "c:\file_path\file_name.cpp"
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
174 ## Command "file(TO_NATIVE_PATH ...)" is wrong on Windows
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
175 macro(MAKE_NATIVE_PATH pathname)
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
176 if(CMAKE_HOST_WIN32)
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
177 # An extra \\ escape is necessary to get a \ through CMake's processing.
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
178 string(REPLACE "/" "\\" ${pathname} "${${pathname}}")
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
179 # Enclose with UNESCAPED quotes. This means we need to escape our
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
180 # quotes once here, i.e. with \"
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
181 set(${pathname} \"${${pathname}}\")
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
182 endif(CMAKE_HOST_WIN32)
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
183 endmacro(MAKE_NATIVE_PATH)
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
184
55
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
185 ##
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
186 ## Example:
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
187 ## set(path 24.3+23.bin)
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
188 ## obj_path(path)
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
189 ## message(STATUS ${path})
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
190 ## Example output:
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
191 ## -- 24\.3\+23\.bin
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
192 macro(regex_safe_string outvariable)
50
cc557203146c CMake: fix building when path of source or build directory contain the reserve regex symbols.
SokoL_SD
parents: 49
diff changeset
193 set(${outvariable} ${ARGN})
cc557203146c CMake: fix building when path of source or build directory contain the reserve regex symbols.
SokoL_SD
parents: 49
diff changeset
194 set(__regex_chars__ ^ $ . ] [ - * + ? | \( \))
cc557203146c CMake: fix building when path of source or build directory contain the reserve regex symbols.
SokoL_SD
parents: 49
diff changeset
195 foreach(__regex_char__ ${__regex_chars__})
cc557203146c CMake: fix building when path of source or build directory contain the reserve regex symbols.
SokoL_SD
parents: 49
diff changeset
196 string(REPLACE "${__regex_char__}"
cc557203146c CMake: fix building when path of source or build directory contain the reserve regex symbols.
SokoL_SD
parents: 49
diff changeset
197 "\\${__regex_char__}" ${outvariable} ${${outvariable}}
cc557203146c CMake: fix building when path of source or build directory contain the reserve regex symbols.
SokoL_SD
parents: 49
diff changeset
198 )
cc557203146c CMake: fix building when path of source or build directory contain the reserve regex symbols.
SokoL_SD
parents: 49
diff changeset
199 endforeach(__regex_char__ ${__regex_chars__})
55
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
200 endmacro(regex_safe_string outvariable)
50
cc557203146c CMake: fix building when path of source or build directory contain the reserve regex symbols.
SokoL_SD
parents: 49
diff changeset
201
55
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
202 ## Remove unnecessary path to the object file.
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
203 ## path -- path to object file.
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
204 ## Example:
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
205 ## set(path ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/target.dir/main.d.obj)
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
206 ## obj_path(path)
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
207 ## message(STATUS ${path})
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
208 ## Example output:
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
209 ## -- CMakeFiles/target.dir/main.d.obj
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
210 macro(OBJ_PATH path)
55
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
211 regex_safe_string(__cbd_safe__ ${CMAKE_CURRENT_BINARY_DIR})
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
212 regex_safe_string(__csd_safe__ ${CMAKE_CURRENT_SOURCE_DIR})
50
cc557203146c CMake: fix building when path of source or build directory contain the reserve regex symbols.
SokoL_SD
parents: 49
diff changeset
213 set(regexp_str "(${__cbd_safe__}/|${__csd_safe__}/|)(.+)")
cc557203146c CMake: fix building when path of source or build directory contain the reserve regex symbols.
SokoL_SD
parents: 49
diff changeset
214 string(REGEX REPLACE ${regexp_str} "\\2" ${path} "${${path}}")
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
215 endmacro(OBJ_PATH)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
216
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
217 ## Compile d files.
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
218 ## target -- name of a new target.
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
219 ## objects_list -- created object files.
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
220 ## params -- sources files.
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
221 macro(compile_d_files target objects_list)
9
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
222 set(${objects_list})
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
223 set(tmp_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.dir)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
224 file(MAKE_DIRECTORY ${tmp_dir})
9
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
225 if(NOT SINGLE_D_OBJECT)
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
226 foreach (d_source_p ${ARGN})
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
227 ## TODO: why find_file command work wrong?
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
228 find_file(d_source_p ${d_source_p} PATHS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
229 ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
230 set (d_source ${d_source_p})
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
231 obj_path(d_source)
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
232 set(d_obj ${tmp_dir}/${d_source}${D_OBJECT_SUFFIX})
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
233 set(${objects_list} ${${objects_list}} ${d_obj})
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
234 get_filename_component(path ${d_obj} PATH)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
235 file(MAKE_DIRECTORY ${path})
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
236 set(d_obj_out ${d_obj})
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
237 obj_path(d_obj_out)
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
238 add_custom_command(OUTPUT "${d_obj}"
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
239 COMMAND "${DC}"
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
240 ARGS ${D_FLAGS} -c ${d_source_p} -of${d_obj}
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
241 COMMENT "Building ${d_obj_out}"
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
242 DEPENDS ${d_source_p}
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
243 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
244 )
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
245 endforeach(d_source_p)
9
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
246 else(NOT SINGLE_D_OBJECT)
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
247 set(${objects_list} ${tmp_dir}/${target}${D_OBJECT_SUFFIX})
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
248 set(d_obj_out ${${objects_list}})
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
249 obj_path(d_obj_out)
12
74465e760fde Small cmake fix on linux.
SokoL_SD
parents: 11
diff changeset
250 set(parameters ${D_FLAGS} -c ${ARGN} -of${${objects_list}})
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
251 set(parameters_list_file ${tmp_dir}/parameters)
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
252 if(CMAKE_HOST_WIN32)
12
74465e760fde Small cmake fix on linux.
SokoL_SD
parents: 11
diff changeset
253 file(REMOVE ${parameters_list_file})
74465e760fde Small cmake fix on linux.
SokoL_SD
parents: 11
diff changeset
254 foreach(arg ${parameters})
74465e760fde Small cmake fix on linux.
SokoL_SD
parents: 11
diff changeset
255 file(APPEND ${parameters_list_file} "${arg}\n")
74465e760fde Small cmake fix on linux.
SokoL_SD
parents: 11
diff changeset
256 endforeach(arg)
74465e760fde Small cmake fix on linux.
SokoL_SD
parents: 11
diff changeset
257 set(param @${parameters_list_file})
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
258 elseif(CMAKE_HOST_UNIX)
12
74465e760fde Small cmake fix on linux.
SokoL_SD
parents: 11
diff changeset
259 set(param ${parameters})
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
260 endif(CMAKE_HOST_WIN32)
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
261 add_custom_command(OUTPUT "${${objects_list}}"
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
262 COMMAND "${DC}"
12
74465e760fde Small cmake fix on linux.
SokoL_SD
parents: 11
diff changeset
263 ARGS ${param}
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
264 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
265 DEPENDS ${ARGN}
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
266 COMMENT ""
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
267 )
9
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
268 endif(NOT SINGLE_D_OBJECT)
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
269 add_custom_target(${target} DEPENDS "${${objects_list}}")
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
270 endmacro(compile_d_files objects_list)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
271
59
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
272 macro(qtd_add_resource name output)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
273 set(${output})
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
274 foreach(res "${ARGN}")
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
275 ## Test input file exists.
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
276 get_filename_component(res_path ${res} PATH)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
277 get_filename_component(res_name ${res} NAME_WE)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
278 get_filename_component(res_ext ${res} EXT)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
279 #if(NOT ${req_ext} STREQUAL "qrc")
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
280 # get_filename_component(res_name ${res} NAME_WE)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
281 #endif(NOT ${req_ext} STREQUAL "qrc")
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
282 set(out ${CMAKE_CURRENT_BINARY_DIR}/${res_path}qrc_${res_name}.d)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
283 add_custom_command(OUTPUT "${out}"
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
284 COMMAND "${DRCC}"
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
285 ARGS -name ${name} ${res} -o ${out}
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
286 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
287 DEPENDS ${res}
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
288 COMMENT "Compile QtD resource ${res}"
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
289 )
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
290 set(${output} ${${output}} ${out})
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
291 endforeach(res "${ARGN}")
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
292 endmacro(qtd_add_resource output)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
293
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
294 ## Build example macro.
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
295 ## name -- example name.
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
296 ## Options:
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
297 ## PACKAGES -- list of packages to link to exaple (for example, QtCore QtGui QtOpenGL).
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
298 ## Default value is "QtCore QtGui".
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
299 ## params -- sources d files.
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
300 ## Usage:
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
301 ## build_example(ExampleName PACKAGES QtCore QtGui QtXml main.d another_d_file.d)
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
302 macro(build_example name)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
303 set(qtd_libs ${core_lib_param} ${gui_lib_param})
59
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
304 set(type_dat SOURCES)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
305 set(RESOURCES)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
306 set(SOURCES)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
307 set(PACKAGES)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
308 ## Parse parameters list.
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
309 set(params_dat RESOURCES SOURCES PACKAGES)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
310 foreach(arg_dat ${ARGN})
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
311 set(founded_type_dat)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
312 foreach(param_dat ${params_dat})
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
313 if(${arg_dat} STREQUAL ${param_dat})
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
314 set(type_dat ${param_dat})
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
315 set(founded_type_dat 1)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
316 break(${arg_dat} STREQUAL ${param_dat})
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
317 endif(${arg_dat} STREQUAL ${param_dat})
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
318 endforeach(param_dat ${params_dat})
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
319 if(NOT founded_type_dat)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
320 set(${type_dat} ${${type_dat}} ${arg_dat})
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
321 endif(NOT founded_type_dat)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
322 endforeach(arg_dat ${ARGN})
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
323 if(NOT PACKAGES)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
324 set(PACKAGES QtCore QtGui)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
325 endif(NOT PACKAGES)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
326 ## TODO: Tools building is acitve???
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
327 if(RESOURCES)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
328 if(NOT BUILD_TOOLS)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
329 message(STATUS "Example '${name}' required drcc. Example will not build")
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
330 return(build_example name)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
331 endif(NOT BUILD_TOOLS)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
332 qtd_add_resource(${name} res_sources ${RESOURCES})
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
333 endif(RESOURCES)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
334 compile_d_files(${name}_dobjs objects ${SOURCES} ${res_sources})
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
335 set(output ${CMAKE_CURRENT_BINARY_DIR}/${name}${CMAKE_EXECUTABLE_SUFFIX})
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
336 set(output_native ${output})
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
337 make_native_path(output_native)
59
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
338 foreach(package ${PACKAGES})
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
339 string(REGEX REPLACE "Qt([A-Za-z0-9])" "\\1" req "${package}")
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
340 set(is_founded)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
341 foreach(package_big ${packages_big})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
342 string(TOLOWER ${package_big} package)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
343 if(${req} STREQUAL ${package_big})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
344 set(is_founded 1)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
345 break(package_big ${packages_big})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
346 endif(${req} STREQUAL ${package_big})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
347 endforeach(package_big ${packages_big})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
348 if(NOT is_founded)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
349 message(STATUS "Example '${name}' required package '${req}', but its not active. Example will not build")
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
350 return(build_example name)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
351 else(NOT is_founded)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
352 set(qtd_libs ${${package}_lib_param} ${qtd_libs})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
353 endif(NOT is_founded)
59
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
354 endforeach(package ${PACKAGES})
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
355 add_custom_command(OUTPUT "${output}"
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
356 COMMAND "${DC}"
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
357 ARGS ${D_FLAGS} ${libs_path} ${qtd_libs} ${objects}
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
358 -of${output_native}
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
359 DEPENDS ${objects}
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
360 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
361 COMMENT "Building example ${name}"
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
362 )
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
363 add_custom_target(example_${name} ALL DEPENDS "${output}")
23
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
364 ## TODO: Enable on windows too.
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
365 if(STRIP AND ${CMAKE_BUILD_TYPE} EQUAL "Release" AND CMAKE_HOST_UNIX) ##
23
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
366 add_custom_command(TARGET example_${name} POST_BUILD COMMAND "${STRIP}" ARGS "${output}")
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
367 endif(STRIP AND ${CMAKE_BUILD_TYPE} EQUAL "Release" AND CMAKE_HOST_UNIX)
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
368 add_dependencies(example_${name} allpackages)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
369 endmacro(build_example sources)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
370
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
371 ##--------------------------------------------
23
907d517d37c6 CMake: Set Release configuration as default.
SokoL_SD
parents: 17
diff changeset
372 ## Build and install library.
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
373 ##--------------------------------------------
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
374
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
375 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
59
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
376 add_custom_target(allpackages)
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
377 link_directories(${CMAKE_BINARY_DIR}/CMakeFiles)
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
378
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
379 foreach(package_big ${all_packages})
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
380 string(TOLOWER ${package_big} package)
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
381 ## Loading settings for package.
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
382 set(required)
9
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
383 set(d_objs)
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
384 set(cpp_objs)
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
385 set(d_sources)
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
386 set(cpp_sources)
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
387 set(lib_name)
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
388 set(link_cpp)
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
389 set(link_d)
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
390 set(cpp_files)
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
391 set(d_files)
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
392 set(classes)
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
393 set(d_generated_files)
16
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
394 set(d_version_files)
9
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
395 set(link_example)
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
396 include (${CMAKE_SOURCE_DIR}/build/${package}.txt)
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
397
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
398 set(all_req_found 1)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
399 string(TOUPPER ${package} package_upper)
42
eb3b5bbffc8f CMake: generator is not running multiple times.
SokoL_SD
parents: 39
diff changeset
400 option(BUILD_QT_${package_upper} "Build Qt${package_big}" "ON")
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
401 if(BUILD_QT_${package_upper})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
402 foreach(req ${required})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
403 set(req_found)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
404 foreach(pack ${packages_big})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
405 if(${pack} STREQUAL ${req})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
406 set(req_found 1)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
407 endif(${pack} STREQUAL ${req})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
408 endforeach(pack ${packages})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
409 if(NOT req_found)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
410 set(req_found)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
411 foreach(pack ${all_packages})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
412 if(${pack} STREQUAL ${req})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
413 set(req_found 1)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
414 endif(${pack} STREQUAL ${req})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
415 endforeach(pack ${all_packages})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
416 if(req_found)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
417 message(STATUS "Package '${package_big}' required '${req}', but its not active")
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
418 else(req_found)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
419 message(STATUS "Package '${package_big}' required '${req}', but its not found")
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
420 endif(req_found)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
421 set(all_req_found)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
422 endif(NOT req_found)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
423 endforeach(req ${required})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
424 else(BUILD_QT_${package_upper})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
425 set(all_req_found)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
426 endif(BUILD_QT_${package_upper})
55
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
427
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
428 ## TODO: cleanup.
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
429 if("${all_req_found}" EQUAL 1)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
430 set(packages_big ${packages_big} ${package_big})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
431 set(packages ${packages} ${package})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
432 ## Loading package sources list.
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
433 foreach(d_source ${d_version_files})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
434 set(d_sources ${d_sources} ${CMAKE_SOURCE_DIR}/qt/d${D_VERSION}/qt/${d_source}.d)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
435 if(NOT GENERATE_DI_FILES)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
436 get_filename_component(path ${d_source}.d PATH)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
437 get_filename_component(name ${d_source}.d NAME_WE)
55
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
438 install(FILES ${CMAKE_SOURCE_DIR}/qt/d${D_VERSION}/qt/${d_source}.d COMPONENT qtd DESTINATION include/d/qt/${path} RENAME ${name}.di)
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
439 install(FILES ${CMAKE_SOURCE_DIR}/qt/d${D_VERSION}/qt/${d_source}_enum.d COMPONENT qtd DESTINATION include/d/qt/${path} RENAME ${name}_enum.di OPTIONAL)
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
440 endif(NOT GENERATE_DI_FILES)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
441 endforeach(d_source)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
442 foreach(d_source ${d_files})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
443 set(d_sources ${d_sources} ${CMAKE_SOURCE_DIR}/qt/${d_source}.d)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
444 if(NOT GENERATE_DI_FILES)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
445 get_filename_component(path ${d_source}.d PATH)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
446 get_filename_component(name ${d_source}.d NAME_WE)
55
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
447 install(FILES ${CMAKE_SOURCE_DIR}/qt/${d_source}.d DESTINATION include/d/qt/${path} COMPONENT qtd RENAME ${name}.di)
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
448 install(FILES ${CMAKE_SOURCE_DIR}/qt/${d_source}_enum.d DESTINATION include/d/qt/${path} COMPONENT qtd RENAME ${name}_enum.di OPTIONAL)
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
449 endif(NOT GENERATE_DI_FILES)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
450 endforeach(d_source)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
451 foreach(d_source ${d_generated_files})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
452 set(d_sources ${d_sources} ${CMAKE_BINARY_DIR}/qt/${d_source}.d)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
453 if(NOT GENERATE_DI_FILES)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
454 get_filename_component(path ${d_source}.d PATH)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
455 get_filename_component(name ${d_source}.d NAME_WE)
55
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
456 install(FILES ${CMAKE_BINARY_DIR}/qt/${d_source}.d DESTINATION include/d/qt/${path} COMPONENT qtd RENAME ${name}.di)
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
457 install(FILES ${CMAKE_BINARY_DIR}/qt/${d_source}_enum.d DESTINATION include/d/qt/${path} COMPONENT qtd RENAME ${name}_enum.di OPTIONAL)
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
458 endif(NOT GENERATE_DI_FILES)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
459 endforeach(d_source)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
460 foreach (cpp_source ${cpp_files})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
461 set(cpp_sources ${cpp_sources} ${CMAKE_SOURCE_DIR}/cpp/${cpp_source}.cpp)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
462 endforeach(cpp_source)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
463 set(classes ArrayOps ${classes})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
464 foreach(class ${classes})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
465 set(d_sources ${d_sources} ${CMAKE_BINARY_DIR}/qt/${package}/${class}.d)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
466 set(cpp_sources ${cpp_sources} ${CMAKE_BINARY_DIR}/cpp/qt_${package}/${class}_shell.cpp)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
467 set(files_for_gen ${files_for_gen} ${CMAKE_BINARY_DIR}/cpp/qt_${package}/${class}_shell.cpp
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
468 ${CMAKE_BINARY_DIR}/qt/${package}/${class}.d)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
469 if(NOT GENERATE_DI_FILES)
55
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
470 install(FILES ${CMAKE_BINARY_DIR}/qt/${package}/${class}.d DESTINATION include/d/qt/${package} COMPONENT qtd RENAME ${class}.di)
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
471 install(FILES ${CMAKE_BINARY_DIR}/qt/${package}/${class}_enum.d DESTINATION include/d/qt/${package} COMPONENT qtd RENAME ${class}_enum.di OPTIONAL)
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
472 endif(NOT GENERATE_DI_FILES)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
473 endforeach(class)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
474
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
475 ## Link CPP library.
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
476 add_library(cpp_${package} SHARED ${cpp_sources})
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
477
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
478 ## Link D library.
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
479 set(lib_name ${D_LIB_PREFIX}qtd${package}${D_LIB_SUFFIX})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
480 set(lib lib/${lib_name})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
481 compile_d_files(${package}_dobjs objects ${d_sources})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
482 set(d_objs ${d_objs} ${objects})
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
483 if(CMAKE_HOST_WIN32)
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
484 set_property(TARGET cpp_${package} PROPERTY RUNTIME_OUTPUT_DIRECTORY lib)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
485 set_property(TARGET cpp_${package} PROPERTY ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
486 foreach(req ${required})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
487 set(is_found)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
488 foreach(pack ${packages_big})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
489 if("${pack}" STREQUAL "${req}")
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
490 set(is_found 1)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
491 break(pack ${packages_big})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
492 endif("${pack}" STREQUAL "${req}")
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
493 endforeach(pack ${packages_big})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
494 if(NOT is_found)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
495 message(FATAL_ERROR "Package ${package_big} required ${req}, but its not found")
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
496 endif(NOT is_found)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
497 string(TOUPPER ${req} req_upper)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
498 string(TOLOWER ${req} req_lower)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
499 set(link_cpp ${link_cpp} cpp_${req_lower} ${QT_QT${req_upper}_LIBRARY})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
500 endforeach(req ${require})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
501 string(TOUPPER ${package} package_upper)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
502 set(link_cpp ${link_cpp} ${QT_QT${package_upper}_LIBRARY})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
503 target_link_libraries(cpp_${package} ${link_cpp} )
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
504 set(cpp_lib ${CMAKE_BINARY_DIR}/lib/libcpp_${package}.dll)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
505 set(cpp_lib_native ${cpp_lib})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
506 make_native_path(cpp_lib_native)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
507 set(d_implib ${CMAKE_BINARY_DIR}/CMakeFiles/${package}.dir/cpp_${package}.lib)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
508 set(d_implib_native ${d_implib})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
509 make_native_path(d_implib_native)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
510 add_custom_command(
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
511 OUTPUT "${d_implib}"
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
512 COMMAND "${IMPLIB}"
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
513 ARGS /system /PAGESIZE:32 ${d_implib_native} ${cpp_lib_native}
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
514 DEPENDS "cpp_${package}"
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
515 COMMENT "Creating implib ${lib_name}"
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
516 )
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
517 add_custom_command(
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
518 OUTPUT "${lib}"
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
519 COMMAND "${DC}"
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
520 ARGS -lib ${d_objs} ${d_implib} -of${lib}
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
521 DEPENDS ${d_objs} ${d_implib}
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
522 COMMENT "Linking ${lib_name}"
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
523 )
55
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
524 install(FILES ${cpp_lib} COMPONENT qtd DESTINATION lib)
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
525 else(CMAKE_HOST_UNIX)
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
526 set_property(TARGET cpp_${package} PROPERTY LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
527 foreach(cpp_source ${cpp_sources})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
528 set(cpp_source ${cpp_source})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
529 obj_path(cpp_source)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
530 set(cpp_objs ${cpp_objs} CMakeFiles/cpp_${package}.dir/${cpp_source}${CMAKE_CXX_OUTPUT_EXTENSION})
55
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
531 endforeach(cpp_source)
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
532 add_custom_command(
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
533 OUTPUT "${lib}"
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
534 COMMAND "${CMAKE_AR}"
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
535 ARGS rcs ${lib} ${d_objs} ${cpp_objs}
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
536 DEPENDS ${d_objs} cpp_${package}
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
537 COMMENT "Linking ${lib_name}"
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
538 )
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
539 endif(CMAKE_HOST_WIN32)
55
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
540 install(FILES ${CMAKE_BINARY_DIR}/${lib} COMPONENT qtd DESTINATION lib)
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
541
28
10baf869635a CMake: QtD build with cmake again, but some functionality from previews revision are disabled.
SokoL_SD
parents: 27
diff changeset
542 ## Dependences.
10baf869635a CMake: QtD build with cmake again, but some functionality from previews revision are disabled.
SokoL_SD
parents: 27
diff changeset
543 add_custom_target(${package} DEPENDS ${lib})
10baf869635a CMake: QtD build with cmake again, but some functionality from previews revision are disabled.
SokoL_SD
parents: 27
diff changeset
544 foreach(depend ${required})
10baf869635a CMake: QtD build with cmake again, but some functionality from previews revision are disabled.
SokoL_SD
parents: 27
diff changeset
545 string(TOLOWER ${depend} depend)
10baf869635a CMake: QtD build with cmake again, but some functionality from previews revision are disabled.
SokoL_SD
parents: 27
diff changeset
546 add_dependencies(cpp_${package} cpp_${depend})
10baf869635a CMake: QtD build with cmake again, but some functionality from previews revision are disabled.
SokoL_SD
parents: 27
diff changeset
547 add_dependencies(${package} ${depend})
10baf869635a CMake: QtD build with cmake again, but some functionality from previews revision are disabled.
SokoL_SD
parents: 27
diff changeset
548 endforeach(depend ${required})
10baf869635a CMake: QtD build with cmake again, but some functionality from previews revision are disabled.
SokoL_SD
parents: 27
diff changeset
549 add_dependencies(allpackages ${package})
10baf869635a CMake: QtD build with cmake again, but some functionality from previews revision are disabled.
SokoL_SD
parents: 27
diff changeset
550
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
551 ## Paths for QtD libs. Needed by examples.
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
552 if(CMAKE_HOST_WIN32 AND D_IS_MARS)
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
553 set(libs_path ${CMAKE_BINARY_DIR}/lib/qtd${package}.lib)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
554 make_native_path(libs_path)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
555 set(${package}_lib_param -L+${libs_path})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
556 foreach(link ${link_example})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
557 set(link ${CMAKE_SOURCE_DIR}/lib/${link}.lib)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
558 make_native_path(link)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
559 set(link -L+${link})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
560 set(${package}_lib_param ${${package}_lib_param} ${link})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
561 endforeach(link ${link_example})
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
562 else (CMAKE_HOST_WIN32 AND D_IS_MARS)
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
563 set(${package}_lib_param -L-lqtd${package} -L-lQt${package_big})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
564 foreach(link ${link_example})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
565 set(${package}_lib_param ${${package}_lib_param} ${link})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
566 endforeach(link ${link_example})
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
567 endif(CMAKE_HOST_WIN32 AND D_IS_MARS)
9
16eec94c5b33 Bug fixes in CMake script.
SokoL_SD
parents: 7
diff changeset
568
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
569 if(GENERATE_DI_FILES)
50
cc557203146c CMake: fix building when path of source or build directory contain the reserve regex symbols.
SokoL_SD
parents: 49
diff changeset
570 regexseafestring(cbd_safe ${CMAKE_BINARY_DIR})
cc557203146c CMake: fix building when path of source or build directory contain the reserve regex symbols.
SokoL_SD
parents: 49
diff changeset
571 regexseafestring(csd_safe ${CMAKE_SOURCE_DIR})
cc557203146c CMake: fix building when path of source or build directory contain the reserve regex symbols.
SokoL_SD
parents: 49
diff changeset
572 set(regexp_str "(${csd}/qt/d${D_VERSION}|${csd_safe}|${cbd_safe})/([A-Za-z0-9\\-_\\\\/]+)[/]+([A-Za-z0-9\\-_\\\\]+).d")
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
573 foreach(source ${d_sources})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
574 # find_file(source ${source} PATHS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
575 # ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
576 string(REGEX REPLACE ${regexp_str} "\\2" inc_path "${source}")
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
577 string(REGEX REPLACE ${regexp_str} "\\3" file_name "${source}")
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
578 set(interface_file_path ${CMAKE_BINARY_DIR}/d/${inc_path})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
579 set(interface_file "${interface_file_path}/${file_name}.di")
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
580 if(NOT "${file_name}" STREQUAL "QGlobal")
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
581 add_custom_command(OUTPUT "${interface_file}"
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
582 COMMAND "${DC}"
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
583 ARGS ${D_FLAGS} -o- -H -Hd${interface_file_path} ${source}
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
584 COMMENT "Generating header for ${source}"
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
585 DEPENDS ${source}
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
586 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
587 )
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
588 else(NOT "${file_name}" STREQUAL "QGlobal") ## DMD frontend crash on this file.
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
589 add_custom_command(OUTPUT "${interface_file}"
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
590 COMMAND ${CMAKE_COMMAND} -E make_directory ${interface_file_path}
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
591 COMMAND ${CMAKE_COMMAND} -E remove -f ${interface_file}
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
592 COMMAND ${CMAKE_COMMAND} -E copy ${source} ${interface_file}
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
593 COMMENT ""
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
594 DEPENDS ${source}
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
595 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
596 )
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
597 endif(NOT "${file_name}" STREQUAL "QGlobal" AND GENERATE_DI_FILES)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
598 set(interfaces_list ${interfaces_list} ${interface_file_path}/${file_name}.di)
55
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
599 install(FILES ${interface_file} COMPONENT qtd DESTINATION include/d/${inc_path})
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
600 endforeach(source)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
601 endif(GENERATE_DI_FILES)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
602 endif("${all_req_found}" EQUAL 1)
13
4faee409a98d Disable SINGLE_D_OBJECT option for ldc compiler.
SokoL_SD
parents: 12
diff changeset
603 endforeach(package_big ${packages_big})
4faee409a98d Disable SINGLE_D_OBJECT option for ldc compiler.
SokoL_SD
parents: 12
diff changeset
604 if(GENERATE_DI_FILES)
4faee409a98d Disable SINGLE_D_OBJECT option for ldc compiler.
SokoL_SD
parents: 12
diff changeset
605 add_custom_target(generate_headers ALL DEPENDS ${interfaces_list})
4faee409a98d Disable SINGLE_D_OBJECT option for ldc compiler.
SokoL_SD
parents: 12
diff changeset
606 endif(GENERATE_DI_FILES)
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
607
42
eb3b5bbffc8f CMake: generator is not running multiple times.
SokoL_SD
parents: 39
diff changeset
608 add_subdirectory(generator)
27
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
609 ## Dependences.
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
610 foreach(package ${packages})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
611 add_dependencies(cpp_${package} dgen)
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
612 endforeach(package ${packages})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
613 add_sources_for_generating(${files_for_gen})
a9626891eca6 CMake: generator will work only for needed packages.
SokoL_SD
parents: 24
diff changeset
614
60
fbf7881c8b0f CMake: add missing files
SokoL_SD
parents: 59
diff changeset
615 set(CPACK_COMPONENTS_ALL qtd qtd_tools)
55
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
616
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
617 ##--------------------------------------------
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
618 ## Build other parts of the QtD.
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
619 ##--------------------------------------------
59
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
620 add_custom_target(tools ALL)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
621 if(BUILD_TOOLS)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
622 add_subdirectory(tools)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
623 add_dependencies(tools drcc duic)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
624 endif(BUILD_TOOLS)
17165763b300 CMake: build QtD tools.
SokoL_SD
parents: 55
diff changeset
625
7
b8a79f9fba5a More fixes and cleanups in CMake build script.
SokoL_SD
parents: 5
diff changeset
626 if(BUILD_EXAMPLES)
4
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
627 add_subdirectory(demos)
0a29ce1ae854 CMake build script.
SokoL_SD
parents: 1
diff changeset
628 add_subdirectory(examples)
16
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
629 endif(BUILD_EXAMPLES)
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
630
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
631 ##--------------------------------------------
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
632 ## CPack.
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
633 ##--------------------------------------------
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
634 set(CPACK_PACKAGE_VERSION_PATCH 1)
55
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
635 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "QtD is a D binding to the Qt application and UI framework.
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
636 QtD is a D binding to the Qt application and UI framework.
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
637 This package installs binding and static library for qt port on D programming language.
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
638 ")
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
639 #SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
63c31e221118 CMake: Add forgotten files to install.
SokoL_SD
parents: 51
diff changeset
640 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt")
16
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
641 set(CPACK_PACKAGE_VENDOR "QtD team")
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
642 set(CPACK_PACKAGE_CONTACT "e@mail.ru" )
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
643 SET(CPACK_PACKAGE_VERSION "0.1")
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
644 #set(CPACK_PACKAGE_VERSION_PATCH "${RFS_VERSION_BUILD}")
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
645 set(CPACK_PACKAGE_INSTALL_DIRECTORY "qtd ${CPACK_PACKAGE_VERSION}")
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
646 set(CPACK_PACKAGE_FILE_NAME "qtd-${CPACK_PACKAGE_VERSION}")
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
647 set(CPACK_SOURCE_PACKAGE_FILE_NAME "qtd-${CPACK_PACKAGE_VERSION}")
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
648 if(CMAKE_HOST_WIN32)
17
SokoL_SD
parents: 16
diff changeset
649 set(CPACK_GENERATOR "ZIP")
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
650 elseif(CMAKE_HOST_UNIX)
17
SokoL_SD
parents: 16
diff changeset
651 set(CPACK_GENERATOR "TBZ2;DEB;RPM")
89
8a4e85876ea8 CMake: improve of OS detection.
SokoL_SD
parents: 88
diff changeset
652 endif(CMAKE_HOST_WIN32)
16
6faf3d3cb95e CMake: implement install and package targets.
SokoL_SD
parents: 13
diff changeset
653 include(CPack)