From 4c85ee7b16852e7635ec002533279a0078d3ae36 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Thu, 18 Sep 2025 17:13:37 +0200 Subject: [PATCH] build: add knob to specify which plugins to build Type: make Change-Id: I6bd6df968577a4b5335f0604e02c2ea05d938355 Signed-off-by: Damjan Marion --- configure | 12 ++++++++++++ src/plugins/CMakeLists.txt | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/configure b/configure index 444ed3c0634..b28b3b10090 100755 --- a/configure +++ b/configure @@ -34,6 +34,7 @@ OPTIONS: --native-only, -n Only compile for Native CPU (no multiarch) --option, -o Enable specific VPP options (fib8, fib16) --platform, -p Specify target platform + --plugins, -P Specify list of plugins to be built --prefix, -r Specify prefix path (default: $prefix_path) --sanitize, -s Enable sanitizer (mem) --verbose, -v Verbose output of this script @@ -92,6 +93,15 @@ while (( "$#" )); do exit 1 fi ;; + -P|--plugins) + if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then + plugins=$2 + shift 2 + else + echo "Error: Argument for $1 is missing" >&2 + exit 1 + fi + ;; -r|--prefix) if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then prefix_path=$2 @@ -169,6 +179,8 @@ $native_only && args+=("-DVPP_BUILD_NATIVE_ONLY:BOOL=ON") $wipe && git clean -fdx --exclude=startup.\* +[[ -v plugins ]] && args+=("-DVPP_PLUGINS=${plugins}") + ( $verbose && set -o xtrace cmake ${args[@]} -G Ninja -S ${src_dir}/src -B ${build_dir} diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 43ad4cc2a25..e62acc28541 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -16,6 +16,27 @@ include_directories ( ${CMAKE_CURRENT_BINARY_DIR} ) +set(VPP_PLUGINS + "" + CACHE + STRING "Comma-separated list of plugins included in build" +) + +if(NOT VPP_PLUGINS STREQUAL "") + string(REGEX REPLACE "[ \t]*,[ \t]*" ";" _plugins "${VPP_PLUGINS}") + list(FILTER _plugins EXCLUDE REGEX "^$") + + foreach(p IN LISTS _plugins) + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${p}/CMakeLists.txt") + add_subdirectory("${p}") + else() + message(FATAL_ERROR + "VPP plugin '${p}' not found: expected '${CMAKE_CURRENT_SOURCE_DIR}/${p}/CMakeLists.txt'") + endif() + endforeach() + return() +endif() + ############################################################################## # find and add all plugin subdirs ############################################################################## -- 2.16.6