-
Notifications
You must be signed in to change notification settings - Fork 0
CMake Integration
After installing serp-dev, SERP exposes a standard CMake package that your project's CMakeLists.txt can consume with find_package.
cmake_minimum_required(VERSION 3.16)
project(MyApp)
find_package(Serp REQUIRED)
add_executable(myapp main.cpp MyService.cpp)
target_link_libraries(myapp
Serp::core
Serp::command
Serp::logger_console
Serp::transport_dbus # or Serp::transport_grpc
)| Target | Contents | Notes |
|---|---|---|
Serp::core |
EventLoop, Service, Call, Property, Notification, Timer, Watchdog, Promise | Always required |
Serp::command |
Command, CommandQueue, CommandProcessor, LambdaCommand | Orchestration layer |
Serp::serp |
Aggregate: core + command + logger + default transport | Convenience target |
| Target | Contents | Notes |
|---|---|---|
Serp::logger |
LogManager, Logger, LogWriter, LogTag, Loggable | Logging core |
Serp::logger_console |
LogStrategyConsole | Console log output |
Serp::logger_file |
LogStrategyFile | File log output with rotation |
| Target | Contents | Notes |
|---|---|---|
Serp::transport |
Transport base interface | Included transitively by backend targets |
Serp::transport_dbus |
DBus backend (sdbus-c++) | Linux only |
Serp::transport_grpc |
gRPC backend | macOS and Linux |
| Target | Contents | Notes |
|---|---|---|
Serp::runtime |
Runtime debug registry | Do not include in production builds |
Serp::runtime_console |
RuntimeConsole REPL | Interactive runtime console |
Serp::runtime_dbus |
RuntimeDbus adapter | DBus-based runtime access |
Serp::runtime_grpc |
RuntimeGrpc adapter | gRPC-based runtime access |
| Target | Contents | Notes |
|---|---|---|
Serp::test_engine |
TestRunner, ReplyHolder | For SERP-based integration tests |
These SERP_BUILD_* options control which optional components are compiled into the installed package. Set them before find_package (if building SERP from source) or in your project's CMake configuration:
set(SERP_BUILD_TRANSPORT_DBUS ON)
set(SERP_BUILD_TRANSPORT_GRPC ON)
set(SERP_BUILD_LOGGER_CONSOLE ON)
set(SERP_BUILD_LOGGER_FILE ON)If you installed serp-dev via the package manager rather than building from source, all components are available and these options are not needed.
When writing a CMakeLists.txt for a service executable, link the transport that matches your deployment's transport: field:
Deployment transport
|
CMake target |
|---|---|
inprocess |
No transport target needed |
dbus |
Serp::transport_dbus |
grpc |
Serp::transport_grpc |
In a serpgen-managed project, you typically do not write deployment CMakeLists.txt files by hand. serpgen generate-workspace generates one per process:
gen/deployments/multiprocess_dbus/
car_service_app/
CMakeLists.txt # Generated — includes find_package(Serp) and links correct targets
climate_hal_app/
CMakeLists.txt
The generated files call find_package(Serp REQUIRED), define an executable from the generated main.cpp and your src/ files, and link the appropriate Serp::* targets based on the deployment spec.
The top-level project CMakeLists.txt includes the generated deployment directories:
add_subdirectory(gen/deployments/multiprocess_dbus/car_service_app)
add_subdirectory(gen/deployments/multiprocess_dbus/climate_hal_app)Do not hand-edit generated CMakeLists.txt files — they are regenerated on every serpgen run. If you need to customize the build, use variables or hooks in the top-level CMakeLists.txt that the generated files pick up.
SERP requires CMake 3.16 or later for target_link_libraries with modern imported targets and find_package config mode.
-
Generator Overview — how
serpgenproducesCMakeLists.txtfiles -
Generated Code Layout — where generated
CMakeLists.txtfiles live - Deployment Configurations — choosing the right transport and its CMake target
Getting Started
The Development Model
Architecture Language
Code Generator
- Generator Overview
- Generated Code Layout
- Deployment Configurations
- Lifecycle Backends
- CMake Integration
Framework Internals
- Core Concepts
- Services & Lifecycle
- Methods
- Properties
- Notifications
- Timers & Watchdog
- Promises & Async
- Streams
- Commands
- Logging
- Test Engine
- Transports
- Runtime & Debug Tools
VS Code Plugin
Examples