Files
FWS-PacManage/CMakeLists.txt
T
BlackAngelTV a2cef3d256 feat(providers): add provider plugin system
Introduce a registry (PluginManager) that owns package managers and can
load additional providers at runtime from shared-library plugins dropped
in a plugins directory. Providers declare their metadata and a factory
through a C ABI (provider-plugin.h); requiresPassword() tells the UI
whether a provider needs sudo. Ships a sample external plugin as a
template for adding new backends.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-08-29 13:34:29 +02:00

65 lines
2.1 KiB
CMake

cmake_minimum_required(VERSION 3.20)
project(PacManager VERSION 1.0.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
# Find Qt6
find_package(Qt6 REQUIRED COMPONENTS Widgets)
# Main executable
set(SOURCES
src/main.cpp
src/main-window.cpp
src/pacman-manager.cpp
src/plugin-manager.cpp
src/history-manager.cpp
src/package-model.cpp
resources/resources.qrc
)
set(HEADERS
include/package-manager.h
include/pacman-manager.h
include/plugin-manager.h
include/provider-plugin.h
include/main-window.h
include/history-manager.h
include/package-model.h
)
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
target_include_directories(${PROJECT_NAME} PRIVATE include)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Widgets)
# Install
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME})
# Tests
enable_testing()
add_executable(pacman-manager-test tests/pacman-manager.test.cpp src/pacman-manager.cpp)
target_include_directories(pacman-manager-test PRIVATE include)
add_test(NAME pacman-manager-test COMMAND pacman-manager-test)
# Optional example external provider plugin. Demonstrates the plugin mechanism:
# the produced library is copied next to the executable and discovered at
# runtime by PluginManager (see the Providers page).
option(FWS_BUILD_EXAMPLE_PLUGIN "Build the example external provider plugin" OFF)
if(FWS_BUILD_EXAMPLE_PLUGIN)
add_library(example-provider-plugin MODULE plugins/example-provider/example-provider.cpp)
target_include_directories(example-provider-plugin PRIVATE include)
set_target_properties(example-provider-plugin PROPERTIES
OUTPUT_NAME "sample-provider"
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON)
add_custom_command(TARGET example-provider-plugin POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:PacManager>/plugins
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:example-provider-plugin>
$<TARGET_FILE_DIR:PacManager>/plugins/)
endif()