2025-02-18 04:10:35 +00:00
|
|
|
cmake_minimum_required(VERSION 3.22)
|
|
|
|
project(dpm)
|
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
|
|
|
|
# Create modules directory
|
|
|
|
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/modules)
|
|
|
|
|
2025-03-08 22:44:23 +00:00
|
|
|
# Main DPM executable
|
2025-03-03 08:56:51 +00:00
|
|
|
add_executable(
|
|
|
|
dpm
|
2025-02-18 04:10:35 +00:00
|
|
|
src/dpm.cpp
|
|
|
|
src/ModuleLoader.cpp
|
|
|
|
src/dpm_interface.cpp
|
2025-02-27 06:57:21 +00:00
|
|
|
src/error.cpp
|
|
|
|
src/dpm_interface_helpers.cpp
|
|
|
|
src/handlers.cpp
|
2025-03-02 01:57:38 +00:00
|
|
|
src/module_interface.cpp
|
2025-03-02 05:29:26 +00:00
|
|
|
src/ConfigManager.cpp
|
2025-03-03 08:56:51 +00:00
|
|
|
src/Logger.cpp
|
2025-02-18 04:10:35 +00:00
|
|
|
)
|
|
|
|
|
2025-03-08 22:44:23 +00:00
|
|
|
# Include directories for the main executable
|
2025-02-18 04:10:35 +00:00
|
|
|
target_include_directories(dpm PRIVATE include)
|
|
|
|
target_link_libraries(dpm dl)
|
|
|
|
|
2025-03-02 01:57:38 +00:00
|
|
|
# Export symbols for dynamic loading
|
|
|
|
target_link_options(dpm PRIVATE -rdynamic)
|
|
|
|
|
2025-03-09 03:31:39 +00:00
|
|
|
# Add the info module by including its CMakeLists.txt
|
|
|
|
add_subdirectory(modules/info)
|
2025-03-02 06:08:07 +00:00
|
|
|
|
2025-03-09 03:31:39 +00:00
|
|
|
# Create a custom target for building all modules
|
|
|
|
add_custom_target(modules DEPENDS info)
|
2025-03-08 09:56:07 +00:00
|
|
|
|
2025-03-02 06:08:07 +00:00
|
|
|
# Installation rules
|
|
|
|
install(TARGETS dpm DESTINATION bin)
|
|
|
|
install(DIRECTORY DESTINATION /etc/dpm/conf.d)
|
2025-03-03 08:56:51 +00:00
|
|
|
install(
|
|
|
|
DIRECTORY "${CMAKE_SOURCE_DIR}/data/"
|
2025-03-02 11:11:32 +00:00
|
|
|
DESTINATION /etc/dpm/conf.d
|
|
|
|
FILES_MATCHING
|
|
|
|
PATTERN "*.conf"
|
|
|
|
)
|
2025-03-02 06:08:07 +00:00
|
|
|
|
2025-03-08 22:44:23 +00:00
|
|
|
# Install modules
|
2025-03-03 08:56:51 +00:00
|
|
|
install(
|
|
|
|
DIRECTORY ${CMAKE_BINARY_DIR}/modules/
|
2025-03-02 06:08:07 +00:00
|
|
|
DESTINATION /usr/lib/dpm/modules
|
2025-03-03 08:56:51 +00:00
|
|
|
FILES_MATCHING PATTERN "*.so"
|
|
|
|
)
|