From 8f81ec244c9a45d7c0402692908a7d2c51de21de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Thu, 30 Mar 2017 18:58:57 +0200 Subject: [PATCH 1/5] Add CMakeLists.txt --- src/CMakeLists.txt | 125 ++++++++++++++++++++++++++++++++++++ src/cmake/FindRadare2.cmake | 55 ++++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 src/CMakeLists.txt create mode 100644 src/cmake/FindRadare2.cmake diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..bdfee90a --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,125 @@ + +cmake_minimum_required(VERSION 3.1) + +project(Iaito VERSION 1.0.0) + +set(CMAKE_CXX_STANDARD 11) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) +find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui WebKit WebKitWidgets) + +find_package(Radare2 REQUIRED) +include_directories(${RADARE2_INCLUDE_DIRS}) + + +set(SOURCE_FILES + main.cpp + mainwindow.cpp + newfiledialog.cpp + optionsdialog.cpp + highlighter.cpp + qrcore.cpp + createnewdialog.cpp + hexascii_highlighter.cpp + webserverthread.cpp + widgets/pieview.cpp + widgets/sectionswidget.cpp + widgets/codegraphic.cpp + widgets/notepad.cpp + mdhighlighter.cpp + widgets/functionswidget.cpp + dialogs/renamedialog.cpp + dialogs/aboutdialog.cpp + widgets/importswidget.cpp + widgets/symbolswidget.cpp + widgets/relocswidget.cpp + widgets/commentswidget.cpp + widgets/stringswidget.cpp + widgets/flagswidget.cpp + widgets/memwidget/memorywidget.cpp + qrdisasm.cpp + widgets/sdbdock.cpp + analthread.cpp + dialogs/commentsdialog.cpp + widgets/sidebar.cpp + helpers.cpp + widgets/omnibar.cpp + widgets/dashboard.cpp + dialogs/xrefsdialog.cpp + hexhighlighter.cpp) + +set(HEADER_FILES + mainwindow.h + newfiledialog.h + optionsdialog.h + highlighter.h + qrcore.h + createnewdialog.h + hexascii_highlighter.h + webserverthread.h + widgets/pieview.h + widgets/sectionswidget.h + widgets/codegraphic.h + widgets/notepad.h + mdhighlighter.h + widgets/functionswidget.h + dialogs/renamedialog.h + dialogs/aboutdialog.h + widgets/importswidget.h + widgets/symbolswidget.h + widgets/relocswidget.h + widgets/commentswidget.h + widgets/stringswidget.h + widgets/flagswidget.h + widgets/memwidget/memorywidget.h + qrdisasm.h + widgets/sdbdock.h + analthread.h + dialogs/commentsdialog.h + widgets/sidebar.h + helpers.h + widgets/omnibar.h + widgets/dashboard.h + dialogs/xrefsdialog.h + widgets/banned.h + hexhighlighter.h) + +set(UI_FILES + mainwindow.ui + newfiledialog.ui + optionsdialog.ui + createnewdialog.ui + widgets/notepad.ui + widgets/functionswidget.ui + dialogs/aboutdialog.ui + dialogs/renamedialog.ui + widgets/importswidget.ui + widgets/symbolswidget.ui + widgets/relocswidget.ui + widgets/commentswidget.ui + widgets/stringswidget.ui + widgets/flagswidget.ui + widgets/memwidget/memorywidget.ui + widgets/sdbdock.ui + dialogs/commentsdialog.ui + widgets/sidebar.ui + widgets/dashboard.ui + dialogs/xrefsdialog.ui) + +set(QRC_FILES resources.qrc) + + +set(IAITO_VERSION_SUFFIX "-dev") +set(IAITO_VERSION_FULL "${PROJECT_VERSION}${IAITO_VERSION_SUFFIX}") +message("Building Iaito version ${IAITO_VERSION_FULL}") +add_definitions("-DAPP_VERSION=\"${IAITO_VERSION_FULL}\"") + + +add_executable(iaito ${UI_FILES} ${QRC_FILES} ${SOURCE_FILES} ${HEADER_FILES}) +qt5_use_modules(iaito Core Widgets Gui WebKit WebKitWidgets) +target_link_libraries(iaito ${RADARE2_LIBRARIES}) diff --git a/src/cmake/FindRadare2.cmake b/src/cmake/FindRadare2.cmake new file mode 100644 index 00000000..0e1bccd5 --- /dev/null +++ b/src/cmake/FindRadare2.cmake @@ -0,0 +1,55 @@ +# - Find Radare2 (libr) +# +# RADARE2_FOUND - True if libr has been found. +# RADARE2_INCLUDE_DIRS - libr Include Directory +# RADARE2_LIBRARIES - List of libraries when using libr. +# RADARE2_LIBRARY_ - Path to library r_ + +find_path(RADARE2_INCLUDE_DIRS + NAMES r_core.h r_bin.h r_util.h + HINTS + /usr/local/include/libr + /usr/include/libr) + +set(RADARE2_LIBRARY_NAMES + core + config + cons + io + util + flag + asm + debug + hash + bin + lang + io + anal + parse + bp + egg + reg + search + syscall + socket + fs + magic + crypto) + +set(RADARE2_LIBRARIES "") +set(RADARE2_LIBRARIES_VARS "") +foreach(libname ${RADARE2_LIBRARY_NAMES}) + find_library(RADARE2_LIBRARY_${libname} + r_${libname} + HINTS + /usr/local/lib + /usr/lib) + + list(APPEND RADARE2_LIBRARIES ${RADARE2_LIBRARY_${libname}}) + list(APPEND RADARE2_LIBRARIES_VARS "RADARE2_LIBRARY_${libname}") +endforeach() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(RADARE2 REQUIRED_VARS ${RADARE2_LIBRARIES_VARS} RADARE2_INCLUDE_DIRS) + +mark_as_advanced(RADARE2_LIBRARIES_VARS) \ No newline at end of file From 94f513a7bd96197adbedfc60446b9b270f9d3873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Fri, 31 Mar 2017 13:28:27 +0200 Subject: [PATCH 2/5] Update CMakeLists.txt for Windows --- src/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bdfee90a..085461a6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,6 +13,14 @@ set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui WebKit WebKitWidgets) + +if(WIN32) + set(IAITO_WIN32_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../iaito_win32") + list(APPEND CMAKE_PREFIX_PATH "${IAITO_WIN32_DIR}" "${IAITO_WIN32_DIR}/radare2") + list(APPEND CMAKE_LIBRARY_PATH "${IAITO_WIN32_DIR}/radare2/lib32") +endif() + + find_package(Radare2 REQUIRED) include_directories(${RADARE2_INCLUDE_DIRS}) From 03e2ea5df9b0b141c64b1b9da6a26ad212f39ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Fri, 31 Mar 2017 16:52:26 +0200 Subject: [PATCH 3/5] Fix CMake build on Windows --- src/CMakeLists.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 085461a6..b758d8e9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,9 +15,11 @@ find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui WebKit WebKitWidgets) if(WIN32) - set(IAITO_WIN32_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../iaito_win32") - list(APPEND CMAKE_PREFIX_PATH "${IAITO_WIN32_DIR}" "${IAITO_WIN32_DIR}/radare2") - list(APPEND CMAKE_LIBRARY_PATH "${IAITO_WIN32_DIR}/radare2/lib32") + # use radare2 libraries from submodule on windows + set(IAITO_WIN32_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../iaito_win32") + list(APPEND CMAKE_PREFIX_PATH "${IAITO_WIN32_DIR}") + list(APPEND CMAKE_LIBRARY_PATH "${IAITO_WIN32_DIR}/radare2/lib32") + set(RADARE2_INCLUDE_DIRS "${IAITO_WIN32_DIR}/radare2/include/libr" "${IAITO_WIN32_DIR}/include") endif() @@ -26,7 +28,7 @@ include_directories(${RADARE2_INCLUDE_DIRS}) set(SOURCE_FILES - main.cpp + main.cpp mainwindow.cpp newfiledialog.cpp optionsdialog.cpp @@ -62,7 +64,7 @@ set(SOURCE_FILES hexhighlighter.cpp) set(HEADER_FILES - mainwindow.h + mainwindow.h newfiledialog.h optionsdialog.h highlighter.h @@ -98,7 +100,7 @@ set(HEADER_FILES hexhighlighter.h) set(UI_FILES - mainwindow.ui + mainwindow.ui newfiledialog.ui optionsdialog.ui createnewdialog.ui From 7b62fc21692525cadd55ffd6a3a3c578e74bce8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Sat, 1 Apr 2017 11:11:39 +0200 Subject: [PATCH 4/5] CMake on Windows: Detect 64 bit for library dir --- src/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b758d8e9..0e0369ee 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,7 +18,13 @@ if(WIN32) # use radare2 libraries from submodule on windows set(IAITO_WIN32_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../iaito_win32") list(APPEND CMAKE_PREFIX_PATH "${IAITO_WIN32_DIR}") - list(APPEND CMAKE_LIBRARY_PATH "${IAITO_WIN32_DIR}/radare2/lib32") + + if(CMAKE_SIZEOF_VOID_P EQUAL 8) # 64 bit + list(APPEND CMAKE_LIBRARY_PATH "${IAITO_WIN32_DIR}/radare2/lib64") + else() + list(APPEND CMAKE_LIBRARY_PATH "${IAITO_WIN32_DIR}/radare2/lib32") + endif() + set(RADARE2_INCLUDE_DIRS "${IAITO_WIN32_DIR}/radare2/include/libr" "${IAITO_WIN32_DIR}/include") endif() From 898350f3cde04fbd875719307638b99f05bb168b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Sat, 1 Apr 2017 11:20:06 +0200 Subject: [PATCH 5/5] Add .idea to gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index b0e9bc97..d5c445b5 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,6 @@ Makefile* # QtCtreator CMake CMakeLists.txt.user +# CLion +.idea +