Build System & CMake Presets
Relevant source files
The following files were used as context for generating this wiki page:
The SSA Consulta Rapida Cpp project utilizes a modern CMake build system (minimum version 3.24) to manage its C++20 codebase. The system is designed to be cross-platform, supporting macOS, Linux (Debian), and Windows 11, with a heavy reliance on the Qt 6 framework and SQLite3.
The build architecture is modular, separating the application into static libraries before linking them into the final executable. It utilizes CMake Presets to standardize configuration, build, and test environments across different development and CI/CD stages.
Sources: CMakeLists.txt:1-5, README.md:1-10
Core Architecture and Targets
The build system defines four primary internal targets to ensure a strict separation of concerns, as mandated by the project's architectural rules.
Static Libraries
- ssa_core: Contains domain types, search parsers, and SQL builders. It has no dependencies on Qt or SQLite.
- ssa_infra: Handles persistence and infrastructure, linking against
ssa_core,Qt6::Core, and SQLite3. - ssa_presentation: Contains ViewModels and platform-specific logic, linking against
ssa_core,ssa_infra, and various Qt6 components.
Executable and QML Module
The main executable, ssa_consulta_rapida, is built using qt_add_executable and incorporates a QML module named SsaConsultaRapida. This module bundles the visual components and resources required for the desktop interface.
Sources: CMakeLists.txt:33-85, AGENTS.md:14-22
The diagram shows the dependency flow where the core library remains isolated from external frameworks, while the infrastructure and presentation layers build upon it.
Sources: CMakeLists.txt:33-98
CMake Presets
The project uses CMakePresets.json (version 6) to define standardized workflows for developers. There are two primary configurations: dev and release.
| Preset Name | Generator | Build Type | Test Support | Purpose |
|---|---|---|---|---|
| dev | Ninja | Debug | Enabled | Daily development, includes symbols and exported compile commands. |
| release | Ninja | Release | Enabled | Production builds, optimized for performance. |
Sources: CMakePresets.json:4-25
Workflow Commands
The project enforces specific validation steps through these presets:
- Configure:
cmake --preset dev - Build:
cmake --build --preset dev - Test:
ctest --preset dev --output-on-failure
Sources: AGENTS.md:48-51, README.md:35-39
Dependencies and Requirements
The build system requires several external components to be present on the host system. The CMakeLists.txt file uses find_package to locate these dependencies.
| Dependency | Required Version | Components |
|---|---|---|
| Qt 6 | 6.6+ | Concurrent, Core, Gui, Qml, Quick, QuickControls2, Sql, Test |
| SQLite3 | Latest | Required for the ssa_infra target |
| C++ Standard | 20 | Required for all CXX targets |
| CMake | 3.24+ | - |
Sources: CMakeLists.txt:1-12, README.md:12-25
SQLite Target Handling
The build system includes logic to handle various SQLite3 target naming conventions across different platforms, ensuring compatibility by creating an internal ssa_sqlite3 library if a standard target is not found.
Sources: CMakeLists.txt:14-26
Testing Infrastructure
When SSA_BUILD_TESTS is enabled (default is ON), the build system generates three distinct test executables:
- ssa_core_tests: Unit tests for domain and query logic using Catch2.
- ssa_integration_tests: Integration tests for the SQLite repository using Catch2.
- ssa_qt_presentation_tests: Smoke tests for the presentation layer using QtTest.
Sources: CMakeLists.txt:100-128, AGENTS.md:54-57
The testing flow integrates multiple testing frameworks (Catch2 and QtTest) into the unified CTest execution environment.
Sources: CMakeLists.txt:104-128
Packaging and Release
Packaging is platform-dependent and follows specific requirements for macOS, Linux, and Windows.
- macOS: Requires a release preset build, a QML smoke test against a fixture database, and the creation of a
.appbundle zip. - Windows: Utilizes
windeployqt.exeto gather dependencies into a deployment folder. - Linux: Targets AppImage or distribution-specific tarballs once CI stability is reached.
Sources: packaging/macos/README.md:5-11, README.md:65-67, packaging/linux/README.md:1-5
Build System Principles
The build system is governed by several architectural rules:
- No Qt in Core:
src/domainandsrc/querymust not depend on Qt. - Explicit Ownership: CMake targets use
STATIClibraries for internal modules to manage ownership and visibility clearly. - Strict Standard:
CMAKE_CXX_STANDARD_REQUIREDis set to ON to ensure C++20 compliance.
Sources: AGENTS.md:14-35, CMakeLists.txt:6-8
The build system successfully encapsulates complex multi-layer dependencies, providing developers with a streamlined interface via CMake Presets while maintaining strict architectural boundaries between domain logic and framework-dependent infrastructure.
Sources: README.md:80-87