From 190c0c5f84f8f1ca5aa7c5c78e87ee67f1402330 Mon Sep 17 00:00:00 2001 From: crizzitello <98421672+crizzitello@users.noreply.github.com> Date: Thu, 14 Apr 2022 15:11:37 -0400 Subject: [PATCH] Cmake full (#135) * remove OS Name for deployment * Remove QMake Project * More SubLibs Co-authored-by: Chris Rizzitello --- .github/workflows/ci.yaml | 2 +- CMakeLists.txt | 145 +------------ ashirt.pro | 194 ------------------ src/CMakeLists.txt | 91 ++++++++ src/components/CMakeLists.txt | 38 ++++ src/db/CMakeLists.txt | 21 ++ src/db/databaseconnection.h | 2 +- src/dtos/CMakeLists.txt | 21 ++ src/exceptions/CMakeLists.txt | 19 ++ src/forms/CMakeLists.txt | 31 +++ .../evidence_filter/evidencefilterform.h | 4 +- src/helpers/CMakeLists.txt | 50 +++++ src/models/CMakeLists.txt | 24 +++ src/porting/CMakeLists.txt | 25 +++ 14 files changed, 326 insertions(+), 341 deletions(-) delete mode 100644 ashirt.pro create mode 100644 src/CMakeLists.txt create mode 100644 src/components/CMakeLists.txt create mode 100644 src/db/CMakeLists.txt create mode 100644 src/dtos/CMakeLists.txt create mode 100644 src/exceptions/CMakeLists.txt create mode 100644 src/forms/CMakeLists.txt create mode 100644 src/helpers/CMakeLists.txt create mode 100644 src/models/CMakeLists.txt create mode 100644 src/porting/CMakeLists.txt diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a94e509..f215ade 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -144,7 +144,7 @@ jobs: export VERSION=${{ env.githash }}${{ matrix.config.QT_STRING }} ${{matrix.config.linuxDeployQtPath}} ./linuxdeploy-x86_64.AppImage --appdir=appdir --output appimage \ - -e ashirt \ + -e src/ashirt \ -d deploy/ashirt.desktop \ -i deploy/hicolor/128x128/apps/ashirt.png \ --plugin=qt diff --git a/CMakeLists.txt b/CMakeLists.txt index cccaeb3..60c4b67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) -option(NOTARIZE_AS "Attempt get mac bundle notarization as Provided user" "") +set(NOTARIZE_AS "" CACHE STRING "Attempt to Sign Package With Provided User") if(EXISTS ${CMAKE_SOURCE_DIR}/.git) find_package(Git) if(GIT_FOUND) @@ -64,147 +64,6 @@ find_package(Qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED COMPONENTS Sql Core ) -include_directories(${Qt${QT_DEFAULT_MAJOR_VERSION}Gui_PRIVATE_INCLUDE_DIRS}/qpa) -include_directories(${CMAKE_SOURCE_DIR}/src) add_subdirectory(deploy) - -set(ASHIRT_SOURCES - src/appconfig.h - src/appsettings.h - src/components/aspectratio_pixmap_label/aspectratiopixmaplabel.cpp src/components/aspectratio_pixmap_label/aspectratiopixmaplabel.h - src/components/aspectratio_pixmap_label/imageview.cpp src/components/aspectratio_pixmap_label/imageview.h - src/components/code_editor/codeblockview.cpp src/components/code_editor/codeblockview.h - src/components/code_editor/codeeditor.cpp src/components/code_editor/codeeditor.h - src/components/custom_keyseq_edit/singlestrokekeysequenceedit.cpp src/components/custom_keyseq_edit/singlestrokekeysequenceedit.h - src/components/error_view/errorview.cpp src/components/error_view/errorview.h - src/components/evidence_editor/deleteevidenceresponse.h - src/components/evidence_editor/evidenceeditor.cpp src/components/evidence_editor/evidenceeditor.h - src/components/evidence_editor/saveevidenceresponse.h - src/components/evidencepreview.cpp src/components/evidencepreview.h - src/components/flow_layout/flowlayout.cpp src/components/flow_layout/flowlayout.h - src/components/loading/qprogressindicator.cpp src/components/loading/qprogressindicator.h - src/components/loading_button/loadingbutton.cpp src/components/loading_button/loadingbutton.h - src/components/tagging/tag_cache/tagcache.cpp src/components/tagging/tag_cache/tagcache.h - src/components/tagging/tag_cache/tagcacheitem.cpp src/components/tagging/tag_cache/tagcacheitem.h - src/components/tagging/tageditor.cpp src/components/tagging/tageditor.h - src/components/tagging/tagginglineediteventfilter.h - src/components/tagging/tagview.cpp src/components/tagging/tagview.h - src/components/tagging/tagwidget.cpp src/components/tagging/tagwidget.h - src/db/databaseconnection.cpp src/db/databaseconnection.h - src/db/query_result.h - src/dtos/checkConnection.h - src/dtos/github_release.h - src/dtos/operation.h - src/dtos/tag.h - src/exceptions/databaseerr.h - src/exceptions/fileerror.h - src/forms/add_operation/createoperation.cpp src/forms/add_operation/createoperation.h - src/forms/credits/credits.cpp src/forms/credits/credits.h - src/forms/evidence/evidencemanager.cpp src/forms/evidence/evidencemanager.h - src/forms/evidence_filter/evidencefilter.cpp src/forms/evidence_filter/evidencefilter.h - src/forms/evidence_filter/evidencefilterform.cpp src/forms/evidence_filter/evidencefilterform.h - src/forms/getinfo/getinfo.cpp src/forms/getinfo/getinfo.h - src/forms/porting/porting_dialog.cpp src/forms/porting/porting_dialog.h - src/forms/settings/settings.cpp src/forms/settings/settings.h - src/helpers/clipboard/clipboardhelper.cpp src/helpers/clipboard/clipboardhelper.h - src/helpers/constants.h - src/helpers/file_helpers.h - src/helpers/http_status.h - src/helpers/jsonhelpers.h - src/helpers/multipartparser.cpp src/helpers/multipartparser.h - src/helpers/netman.h - src/helpers/request_builder.h - src/helpers/screenshot.cpp src/helpers/screenshot.h - src/helpers/stopreply.cpp src/helpers/stopreply.h - src/helpers/system_helpers.h - src/helpers/ui_helpers.h - src/helpers/hotkeys/hotkeymap.h - src/helpers/hotkeys/uglobalhotkeys.cpp src/helpers/hotkeys/uglobalhotkeys.h - src/helpers/hotkeys/ukeysequence.cpp src/helpers/hotkeys/ukeysequence.h - src/hotkeymanager.cpp src/hotkeymanager.h - src/main.cpp - src/models/codeblock.cpp src/models/codeblock.h - src/models/evidence.h - src/models/tag.h - src/porting/evidence_manifest.h - src/porting/system_manifest.cpp src/porting/system_manifest.h - src/porting/system_porting_options.h - src/traymanager.cpp src/traymanager.h - ${CMAKE_SOURCE_DIR}/icons/res_icons.qrc - ${CMAKE_SOURCE_DIR}/migrations/res_migrations.qrc -) -## Locate the deploy app for later use -get_target_property(qmake_executable Qt${QT_DEFAULT_MAJOR_VERSION}::qmake IMPORTED_LOCATION) -get_filename_component(_qt_bin_dir "${qmake_executable}" DIRECTORY) -if(WIN32 OR APPLE) - if(WIN32) - set(deployqtapp windeployqt) - elseif(APPLE) - set(deployqtapp macdeployqt) - endif() - find_program(PLATFORMDEPLOYQT ${deployqtapp} HINTS "${_qt_bin_dir}") -endif() - -if(APPLE) - set(ASHIRT_PLATFORM_EX_SRC ${CMAKE_SOURCE_DIR}/deploy/ashirt.icns) - set_source_files_properties(${ASHIRT_PLATFORM_EX_SRC} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") -elseif(WIN32) - set(CMAKE_PREFIX_PATH $ENV{QTDIR}) - configure_file(${CMAKE_SOURCE_DIR}/deploy/ashirt.rc.in ${CMAKE_CURRENT_BINARY_DIR}/deploy/ashirt.rc @ONLY) - set(ASHIRT_PLATFORM_EX_SRC ${CMAKE_CURRENT_BINARY_DIR}/deploy/ashirt.rc) -endif() - -#MACOSX_BUNDLE Make it a bundle on Mac OS -#WIN32 Its a "GUI" app on win32 -add_executable(ashirt MACOSX_BUNDLE WIN32 ${ASHIRT_SOURCES} ${ASHIRT_PLATFORM_EX_SRC}) -set_target_properties(ashirt PROPERTIES - MACOSX_BUNDLE_GUI_IDENTIFIER "com.theparanoids.ashirt" - MACOSX_BUNDLE_BUNDLE_NAME "ashirt" - MACOSX_BUNDLE_ICON_FILE ashirt.icns - MACOSX_BUNDLE_BUNDLE_VERSION ${CMAKE_PROJECT_VERSION} - MACOSX_BUNDLE_SHORT_VERSION_STRING "${CMAKE_PROJECT_VERSION}" -) - -target_link_libraries ( ashirt - PRIVATE - Qt::Widgets - Qt::Sql - Qt::Gui - Qt::Network - Qt::GuiPrivate -) - -if(APPLE) - find_library(CARBON_LIBRARY Carbon) - target_link_libraries(ashirt PRIVATE ${CARBON_LIBRARY}) - if(NOTARIZE_AS STREQUAL "") - add_custom_command( - TARGET ashirt POST_BUILD - COMMAND ${PLATFORMDEPLOYQT} ${CMAKE_BINARY_DIR}/ashirt.app - ) - else() - add_custom_command( - TARGET ashirt POST_BUILD - COMMAND ${PLATFORMDEPLOYQT} ${CMAKE_BINARY_DIR}/ashirt.app -sign-for-notarization=${NOTARIZE_AS} - ) - endif() - install(TARGETS ashirt BUNDLE DESTINATION .) -elseif(UNIX AND NOT APPLE) - target_link_libraries(ashirt PRIVATE xcb xcb-keysyms pthread) - install(TARGETS ashirt BUNDLE DESTINATION bin) -elseif(WIN32) - target_link_libraries(ashirt PRIVATE user32) - install(TARGETS ashirt RUNTIME DESTINATION .) - if(${QT_DEFAULT_MAJOR_VERSION} MATCHES "5") - add_custom_command( - TARGET ashirt POST_BUILD - COMMAND ${PLATFORMDEPLOYQT} $ --no-compiler-runtime --no-system-d3d-compiler --no-quick-import --no-translations --no-angle --no-webkit2 --no-opengl-sw --dir ${CMAKE_BINARY_DIR}/qtDeploy --plugindir ${CMAKE_BINARY_DIR}/qtDeploy/plugins - ) - else() - add_custom_command( - TARGET ashirt POST_BUILD - COMMAND ${PLATFORMDEPLOYQT} $ --no-compiler-runtime --no-system-d3d-compiler --no-quick-import --no-translations --no-opengl-sw --dir ${CMAKE_BINARY_DIR}/qtDeploy --plugindir ${CMAKE_BINARY_DIR}/qtDeploy/plugins - ) - endif() -endif() +add_subdirectory(src) diff --git a/ashirt.pro b/ashirt.pro deleted file mode 100644 index 70f0d5b..0000000 --- a/ashirt.pro +++ /dev/null @@ -1,194 +0,0 @@ -QT += core gui network sql widgets gui-private - -CONFIG += c++11 -TEMPLATE = app - -# The following define makes your compiler emit warnings if you use -# any Qt feature that has been marked deprecated (the exact warnings -# depend on your compiler). Please consult the documentation of the -# deprecated API in order to know how to port your code away from it. -DEFINES += QT_DEPRECATED_WARNINGS - -# App version number -SOURCE_CONTROL_REPO_PLAIN = $$getenv(GITHUB_REPOSITORY) - -VERSION_TAG_PLAIN = $$getenv(GITHUB_REF) -COMMIT_HASH_PLAIN = $$getenv(GITHUB_SHA) - -!contains(VERSION_TAG_PLAIN, .*tags/v.*) { - message("Ref appears to not be a tag (Value: $$VERSION_TAG_PLAIN). Using non-version instead.") - VERSION_TAG_PLAIN = v0.0.0-development -} - -equals(COMMIT_HASH_PLAIN, "") { - message("commit hash not specified. Please ensure GITHUB_SHA environment variable is set.") - COMMIT_HASH_PLAIN = Unknown -} - -equals(SOURCE_CONTROL_REPO_PLAIN, "") { - message("Source control repo not specified. Please ensure GITHUB_REPOSITORY environment variable is set.") -} - - -VERSION_TAG = \\\"$$VERSION_TAG_PLAIN\\\" -COMMIT_HASH = \\\"$$COMMIT_HASH_PLAIN\\\" -SOURCE_CONTROL_REPO = \\\"$$SOURCE_CONTROL_REPO_PLAIN\\\" - -message(Building with version: [$$VERSION_TAG]; Hash: [$$COMMIT_HASH]; Source Control: [$$SOURCE_CONTROL_REPO]) - -DEFINES += "VERSION_TAG=$$VERSION_TAG" \ - "COMMIT_HASH=$$COMMIT_HASH" \ - "SOURCE_CONTROL_REPO=$$SOURCE_CONTROL_REPO" - -INCLUDEPATH += src - -SOURCES += \ - src/components/aspectratio_pixmap_label/aspectratiopixmaplabel.cpp \ - src/components/aspectratio_pixmap_label/imageview.cpp \ - src/components/code_editor/codeblockview.cpp \ - src/components/code_editor/codeeditor.cpp \ - src/components/custom_keyseq_edit/singlestrokekeysequenceedit.cpp \ - src/components/error_view/errorview.cpp \ - src/components/evidence_editor/evidenceeditor.cpp \ - src/components/evidencepreview.cpp \ - src/components/flow_layout/flowlayout.cpp \ - src/components/loading/qprogressindicator.cpp \ - src/components/loading_button/loadingbutton.cpp \ - src/components/tagging/tag_cache/tagcache.cpp \ - src/components/tagging/tag_cache/tagcacheitem.cpp \ - src/components/tagging/tageditor.cpp \ - src/components/tagging/tagview.cpp \ - src/components/tagging/tagwidget.cpp \ - src/db/databaseconnection.cpp \ - src/forms/add_operation/createoperation.cpp \ - src/forms/evidence_filter/evidencefilter.cpp \ - src/forms/evidence_filter/evidencefilterform.cpp \ - src/forms/getinfo/getinfo.cpp \ - src/forms/porting/porting_dialog.cpp \ - src/helpers/clipboard/clipboardhelper.cpp \ - src/helpers/hotkeys/uglobalhotkeys.cpp \ - src/helpers/hotkeys/ukeysequence.cpp \ - src/models/codeblock.cpp \ - src/helpers/multipartparser.cpp \ - src/hotkeymanager.cpp \ - src/main.cpp \ - src/porting/system_manifest.cpp \ - src/traymanager.cpp \ - src/helpers/screenshot.cpp \ - src/helpers/stopreply.cpp \ - src/forms/credits/credits.cpp \ - src/forms/evidence/evidencemanager.cpp \ - src/forms/settings/settings.cpp - -HEADERS += \ - src/components/aspectratio_pixmap_label/aspectratiopixmaplabel.h \ - src/components/aspectratio_pixmap_label/imageview.h \ - src/components/code_editor/codeblockview.h \ - src/components/code_editor/codeeditor.h \ - src/components/custom_keyseq_edit/singlestrokekeysequenceedit.h \ - src/components/error_view/errorview.h \ - src/components/evidence_editor/deleteevidenceresponse.h \ - src/components/evidence_editor/evidenceeditor.h \ - src/components/evidence_editor/saveevidenceresponse.h \ - src/components/evidencepreview.h \ - src/components/flow_layout/flowlayout.h \ - src/components/loading/qprogressindicator.h \ - src/components/loading_button/loadingbutton.h \ - src/components/tagging/tag_cache/tagcache.h \ - src/components/tagging/tag_cache/tagcacheitem.h \ - src/components/tagging/tageditor.h \ - src/components/tagging/tagginglineediteventfilter.h \ - src/components/tagging/tagview.h \ - src/components/tagging/tagwidget.h \ - src/db/databaseconnection.h \ - src/db/query_result.h \ - src/dtos/github_release.h \ - src/dtos/checkConnection.h \ - src/exceptions/databaseerr.h \ - src/exceptions/fileerror.h \ - src/forms/add_operation/createoperation.h \ - src/forms/evidence_filter/evidencefilter.h \ - src/forms/evidence_filter/evidencefilterform.h \ - src/forms/getinfo/getinfo.h \ - src/forms/porting/porting_dialog.h \ - src/helpers/clipboard/clipboardhelper.h \ - src/helpers/constants.h \ - src/helpers/hotkeys/hotkeymap.h \ - src/helpers/hotkeys/uglobal.h \ - src/helpers/hotkeys/uglobalhotkeys.h \ - src/helpers/hotkeys/ukeysequence.h \ - src/helpers/request_builder.h \ - src/helpers/system_helpers.h \ - src/helpers/ui_helpers.h \ - src/models/codeblock.h \ - src/helpers/file_helpers.h \ - src/helpers/http_status.h \ - src/hotkeymanager.h \ - src/models/evidence.h \ - src/models/tag.h \ - src/porting/evidence_manifest.h \ - src/porting/system_manifest.h \ - src/porting/system_porting_options.h \ - src/traymanager.h \ - src/appconfig.h \ - src/appsettings.h \ - src/helpers/jsonhelpers.h \ - src/helpers/multipartparser.h \ - src/helpers/netman.h \ - src/helpers/screenshot.h \ - src/helpers/stopreply.h \ - src/dtos/tag.h \ - src/dtos/operation.h \ - src/forms/credits/credits.h \ - src/forms/evidence/evidencemanager.h \ - src/forms/settings/settings.h - -linux: LIBS += -lxcb -lxcb-keysyms -mac: LIBS += -framework Carbon - -windows { - *-g++* { - LIBS += -luser32 - } - *-msvc* { - LIBS += user32.lib - } -} - -macx { - ICON = icons/ashirt.icns - QMAKE_TARGET_BUNDLE_PREFIX = com.theparanoids -} -unix { - isEmpty(PREFIX) { - PREFIX = /usr - } - - isEmpty(BINDIR) { - BINDIR = $$PREFIX/bin - } - - isEmpty(DATADIR) { - DATADIR = $$PREFIX/share - } - message("INSTROOT: |$$INSTROOT|") - message("PREFIX: |$$PREFIX|") - - INSTALLS += target desktop icons - target.path = $$BINDIR - - # Create appimage structure - desktop.path = $$DATADIR/applications - desktop.files += linux/ashirt.desktop - icons.path = $$DATADIR/icons/hicolor - icons.files += linux/icons/* -} - -# Default rules for deployment. -qnx: target.path = /tmp/$${TARGET}/bin -# else: unix:!android: target.path = /opt/$${TARGET}/bin -!isEmpty(target.path): INSTALLS += target - -RESOURCES += \ - res_migrations.qrc \ - res_icons.qrc diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..756df6a --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,91 @@ +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +add_subdirectory(components) +add_subdirectory(db) +add_subdirectory(dtos) +add_subdirectory(exceptions) +add_subdirectory(forms) +add_subdirectory(helpers) +add_subdirectory(models) +add_subdirectory(porting) + +set(ASHIRT_SOURCES + appconfig.h + appsettings.h + hotkeymanager.cpp hotkeymanager.h + main.cpp + traymanager.cpp traymanager.h + ${CMAKE_SOURCE_DIR}/icons/res_icons.qrc + ) +## Locate the deploy app for later use +get_target_property(qmake_executable Qt${QT_DEFAULT_MAJOR_VERSION}::qmake IMPORTED_LOCATION) +get_filename_component(_qt_bin_dir "${qmake_executable}" DIRECTORY) +if(WIN32 OR APPLE) + if(WIN32) + set(deployqtapp windeployqt) + elseif(APPLE) + set(deployqtapp macdeployqt) + endif() + find_program(PLATFORMDEPLOYQT ${deployqtapp} HINTS "${_qt_bin_dir}") +endif() + +if(APPLE) + set(ASHIRT_PLATFORM_EX_SRC ${CMAKE_SOURCE_DIR}/deploy/ashirt.icns) + set_source_files_properties(${ASHIRT_PLATFORM_EX_SRC} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") +elseif(WIN32) + set(CMAKE_PREFIX_PATH $ENV{QTDIR}) + configure_file(${CMAKE_SOURCE_DIR}/deploy/ashirt.rc.in ${CMAKE_BINARY_DIR}/deploy/ashirt.rc @ONLY) + set(ASHIRT_PLATFORM_EX_SRC ${CMAKE_BINARY_DIR}/deploy/ashirt.rc) +endif() + +#MACOSX_BUNDLE Make it a bundle on Mac OS +#WIN32 Its a "GUI" app on win32 +add_executable(ashirt MACOSX_BUNDLE WIN32 ${ASHIRT_SOURCES} ${ASHIRT_PLATFORM_EX_SRC}) +set_target_properties(ashirt PROPERTIES + MACOSX_BUNDLE_GUI_IDENTIFIER "com.theparanoids.ashirt" + MACOSX_BUNDLE_BUNDLE_NAME "ashirt" + MACOSX_BUNDLE_ICON_FILE ashirt.icns + MACOSX_BUNDLE_BUNDLE_VERSION ${CMAKE_PROJECT_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING "${CMAKE_PROJECT_VERSION}" +) + +target_link_libraries ( ashirt + PRIVATE + ASHIRT::COMPONENTS + ASHIRT::HELPERS + ASHIRT::DTOS + ASHIRT::EXCEPTIONS + ASHIRT::FORMS + ASHIRT::PORTING +) + +if(APPLE) + if(NOTARIZE_AS STREQUAL "") + add_custom_command( + TARGET ashirt POST_BUILD + COMMAND ${PLATFORMDEPLOYQT} ${CMAKE_CURRENT_BINARY_DIR}/ashirt.app + ) + else() + message(STATUS "Sign Bundle As: ${NOTARIZE_AS}") + add_custom_command( + TARGET ashirt POST_BUILD + COMMAND ${PLATFORMDEPLOYQT} ${CMAKE_CURRENT_BINARY_DIR}/ashirt.app -sign-for-notarization=${NOTARIZE_AS} + ) + endif() + install(TARGETS ashirt BUNDLE DESTINATION .) +elseif(UNIX AND NOT APPLE) + install(TARGETS ashirt BUNDLE DESTINATION bin) +elseif(WIN32) + install(TARGETS ashirt RUNTIME DESTINATION .) + if(${QT_DEFAULT_MAJOR_VERSION} MATCHES "5") + add_custom_command( + TARGET ashirt POST_BUILD + COMMAND ${PLATFORMDEPLOYQT} $ --no-compiler-runtime --no-system-d3d-compiler --no-quick-import --no-translations --no-angle --no-webkit2 --no-opengl-sw --dir ${CMAKE_BINARY_DIR}/qtDeploy --plugindir ${CMAKE_BINARY_DIR}/qtDeploy/plugins + ) + else() + add_custom_command( + TARGET ashirt POST_BUILD + COMMAND ${PLATFORMDEPLOYQT} $ --no-compiler-runtime --no-system-d3d-compiler --no-quick-import --no-translations --no-opengl-sw --dir ${CMAKE_BINARY_DIR}/qtDeploy --plugindir ${CMAKE_BINARY_DIR}/qtDeploy/plugins + ) + endif() +endif() diff --git a/src/components/CMakeLists.txt b/src/components/CMakeLists.txt new file mode 100644 index 0000000..f4ec978 --- /dev/null +++ b/src/components/CMakeLists.txt @@ -0,0 +1,38 @@ + +add_library (COMPONENTS STATIC + aspectratio_pixmap_label/aspectratiopixmaplabel.cpp aspectratio_pixmap_label/aspectratiopixmaplabel.h + aspectratio_pixmap_label/imageview.cpp aspectratio_pixmap_label/imageview.h + code_editor/codeblockview.cpp code_editor/codeblockview.h + code_editor/codeeditor.cpp code_editor/codeeditor.h + custom_keyseq_edit/singlestrokekeysequenceedit.cpp custom_keyseq_edit/singlestrokekeysequenceedit.h + error_view/errorview.cpp error_view/errorview.h + evidence_editor/deleteevidenceresponse.h + evidence_editor/evidenceeditor.cpp evidence_editor/evidenceeditor.h + evidence_editor/saveevidenceresponse.h + evidencepreview.cpp evidencepreview.h + flow_layout/flowlayout.cpp flow_layout/flowlayout.h + loading/qprogressindicator.cpp loading/qprogressindicator.h + loading_button/loadingbutton.cpp loading_button/loadingbutton.h + tagging/tag_cache/tagcache.cpp tagging/tag_cache/tagcache.h + tagging/tag_cache/tagcacheitem.cpp tagging/tag_cache/tagcacheitem.h + tagging/tageditor.cpp tagging/tageditor.h + tagging/tagginglineediteventfilter.h + tagging/tagview.cpp tagging/tagview.h + tagging/tagwidget.cpp tagging/tagwidget.h +) + +add_library(ASHIRT::COMPONENTS ALIAS COMPONENTS) + +target_include_directories (COMPONENTS + PUBLIC + $ + $ + PRIVATE + ${CMAKE_SOURCE_DIR}/src +) + +target_link_libraries ( COMPONENTS PUBLIC + Qt::Widgets + Qt::Network + ASHIRT::DB +) diff --git a/src/db/CMakeLists.txt b/src/db/CMakeLists.txt new file mode 100644 index 0000000..69fbdf1 --- /dev/null +++ b/src/db/CMakeLists.txt @@ -0,0 +1,21 @@ + +add_library (DB STATIC + databaseconnection.cpp + databaseconnection.h + query_result.h + ${CMAKE_SOURCE_DIR}/migrations/res_migrations.qrc +) + +add_library(ASHIRT::DB ALIAS DB) + +target_include_directories (DB + PUBLIC + $ + $ + PRIVATE + ${CMAKE_SOURCE_DIR}/src +) + +target_link_libraries ( DB PUBLIC + Qt::Sql +) diff --git a/src/db/databaseconnection.h b/src/db/databaseconnection.h index 90c504d..7242084 100644 --- a/src/db/databaseconnection.h +++ b/src/db/databaseconnection.h @@ -15,7 +15,7 @@ #include "forms/evidence_filter/evidencefilter.h" #include "models/evidence.h" #include "helpers/constants.h" -#include "db/query_result.h" +#include "query_result.h" using FieldEncoderFunc = std::function; using RowDecoderFunc = std::function; diff --git a/src/dtos/CMakeLists.txt b/src/dtos/CMakeLists.txt new file mode 100644 index 0000000..faea90c --- /dev/null +++ b/src/dtos/CMakeLists.txt @@ -0,0 +1,21 @@ + +add_library (DTOS STATIC + checkConnection.h + github_release.h + operation.h + tag.h +) + +add_library(ASHIRT::DTOS ALIAS DTOS) + +target_include_directories (DTOS + PUBLIC + $ + $ +) + +target_link_libraries ( DTOS PUBLIC + ASHIRT::MODELS +) + + diff --git a/src/exceptions/CMakeLists.txt b/src/exceptions/CMakeLists.txt new file mode 100644 index 0000000..631be08 --- /dev/null +++ b/src/exceptions/CMakeLists.txt @@ -0,0 +1,19 @@ + +add_library (EXCEPTIONS STATIC + databaseerr.h + fileerror.h +) + +add_library(ASHIRT::EXCEPTIONS ALIAS EXCEPTIONS) + +target_include_directories (EXCEPTIONS + PUBLIC + $ + $ +) + +target_link_libraries ( EXCEPTIONS PUBLIC + Qt::Core +) + + diff --git a/src/forms/CMakeLists.txt b/src/forms/CMakeLists.txt new file mode 100644 index 0000000..5a2de6f --- /dev/null +++ b/src/forms/CMakeLists.txt @@ -0,0 +1,31 @@ + +add_library (FORMS STATIC + add_operation/createoperation.cpp add_operation/createoperation.h + credits/credits.cpp credits/credits.h + evidence/evidencemanager.cpp evidence/evidencemanager.h + evidence_filter/evidencefilter.cpp evidence_filter/evidencefilter.h + evidence_filter/evidencefilterform.cpp evidence_filter/evidencefilterform.h + getinfo/getinfo.cpp getinfo/getinfo.h + porting/porting_dialog.cpp porting/porting_dialog.h + settings/settings.cpp settings/settings.h +) + +add_library(ASHIRT::FORMS ALIAS FORMS) + +target_include_directories (FORMS + PUBLIC + $ + $ + PRIVATE + ${CMAKE_SOURCE_DIR}/src +) + +target_link_libraries ( FORMS + PUBLIC + Qt::Gui + Qt::Widgets + Qt::Sql + ASHIRT::HELPERS + ASHIRT::MODELS + ASHIRT::COMPONENTS +) diff --git a/src/forms/evidence_filter/evidencefilterform.h b/src/forms/evidence_filter/evidencefilterform.h index dc5d916..f42bbba 100644 --- a/src/forms/evidence_filter/evidencefilterform.h +++ b/src/forms/evidence_filter/evidencefilterform.h @@ -14,8 +14,8 @@ #include #include -#include "src/db/databaseconnection.h" -#include "src/dtos/operation.h" +#include "db/databaseconnection.h" +#include "dtos/operation.h" class EvidenceFilterForm : public QDialog { Q_OBJECT diff --git a/src/helpers/CMakeLists.txt b/src/helpers/CMakeLists.txt new file mode 100644 index 0000000..a06a172 --- /dev/null +++ b/src/helpers/CMakeLists.txt @@ -0,0 +1,50 @@ + +include_directories(${Qt${QT_DEFAULT_MAJOR_VERSION}Gui_PRIVATE_INCLUDE_DIRS}/qpa) + +if(APPLE) + find_library(CARBON_LIBRARY Carbon) +endif() + +add_library (HELPERS STATIC + constants.h + file_helpers.h + http_status.h + jsonhelpers.h + multipartparser.cpp multipartparser.h + netman.h + request_builder.h + screenshot.cpp screenshot.h + stopreply.cpp stopreply.h + system_helpers.h + ui_helpers.h + clipboard/clipboardhelper.cpp clipboard/clipboardhelper.h + hotkeys/hotkeymap.h + hotkeys/uglobalhotkeys.cpp hotkeys/uglobalhotkeys.h + hotkeys/ukeysequence.cpp hotkeys/ukeysequence.h +) + +add_library(ASHIRT::HELPERS ALIAS HELPERS) + +target_include_directories (HELPERS + PUBLIC + $ + $ + PRIVATE + ${CMAKE_SOURCE_DIR}/src +) + +target_link_libraries ( HELPERS + PUBLIC + Qt::Network + Qt::Widgets + Qt::Gui + Qt::GuiPrivate +) + +if(APPLE) + target_link_libraries(HELPERS PRIVATE ${CARBON_LIBRARY}) +elseif(UNIX AND NOT APPLE) + target_link_libraries(HELPERS PRIVATE xcb xcb-keysyms pthread) +elseif(WIN32) + target_link_libraries(HELPERS PRIVATE user32) +endif() diff --git a/src/models/CMakeLists.txt b/src/models/CMakeLists.txt new file mode 100644 index 0000000..27aba17 --- /dev/null +++ b/src/models/CMakeLists.txt @@ -0,0 +1,24 @@ + +add_library (MODELS STATIC + codeblock.cpp codeblock.h + evidence.h + tag.h +) + +add_library(ASHIRT::MODELS ALIAS MODELS) + +target_include_directories (MODELS + PUBLIC + $ + $ + PRIVATE + ${CMAKE_SOURCE_DIR}/src +) + +target_link_libraries ( MODELS PUBLIC + Qt::Core +) + + + + diff --git a/src/porting/CMakeLists.txt b/src/porting/CMakeLists.txt new file mode 100644 index 0000000..788a14a --- /dev/null +++ b/src/porting/CMakeLists.txt @@ -0,0 +1,25 @@ + +add_library (PORTING STATIC + evidence_manifest.h + system_manifest.cpp system_manifest.h + system_porting_options.h +) + +add_library(ASHIRT::PORTING ALIAS PORTING) + +target_include_directories (PORTING + PUBLIC + $ + $ + PRIVATE + ${CMAKE_SOURCE_DIR}/src +) + +target_link_libraries ( PORTING PUBLIC + ASHIRT::DB + ASHIRT::MODELS +) + + + +