To build and run this project, you will need:
- Git
- CMake (version 3.22 or higher recommended)
- A C++17 compliant compiler (e.g., GCC, Clang, MSVC)
This project uses CMake Presets (CMakePresets.json) to manage all build configurations. This is the recommended way to configure and build.
The following presets are available:
debug: Compiles in Debug mode with tests enabled. Ideal for development.release: Compiles in Release mode with optimizations and without tests. Ideal for production/distribution.
-
Clone the repository:
git clone <repository-url> cd <repository-name>
-
Configure the project using a preset: This step only needs to be done once, or when you want to switch presets.
# To configure a debug build with tests cmake --preset debug # OR # To configure a release build without tests cmake --preset release
This will generate a
build/debugorbuild/releasedirectory with the necessary build files. -
Build the project:
# To build the active debug configuration cmake --build --preset debug # OR # To build the active release configuration cmake --build --preset release
The executable (PG_Project) will be located in the bin subdirectory of your build folder.
# Example for the debug build
./build/debug/bin/PG_ProjectTests are only available in the debug preset.
-
Make sure you have configured and built the project using the
debugpreset. -
Run from the command line:
# Run all tests ctest --preset test # Run tests with detailed output ctest --preset test --verbose
This project includes rules to create a clean, distributable package in a local install directory. This is useful for testing the final deployment or for packaging your application.
-
First, configure and build the project (e.g., using the
releasepreset). -
Run the install command from the root directory of the project:
# This will install the release build into the `install/release` directory cmake --install build/releaseThe
install/releasefolder will then contain thePG_Projectexecutable and thelibPrism.so(orPrism.dll) library, ready to be run together.
This project uses clang-format to maintain a consistent code style across the entire codebase. A configuration file (.clang-format) is included in the project root to define the style rules.
Before committing any changes, please format your code.
You must have clang-format installed on your system. On Debian/Ubuntu-based systems, you can install it with:
sudo apt install clang-formatTo format all .hpp and .cpp files in the src, libs, and tests directories at once, run the following command from the root directory of the project:
find src demo tests -name "*.cpp" -o -name "*.hpp" | xargs clang-format -iWhat this command does:
find src libs tests ...: Searches for files within thesrc,libs, andtestsfolders.-name "*.cpp" -o -name "*.hpp": Finds files that end in.cppOR.hpp.| xargs clang-format -i: For every file found, it runs the commandclang-format -ito format it in-place.
The project is organized into three main components: the core Prism library, a prism_demo application that uses the library, and a runTests executable for unit testing. The dependencies are managed by CMake and are visualized below.
graph TD;
subgraph "External Dependencies"
YAML_CPP["📚 yaml-cpp"];
GTEST["🧪 GoogleTest"];
end
subgraph "Prism Project"
DEMO["💻 prism_demo (Demo App)"];
PRISM_LIB["🎨 Prism (Library)"];
TESTS["⚙️ runTests (Unit Tests)"];
end
DEMO --> PRISM_LIB;
TESTS --> PRISM_LIB;
TESTS --> GTEST;
PRISM_LIB --> YAML_CPP;
style DEMO fill:#cce5ff,stroke:#333,stroke-width:2px;
style TESTS fill:#d5e8d4,stroke:#333,stroke-width:2px;
style PRISM_LIB fill:#ffcce5,stroke:#333,stroke-width:2px;
style YAML_CPP fill:#fff2cc,stroke:#333,stroke-width:2px;
style GTEST fill:#fff2cc,stroke:#333,stroke-width:2px;
For a more detailed breakdown of the internal library dependencies, please see the ARCHITECTURE.md file.