From 091e437414a5dbb1ff542661be744174eec9c898 Mon Sep 17 00:00:00 2001 From: giuliof Date: Wed, 30 Nov 2022 20:59:48 +0100 Subject: [PATCH 1/4] Migrazione al sistema di build CMake --- CMakeLists.txt | 11 ++++++++ argento/AboutWindow.cpp | 2 ++ argento/CMakeLists.txt | 58 +++++++++++++++++++++++++++++++++++++++++ argento/version.h.in | 1 + nicolodi/CMakeLists.txt | 42 +++++++++++++++++++++++++++++ 5 files changed, 114 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 argento/CMakeLists.txt create mode 100644 argento/version.h.in create mode 100644 nicolodi/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..20bb56b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required (VERSION 3.7.2 FATAL_ERROR) + +project (gestionale + LANGUAGES CXX + ) + +# Administrator frontend +add_subdirectory (argento) + +# Thin client interface +add_subdirectory (nicolodi) diff --git a/argento/AboutWindow.cpp b/argento/AboutWindow.cpp index ed4b7a7..730fc34 100644 --- a/argento/AboutWindow.cpp +++ b/argento/AboutWindow.cpp @@ -1,6 +1,8 @@ #include "AboutWindow.h" #include "ui_AboutWindow.h" +#include "version.h" + AboutWindow::AboutWindow(QWidget* parent) : QDialog(parent), ui(new Ui::AboutWindow) diff --git a/argento/CMakeLists.txt b/argento/CMakeLists.txt new file mode 100644 index 0000000..8a20da2 --- /dev/null +++ b/argento/CMakeLists.txt @@ -0,0 +1,58 @@ +# Set C++ standards +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Qt: add dependencies to needed components +find_package(Qt5 COMPONENTS Core Widgets Sql REQUIRED) + +# Qt: Automatically handle moc, .rc and .ui files. +# Search for includes in source and binary directory, so that CMake cand find +# Qt intermediate files +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +# List of C++ sources for current executable +set (argento_CXXSRCS + EditWindow.cpp + main.cpp + MainWindow.cpp + status.cpp + fullQuery.cpp + SociListTab.cpp + RenewalTab.cpp + AboutWindow.cpp + ) + +# Qt: list of .ui sources for current executable +set (argento_UISRCS + MainWindow.ui + EditWindow.ui + SociListTab.ui + RenewalTab.ui + AboutWindow.ui + ) + +# Qt: list of resource files +qt5_add_resources (argento_RESOURCES_RCC + ${CMAKE_CURRENT_SOURCE_DIR}/resources.qrc + ) + +# Qt: generate ui_*.h files from *.ui +qt5_wrap_ui (argento_GENUISRCS ${argento_UISRCS}) + +# Version generation: store git output in GIT_REPO_COMMIT, then generate +# version.h +execute_process(COMMAND git describe --tags --always OUTPUT_VARIABLE GIT_REPO_COMMIT) +configure_file("version.h.in" "version.h") + +# Dependencies mashup to generate the executable +add_executable (argento + ${argento_CXXSRCS} + ${argento_GENUISRCS} + ${argento_RESOURCES_RCC} + ) + +# Qt: link needed libraries +target_link_libraries(argento Qt5::Widgets Qt5::Sql) diff --git a/argento/version.h.in b/argento/version.h.in new file mode 100644 index 0000000..76cac38 --- /dev/null +++ b/argento/version.h.in @@ -0,0 +1 @@ +static const char* GOLEM_CURRENT_COMMIT = QT_STRINGIFY(${GIT_REPO_COMMIT}); diff --git a/nicolodi/CMakeLists.txt b/nicolodi/CMakeLists.txt new file mode 100644 index 0000000..39b0e49 --- /dev/null +++ b/nicolodi/CMakeLists.txt @@ -0,0 +1,42 @@ +# Set C++ standards +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Qt: add dependencies to needed components +find_package(Qt5 COMPONENTS Core Widgets Sql REQUIRED) + +# Qt: Automatically handle moc, .rc and .ui files. +# Search for includes in source and binary directory, so that CMake cand find +# Qt intermediate files +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +# List of C++ sources for current executable +set (nicolodi_CXXSRCS + EditWindow.cpp + Pin.cpp + db.cpp + fullQuery.cpp + main.cpp + status.cpp + ) + +# Qt: list of .ui sources for current executable +set (nicolodi_UISRCS + EditWindow.ui + Pin.ui + ) + +# Qt: generate ui_*.h files from *.ui +qt5_wrap_ui (nicolodi_GENUISRCS ${nicolodi_UISRCS}) + +# Dependencies mashup to generate the executable +add_executable (nicolodi + ${nicolodi_CXXSRCS} + ${nicolodi_GENUISRCS} + ) + +# Qt: link needed libraries +target_link_libraries(nicolodi Qt5::Widgets Qt5::Sql) -- 2.40.1 From 64c0ddfe6fdd3adc27faf57bffe97d86f5f45b93 Mon Sep 17 00:00:00 2001 From: giuliof Date: Wed, 30 Nov 2022 21:04:49 +0100 Subject: [PATCH 2/4] Aggiunto packaging automatizzato tramite CPack --- argento/CMakeLists.txt | 4 ++++ nicolodi/CMakeLists.txt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/argento/CMakeLists.txt b/argento/CMakeLists.txt index 8a20da2..ab3c673 100644 --- a/argento/CMakeLists.txt +++ b/argento/CMakeLists.txt @@ -56,3 +56,7 @@ add_executable (argento # Qt: link needed libraries target_link_libraries(argento Qt5::Widgets Qt5::Sql) + +# CMake packaging system +install(TARGETS argento RUNTIME DESTINATION bin) +include (CPack) diff --git a/nicolodi/CMakeLists.txt b/nicolodi/CMakeLists.txt index 39b0e49..7fec3a0 100644 --- a/nicolodi/CMakeLists.txt +++ b/nicolodi/CMakeLists.txt @@ -40,3 +40,7 @@ add_executable (nicolodi # Qt: link needed libraries target_link_libraries(nicolodi Qt5::Widgets Qt5::Sql) + +# CMake packaging system +install(TARGETS nicolodi RUNTIME DESTINATION bin) +include (CPack) -- 2.40.1 From 74850d2ce82119ca692025879136a6f952d038e0 Mon Sep 17 00:00:00 2001 From: giuliof Date: Tue, 3 Jan 2023 21:34:35 +0100 Subject: [PATCH 3/4] CPack: aggiunto mantainer mancante --- argento/CMakeLists.txt | 1 + nicolodi/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/argento/CMakeLists.txt b/argento/CMakeLists.txt index ab3c673..67ac13c 100644 --- a/argento/CMakeLists.txt +++ b/argento/CMakeLists.txt @@ -59,4 +59,5 @@ target_link_libraries(argento Qt5::Widgets Qt5::Sql) # CMake packaging system install(TARGETS argento RUNTIME DESTINATION bin) +set(CPACK_PACKAGE_CONTACT "GOLEM") include (CPack) diff --git a/nicolodi/CMakeLists.txt b/nicolodi/CMakeLists.txt index 7fec3a0..3738ad3 100644 --- a/nicolodi/CMakeLists.txt +++ b/nicolodi/CMakeLists.txt @@ -43,4 +43,5 @@ target_link_libraries(nicolodi Qt5::Widgets Qt5::Sql) # CMake packaging system install(TARGETS nicolodi RUNTIME DESTINATION bin) +set(CPACK_PACKAGE_CONTACT "GOLEM") include (CPack) -- 2.40.1 From ae54227a146ae7bdb447ccf3dc1ce1a257748e4f Mon Sep 17 00:00:00 2001 From: giuliof Date: Fri, 6 Jan 2023 21:17:52 +0100 Subject: [PATCH 4/4] Corretta CPACK_PACKAGE_CONTACT --- argento/CMakeLists.txt | 2 +- nicolodi/CMakeLists.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/argento/CMakeLists.txt b/argento/CMakeLists.txt index 67ac13c..3bb968f 100644 --- a/argento/CMakeLists.txt +++ b/argento/CMakeLists.txt @@ -59,5 +59,5 @@ target_link_libraries(argento Qt5::Widgets Qt5::Sql) # CMake packaging system install(TARGETS argento RUNTIME DESTINATION bin) -set(CPACK_PACKAGE_CONTACT "GOLEM") +set(CPACK_PACKAGE_CONTACT "GOLEM ") include (CPack) diff --git a/nicolodi/CMakeLists.txt b/nicolodi/CMakeLists.txt index 3738ad3..1c07589 100644 --- a/nicolodi/CMakeLists.txt +++ b/nicolodi/CMakeLists.txt @@ -43,5 +43,6 @@ target_link_libraries(nicolodi Qt5::Widgets Qt5::Sql) # CMake packaging system install(TARGETS nicolodi RUNTIME DESTINATION bin) -set(CPACK_PACKAGE_CONTACT "GOLEM") +set(CPACK_PACKAGE_CONTACT "GOLEM ") include (CPack) + -- 2.40.1