From e0e1dbc6380ed3900a625b20991bb886e95822ee Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 13 Mar 2015 09:26:40 +0530 Subject: [PATCH] Fix building with Qt 5.3.x --- setup/extensions.py | 8 ++++++-- src/calibre/headless/headless_integration.cpp | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/setup/extensions.py b/setup/extensions.py index b4f9daef39..1b0e50d495 100644 --- a/setup/extensions.py +++ b/setup/extensions.py @@ -492,17 +492,21 @@ class Build(Command): def build_headless(self): if iswindows or isosx: return # Dont have headless operation on these platforms + from PyQt5.QtCore import QT_VERSION self.info('\n####### Building headless QPA plugin', '#'*7) a = Extension.absolutize headers = a([ 'calibre/headless/headless_backingstore.h', 'calibre/headless/headless_integration.h', - 'calibre/headless/fontconfig_database.h']) + ]) sources = a([ 'calibre/headless/main.cpp', 'calibre/headless/headless_backingstore.cpp', 'calibre/headless/headless_integration.cpp', - 'calibre/headless/fontconfig_database.cpp']) + ]) + if QT_VERSION >= 0x50401: + headers.extend(a(['calibre/headless/fontconfig_database.h'])) + sources.extend(a(['calibre/headless/fontconfig_database.cpp'])) others = a(['calibre/headless/headless.json']) target = self.dest('headless') if not self.newer(target, headers + sources + others): diff --git a/src/calibre/headless/headless_integration.cpp b/src/calibre/headless/headless_integration.cpp index c8247c2f1c..a89917463a 100644 --- a/src/calibre/headless/headless_integration.cpp +++ b/src/calibre/headless/headless_integration.cpp @@ -1,6 +1,11 @@ +#include #include "headless_integration.h" #include "headless_backingstore.h" +#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 1)) #include "fontconfig_database.h" +#else +#include +#endif #ifndef Q_OS_WIN #include #else