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