Migrazione a CMake #6

Merged
giuliof merged 4 commits from feat-cmake into master 2023-01-08 19:45:13 +00:00
5 changed files with 125 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)

63
argento/CMakeLists.txt Normal file
View File

@ -0,0 +1,63 @@
# 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)
# CMake packaging system
install(TARGETS argento RUNTIME DESTINATION bin)
set(CPACK_PACKAGE_CONTACT "GOLEM <golem@golem.linux.it>")
giuliof marked this conversation as resolved Outdated

Qui non ci andrebbe messo un indirizzo email?

Qui non ci andrebbe messo un indirizzo email?

Snì, l'altra sera l'ho fatto di fretta per farlo compilare, ma vorrebbe un contatto nella forma nome <mail@domain.tld>.
Metto la mail "da BOTtaglia" del golem?

Snì, l'altra sera l'ho fatto di fretta per farlo compilare, ma vorrebbe un contatto nella forma `nome <mail@domain.tld>`. Metto la mail "da BOTtaglia" del golem?

Sì.

Sì.
include (CPack)

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

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

48
nicolodi/CMakeLists.txt Normal file
View File

@ -0,0 +1,48 @@
# 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)
# CMake packaging system
install(TARGETS nicolodi RUNTIME DESTINATION bin)
set(CPACK_PACKAGE_CONTACT "GOLEM <golem@golem.linux.it>")
giuliof marked this conversation as resolved Outdated

Come sopra.

Come sopra.
include (CPack)