From 7c9c7e6fe48f5afe0b31f359597096705e451dff Mon Sep 17 00:00:00 2001 From: karliss Date: Sat, 1 Aug 2020 17:14:30 +0300 Subject: [PATCH] Add symbol exports. (#2345) * Add symbol exports required for external native plugins to work on Windows * Make Linux build behave more like Windows so that missing export annotations can be more easily detected. --- src/CMakeLists.txt | 1 + src/Cutter.pro | 6 +- src/cmake/BundledRadare2.cmake | 4 +- src/common/AddressableItemModel.cpp | 2 + src/common/AddressableItemModel.h | 8 +-- src/common/AsyncTask.h | 4 +- src/common/CommandTask.h | 2 +- src/common/Configuration.h | 2 +- src/common/CutterSeekable.h | 2 +- src/common/Decompiler.h | 2 +- src/common/Helpers.h | 38 +++++++------ src/common/HexAsciiHighlighter.cpp | 50 ----------------- src/common/HexAsciiHighlighter.h | 40 ------------- src/common/HexHighlighter.cpp | 77 -------------------------- src/common/HexHighlighter.h | 40 ------------- src/common/SyntaxHighlighter.h | 3 +- src/common/TempConfig.h | 4 +- src/core/Cutter.h | 4 +- src/core/MainWindow.cpp | 1 - src/core/MainWindow.h | 1 - src/dialogs/R2TaskDialog.h | 3 +- src/menus/AddressableItemContextMenu.h | 2 +- src/menus/DisassemblyContextMenu.h | 2 +- src/meson.build | 1 + src/plugins/CutterPlugin.h | 2 +- src/widgets/BoolToggleDelegate.h | 4 +- src/widgets/ComboQuickFilterView.h | 4 +- src/widgets/CutterDockWidget.h | 4 +- src/widgets/CutterTreeView.h | 4 +- src/widgets/CutterTreeWidget.h | 4 +- src/widgets/HexdumpWidget.h | 2 - src/widgets/ListDockWidget.h | 2 +- src/widgets/MemoryDockWidget.h | 2 +- src/widgets/QuickFilterView.h | 4 +- 34 files changed, 70 insertions(+), 261 deletions(-) delete mode 100644 src/common/HexAsciiHighlighter.cpp delete mode 100644 src/common/HexAsciiHighlighter.h delete mode 100644 src/common/HexHighlighter.cpp delete mode 100644 src/common/HexHighlighter.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7c923bf2..5a71d564 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -172,6 +172,7 @@ endif() add_executable(Cutter MACOSX_BUNDLE ${UI_FILES} ${QRC_FILES} ${SOURCE_FILES} ${HEADER_FILES} ${BINDINGS_SOURCE}) set_target_properties(Cutter PROPERTIES ENABLE_EXPORTS ON + CXX_VISIBILITY_PRESET hidden MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/macos/Info.plist") target_compile_definitions(Cutter PRIVATE CUTTER_SOURCE_BUILD) diff --git a/src/Cutter.pro b/src/Cutter.pro index 1c4da0f3..676bfbbf 100644 --- a/src/Cutter.pro +++ b/src/Cutter.pro @@ -60,6 +60,8 @@ equals(CUTTER_APPVEYOR_R2DEC, true) CONFIG += CUTTER_APPVEYOR_R2DEC !defined(CUTTER_R2GHIDRA_STATIC, var) CUTTER_R2GHIDRA_STATIC=false equals(CUTTER_R2GHIDRA_STATIC, true) CONFIG += CUTTER_R2GHIDRA_STATIC +DEFINES += CUTTER_SOURCE_BUILD + CUTTER_ENABLE_CRASH_REPORTS { message("Crash report support enabled.") DEFINES += CUTTER_ENABLE_CRASH_REPORTS @@ -310,8 +312,6 @@ SOURCES += \ dialogs/XrefsDialog.cpp \ core/MainWindow.cpp \ common/Helpers.cpp \ - common/HexAsciiHighlighter.cpp \ - common/HexHighlighter.cpp \ common/Highlighter.cpp \ common/MdHighlighter.cpp \ common/DirectionalComboBox.cpp \ @@ -459,8 +459,6 @@ HEADERS += \ dialogs/NativeDebugDialog.h \ dialogs/XrefsDialog.h \ common/Helpers.h \ - common/HexAsciiHighlighter.h \ - common/HexHighlighter.h \ core/MainWindow.h \ common/Highlighter.h \ common/MdHighlighter.h \ diff --git a/src/cmake/BundledRadare2.cmake b/src/cmake/BundledRadare2.cmake index 101f2520..d3ec0d95 100644 --- a/src/cmake/BundledRadare2.cmake +++ b/src/cmake/BundledRadare2.cmake @@ -26,7 +26,7 @@ endif() ExternalProject_Add(Radare2-Bundled SOURCE_DIR "${RADARE2_SOURCE_DIR}" - CONFIGURE_COMMAND "${MESON}" "" ${MESON_OPTIONS} && "${MESON}" configure ${MESON_OPTIONS} + CONFIGURE_COMMAND "${MESON}" "" ${MESON_OPTIONS} && "${MESON}" configure ${MESON_OPTIONS} --buildtype "$<$:debug>$<$>:release>" BUILD_COMMAND "${NINJA}" INSTALL_COMMAND "${NINJA}" install) @@ -69,4 +69,4 @@ elseif (WIN32) PATTERN "*.pdb" EXCLUDE) else () install(DIRECTORY "${RADARE2_INSTALL_DIR}/" DESTINATION ".") -endif() \ No newline at end of file +endif() diff --git a/src/common/AddressableItemModel.cpp b/src/common/AddressableItemModel.cpp index f593aefc..3da649a4 100644 --- a/src/common/AddressableItemModel.cpp +++ b/src/common/AddressableItemModel.cpp @@ -1,6 +1,8 @@ #include #include "AddressableItemModel.h" +#include + AddressableFilterProxyModel::AddressableFilterProxyModel(AddressableItemModelI *sourceModel, QObject *parent) : AddressableItemModel(parent) diff --git a/src/common/AddressableItemModel.h b/src/common/AddressableItemModel.h index dc34ba00..1eb704ed 100644 --- a/src/common/AddressableItemModel.h +++ b/src/common/AddressableItemModel.h @@ -6,9 +6,9 @@ #include #include -#include +#include "core/CutterCommon.h" -class AddressableItemModelI +class CUTTER_EXPORT AddressableItemModelI { public: virtual RVA address(const QModelIndex &index) const = 0; @@ -22,7 +22,7 @@ public: }; template -class AddressableItemModel : public ParentModel, public AddressableItemModelI +class CUTTER_EXPORT AddressableItemModel : public ParentModel, public AddressableItemModelI { static_assert (std::is_base_of::value, "ParentModel needs to inherit from QAbstractItemModel"); @@ -32,7 +32,7 @@ public: QAbstractItemModel *asItemModel() { return this; } }; -class AddressableFilterProxyModel : public AddressableItemModel +class CUTTER_EXPORT AddressableFilterProxyModel : public AddressableItemModel { using ParentClass = AddressableItemModel; public: diff --git a/src/common/AsyncTask.h b/src/common/AsyncTask.h index 306c1d50..2348d90d 100644 --- a/src/common/AsyncTask.h +++ b/src/common/AsyncTask.h @@ -2,6 +2,8 @@ #ifndef ASYNCTASK_H #define ASYNCTASK_H +#include "core/CutterCommon.h" + #include #include #include @@ -11,7 +13,7 @@ class AsyncTaskManager; -class AsyncTask : public QObject, public QRunnable +class CUTTER_EXPORT AsyncTask : public QObject, public QRunnable { Q_OBJECT diff --git a/src/common/CommandTask.h b/src/common/CommandTask.h index 65110fde..e0448af4 100644 --- a/src/common/CommandTask.h +++ b/src/common/CommandTask.h @@ -5,7 +5,7 @@ #include "common/AsyncTask.h" #include "core/Cutter.h" -class CommandTask : public AsyncTask +class CUTTER_EXPORT CommandTask : public AsyncTask { Q_OBJECT diff --git a/src/common/Configuration.h b/src/common/Configuration.h index cd981940..b6f04e06 100644 --- a/src/common/Configuration.h +++ b/src/common/Configuration.h @@ -30,7 +30,7 @@ struct CutterInterfaceTheme { }; -class Configuration : public QObject +class CUTTER_EXPORT Configuration : public QObject { Q_OBJECT private: diff --git a/src/common/CutterSeekable.h b/src/common/CutterSeekable.h index e32a872b..ebaa61fc 100644 --- a/src/common/CutterSeekable.h +++ b/src/common/CutterSeekable.h @@ -4,7 +4,7 @@ class MainWindow; -class CutterSeekable : public QObject +class CUTTER_EXPORT CutterSeekable : public QObject { Q_OBJECT diff --git a/src/common/Decompiler.h b/src/common/Decompiler.h index 031edefd..5c886f9d 100644 --- a/src/common/Decompiler.h +++ b/src/common/Decompiler.h @@ -11,7 +11,7 @@ /** * Implements a decompiler that can be registered using CutterCore::registerDecompiler() */ -class Decompiler: public QObject +class CUTTER_EXPORT Decompiler: public QObject { Q_OBJECT diff --git a/src/common/Helpers.h b/src/common/Helpers.h index 85869d93..44cd26e4 100644 --- a/src/common/Helpers.h +++ b/src/common/Helpers.h @@ -1,6 +1,8 @@ #ifndef QHELPERS_H #define QHELPERS_H +#include "core/CutterCommon.h" + #include #include #include @@ -28,19 +30,19 @@ class QComboBox; #endif namespace qhelpers { -QString formatBytecount(const uint64_t bytecount); -void adjustColumns(QTreeView *tv, int columnCount, int padding); -void adjustColumns(QTreeWidget *tw, int padding); -bool selectFirstItem(QAbstractItemView *itemView); -QTreeWidgetItem *appendRow(QTreeWidget *tw, const QString &str, const QString &str2 = QString(), +CUTTER_EXPORT QString formatBytecount(const uint64_t bytecount); +CUTTER_EXPORT void adjustColumns(QTreeView *tv, int columnCount, int padding); +CUTTER_EXPORT void adjustColumns(QTreeWidget *tw, int padding); +CUTTER_EXPORT bool selectFirstItem(QAbstractItemView *itemView); +CUTTER_EXPORT QTreeWidgetItem *appendRow(QTreeWidget *tw, const QString &str, const QString &str2 = QString(), const QString &str3 = QString(), const QString &str4 = QString(), const QString &str5 = QString()); -void setVerticalScrollMode(QAbstractItemView *tw); +CUTTER_EXPORT void setVerticalScrollMode(QAbstractItemView *tw); -void setCheckedWithoutSignals(QAbstractButton *button, bool checked); +CUTTER_EXPORT void setCheckedWithoutSignals(QAbstractButton *button, bool checked); -struct SizePolicyMinMax { +struct CUTTER_EXPORT SizePolicyMinMax { QSizePolicy sizePolicy; int min; int max; @@ -49,26 +51,26 @@ struct SizePolicyMinMax { void restoreHeight(QWidget *widget); }; -SizePolicyMinMax forceWidth(QWidget *widget, int width); -SizePolicyMinMax forceHeight(QWidget *widget, int height); +CUTTER_EXPORT SizePolicyMinMax forceWidth(QWidget *widget, int width); +CUTTER_EXPORT SizePolicyMinMax forceHeight(QWidget *widget, int height); -int getMaxFullyDisplayedLines(QTextEdit *textEdit); -int getMaxFullyDisplayedLines(QPlainTextEdit *plainTextEdit); +CUTTER_EXPORT int getMaxFullyDisplayedLines(QTextEdit *textEdit); +CUTTER_EXPORT int getMaxFullyDisplayedLines(QPlainTextEdit *plainTextEdit); -QByteArray applyColorToSvg(const QByteArray &data, QColor color); -QByteArray applyColorToSvg(const QString &filename, QColor color); +CUTTER_EXPORT QByteArray applyColorToSvg(const QByteArray &data, QColor color); +CUTTER_EXPORT QByteArray applyColorToSvg(const QString &filename, QColor color); -void setThemeIcons(QList> supportedIconsNames, std::function setter); +CUTTER_EXPORT void setThemeIcons(QList> supportedIconsNames, std::function setter); -void prependQAction(QAction *action, QMenu *menu); -qreal devicePixelRatio(const QPaintDevice *p); +CUTTER_EXPORT void prependQAction(QAction *action, QMenu *menu); +CUTTER_EXPORT qreal devicePixelRatio(const QPaintDevice *p); /** * @brief Select comboBox item by value in Qt::UserRole. * @param comboBox * @param data - value to search in combobox item data * @param defaultIndex - item to select in case no match */ -void selectIndexByData(QComboBox *comboBox, QVariant data, int defaultIndex = -1); +CUTTER_EXPORT void selectIndexByData(QComboBox *comboBox, QVariant data, int defaultIndex = -1); } // qhelpers diff --git a/src/common/HexAsciiHighlighter.cpp b/src/common/HexAsciiHighlighter.cpp deleted file mode 100644 index af3f1a17..00000000 --- a/src/common/HexAsciiHighlighter.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include - -#include "common/HexAsciiHighlighter.h" - -AsciiHighlighter::AsciiHighlighter(QTextDocument *parent) - : QSyntaxHighlighter(parent) -{ - HighlightingRule rule; - - asciiFormat.setForeground(QColor(65, 131, 215)); - rule.pattern.setPattern("\\b[A-Za-z0-9]+\\b"); - rule.format = asciiFormat; - highlightingRules.append(rule); - - commentStartRegularExpression.setPattern("/\\*"); - commentEndRegularExpression.setPattern("\\*/"); -} - -void AsciiHighlighter::highlightBlock(const QString &text) -{ - for (const HighlightingRule &rule : highlightingRules) { - QRegularExpression expression(rule.pattern); - int index = expression.match(text).capturedStart(); - while (index >= 0) { - int length = expression.match(text).capturedLength(); - setFormat(index, length, rule.format); - index = expression.match(text.mid(index + length)).capturedStart(); - } - } - setCurrentBlockState(0); - - int startIndex = 0; - if (previousBlockState() != 1) - startIndex = QRegularExpression(commentStartRegularExpression).match(text).capturedStart(); - - while (startIndex >= 0) { - QRegularExpressionMatch commentEndMatch = QRegularExpression(commentEndRegularExpression).match(text.mid(startIndex)); - int endIndex = commentEndMatch.capturedStart(); - int commentLength; - if (endIndex == -1) { - setCurrentBlockState(1); - commentLength = text.length() - startIndex; - } else { - commentLength = endIndex - startIndex - + commentEndMatch.capturedLength(); - } - setFormat(startIndex, commentLength, multiLineCommentFormat); - startIndex = QRegularExpression(commentStartRegularExpression).match(text.mid(startIndex + commentLength)).capturedStart(); - } -} diff --git a/src/common/HexAsciiHighlighter.h b/src/common/HexAsciiHighlighter.h deleted file mode 100644 index fb08ddbd..00000000 --- a/src/common/HexAsciiHighlighter.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef ASCIIHIGHLIGHTER_H -#define ASCIIHIGHLIGHTER_H - -#include - -#include -#include -#include - -class QTextDocument; - -class AsciiHighlighter : public QSyntaxHighlighter -{ - Q_OBJECT - -public: - explicit AsciiHighlighter(QTextDocument *parent = nullptr); - -protected: - void highlightBlock(const QString &text); - -private: - struct HighlightingRule { - QRegularExpression pattern; - QTextCharFormat format; - }; - QVector highlightingRules; - - QRegularExpression commentStartRegularExpression; - QRegularExpression commentEndRegularExpression; - - QTextCharFormat keywordFormat; - QTextCharFormat classFormat; - QTextCharFormat singleLineCommentFormat; - QTextCharFormat multiLineCommentFormat; - QTextCharFormat quotationFormat; - QTextCharFormat asciiFormat; -}; - -#endif // ASCIIHIGHLIGHTER_H diff --git a/src/common/HexHighlighter.cpp b/src/common/HexHighlighter.cpp deleted file mode 100644 index 0a18bfb3..00000000 --- a/src/common/HexHighlighter.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include - -#include "common/HexHighlighter.h" - -HexHighlighter::HexHighlighter(QTextDocument *parent) - : QSyntaxHighlighter(parent) -{ - HighlightingRule rule; - - keywordFormat.setForeground(QColor(65, 131, 215)); - keywordFormat.setFontWeight(QFont::Bold); - QStringList keywordPatterns; - // I know, your eyes are bleeding, mine too - keywordPatterns << "\\b20\\b" << "\\b21\\b" << "\\b22\\b" << "\\b23\\b" << "\\b24\\b" << "\\b25\\b" - << "\\b26\\b" - << "\\b27\\b" << "\\b28\\b" << "\\b29\\b" << "\\b2a\\b" << "\\b2b\\b" << "\\b2c\\b" << "\\b2d\\b" - << "\\b2e\\b" << "\\b2f\\b" << "\\b30\\b" << "\\b31\\b" << "\\b32\\b" << "\\b33\\b" << "\\b34\\b" - << "\\b35\\b" << "\\b36\\b" << "\\b37\\b" << "\\b38\\b" << "\\b39\\b" << "\\b3a\\b" << "\\b3b\\b" - << "\\b3c\\b" << "\\b3d\\b" << "\\b3e\\b" << "\\b3f\\b" << "\\b41\\b" << "\\b42\\b" << "\\b43\\b" - << "\\b44\\b" << "\\b45\\b" << "\\b46\\b" << "\\b47\\b" << "\\b48\\b" << "\\b49\\b" << "\\b4a\\b" - << "\\b4b\\b" << "\\b4c\\b" << "\\b4d\\b" << "\\b4e\\b" << "\\b4f\\b" << "\\b50\\b" << "\\b51\\b" - << "\\b52\\b" << "\\b53\\b" << "\\b54\\b" << "\\b55\\b" << "\\b56\\b" << "\\b57\\b" << "\\b58\\b" - << "\\b59\\b" << "\\b5a\\b" << "\\b5b\\b" << "\\b5c\\b" << "\\b5d\\b" << "\\b5e\\b" << "\\b5f\\b" - << "\\b60\\b" << "\\b61\\b" << "\\b62\\b" << "\\b63\\b" << "\\b64\\b" << "\\b65\\b" << "\\b66\\b" - << "\\b67\\b" << "\\b68\\b" << "\\b69\\b" << "\\b6a\\b" << "\\b6b\\b" << "\\b6c\\b" << "\\b6d\\b" - << "\\b6e\\b" << "\\b6f\\b" << "\\b70\\b" << "\\b71\\b" << "\\b72\\b" << "\\b73\\b" << "\\b74\\b" - << "\\b75\\b" << "\\b76\\b" << "\\b77\\b" << "\\b78\\b" << "\\b79\\b" << "\\b7a\\b" << "\\b7b\\b" - << "\\b7c\\b" << "\\b7d\\b" << "\\b7e\\b" << "\\b7f\\b"; - for (const QString &pattern : keywordPatterns) { - rule.pattern.setPattern(pattern); - rule.pattern.setPatternOptions(QRegularExpression::CaseInsensitiveOption); - rule.format = keywordFormat; - highlightingRules.append(rule); - } - - singleLineCommentFormat.setFontWeight(QFont::Bold); - singleLineCommentFormat.setForeground(Qt::darkGreen); - rule.pattern.setPattern(";[^\n]*"); - rule.format = singleLineCommentFormat; - highlightingRules.append(rule); - - commentStartRegularExpression.setPattern("/\\*"); - commentEndRegularExpression.setPattern("\\*/"); -} - -void HexHighlighter::highlightBlock(const QString &text) -{ - for (const HighlightingRule &rule : highlightingRules) { - QRegularExpression expression(rule.pattern); - int index = expression.match(text).capturedStart(); - while (index >= 0) { - int length = expression.match(text).capturedLength(); - setFormat(index, length, rule.format); - index = expression.match(text.mid(index + length)).capturedStart(); - } - } - setCurrentBlockState(0); - - int startIndex = 0; - if (previousBlockState() != 1) - startIndex = QRegularExpression(commentStartRegularExpression).match(text).capturedStart(); - - while (startIndex >= 0) { - QRegularExpressionMatch commentEndMatch = QRegularExpression(commentEndRegularExpression).match(text.mid(startIndex)); - int endIndex = commentEndMatch.capturedStart(); - int commentLength; - if (endIndex == -1) { - setCurrentBlockState(1); - commentLength = text.length() - startIndex; - } else { - commentLength = endIndex - startIndex - + commentEndMatch.capturedLength(); - } - setFormat(startIndex, commentLength, multiLineCommentFormat); - startIndex = QRegularExpression(commentStartRegularExpression).match(text.mid(startIndex + commentLength)).capturedStart(); - } -} diff --git a/src/common/HexHighlighter.h b/src/common/HexHighlighter.h deleted file mode 100644 index 47b95711..00000000 --- a/src/common/HexHighlighter.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef HEXHIGHLIGHTER_H -#define HEXHIGHLIGHTER_H - -#include - -#include -#include -#include - -class QTextDocument; - -class HexHighlighter : public QSyntaxHighlighter -{ - Q_OBJECT - -public: - explicit HexHighlighter(QTextDocument *parent = nullptr); - -protected: - void highlightBlock(const QString &text); - -private: - struct HighlightingRule { - QRegularExpression pattern; - QTextCharFormat format; - }; - QVector highlightingRules; - - QRegularExpression commentStartRegularExpression; - QRegularExpression commentEndRegularExpression; - - QTextCharFormat keywordFormat; - QTextCharFormat classFormat; - QTextCharFormat singleLineCommentFormat; - QTextCharFormat multiLineCommentFormat; - QTextCharFormat quotationFormat; - QTextCharFormat functionFormat; -}; - -#endif // HEXHIGHLIGHTER_H diff --git a/src/common/SyntaxHighlighter.h b/src/common/SyntaxHighlighter.h index 46556c27..80d6b845 100644 --- a/src/common/SyntaxHighlighter.h +++ b/src/common/SyntaxHighlighter.h @@ -1,6 +1,7 @@ #ifndef SYNTAXHIGHLIGHTER_H #define SYNTAXHIGHLIGHTER_H +#include "CutterCommon.h" #include #include #include @@ -27,7 +28,7 @@ private slots: /** * SyntaxHighlighter to be used when KSyntaxHighlighting is not available */ -class FallbackSyntaxHighlighter : public QSyntaxHighlighter +class CUTTER_EXPORT FallbackSyntaxHighlighter : public QSyntaxHighlighter { Q_OBJECT diff --git a/src/common/TempConfig.h b/src/common/TempConfig.h index f50a1b51..69862e92 100644 --- a/src/common/TempConfig.h +++ b/src/common/TempConfig.h @@ -2,6 +2,8 @@ #ifndef TEMPCONFIG_H #define TEMPCONFIG_H +#include "core/CutterCommon.h" + #include #include @@ -22,7 +24,7 @@ * } * \endcode */ -class TempConfig +class CUTTER_EXPORT TempConfig { public: TempConfig() = default; diff --git a/src/core/Cutter.h b/src/core/Cutter.h index 831ad05a..e41f694c 100644 --- a/src/core/Cutter.h +++ b/src/core/Cutter.h @@ -33,7 +33,7 @@ class R2TaskDialog; class RCoreLocked; -class CutterCore: public QObject +class CUTTER_EXPORT CutterCore: public QObject { Q_OBJECT @@ -730,7 +730,7 @@ private: QVector getCutterRCFilePaths() const; }; -class RCoreLocked +class CUTTER_EXPORT RCoreLocked { CutterCore * const core; diff --git a/src/core/MainWindow.cpp b/src/core/MainWindow.cpp index d20e86e7..0b95d04f 100644 --- a/src/core/MainWindow.cpp +++ b/src/core/MainWindow.cpp @@ -4,7 +4,6 @@ // Common Headers #include "common/BugReporting.h" #include "common/Highlighter.h" -#include "common/HexAsciiHighlighter.h" #include "common/Helpers.h" #include "common/SvgIconEngine.h" #include "common/ProgressIndicator.h" diff --git a/src/core/MainWindow.h b/src/core/MainWindow.h index 039da028..7a21390a 100644 --- a/src/core/MainWindow.h +++ b/src/core/MainWindow.h @@ -225,7 +225,6 @@ private: QString filename; std::unique_ptr ui; Highlighter *highlighter; - AsciiHighlighter *hex_highlighter; VisualNavbar *visualNavbar; Omnibar *omnibar; ProgressIndicator *tasksProgressIndicator; diff --git a/src/dialogs/R2TaskDialog.h b/src/dialogs/R2TaskDialog.h index 931d5eee..53b2bf1f 100644 --- a/src/dialogs/R2TaskDialog.h +++ b/src/dialogs/R2TaskDialog.h @@ -8,13 +8,14 @@ #include #include "common/R2Task.h" +#include "core/CutterCommon.h" class R2Task; namespace Ui { class R2TaskDialog; } -class R2TaskDialog : public QDialog +class CUTTER_EXPORT R2TaskDialog : public QDialog { Q_OBJECT diff --git a/src/menus/AddressableItemContextMenu.h b/src/menus/AddressableItemContextMenu.h index e4cebbfb..b41b3caa 100644 --- a/src/menus/AddressableItemContextMenu.h +++ b/src/menus/AddressableItemContextMenu.h @@ -5,7 +5,7 @@ #include #include -class AddressableItemContextMenu : public QMenu +class CUTTER_EXPORT AddressableItemContextMenu : public QMenu { Q_OBJECT diff --git a/src/menus/DisassemblyContextMenu.h b/src/menus/DisassemblyContextMenu.h index 6108c8ac..28eeaa5c 100644 --- a/src/menus/DisassemblyContextMenu.h +++ b/src/menus/DisassemblyContextMenu.h @@ -6,7 +6,7 @@ #include #include -class DisassemblyContextMenu : public QMenu +class CUTTER_EXPORT DisassemblyContextMenu : public QMenu { Q_OBJECT diff --git a/src/meson.build b/src/meson.build index 6662eb0f..c26287f9 100644 --- a/src/meson.build +++ b/src/meson.build @@ -16,6 +16,7 @@ if get_option('enable_python') endif add_project_arguments(feature_define_args, language: 'cpp') +add_project_arguments('-DCUTTER_SOURCE_BUILD', language: 'cpp') parse_cmd = [py3_exe, join_paths(meson.current_source_dir(), '../scripts/meson_parse_qmake.py')] configure_qmake_cmd = [py3_exe, join_paths(meson.current_source_dir(), '../scripts/meson_configure_qmake_in.py')] diff --git a/src/plugins/CutterPlugin.h b/src/plugins/CutterPlugin.h index 18d34327..85c6e906 100644 --- a/src/plugins/CutterPlugin.h +++ b/src/plugins/CutterPlugin.h @@ -7,7 +7,7 @@ class MainWindow; #include "core/Cutter.h" #include "widgets/CutterDockWidget.h" -class CutterPlugin +class CUTTER_EXPORT CutterPlugin { public: virtual ~CutterPlugin() = default; diff --git a/src/widgets/BoolToggleDelegate.h b/src/widgets/BoolToggleDelegate.h index 6933a0bb..8692baf9 100644 --- a/src/widgets/BoolToggleDelegate.h +++ b/src/widgets/BoolToggleDelegate.h @@ -1,9 +1,11 @@ #ifndef BOOLTOGGGLEDELEGATE_H #define BOOLTOGGGLEDELEGATE_H +#include "core/CutterCommon.h" + #include -class BoolTogggleDelegate : public QStyledItemDelegate +class CUTTER_EXPORT BoolTogggleDelegate : public QStyledItemDelegate { public: BoolTogggleDelegate(QObject *parent = nullptr); diff --git a/src/widgets/ComboQuickFilterView.h b/src/widgets/ComboQuickFilterView.h index d8790f9c..ba913649 100644 --- a/src/widgets/ComboQuickFilterView.h +++ b/src/widgets/ComboQuickFilterView.h @@ -1,6 +1,8 @@ #ifndef COMBOQUICKFILTERVIEW_H #define COMBOQUICKFILTERVIEW_H +#include "core/CutterCommon.h" + #include #include @@ -8,7 +10,7 @@ namespace Ui { class ComboQuickFilterView; } -class ComboQuickFilterView : public QWidget +class CUTTER_EXPORT ComboQuickFilterView : public QWidget { Q_OBJECT diff --git a/src/widgets/CutterDockWidget.h b/src/widgets/CutterDockWidget.h index 5687522a..d9d1ec9d 100644 --- a/src/widgets/CutterDockWidget.h +++ b/src/widgets/CutterDockWidget.h @@ -1,14 +1,14 @@ #ifndef CUTTERWIDGET_H #define CUTTERWIDGET_H -#include "CutterCommon.h" +#include "core/CutterCommon.h" #include "common/RefreshDeferrer.h" #include class MainWindow; -class CutterDockWidget : public QDockWidget +class CUTTER_EXPORT CutterDockWidget : public QDockWidget { Q_OBJECT diff --git a/src/widgets/CutterTreeView.h b/src/widgets/CutterTreeView.h index 3d636567..f4b34eb4 100644 --- a/src/widgets/CutterTreeView.h +++ b/src/widgets/CutterTreeView.h @@ -1,6 +1,8 @@ #ifndef CUTTERTREEVIEW_H #define CUTTERTREEVIEW_H +#include "core/CutterCommon.h" + #include #include #include @@ -9,7 +11,7 @@ namespace Ui { class CutterTreeView; } -class CutterTreeView : public QTreeView +class CUTTER_EXPORT CutterTreeView : public QTreeView { Q_OBJECT diff --git a/src/widgets/CutterTreeWidget.h b/src/widgets/CutterTreeWidget.h index b077201f..00fe7e9b 100644 --- a/src/widgets/CutterTreeWidget.h +++ b/src/widgets/CutterTreeWidget.h @@ -1,12 +1,14 @@ #ifndef CUTTERTREEWIDGET_H #define CUTTERTREEWIDGET_H +#include "core/CutterCommon.h" + #include #include class MainWindow; -class CutterTreeWidget : public QObject +class CUTTER_EXPORT CutterTreeWidget : public QObject { Q_OBJECT diff --git a/src/widgets/HexdumpWidget.h b/src/widgets/HexdumpWidget.h index c3a9d8b5..6980977c 100644 --- a/src/widgets/HexdumpWidget.h +++ b/src/widgets/HexdumpWidget.h @@ -13,8 +13,6 @@ #include "MemoryDockWidget.h" #include "common/CutterSeekable.h" #include "common/Highlighter.h" -#include "common/HexAsciiHighlighter.h" -#include "common/HexHighlighter.h" #include "common/SvgIconEngine.h" #include "HexWidget.h" diff --git a/src/widgets/ListDockWidget.h b/src/widgets/ListDockWidget.h index d79d4115..4d8184c8 100644 --- a/src/widgets/ListDockWidget.h +++ b/src/widgets/ListDockWidget.h @@ -21,7 +21,7 @@ class ListDockWidget; } -class ListDockWidget : public CutterDockWidget +class CUTTER_EXPORT ListDockWidget : public CutterDockWidget { Q_OBJECT diff --git a/src/widgets/MemoryDockWidget.h b/src/widgets/MemoryDockWidget.h index 44472f96..eb3c329e 100644 --- a/src/widgets/MemoryDockWidget.h +++ b/src/widgets/MemoryDockWidget.h @@ -9,7 +9,7 @@ /* Disassembly/Graph/Hexdump/Decompiler view priority */ enum class MemoryWidgetType { Disassembly, Graph, Hexdump, Decompiler }; -class MemoryDockWidget : public AddressableDockWidget +class CUTTER_EXPORT MemoryDockWidget : public AddressableDockWidget { Q_OBJECT public: diff --git a/src/widgets/QuickFilterView.h b/src/widgets/QuickFilterView.h index 88097066..9fb47cbc 100644 --- a/src/widgets/QuickFilterView.h +++ b/src/widgets/QuickFilterView.h @@ -2,6 +2,8 @@ #ifndef QUICKFILTERVIEW_H #define QUICKFILTERVIEW_H +#include "core/CutterCommon.h" + #include #include @@ -10,7 +12,7 @@ namespace Ui { class QuickFilterView; } -class QuickFilterView : public QWidget +class CUTTER_EXPORT QuickFilterView : public QWidget { Q_OBJECT