build: add knob to specify which plugins to build 21/43721/2
authorDamjan Marion <[email protected]>
Thu, 18 Sep 2025 15:13:37 +0000 (17:13 +0200)
committerDave Wallace <[email protected]>
Thu, 18 Sep 2025 20:13:30 +0000 (20:13 +0000)
Type: make
Change-Id: I6bd6df968577a4b5335f0604e02c2ea05d938355
Signed-off-by: Damjan Marion <[email protected]>
configure
src/plugins/CMakeLists.txt

index 444ed3c..b28b3b1 100755 (executable)
--- 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}
index 43ad4cc..e62acc2 100644 (file)
@@ -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
 ##############################################################################