~kalikiana/ubuntu-sdk-ide/lxdfixes

1 by Zoltán Balogh
Initial import
1
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
2
    message( FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt." )
3
endif()
4
2 by Zoltán Balogh
clean up
5
project(ubuntu-sdk-ide C CXX)
1 by Zoltán Balogh
Initial import
6
7
include(ExternalProject)
4 by Zoltán Balogh
Improvements from zbenjamin
8
include(ProcessorCount)
9
68.1.1 by Benjamin Zeller
- Automatically create Kits on creation
10
function(ConcatStrings targetVar )
11
  set(loc_val ${${targetVar}})
12
  foreach(curr_substr ${ARGN})
13
      set(loc_val "${loc_val}${curr_substr}")
14
  endforeach()
15
  set(${targetVar} ${loc_val} PARENT_SCOPE)
16
endfunction()
17
4 by Zoltán Balogh
Improvements from zbenjamin
18
ProcessorCount(JOBS)
19
if(NOT JOBS EQUAL 0)
20
  set(GENERATED_MAKE_FLAGS -j${JOBS})
21
endif()
22
1 by Zoltán Balogh
Initial import
23
cmake_minimum_required(VERSION 2.8.9)
24
set (ubuntu_sdk_VERSION_MAJOR 3)
25
set (ubuntu_sdk_VERSION_MINOR 5)
26
160 by Benjamin Zeller
Upgrade to Qt 5.6.1 and force debug symbols on release
27
set (QT_VERSION      "qt-5.6.1")
132 by Benjamin Zeller
Big source package containing all our dependencies
28
set (EXT_SOURCE_DIR  "${CMAKE_SOURCE_DIR}/dist")
160 by Benjamin Zeller
Upgrade to Qt 5.6.1 and force debug symbols on release
29
set (QT_SOURCE_DIR   "${EXT_SOURCE_DIR}/qt5")
58.1.1 by Benjamin Zeller
Start on refactoring the build script
30
set (QT_BUILD_DIR    "${CMAKE_BINARY_DIR}/qt-build/build")
31
set (QT_INSTALL_DIR  "${CMAKE_BINARY_DIR}/qt")
1 by Zoltán Balogh
Initial import
32
145 by Benjamin Zeller
Prepare for QtC 4.1
33
add_custom_target(RevertPatches
146 by Benjamin Zeller
New QtC 4.1 based IDE with LXD backend
34
                  env QUILT_PATCHES=debian/patches quilt pop -a
145 by Benjamin Zeller
Prepare for QtC 4.1
35
                  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
36
132 by Benjamin Zeller
Big source package containing all our dependencies
37
add_custom_target(QtSource
160 by Benjamin Zeller
Upgrade to Qt 5.6.1 and force debug symbols on release
38
                  ${CMAKE_SOURCE_DIR}/get_git_source.py -k -d "${QT_SOURCE_DIR}" -b "5.6.1" "http://code.qt.io/qt/qt5.git"
39
                  COMMAND cd ${QT_SOURCE_DIR} && ./init-repository && cd ${CMAKE_SOURCE_DIR}
132 by Benjamin Zeller
Big source package containing all our dependencies
40
                  COMMAND ${CMAKE_SOURCE_DIR}/get_package_source.py -c ${QT_SOURCE_DIR} qtfeedback-opensource-src:qtfeedback qtpim-opensource-src:qtpim
148 by Benjamin Zeller
Switch to ui-toolkit staging
41
                  COMMAND ${CMAKE_SOURCE_DIR}/get_bzr_source.py -d ${QT_SOURCE_DIR}/ubuntu-sdk lp:ubuntu-ui-toolkit/staging
132 by Benjamin Zeller
Big source package containing all our dependencies
42
                  COMMAND cat ${CMAKE_SOURCE_DIR}/patches/qt-enable-uitk.patch >> ${QT_SOURCE_DIR}/.gitmodules
135 by Benjamin Zeller
save git files that are required for building
43
                  COMMAND ${CMAKE_SOURCE_DIR}/fix-qt-build.py -b \"${QT_SOURCE_DIR}\"
132 by Benjamin Zeller
Big source package containing all our dependencies
44
                  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
45
46
add_custom_target(LibDusSource
47
                  ${CMAKE_SOURCE_DIR}/get_bzr_source.py -d "${EXT_SOURCE_DIR}/libdbusmenu-qt" lp:libdbusmenu-qt
48
                  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
49
50
add_custom_target(MaliitSource
51
                  ${CMAKE_SOURCE_DIR}/get_package_source.py maliit-framework
52
                  WORKING_DIRECTORY ${EXT_SOURCE_DIR})
53
54
add_custom_target(fcitx-qtSource
55
                  ${CMAKE_SOURCE_DIR}/get_bzr_source.py -d "${EXT_SOURCE_DIR}/fcitx-qt" lp:ubuntu/wily-proposed/fcitx-qt5
56
                  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
57
58
add_custom_target(AppmenuSource
59
                  ${CMAKE_SOURCE_DIR}/get_bzr_source.py -d "${EXT_SOURCE_DIR}/appmenu-qt5"  lp:appmenu-qt5
60
                  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
61
62
add_custom_target(QtCreatorSource
147 by Benjamin Zeller
- Change packaging to conflict and remove ubuntu-sdk-device
63
                  ${CMAKE_SOURCE_DIR}/get_git_source.py -d "${EXT_SOURCE_DIR}/qtcreator" -b "v4.1.0" "http://code.qt.io/qt-creator/qt-creator.git"
146 by Benjamin Zeller
New QtC 4.1 based IDE with LXD backend
64
                  COMMAND ${CMAKE_SOURCE_DIR}/get_bzr_source.py -d "${EXT_SOURCE_DIR}/qtcreator/src/plugins/ubuntu" lp:qtcreator-plugin-ubuntu
132 by Benjamin Zeller
Big source package containing all our dependencies
65
                  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
66
67
add_custom_target(sources DEPENDS QtSource LibDusSource MaliitSource fcitx-qtSource AppmenuSource QtCreatorSource)
68
145 by Benjamin Zeller
Prepare for QtC 4.1
69
add_custom_command(TARGET sources
70
                   PRE_BUILD
71
                   COMMAND "REVERTING ALL PATCHES"
72
                   COMMAND quilt pop -a
73
                   WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
74
135 by Benjamin Zeller
save git files that are required for building
75
IF(CMAKE_BUILD_TYPE MATCHES DEBUG)
76
    message("debug mode enabled")
77
    set(QT_ADDITIONAL_CONF "-debug")
78
    set(QMAKE_ADDITIONAL_CONF "CONFIG+=DEBUG")
79
    set(CMAKE_ADDITIONAL_CONF "-DCMAKE_BUILD_TYPE=Debug")
80
    set(CMAKE_BUILD_TYPE_STRING "Debug")
81
ELSE(CMAKE_BUILD_TYPE MATCHES DEBUG)
82
    set(CMAKE_BUILD_TYPE_STRING "RelWithDebInfo")
160 by Benjamin Zeller
Upgrade to Qt 5.6.1 and force debug symbols on release
83
    set(QT_ADDITIONAL_CONF "-force-debug-info")
84
    set(QMAKE_ADDITIONAL_CONF "CONFIG+=force_debug_info")
85
    set(CMAKE_ADDITIONAL_CONF "-DCMAKE_BUILD_TYPE=RelWithDebInfo")
135 by Benjamin Zeller
save git files that are required for building
86
ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG)
87
145 by Benjamin Zeller
Prepare for QtC 4.1
88
add_custom_target(ApplyPatches
146 by Benjamin Zeller
New QtC 4.1 based IDE with LXD backend
89
                  env QUILT_PATCHES=debian/patches quilt push -a
145 by Benjamin Zeller
Prepare for QtC 4.1
90
                  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
91
58.1.1 by Benjamin Zeller
Start on refactoring the build script
92
ExternalProject_Add(${QT_VERSION}
93
  PREFIX      "qt-build"
94
  SOURCE_DIR  "${QT_SOURCE_DIR}"
95
  BINARY_DIR  "${QT_BUILD_DIR}"
96
  INSTALL_DIR "${QT_INSTALL_DIR}"
132 by Benjamin Zeller
Big source package containing all our dependencies
97
  DOWNLOAD_COMMAND  sh -c "exit 0"
135 by Benjamin Zeller
save git files that are required for building
98
  CONFIGURE_COMMAND sh -c "${CMAKE_SOURCE_DIR}/fix-qt-build.py -f \"${QT_SOURCE_DIR}\" && ${QT_SOURCE_DIR}/configure -prefix ${QT_INSTALL_DIR} ${QT_ADDITIONAL_CONF} `cat ${CMAKE_SOURCE_DIR}/qt5config`"
58.1.1 by Benjamin Zeller
Start on refactoring the build script
99
  BUILD_COMMAND     sh -c "make ${GENERATED_MAKE_FLAGS}"
100
  INSTALL_COMMAND   sh -c "make install"
145 by Benjamin Zeller
Prepare for QtC 4.1
101
  DEPENDS     ApplyPatches
33 by Zoltán Balogh
Silly test version fixed
102
)
30 by Zoltán Balogh
appmenu-qt libdbusmenu-qt
103
58.1.1 by Benjamin Zeller
Start on refactoring the build script
104
SET (DBUSMENU_PREFIX "${CMAKE_BINARY_DIR}/libdbusmenu-qt-build")
68.1.1 by Benjamin Zeller
- Automatically create Kits on creation
105
ConcatStrings (DBUSMENU_BUILD_SCRIPT
106
  "${CMAKE_COMMAND} "
107
  "-DCMAKE_INSTALL_PREFIX=${QT_INSTALL_DIR} "
108
  "-DCMAKE_PREFIX_PATH=${QT_INSTALL_DIR} "
109
  "-DUSE_QT5=true "
135 by Benjamin Zeller
save git files that are required for building
110
  "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE_STRING} "
132 by Benjamin Zeller
Big source package containing all our dependencies
111
  "-DCMAKE_INSTALL_LIBDIR=lib ${EXT_SOURCE_DIR}/libdbusmenu-qt "
58.1.2 by Benjamin Zeller
Build the rest
112
)
61.1.2 by Benjamin Zeller
- Add qmake extras
113
30 by Zoltán Balogh
appmenu-qt libdbusmenu-qt
114
ExternalProject_Add(libdbusmenu-qt
58.1.1 by Benjamin Zeller
Start on refactoring the build script
115
  DEPENDS ${QT_VERSION}
116
  PREFIX      "${DBUSMENU_PREFIX}"
132 by Benjamin Zeller
Big source package containing all our dependencies
117
  SOURCE_DIR  "${EXT_SOURCE_DIR}/libdbusmenu-qt"
58.1.1 by Benjamin Zeller
Start on refactoring the build script
118
  BINARY_DIR  "${DBUSMENU_PREFIX}/build"
119
  INSTALL_DIR "${QT_INSTALL_DIR}"
132 by Benjamin Zeller
Big source package containing all our dependencies
120
  DOWNLOAD_COMMAND  sh -c "exit 0"
58.1.2 by Benjamin Zeller
Build the rest
121
  CONFIGURE_COMMAND sh -c "${DBUSMENU_BUILD_SCRIPT}"
58.1.1 by Benjamin Zeller
Start on refactoring the build script
122
  BUILD_COMMAND     sh -c "LD_LIBRARY_PATH=${QT_INSTALL_DIR}/lib make  ${GENERATED_MAKE_FLAGS}"
123
  INSTALL_COMMAND   sh -c "LD_LIBRARY_PATH=${QT_INSTALL_DIR}/lib make install"
30 by Zoltán Balogh
appmenu-qt libdbusmenu-qt
124
)
125
113.1.2 by Benjamin Zeller
-Build maliit plugin for the touch SDK IDE
126
SET (MALIITPLUGIN_PREFIX "${CMAKE_BINARY_DIR}/maliit-plugin-qt-build")
127
ExternalProject_Add(maliit-plugin
128
  DEPENDS     ${QT_VERSION}
129
  PREFIX      "${MALIITPLUGIN_PREFIX}"
132 by Benjamin Zeller
Big source package containing all our dependencies
130
  SOURCE_DIR  "${EXT_SOURCE_DIR}/maliit-framework"
113.1.2 by Benjamin Zeller
-Build maliit plugin for the touch SDK IDE
131
  BINARY_DIR  "${MALIITPLUGIN_PREFIX}/maliit-framework"
132
  INSTALL_DIR "${QT_INSTALL_DIR}"
132 by Benjamin Zeller
Big source package containing all our dependencies
133
  DOWNLOAD_COMMAND  sh -c "exit 0"
135 by Benjamin Zeller
save git files that are required for building
134
  CONFIGURE_COMMAND sh -c "LD_LIBRARY_PATH=${QT_INSTALL_DIR}/lib ${QT_INSTALL_DIR}/bin/qmake -r CONFIG+=\"qt5-inputcontext glib nodoc notests warn_off\" ${QMAKE_ADDITIONAL_CONF}  M_IM_PREFIX=${QT_INSTALL_DIR} MALIIT_SERVER_ARGUMENTS=\"-software -bypass-wm-hint\" MALIIT_DEFAULT_PLUGIN=libmaliit-keyboard-plugin.so ${EXT_SOURCE_DIR}/maliit-framework"
113.1.2 by Benjamin Zeller
-Build maliit plugin for the touch SDK IDE
135
  BUILD_COMMAND     sh -c "LD_LIBRARY_PATH=${QT_INSTALL_DIR}/lib make  ${GENERATED_MAKE_FLAGS}"
113.1.3 by Benjamin Zeller
- Use the makefile to install the plugin
136
  INSTALL_COMMAND   sh -c "cd ${MALIITPLUGIN_PREFIX}/maliit-framework/input-context && make install"
113.1.2 by Benjamin Zeller
-Build maliit plugin for the touch SDK IDE
137
)
138
113.1.1 by Benjamin Zeller
Add fcitx-qt5 platforminputcontext plugin
139
SET (FCITX_PREFIX "${CMAKE_BINARY_DIR}/fcitx-qt-build")
140
ConcatStrings (FCITX_BUILD_SCRIPT
141
  "${CMAKE_COMMAND} "
142
  "-DCMAKE_INSTALL_PREFIX=${QT_INSTALL_DIR} "
143
  "-DCMAKE_PREFIX_PATH=${QT_INSTALL_DIR} "
144
  "-DUSE_QT5=true "
135 by Benjamin Zeller
save git files that are required for building
145
  "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE_STRING} "
132 by Benjamin Zeller
Big source package containing all our dependencies
146
  "-DCMAKE_INSTALL_LIBDIR=lib ${EXT_SOURCE_DIR}/fcitx-qt"
113.1.1 by Benjamin Zeller
Add fcitx-qt5 platforminputcontext plugin
147
)
148
ExternalProject_Add(fcitx-qt5
149
  DEPENDS ${QT_VERSION}
150
  PREFIX      "${FCITX_PREFIX}"
132 by Benjamin Zeller
Big source package containing all our dependencies
151
  SOURCE_DIR  "${EXT_SOURCE_DIR}/fcitx-qt"
113.1.1 by Benjamin Zeller
Add fcitx-qt5 platforminputcontext plugin
152
  BINARY_DIR  "${FCITX_PREFIX}/build"
153
  INSTALL_DIR "${QT_INSTALL_DIR}"
132 by Benjamin Zeller
Big source package containing all our dependencies
154
  DOWNLOAD_COMMAND  sh -c "exit 0"
113.1.1 by Benjamin Zeller
Add fcitx-qt5 platforminputcontext plugin
155
  CONFIGURE_COMMAND sh -c "${FCITX_BUILD_SCRIPT}"
156
  BUILD_COMMAND     sh -c "LD_LIBRARY_PATH=${QT_INSTALL_DIR}/lib VERBOSE=1 make ${GENERATED_MAKE_FLAGS}"
157
  INSTALL_COMMAND   sh -c "LD_LIBRARY_PATH=${QT_INSTALL_DIR}/lib VERBOSE=1 make install"
158
)
159
58.1.1 by Benjamin Zeller
Start on refactoring the build script
160
SET (APPMENU_PREFIX "${CMAKE_BINARY_DIR}/appmenu-qt5-build")
30 by Zoltán Balogh
appmenu-qt libdbusmenu-qt
161
ExternalProject_Add(appmenu-qt5
162
  DEPENDS libdbusmenu-qt
58.1.1 by Benjamin Zeller
Start on refactoring the build script
163
  PREFIX      "${APPMENU_PREFIX}"
132 by Benjamin Zeller
Big source package containing all our dependencies
164
  SOURCE_DIR  "${EXT_SOURCE_DIR}/appmenu-qt5"
58.1.1 by Benjamin Zeller
Start on refactoring the build script
165
  BINARY_DIR  "${APPMENU_PREFIX}/build"
166
  INSTALL_DIR "${QT_INSTALL_DIR}"
132 by Benjamin Zeller
Big source package containing all our dependencies
167
  DOWNLOAD_COMMAND  sh -c "exit 0"
135 by Benjamin Zeller
save git files that are required for building
168
  CONFIGURE_COMMAND sh -c "PKG_CONFIG_PATH=${QT_INSTALL_DIR}/lib/pkgconfig ${QT_INSTALL_DIR}/bin/qmake -r ${QMAKE_ADDITIONAL_CONF} ${EXT_SOURCE_DIR}/appmenu-qt5"
58.1.2 by Benjamin Zeller
Build the rest
169
  BUILD_COMMAND     sh -c "LD_LIBRARY_PATH=${QT_INSTALL_DIR}/lib make  ${GENERATED_MAKE_FLAGS}"
170
  INSTALL_COMMAND   sh -c "LD_LIBRARY_PATH=${QT_INSTALL_DIR}/lib make install"
171
)
172
173
SET (QTCREATOR_PREFIX "${CMAKE_BINARY_DIR}/qtcreator-build")
7 by Zoltán Balogh
next
174
ExternalProject_Add(qtcreator_3.5.0
113.1.2 by Benjamin Zeller
-Build maliit plugin for the touch SDK IDE
175
  DEPENDS appmenu-qt5 fcitx-qt5 maliit-plugin
58.1.2 by Benjamin Zeller
Build the rest
176
  PREFIX      "${QTCREATOR_PREFIX}"
132 by Benjamin Zeller
Big source package containing all our dependencies
177
  SOURCE_DIR  "${EXT_SOURCE_DIR}/qtcreator"
58.1.2 by Benjamin Zeller
Build the rest
178
  BINARY_DIR  "${QTCREATOR_PREFIX}/build"
179
  INSTALL_DIR "${CMAKE_BINARY_DIR}/ubuntu-sdk-ide"
132 by Benjamin Zeller
Big source package containing all our dependencies
180
  DOWNLOAD_COMMAND  sh -c "exit 0"
145 by Benjamin Zeller
Prepare for QtC 4.1
181
  CONFIGURE_COMMAND sh -c "${QT_INSTALL_DIR}/bin/qmake -r USE_SYSTEM_BOTAN=1 CONFIG+=debug ${QMAKE_ADDITIONAL_CONF} ${EXT_SOURCE_DIR}/qtcreator"
58.1.2 by Benjamin Zeller
Build the rest
182
  BUILD_COMMAND     sh -c "QT_PRIVATE_HEADERS=${QT_INSTALL_DIR} LD_LIBRARY_PATH=${QT_INSTALL_DIR}/lib make ${GENERATED_MAKE_FLAGS}"
183
  INSTALL_COMMAND   sh -c "QT_PRIVATE_HEADERS=${QT_INSTALL_DIR} LD_LIBRARY_PATH=${QT_INSTALL_DIR}/lib make INSTALL_ROOT=${CMAKE_BINARY_DIR}/ubuntu-sdk-ide -j1 docs deployqt"
7 by Zoltán Balogh
next
184
)
52.1.1 by Benjamin Zeller
Add GoLang and Autopilot plugins
185
132 by Benjamin Zeller
Big source package containing all our dependencies
186
#set(QTC_BUILD  "${CMAKE_BINARY_DIR}/ubuntu-sdk-ide")
187
#set(QTC_SOURCE "${QTCREATOR_PREFIX}/qtcreator")
188
189
#SET (QTCREATOR_GO_PREFIX "${CMAKE_BINARY_DIR}/qtcreator-plugin-go-build")
190
#ExternalProject_Add(qtcreator_plugin_go
191
#  DEPENDS qtcreator_3.5.0
192
#  PREFIX      "${QTCREATOR_GO_PREFIX}"
193
#  SOURCE_DIR  "${QTCREATOR_GO_PREFIX}/qtcreator-plugin-go"
194
#  BINARY_DIR  "${QTCREATOR_GO_PREFIX}/build"
195
#  INSTALL_DIR "${QTCREATOR_GO_PREFIX}/ubuntu-sdk-ide"
196
#  DOWNLOAD_COMMAND  sh -c "bzr branch lp:qtcreator-plugin-go ${QTCREATOR_GO_PREFIX}/qtcreator-plugin-go -Ossl.cert_reqs=none --use-existing-dir"
197
#  CONFIGURE_COMMAND sh -c "env QTC_BUILD=\"${QTC_BUILD}\" QTC_SOURCE=\"${QTC_SOURCE}\" ${QT_INSTALL_DIR}/bin/qmake -r ${QTCREATOR_GO_PREFIX}/qtcreator-plugin-go"
198
#  BUILD_COMMAND     sh -c "env QTC_BUILD=\"${QTC_BUILD}\" QTC_SOURCE=\"${QTC_SOURCE}\" QT_PRIVATE_HEADERS=${QT_INSTALL_DIR} LD_LIBRARY_PATH=${QT_INSTALL_DIR}/lib make ${GENERATED_MAKE_FLAGS}"
199
#  #there is no install step required, the plugin is built directly into the installed plugins dir
200
#  INSTALL_COMMAND   sh -c "exit 0"
201
#)
202
203
# Disable the AP plugin for now
204
#
205
#SET (QTCREATOR_AP_PREFIX "${CMAKE_BINARY_DIR}/qtcreator-plugin-autopilot-build")
206
#ExternalProject_Add(qtcreator_plugin_autopilot
207
#  DEPENDS qtcreator_3.5.0
208
#  PREFIX      "${QTCREATOR_AP_PREFIX}"
209
#  SOURCE_DIR  "${QTCREATOR_AP_PREFIX}/qtcreator-plugin-autopilot"
210
#  BINARY_DIR  "${QTCREATOR_AP_PREFIX}/build"
211
#  INSTALL_DIR "${QTCREATOR_AP_PREFIX}/ubuntu-sdk-ide"
212
#  DOWNLOAD_COMMAND  sh -c "bzr branch lp:qtcreator-plugin-autopilot ${QTCREATOR_AP_PREFIX}/qtcreator-plugin-autopilot  -Ossl.cert_reqs=none --use-existing-dir"
213
#  CONFIGURE_COMMAND sh -c "env QTC_BUILD=\"${QTC_BUILD}\" QTC_SOURCE=\"${QTC_SOURCE}\" ${QT_INSTALL_DIR}/bin/qmake -r ${QTCREATOR_AP_PREFIX}/qtcreator-plugin-autopilot"
214
#  BUILD_COMMAND     sh -c "env QTC_BUILD=\"${QTC_BUILD}\" QTC_SOURCE=\"${QTC_SOURCE}\" QT_PRIVATE_HEADERS=${QT_INSTALL_DIR}  LD_LIBRARY_PATH=${QT_INSTALL_DIR}/lib make ${GENERATED_MAKE_FLAGS}"
215
#  #there is no install step required, the plugin is built directly into the installed plugins dir
216
#  INSTALL_COMMAND   sh -c "exit 0"
217
#)