Skip to content

Commit

Permalink
Merge pull request #2 from kolod/debian
Browse files Browse the repository at this point in the history
Debian
  • Loading branch information
kolod authored Jun 5, 2024
2 parents 3719d88 + 5822220 commit 54b865f
Show file tree
Hide file tree
Showing 11 changed files with 3,196 additions and 99 deletions.
146 changes: 75 additions & 71 deletions gui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
cmake_minimum_required(VERSION 3.5)

project(ppm-generator VERSION 1.0.1 LANGUAGES CXX)
project(ppm-generator VERSION 1.1.0 LANGUAGES CXX)

set(PROJECT_NAME "Arduino-PPM-Generator")
set(PROJECT_DESCRIPTION "The GUI for the Arduino Nano sketch that allows you to generate a PPM signal.")
set(PROJECT_AUTHOR "Oleksandr Kolodkin")
set(PROJECT_URL "https://github.com/kolod/Arduino-PPM-Generator")
set(PROJECT_VERSION_MAJOR 1)
set(PROJECT_VERSION_MINOR 0)
set(PROJECT_VERSION_PATCH 1)
set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
Expand All @@ -18,93 +14,101 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 11)

#if(ANDROID)
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
# if (ANDROID_ABI STREQUAL "armeabi-v7a")
# set(ANDROID_EXTRA_LIBS
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so
# )
# endif()
#endif()

find_package(QT
NAMES Qt5 Qt6
REQUIRED COMPONENTS Widgets Charts SerialBus SerialPort LinguistTools
)

find_package(Qt${QT_VERSION_MAJOR}
REQUIRED COMPONENTS Widgets Charts SerialBus SerialPort LinguistTools
)
find_package(Qt6 REQUIRED COMPONENTS Widgets Charts SerialBus SerialPort LinguistTools)

set(TS_FILES
ppm_ua.ts
ppm_ru.ts
ppm_de.ts
translations/ppm_uk.ts
translations/ppm_ru.ts
translations/ppm_de.ts
)

set_source_files_properties(${TS_FILES}
PROPERTIES OUTPUT_LOCATION
"${CMAKE_CURRENT_SOURCE_DIR}/i18n"
)
set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/translations")

set(QRC_FILES
resources.qrc
translations.qrc
)
set(QRC_FILES resources.qrc)
set(RCC_FILES ${CMAKE_CURRENT_BINARY_DIR}/resources.rcc)

set(OTHER_FILES
README.md
LICENSE
README.md
BUILD.md
LICENSE
)

set(PROJECT_SOURCES
loader.cpp
loader.h
main.cpp
mainwindow.cpp
mainwindow.h
ppm.cpp
ppm.h
${TS_FILES}
${APP_WINDOWS_RESOURCE}
loader.cpp
loader.h
main.cpp
mainwindow.cpp
mainwindow.h
ppm.cpp
ppm.h
${TS_FILES}
${QRC_FILES}
# ${APP_WINDOWS_RESOURCE}
)

if(WIN32)
list(APPEND PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/resources.rc")
list(APPEND PROJECT_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/resources.rc")
endif()

if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_binary_resources(resources ${QRC_FILES})
qt_add_resources(PROJECT_SOURCES ${QRC_FILES})
qt_add_executable(ppm-generator MANUAL_FINALIZATION ${PROJECT_SOURCES})
qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
else()
qt5_add_binary_resources(resources ${QRC_FILES})
qt5_add_resources(PROJECT_SOURCES ${QRC_FILES})
if(ANDROID)
add_library(ppm-generator SHARED ${PROJECT_SOURCES})
else()
add_executable(ppm-generator ${PROJECT_SOURCES})
endif()
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
endif()

add_dependencies(ppm-generator resources)
qt_add_executable(ppm-generator MANUAL_FINALIZATION ${PROJECT_SOURCES})
qt_add_lupdate(ppm-generator TS_FILES ${TS_FILES} OPTIONS -locations relative -no-obsolete)
qt_add_lrelease(ppm-generator TS_FILES ${TS_FILES} QM_FILES_OUTPUT_VARIABLE QM_FILES OPTIONS -compress -removeidentical)

target_link_libraries(ppm-generator PRIVATE
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Charts
Qt${QT_VERSION_MAJOR}::SerialBus
Qt${QT_VERSION_MAJOR}::SerialPort
Qt6::Widgets
Qt6::Charts
Qt6::SerialBus
Qt6::SerialPort
)

set_target_properties(ppm-generator PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER oleksandr.kolodkin.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE_GUI_IDENTIFIER oleksandr.kolodkin.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
)

if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(ppm-generator)
qt_finalize_executable(ppm-generator)
endif()

# Installation
if (WIN32)
install(TARGETS ppm-generator RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${VX_EXTRA_RESOURCE_FILES_RCC} DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${QM_FILES} DESTINATION "${CMAKE_INSTALL_BINDIR}/translations" OPTIONAL)

else()
include(GNUInstallDirs)
install(CODE "include(BundleUtilities) ")
install(TARGETS ppm-generator LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/ppm-generator/translations)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/com.github.kolod.ppm-generator.desktop DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/applications)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/com.github.kolod.ppm-generator.svg DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/scalable/apps)

# Debian package build
set(QT_MINIMUM_VERSION 6.4.2)
set(DEBIAN_PACKAGE_DEPENDS
"libqt6core6 (>=${QT_MINIMUM_VERSION}+dfsg)"
"libqt6gui6 (>=${QT_MINIMUM_VERSION}+dfsg)"
"libqt6widgets6 (>=${QT_MINIMUM_VERSION}+dfsg)"
"libqt6serialbus6 (>=${QT_MINIMUM_VERSION})"
"libqt6serialport6 (>=${QT_MINIMUM_VERSION})"
"libqt6charts6 (>=${QT_MINIMUM_VERSION})"
)

list(JOIN DEBIAN_PACKAGE_DEPENDS ", " CPACK_DEBIAN_PACKAGE_DEPENDS)

set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/kolod/Arduino-PPM-Generator")

set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/../LICENSE")
set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/../README.md")

set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Oleksandr Kolodkin <oleksandr.kolodkin@ukr.net>")
set(CPACK_DEBIAN_PACKAGE_SECTION "utils")
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64)
include(CPack)

endif()
10 changes: 10 additions & 0 deletions gui/data/com.github.kolod.ppm-generator-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions gui/data/com.github.kolod.ppm-generator.Devel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 54b865f

Please sign in to comment.