Migrazione al sistema di build CMake

This commit is contained in:
giuliof 2022-11-30 20:59:48 +01:00 committed by Gitea
parent a99bb04a03
commit 6a6eef57ef
5 changed files with 114 additions and 0 deletions

11
CMakeLists.txt Normal file
View File

@ -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)

View File

@ -1,6 +1,8 @@
#include "AboutWindow.h"
#include "ui_AboutWindow.h"
#include "version.h"
AboutWindow::AboutWindow(QWidget* parent) :
QDialog(parent),
ui(new Ui::AboutWindow)

58
argento/CMakeLists.txt Normal file
View File

@ -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)

1
argento/version.h.in Normal file
View File

@ -0,0 +1 @@
static const char* GOLEM_CURRENT_COMMIT = QT_STRINGIFY(${GIT_REPO_COMMIT});

42
nicolodi/CMakeLists.txt Normal file
View File

@ -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)