From 950f24eaf3e8f7144dbf632e2d37b09bea24fbf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Wed, 13 Feb 2019 22:53:52 +0100 Subject: [PATCH] Fix build without Python --- src/CutterApplication.cpp | 6 ++++++ src/common/PythonAPI.cpp | 4 ++++ src/common/PythonManager.h | 5 ++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/CutterApplication.cpp b/src/CutterApplication.cpp index 0ec19951..52ed7acd 100644 --- a/src/CutterApplication.cpp +++ b/src/CutterApplication.cpp @@ -96,11 +96,13 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc } } +#ifdef CUTTER_ENABLE_PYTHON // Init python if (cmd_parser.isSet(pythonHomeOption)) { Python()->setPythonHome(cmd_parser.value(pythonHomeOption)); } Python()->initialize(); +#endif bool analLevelSpecified = false; @@ -170,9 +172,13 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc CutterApplication::~CutterApplication() { +#ifdef CUTTER_ENABLE_PYTHON Plugins()->destroyPlugins(); +#endif delete mainWindow; +#ifdef CUTTER_ENABLE_PYTHON Python()->shutdown(); +#endif } bool CutterApplication::event(QEvent *e) diff --git a/src/common/PythonAPI.cpp b/src/common/PythonAPI.cpp index 848d4cb2..2b1e9bc7 100644 --- a/src/common/PythonAPI.cpp +++ b/src/common/PythonAPI.cpp @@ -1,4 +1,6 @@ +#ifdef CUTTER_ENABLE_PYTHON + #include "PythonAPI.h" #include "Cutter.h" @@ -195,3 +197,5 @@ PyObject *PyInit_api_internal() } #endif // CUTTER_ENABLE_JUPYTER + +#endif // CUTTER_ENABLE_PYTHON \ No newline at end of file diff --git a/src/common/PythonManager.h b/src/common/PythonManager.h index dc94805a..b00a9b30 100644 --- a/src/common/PythonManager.h +++ b/src/common/PythonManager.h @@ -1,9 +1,10 @@ #ifndef PYTHONMANAGER_H #define PYTHONMANAGER_H +#ifdef CUTTER_ENABLE_PYTHON + #include -class CutterPythonPlugin; typedef struct _ts PyThreadState; typedef struct _object PyObject; @@ -52,4 +53,6 @@ private: #define Python() (PythonManager::getInstance()) +#endif // CUTTER_ENABLE_PYTHON + #endif // PYTHONMANAGER_H