diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 456dbed4..6b9f75a0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -64,7 +64,6 @@ set(SOURCES widgets/HeadersWidget.cpp widgets/SearchWidget.cpp CutterApplication.cpp - common/PythonAPI.cpp dialogs/RizinPluginsDialog.cpp widgets/CutterDockWidget.cpp widgets/CutterTreeWidget.cpp @@ -100,7 +99,6 @@ set(SOURCES widgets/CutterTreeView.cpp widgets/ComboQuickFilterView.cpp dialogs/HexdumpRangeDialog.cpp - common/QtResImporter.cpp common/CutterSeekable.cpp common/RefreshDeferrer.cpp dialogs/WelcomeDialog.cpp @@ -108,7 +106,6 @@ set(SOURCES dialogs/EditMethodDialog.cpp dialogs/TypesInteractionDialog.cpp widgets/SdbWidget.cpp - common/PythonManager.cpp plugins/PluginManager.cpp common/BasicBlockHighlighter.cpp common/BasicInstructionHighlighter.cpp @@ -120,7 +117,6 @@ set(SOURCES dialogs/preferences/ColorThemeEditDialog.cpp common/UpdateWorker.cpp widgets/MemoryDockWidget.cpp - common/CrashHandler.cpp common/BugReporting.cpp common/HighDpiPixmap.cpp widgets/GraphGridLayout.cpp @@ -211,7 +207,6 @@ set(HEADER_FILES widgets/TypesWidget.h widgets/HeadersWidget.h widgets/SearchWidget.h - common/PythonAPI.h dialogs/RizinPluginsDialog.h widgets/CutterDockWidget.h widgets/CutterTreeWidget.h @@ -251,7 +246,6 @@ set(HEADER_FILES widgets/CutterTreeView.h widgets/ComboQuickFilterView.h dialogs/HexdumpRangeDialog.h - common/QtResImporter.h common/CutterSeekable.h common/RefreshDeferrer.h dialogs/WelcomeDialog.h @@ -261,7 +255,6 @@ set(HEADER_FILES common/CrashHandler.h dialogs/TypesInteractionDialog.h widgets/SdbWidget.h - common/PythonManager.h plugins/PluginManager.h common/BasicBlockHighlighter.h common/BasicInstructionHighlighter.h @@ -376,6 +369,15 @@ set(QRC_FILES themes/lightstyle/light.qrc ) +if (CUTTER_ENABLE_PYTHON) + list(APPEND SOURCES common/QtResImporter.cpp common/PythonManager.cpp common/PythonAPI.cpp) + list(APPEND HEADER_FILES common/QtResImporter.h common/PythonManager.h common/PythonAPI.h) +endif() + +if(CUTTER_ENABLE_CRASH_REPORTS) + list(APPEND SOURCES common/CrashHandler.cpp) +endif() + if(CUTTER_ENABLE_PYTHON_BINDINGS) set(BINDINGS_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bindings") set(BINDINGS_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/bindings") diff --git a/src/Main.cpp b/src/Main.cpp index a0af5d5c..e47dfc0a 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -54,6 +54,7 @@ static void connectToConsole() int main(int argc, char *argv[]) { +#ifdef CUTTER_ENABLE_CRASH_REPORTS if (argc >= 3 && QString::fromLocal8Bit(argv[1]) == "--start-crash-handler") { QApplication app(argc, argv); QString dumpLocation = QString::fromLocal8Bit(argv[2]); @@ -62,6 +63,7 @@ int main(int argc, char *argv[]) } initCrashHandler(); +#endif #ifdef Q_OS_WIN connectToConsole(); diff --git a/src/common/CrashHandler.cpp b/src/common/CrashHandler.cpp index 251830fe..7e7731d2 100644 --- a/src/common/CrashHandler.cpp +++ b/src/common/CrashHandler.cpp @@ -7,8 +7,6 @@ #include #include -#ifdef CUTTER_ENABLE_CRASH_REPORTS - #include #include #include @@ -106,16 +104,6 @@ void initCrashHandler() atexit(finishCrashHandler); } -#else // CUTTER_ENABLE_CRASH_REPORTS - -void initCrashHandler() -{ - -} - -#endif // CUTTER_ENABLE_CRASH_REPORTS - - void showCrashDialog(const QString &dumpFile) { QMessageBox mb; diff --git a/src/common/PythonAPI.cpp b/src/common/PythonAPI.cpp index cd833f5b..b54fe06f 100644 --- a/src/common/PythonAPI.cpp +++ b/src/common/PythonAPI.cpp @@ -1,6 +1,3 @@ - -#ifdef CUTTER_ENABLE_PYTHON - #include "PythonAPI.h" #include "core/Cutter.h" @@ -83,5 +80,3 @@ PyObject *PyInit_api() { return PyModule_Create(&CutterModule); } - -#endif // CUTTER_ENABLE_PYTHON diff --git a/src/common/PythonAPI.h b/src/common/PythonAPI.h index 76ad843e..3dcb3abd 100644 --- a/src/common/PythonAPI.h +++ b/src/common/PythonAPI.h @@ -1,13 +1,9 @@ #ifndef PYTHONAPI_H #define PYTHONAPI_H -#ifdef CUTTER_ENABLE_PYTHON - #define Py_LIMITED_API 0x03050000 #include PyObject *PyInit_api(); -#endif - #endif // PYTHONAPI_H diff --git a/src/common/PythonManager.cpp b/src/common/PythonManager.cpp index 65d33d87..79564ab6 100644 --- a/src/common/PythonManager.cpp +++ b/src/common/PythonManager.cpp @@ -1,5 +1,3 @@ -#ifdef CUTTER_ENABLE_PYTHON - #include #include "PythonAPI.h" @@ -184,5 +182,3 @@ void PythonManager::saveThread() pyThreadState = PyEval_SaveThread(); } } - -#endif diff --git a/src/common/QtResImporter.cpp b/src/common/QtResImporter.cpp index 6953cd36..425da707 100644 --- a/src/common/QtResImporter.cpp +++ b/src/common/QtResImporter.cpp @@ -1,8 +1,4 @@ -#ifdef CUTTER_ENABLE_PYTHON - -#define Py_LIMITED_API 0x03050000 -#include - +#include "PythonAPI.h" #include "QtResImporter.h" #include @@ -87,5 +83,3 @@ PyObject *PyInit_qtres() { return PyModule_Create(&QtResModule); } - -#endif // CUTTER_ENABLE_PYTHON diff --git a/src/common/QtResImporter.h b/src/common/QtResImporter.h index a3cf470c..f0c81568 100644 --- a/src/common/QtResImporter.h +++ b/src/common/QtResImporter.h @@ -1,14 +1,10 @@ #ifndef QTRESIMPORTER_H #define QTRESIMPORTER_H -#ifdef CUTTER_ENABLE_PYTHON - PyObject *PyInit_qtres(); PyObject *QtResImport(const char *name); #define RegQtResImporter() Py_DecRef(QtResImport("reg_qtres_importer")) -#endif // CUTTER_ENABLE_PYTHON - #endif // QTRESIMPORTER_H diff --git a/src/common/UpdateWorker.cpp b/src/common/UpdateWorker.cpp index e666737d..a5667b11 100644 --- a/src/common/UpdateWorker.cpp +++ b/src/common/UpdateWorker.cpp @@ -19,8 +19,9 @@ #include #include "common/Configuration.h" #include "CutterConfig.h" +#endif - +#if CUTTER_UPDATE_WORKER_AVAILABLE UpdateWorker::UpdateWorker(QObject *parent) : QObject(parent), pending(false) { diff --git a/src/common/UpdateWorker.h b/src/common/UpdateWorker.h index ff9ec20e..225299e6 100644 --- a/src/common/UpdateWorker.h +++ b/src/common/UpdateWorker.h @@ -10,14 +10,15 @@ #endif #if CUTTER_UPDATE_WORKER_AVAILABLE - #include #include #include #include #include +#endif +#if CUTTER_UPDATE_WORKER_AVAILABLE class QNetworkReply; /**