1 | | project(pykde4) |
2 | | |
3 | | cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR) |
4 | | |
5 | | # search packages used by KDE |
6 | | find_package(KDE4 4.9.4 REQUIRED) |
7 | | |
8 | | # Match what's used in the main macros |
9 | | cmake_policy(SET CMP0002 OLD) |
10 | | find_package(PythonLibrary) |
11 | | |
12 | | include(KDE4Defaults) |
13 | | include(MacroLibrary) |
14 | | include(PythonMacros) |
15 | | include(FeatureSummary) |
16 | | find_package(PkgConfig REQUIRED) |
17 | | # this doesn't work ... |
18 | | pkg_check_modules(PYTHON xpython${_CURRENT_VERSION}) |
19 | | |
20 | | option(PYKDEUIC4_ALTINSTALL "Enable parallel-installation of the PyKDE4 tools" FALSE) |
21 | | |
22 | | set(CMAKE_MODULE_PATH ${pykde4_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) |
23 | | |
24 | | find_package(PythonLibrary) |
25 | | |
26 | | set_package_properties(KDE4 PROPERTIES DESCRIPTION "The KDE libraries" |
27 | | URL "http://www.kde.org" TYPE REQUIRED |
28 | | PURPOSE "Required to build PyKDE4") |
29 | | set_package_properties(PythonLibrary PROPERTIES DESCRIPTION |
30 | | "The Python Library" URL "http://www.python.org" |
31 | | TYPE REQUIRED PURPOSE "Required to build PyKDE4") |
32 | | set_package_properties(PythonInterp PROPERTIES |
33 | | DESCRIPTION "The Python interpreter" |
34 | | URL "http://www.python.org" TYPE REQUIRED |
35 | | PURPOSE "Required to build PyKDE4") |
36 | | |
37 | | include_directories(${KDE4_INCLUDES}) |
38 | | |
39 | | add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} -DQT3_SUPPORT) |
40 | | |
41 | | find_package(SIP) |
42 | | set_package_properties(SIP PROPERTIES DESCRIPTION "The SIP binding generator" |
43 | | URL "http://riverbankcomputing.com" TYPE REQUIRED |
44 | | PURPOSE "Required to build PyKDE4") |
45 | | |
46 | | include(SIPMacros) |
47 | | |
48 | | if(SIP_VERSION STRLESS "040e00") # These version numbers also appear in ../CMakeLists.txt |
49 | | message(FATAL_ERROR "The version of SIP found is too old. 4.14 or later is needed.") |
50 | | endif() |
51 | | |
52 | | find_package(PyQt4) |
53 | | set_package_properties(PyQt4 PROPERTIES DESCRIPTION "The PyQt bindings" |
54 | | URL "http://riverbankcomputing.com" TYPE REQUIRED |
55 | | PURPOSE "Required to build PyKDE4") |
56 | | |
57 | | if(PYQT4_VERSION STRLESS "040905") # These version numbers also appear in ../CMakeLists.txt |
58 | | message(FATAL_ERROR "The version of PyQt found is too old. 4.9 or later is required.") |
59 | | endif() |
60 | | |
61 | | macro_optional_find_package(Soprano) |
62 | | set_package_properties(Soprano PROPERTIES DESCRIPTION "The Soprano libraries" |
63 | | URL "http://projects.kde.org/kdesupport/soprano" |
64 | | TYPE OPTIONAL PURPOSE |
65 | | "Required for Soprano Python bindings") |
66 | | |
67 | | macro_optional_find_package(Nepomuk) |
68 | | set_package_properties(Nepomuk PROPERTIES DESCRIPTION "The Nepomuk libraries" |
69 | | URL "http://projects.kde.org/kde/kdelibs/" TYPE OPTIONAL |
70 | | PURPOSE "Required for Nepomuk Python bindings") |
71 | | |
72 | | macro_optional_find_package(KdepimLibs) |
73 | | set_package_properties(KdepimLibs PROPERTIES DESCRIPTION "The KDE PIM libraries" |
74 | | URL "http://projects.kde.org/kde/kdepimlibs" TYPE OPTIONAL |
75 | | PURPOSE "Required for the Akonadi Python bindings") |
76 | | |
77 | | macro_optional_find_package(PolkitQt) |
78 | | set_package_properties(PolkitQt PROPERTIES DESCRIPTION "Qt wrapper around Polkit" |
79 | | TYPE OPTIONAL PURPOSE |
80 | | "Required to build Python Polkit bindings") |
81 | | |
82 | | include_directories( |
83 | | ${PYTHON_INCLUDE_PATH} |
84 | | ${SIP_INCLUDE_DIR} |
85 | | ${QT_INCLUDE_DIR} |
86 | | ${QT_QT_INCLUDE_DIR} |
87 | | ${QT_QTCORE_INCLUDE_DIR} |
88 | | ${QT_QTDESIGNER_INCLUDE_DIR} |
89 | | ${QT_QTGUI_INCLUDE_DIR} |
90 | | ${QT_QTNETWORK_INCLUDE_DIR} |
91 | | ${QT_QTOPENGL_INCLUDE_DIR} |
92 | | ${QT_QTSQL_INCLUDE_DIR} |
93 | | ${QT_QTXML_INCLUDE_DIR} |
94 | | ${QT_QTSVG_INCLUDE_DIR} |
95 | | ${QT_QTWEBKIT_INCLUDE_DIR} |
96 | | ${KDE4_INCLUDE_DIR} |
97 | | ${KDE4_INCLUDE_DIR}/solid |
98 | | ${KDE4_INCLUDE_DIR}/kio |
99 | | ${KDE4_INCLUDE_DIR}/dom |
100 | | ${KDE4_INCLUDE_DIR}/ksettings |
101 | | ${KDE4_INCLUDE_DIR}/knewstuff2 |
102 | | ${KDE4_INCLUDE_DIR}/dnssd |
103 | | ${KDE4_PHONON_INCLUDES} |
104 | | ${KDEPIMLIBS_INCLUDE_DIRS} |
105 | | ) |
106 | | |
107 | | # Pull in ARM configuration options if needed |
108 | | STRING(REGEX MATCH "PyQt_qreal_double" SIP_ARM_HACK ${PYQT4_SIP_FLAGS} "") |
109 | | |
110 | | set(SIP_INCLUDES ${CMAKE_BINARY_DIR} ${PYQT4_SIP_DIR} sip) |
111 | | set(SIP_CONCAT_PARTS 8) |
112 | | if (WIN32) |
113 | | set(SIP_TAGS ALL WS_WIN ${PYQT4_VERSION_TAG}) |
114 | | else () |
115 | | set(SIP_TAGS ALL WS_X11 ${PYQT4_VERSION_TAG}) |
116 | | endif () |
117 | | set(SIP_DISABLE_FEATURES VendorID PyQt_NoPrintRangeBug ${SIP_ARM_HACK}) |
118 | | |
119 | | set(SIP_FILES_INSTALL_DIR ${SHARE_INSTALL_PREFIX}/sip) |
120 | | |
121 | | # Use an extra option when compiling on Python 3. |
122 | | if (PYTHON_VERSION_MAJOR GREATER 2) |
123 | | if(PYQT4_VERSION STRGREATER "040904") |
124 | | # Disable for features in newer Qt |
125 | | if (PYQT4_VERSION STRGREATER "040a04") |
126 | | # GLuint + QVector (PyQt > 4.11) |
127 | | set(SIP_EXTRA_OPTIONS -P -g -x PyKDE_QVector -x PyKDE_GLuint) |
128 | | else () |
129 | | # QVector (PyQt < 4.11) |
130 | | set(SIP_EXTRA_OPTIONS -P -g -x PyKDE_QVector) |
131 | | endif () |
132 | | else () |
133 | | set(SIP_EXTRA_OPTIONS -g) |
134 | | endif() |
135 | | else (PYTHON_VERSION_MAJOR GREATER 2) |
136 | | if(PYQT4_VERSION STRGREATER "040904") |
137 | | # Disable for newer PyQt |
138 | | if (PYQT4_VERSION STRGREATER "040a04") |
139 | | # GLuint + QVector (PyQt > 4.11) |
140 | | set(SIP_EXTRA_OPTIONS -P -g -x PyKDE_QVector -x Py_v3 -x PyKDE_GLuint) |
141 | | else () |
142 | | # QVector (PyQt < 4.11) |
143 | | set(SIP_EXTRA_OPTIONS -P -g -x PyKDE_QVector -x Py_v3) |
144 | | endif () |
145 | | else () |
146 | | set(SIP_EXTRA_OPTIONS -g -x Py_v3) |
147 | | endif() |
148 | | endif () |
149 | | |
150 | | add_definitions(-D_REENTRANT -DQT_CORE_LIB -DQT_GUI_LIB -DUSING_SOPRANO_NRLMODEL_UNSTABLE_API -DSIP_PROTECTED_IS_PUBLIC -Dprotected=public) |
151 | | |
152 | | include(PyKDEConfigurationInformation.cmake) |
153 | | |
154 | | # Only install pykdeconfig.py if PyQt itself has installed pyqtconfig.py, since |
155 | | # its absence indicates PyQt was built with the new build system and |
156 | | # pykdeconfig will not work. |
157 | | execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import PyQt4.pyqtconfig" |
158 | | RESULT_VARIABLE _exit_code OUTPUT_QUIET ERROR_QUIET) |
159 | | if (NOT _exit_code) |
160 | | python_install(${CMAKE_CURRENT_BINARY_DIR}/pykdeconfig.py ${PYTHON_SITE_PACKAGES_INSTALL_DIR}/PyKDE4) |
161 | | endif () |
162 | | |
163 | | # Do not use --no-undefined for python modules. |
164 | | STRING(REPLACE -Wl,--no-undefined "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") |
165 | | |
166 | | file(GLOB kdecore_files_sip sip/kdecore/*.sip) |
167 | | set(SIP_EXTRA_FILES_DEPEND ${kdecore_files_sip}) |
168 | | add_sip_python_module(PyKDE4.kdecore sip/kdecore/kdecoremod.sip ${KDE4_KDECORE_LIBS} ${KDE4_KPTY_LIBS} ${QT_QTNETWORK_LIBRARY}) |
169 | | |
170 | | file(GLOB solid_files_sip sip/solid/*.sip) |
171 | | set(SIP_EXTRA_FILES_DEPEND ${solid_files_sip}) |
172 | | add_sip_python_module(PyKDE4.solid sip/solid/solidmod.sip ${KDE4_SOLID_LIBS} ${QT_QTCORE_LIBRARY}) |
173 | | |
174 | | file(GLOB kdeui_files_sip sip/kdeui/*.sip) |
175 | | set(SIP_EXTRA_FILES_DEPEND ${kdeui_files_sip}) |
176 | | add_sip_python_module(PyKDE4.kdeui sip/kdeui/kdeuimod.sip ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY}) |
177 | | |
178 | | file(GLOB kio_files_sip sip/kio/*.sip) |
179 | | set(SIP_EXTRA_FILES_DEPEND ${kio_files_sip}) |
180 | | add_sip_python_module(PyKDE4.kio sip/kio/kiomod.sip ${KDE4_KIO_LIBS} ${KDE4_KFILE_LIBS}) |
181 | | |
182 | | file(GLOB kutils_files_sip sip/kutils/*.sip) |
183 | | set(SIP_EXTRA_FILES_DEPEND ${kutils_files_sip}) |
184 | | add_sip_python_module(PyKDE4.kutils sip/kutils/kutilsmod.sip ${KDE4_KUTILS_LIBS} ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY} ${KDE4_KDEUI_LIBS}) |
185 | | |
186 | | file(GLOB kparts_files_sip sip/kparts/*.sip) |
187 | | set(SIP_EXTRA_FILES_DEPEND ${kparts_files_sip}) |
188 | | add_sip_python_module(PyKDE4.kparts sip/kparts/kpartsmod.sip ${KDE4_KPARTS_LIBS}) |
189 | | |
190 | | file(GLOB ktexteditor_files_sip sip/ktexteditor/*.sip) |
191 | | set(SIP_EXTRA_FILES_DEPEND ${ktexteditor_files_sip}) |
192 | | add_sip_python_module(PyKDE4.ktexteditor sip/ktexteditor/ktexteditormod.sip ${KDE4_KTEXTEDITOR_LIBS} ${KDE4_KPARTS_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}) |
193 | | |
194 | | file(GLOB khtml_files_sip sip/khtml/*.sip) |
195 | | set(SIP_EXTRA_FILES_DEPEND ${khtml_files_sip}) |
196 | | add_sip_python_module(PyKDE4.khtml sip/khtml/khtmlmod.sip ${KDE4_KHTML_LIBS}) |
197 | | |
198 | | file(GLOB knewstuff_files_sip sip/knewstuff/*.sip) |
199 | | set(SIP_EXTRA_FILES_DEPEND ${knewstuff_files_sip}) |
200 | | add_sip_python_module(PyKDE4.knewstuff sip/knewstuff/knewstuffmod.sip ${KDE4_KNEWSTUFF2_LIBS} ${KDE4_KNEWSTUFF3_LIBS} ${QT_QTCORE_LIBRARY}) |
201 | | |
202 | | file(GLOB dnssd_files_sip sip/dnssd/*.sip) |
203 | | set(SIP_EXTRA_FILES_DEPEND ${dnssd_files_sip}) |
204 | | add_sip_python_module(PyKDE4.dnssd sip/dnssd/dnssdmod.sip ${KDE4_KDNSSD_LIBS} ${QT_QTCORE_LIBRARY}) |
205 | | |
206 | | file(GLOB phonon_files_sip sip/phonon/*.sip) |
207 | | set(SIP_EXTRA_FILES_DEPEND ${phonon_files_sip}) |
208 | | add_sip_python_module(PyKDE4.phonon sip/phonon/phononmod.sip ${PHONON_LIBS} ${QT_QTDBUS_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}) |
209 | | |
210 | | file(GLOB plasma_files_sip sip/plasma/*.sip) |
211 | | set(SIP_EXTRA_FILES_DEPEND ${plasma_files_sip}) |
212 | | add_sip_python_module(PyKDE4.plasma sip/plasma/plasmamod.sip ${KDE4_PLASMA_LIBS} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTUITOOLS_LIBRARY} ${KDE4_KIO_LIBRARY} ${KDE4_KDECORE_LIBRARY} ${KDE4_KDEUI_LIBRARY}) |
213 | | |
214 | | file(GLOB kterminal_files_sip sip/kterminal/*.sip) |
215 | | set(SIP_EXTRA_FILES_DEPEND ${kterminal_files_sip}) |
216 | | add_sip_python_module(PyKDE4.kterminal sip/kterminal/kterminalmod.sip ${KDE4_TERMINAL_LIBS} ${KDE4_KPARTS_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}) |
217 | | |
218 | | set(PYKDE_MODULES "kdecore solid kdeui kio kutils kparts ktexteditor dnssd phonon plasma kterminal") |
219 | | |
220 | | if(Soprano_FOUND) |
221 | | include_directories(${SOPRANO_INCLUDE_DIR}) |
222 | | file(GLOB soprano_files_sip sip/soprano/*.sip) |
223 | | set(SIP_EXTRA_FILES_DEPEND ${soprano_files_sip}) |
224 | | add_sip_python_module(PyKDE4.soprano sip/soprano/sopranomod.sip ${SOPRANO_LIBRARIES} ${SOPRANO_CLIENT_LIBRARIES} ${SOPRANO_SERVER_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY}) |
225 | | set(PYKDE_MODULES "${PYKDE_MODULES} soprano") |
226 | | endif() |
227 | | |
228 | | if(Nepomuk_FOUND) |
229 | | include_directories(${NEPOMUK_INCLUDE_DIR}) |
230 | | file(GLOB nepomuk_files_sip sip/nepomuk/*.sip) |
231 | | set(SIP_EXTRA_FILES_DEPEND ${nepomuk_files_sip}) |
232 | | add_sip_python_module(PyKDE4.nepomuk sip/nepomuk/nepomukmod.sip ${NEPOMUK_LIBRARIES} ${NEPOMUK_QUERY_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${SOPRANO_LIBRARIES} ${KDE4_KIO_LIBS}) |
233 | | set(PYKDE_MODULES "${PYKDE_MODULES} nepomuk") |
234 | | endif() |
235 | | |
236 | | if(KdepimLibs_FOUND) |
237 | | find_package(Boost 1.34.0) |
238 | | set_package_properties(Boost PROPERTIES DESCRIPTION "Boost C++ Libraries" |
239 | | URL "http://www.boost.org" TYPE REQUIRED |
240 | | PURPOSE "Boost is required by Akonadi") |
241 | | include_directories(${KDEPIMLIBS_INCLUDE_DIRS}) |
242 | | file(GLOB akonadi_files_sip sip/akonadi/*.sip) |
243 | | set(SIP_EXTRA_FILES_DEPEND ${akonadi_files_sip}) |
244 | | add_sip_python_module(PyKDE4.akonadi sip/akonadi/akonadimod.sip ${KDE4_AKONADI_LIBS} ${KDE4_AKONADI_KMIME_LIBS} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS}) |
245 | | set(PYKDE_MODULES "${PYKDE_MODULES} akonadi") |
246 | | endif() |
247 | | |
248 | | if(POLKITQT_FOUND) |
249 | | include_directories(${POLKITQT_INCLUDE_DIR}) |
250 | | |
251 | | file(GLOB pollkitqt_files_sip sip/polkitqt/*.sip) |
252 | | |
253 | | # ${POLKITQT_INCLUDE_DIR} -- We don't use this directly, because we need the #includes |
254 | | # in the .sip file to be more specific otherwise they pick up the wrong action.h etc. |
255 | | |
256 | | set(SIP_EXTRA_FILES_DEPEND ${pollkitqt_files_sip}) |
257 | | add_sip_python_module(PyKDE4.polkitqt sip/polkitqt/polkitqtmod.sip ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${POLKITQT_LIBRARIES}) |
258 | | set(PYKDE_MODULES "${PYKDE_MODULES} polkitqt") |
259 | | endif() |
260 | | |
261 | | python_install(__init__.py ${PYTHON_SITE_PACKAGES_INSTALL_DIR}/PyKDE4) |
262 | | |
263 | | # Install the .sip files for anyone that wants to build bindings on top of PyKDE4. |
264 | | # (Don't forget the / at the end of sip/.) |
265 | | install(FILES ${CMAKE_BINARY_DIR}/pykde_config.sip DESTINATION ${SIP_FILES_INSTALL_DIR}/PyKDE4/) |
266 | | if(DEFAULT_PYTHON_VERSION) |
267 | | install(DIRECTORY sip/ DESTINATION ${SIP_FILES_INSTALL_DIR}/PyKDE4 |
268 | | PATTERN "*~" EXCLUDE # This sucks, why can't I just whitelist what I _do_ want? |
269 | | PATTERN ".svn" EXCLUDE |
270 | | PATTERN "*.in" EXCLUDE) |
271 | | message("Installing sip files in this build pass") |
272 | | else(DEFAULT_PYTHON_VERSION) |
273 | | message("Not installing sip files in this build pass") |
274 | | endif(DEFAULT_PYTHON_VERSION) |
275 | | |
276 | | add_subdirectory(tools) |
277 | | #add_subdirectory(docs) |
278 | | add_subdirectory(examples) |
279 | | if (PYTHON_VERSION_MAJOR LESS 3 AND DEFAULT_PYTHON_VERSION) |
280 | | add_subdirectory(kpythonpluginfactory) |
281 | | endif (PYTHON_VERSION_MAJOR LESS 3 AND DEFAULT_PYTHON_VERSION) |
282 | | |
283 | | feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) |