Skip to content

Commit

Permalink
Fixed issues after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
yossizap committed Nov 15, 2019
1 parent 8daf438 commit b94141d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
37 changes: 17 additions & 20 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.14)

if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
Expand Down Expand Up @@ -154,51 +154,45 @@ if (TARGET Graphviz::GVC)
list(APPEND HEADER_FILES ${CUTTER_PRO_GRAPHVIZ_HEADERS})
endif()


if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_definitions(-Wall -Wextra)
set_source_files_properties(${BINDINGS_SOURCE} PROPERTIES COMPILE_FLAGS -w)
endif()


add_executable(Cutter MACOSX_BUNDLE ${UI_FILES} ${QRC_FILES} ${SOURCE_FILES} ${HEADER_FILES} ${BINDINGS_SOURCE})
set_target_properties(Cutter PROPERTIES
ENABLE_EXPORTS ON
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/macos/Info.plist")
list(REMOVE_ITEM SOURCE_FILES Main.cpp)
add_library(CutterLib OBJECT ${UI_FILES} ${QRC_FILES} ${SOURCE_FILES} ${HEADER_FILES} ${BINDINGS_SOURCE})

if (TARGET Graphviz::GVC)
target_link_libraries(Cutter Graphviz::GVC)
target_compile_definitions(Cutter PRIVATE CUTTER_ENABLE_GRAPHVIZ)
target_link_libraries(CutterLib Graphviz::GVC)
target_compile_definitions(CutterLib PRIVATE CUTTER_ENABLE_GRAPHVIZ)
endif()

if(CUTTER_ENABLE_CRASH_REPORTS)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(Cutter Threads::Threads)
target_link_libraries(CutterLib Threads::Threads)

add_definitions(-DCUTTER_ENABLE_CRASH_REPORTS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g ")
if(DEFINED BREAKPAD_FRAMEWORK_DIR)
include_directories("${BREAKPAD_FRAMEWORK_DIR}/Breakpad.framework/Headers")
set_target_properties(Cutter PROPERTIES LINK_FLAGS "-Wl,-F${BREAKPAD_FRAMEWORK_DIR}")
target_link_libraries(Cutter "-framework Breakpad")
set_target_properties(CutterLib PROPERTIES LINK_FLAGS "-Wl,-F${BREAKPAD_FRAMEWORK_DIR}")
target_link_libraries(CutterLib "-framework Breakpad")
else()
find_package(Breakpad REQUIRED)
include_directories(${BREAKPAD_INCLUDE_DIRS})
target_link_libraries(Cutter ${BREAKPAD_LINK_LIBRARIES})
target_link_libraries(CutterLib ${BREAKPAD_LINK_LIBRARIES})
endif()
endif()

list(REMOVE_ITEM SOURCE_FILES Main.cpp)
add_library(CutterLib OBJECT ${UI_FILES} ${QRC_FILES} ${SOURCE_FILES} ${HEADER_FILES} ${BINDINGS_SOURCE})
target_include_directories(CutterLib PUBLIC . core widgets common plugins)
target_link_libraries(CutterLib Qt5::Core Qt5::Widgets Qt5::Gui Qt5::Svg Qt5::Network)
target_link_libraries(CutterLib ${RADARE2_LIBRARIES})
target_link_libraries(CutterLib ${RADARE2_TARGET})
if(CUTTER_ENABLE_PYTHON)
target_link_libraries(CutterLib ${PYTHON_LIBRARIES})
if(CUTTER_ENABLE_PYTHON_BINDINGS)
target_link_libraries(Cutter Shiboken2::libshiboken PySide2::pyside2)
target_link_libraries(CutterLib Shiboken2::libshiboken PySide2::pyside2)

get_target_property(BINDINGS_INCLUDE_DIRS Cutter INCLUDE_DIRECTORIES)
if(APPLE AND _qt5Core_install_prefix)
Expand All @@ -217,11 +211,14 @@ if(CUTTER_ENABLE_PYTHON)
endif()

if(TARGET KF5::SyntaxHighlighting)
target_link_libraries(Cutter KF5::SyntaxHighlighting)
target_compile_definitions(Cutter PRIVATE CUTTER_ENABLE_KSYNTAXHIGHLIGHTING)
target_link_libraries(CutterLib KF5::SyntaxHighlighting)
target_compile_definitions(CutterLib PRIVATE CUTTER_ENABLE_KSYNTAXHIGHLIGHTING)
endif()

add_executable(Cutter Main.cpp)
add_executable(Cutter MACOSX_BUNDLE Main.cpp)
set_target_properties(Cutter PROPERTIES
ENABLE_EXPORTS ON
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/macos/Info.plist")
target_link_libraries(Cutter CutterLib)

if(CUTTER_ENABLE_TESTS)
Expand Down
2 changes: 1 addition & 1 deletion src/CutterApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ CutterApplication::CutterApplication(int &argc, char **argv, bool test) : QAppli
plugin->registerDecompilers();
}

mainWindow = new MainWindow();
mainWindow = new MainWindow(nullptr, test);
installEventFilter(mainWindow);

// set up context menu shortcut display fix
Expand Down
7 changes: 5 additions & 2 deletions src/core/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,19 @@
template<class T>
T* getNewInstance(MainWindow *m, QAction *a) { return new T(m, a); }

MainWindow::MainWindow(QWidget *parent) :
MainWindow::MainWindow(QWidget *parent, bool testMode) :
QMainWindow(parent),
core(Core()),
testMode(testMode),
ui(new Ui::MainWindow)
{
panelLock = false;
tabsOnTop = false;
configuration = Config();

initUI();
if (!testMode) {
initUI();
}
}

MainWindow::~MainWindow()
Expand Down
4 changes: 3 additions & 1 deletion src/core/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class MainWindow : public QMainWindow
public:
bool responsive;

explicit MainWindow(QWidget *parent = nullptr);
explicit MainWindow(QWidget *parent = nullptr, bool testMode = false);
~MainWindow() override;

void openNewFile(InitialOptions &options, bool skipOptionsDialog = false);
Expand Down Expand Up @@ -204,6 +204,8 @@ private slots:
private:
CutterCore *core;

bool testMode;

bool panelLock;
bool tabsOnTop;
ut64 hexdumpTopOffset;
Expand Down

0 comments on commit b94141d

Please sign in to comment.