Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore Snap Supportu #351

Merged
merged 1 commit into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ apps:

parts:
packetsender:
plugin: qmake
plugin: cmake
source: https://github.com/dannagle/PacketSender.git
source-branch: master
qmake-project-file: src/PacketSenderSnap.pro
cmake-parameters:
- /root/project/src/snap
build-packages:
- build-essential
- qt6-base-dev
Expand Down
135 changes: 135 additions & 0 deletions src/snap/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
cmake_minimum_required(VERSION 3.16)
project(packetsender VERSION 1.0 LANGUAGES C CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(SRCROOT /root/project/src)

include_directories(${SRCROOT})

# Set up AUTOMOC and some sensible defaults for runtime execution
# When using Qt 6.3, you can replace the code block below with
# qt_standard_project_setup()
set(CMAKE_AUTOMOC ON)
include(GNUInstallDirs)
set(CMAKE_AUTOUIC ON)

find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Gui Network Widgets)

set(SOURCES
${SRCROOT}/about.cpp
${SRCROOT}/brucethepoodle.cpp
${SRCROOT}/cloudui.cpp
${SRCROOT}/irisandmarigold.cpp
${SRCROOT}/languagechooser.cpp
${SRCROOT}/main.cpp
${SRCROOT}/mainpacketreceiver.cpp
${SRCROOT}/mainwindow.cpp
${SRCROOT}/multicastsetup.cpp
${SRCROOT}/packet.cpp
${SRCROOT}/packetlogmodel.cpp
${SRCROOT}/packetnetwork.cpp
${SRCROOT}/panel.cpp
${SRCROOT}/panelgenerator.cpp
${SRCROOT}/persistentconnection.cpp
${SRCROOT}/persistenthttp.cpp
${SRCROOT}/postdatagen.cpp
${SRCROOT}/sendpacketbutton.cpp
${SRCROOT}/settings.cpp
${SRCROOT}/subnetcalc.cpp
${SRCROOT}/tcpthread.cpp
${SRCROOT}/threadedtcpserver.cpp
${SRCROOT}/udpflooding.cpp
${SRCROOT}/wakeonlan.cpp
)

set(HEADERS
${SRCROOT}/about.h
${SRCROOT}/brucethepoodle.h
${SRCROOT}/cloudui.h
${SRCROOT}/globals.h
${SRCROOT}/irisandmarigold.h
${SRCROOT}/languagechooser.h
${SRCROOT}/mainpacketreceiver.h
${SRCROOT}/mainwindow.h
${SRCROOT}/multicastsetup.h
${SRCROOT}/packet.h
${SRCROOT}/packetlogmodel.h
${SRCROOT}/packetnetwork.h
${SRCROOT}/panel.h
${SRCROOT}/panelgenerator.h
${SRCROOT}/persistenthttp.h
${SRCROOT}/postdatagen.h
${SRCROOT}/sendpacketbutton.h
${SRCROOT}/settings.h
${SRCROOT}/subnetcalc.h
${SRCROOT}/tcpthread.h
${SRCROOT}/threadedtcpserver.h
${SRCROOT}/udpflooding.h
${SRCROOT}/wakeonlan.h
)

set(FORMS
${SRCROOT}/about.ui
${SRCROOT}/brucethepoodle.ui
${SRCROOT}/cloudui.ui
${SRCROOT}/irisandmarigold.ui
${SRCROOT}/languagechooser.ui
${SRCROOT}/mainwindow.ui
${SRCROOT}/multicastsetup.ui
${SRCROOT}/panelgenerator.ui
${SRCROOT}/persistentconnection.ui
${SRCROOT}/persistenthttp.ui
${SRCROOT}/postdatagen.ui
${SRCROOT}/settings.ui
${SRCROOT}/subnetcalc.ui
${SRCROOT}/udpflooding.ui
${SRCROOT}/wakeonlan.ui

)

qt_add_resources(RESOURCES ${SRCROOT}/packetsender.qrc ${SRCROOT}/translations.qrc ${SRCROOT}/qdarkstyle/style.qrc)

set(CSS
${SRCROOT}/packetsender.css
)

qt_add_executable(packetsender
${SOURCES} ${HEADERS} ${FORMS} ${RESOURCES} ${CSS}
)

execute_process(COMMAND git -C ${SRCROOT}/ rev-parse --short HEAD OUTPUT_VARIABLE GIT_SHA COMMAND_ERROR_IS_FATAL ANY OUTPUT_STRIP_TRAILING_WHITESPACE)

target_compile_definitions(packetsender PRIVATE
GUI_BUILD
ISSNAP=1
QT_DISABLE_DEPRECATED_BEFORE=0x050F00
GIT_CURRENT_SHA1=\"${GIT_SHA}\"
)


target_link_libraries(packetsender PRIVATE
Qt::Core
Qt::Gui
Qt::Network
Qt::Widgets
)



target_compile_definitions(packetsender PRIVATE
_FORTIFY_SOURCE=2
)


install(TARGETS packetsender
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

install(FILES ${SRCROOT}/packetsender.desktop DESTINATION /usr/share/applications)
install(FILES ${SRCROOT}/packetsender.svg DESTINATION /usr/share/icons)

# Consider using qt_generate_deploy_app_script() for app deployment if
# the project can use Qt 6.3. In that case rerun qmake2cmake with
# --min-qt-version=6.3.
Loading