Sfoglia il codice sorgente

HPCC-8765 Plugin cmake macros to clean up optional plugins

Add options to suppress building of plugins even if the dependencies are
available.

Add option to make missing dependencies fatal.

Fix typo.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 anni fa
parent
commit
02cfe2eb71
2 ha cambiato i file con 26 aggiunte e 7 eliminazioni
  1. 14 2
      cmake_modules/commonSetup.cmake
  2. 12 5
      plugins/CMakeLists.txt

+ 14 - 2
cmake_modules/commonSetup.cmake

@@ -72,6 +72,12 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
   option(USE_RESOURCE "Use resource download in ECLWatch" OFF)
   option(GENERATE_COVERAGE_INFO "Generate coverage info for gcov" OFF)
 
+  option(USE_PYTHON "Enable Python support" ON)
+  option(USE_V8 "Enable V8 JavaScript support" ON)
+  option(USE_JNI "Enable Java JNI support" ON)
+  option(USE_RINSIDE "Enable R support support" ON)
+
+  option(USE_OPTIONAL "Automatically disable requested features with missing dependencies" ON)
 
   if ( USE_XALAN AND USE_LIBXSLT )
       set(USE_XALAN OFF)
@@ -283,7 +289,9 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
       foreach (dep ${pLOG_MDEPS})
         MESSAGE("---- WARNING -- Missing dependency: ${dep}")
       endforeach()
-
+      if (NOT USE_OPTIONAL)
+        message(FATAL_ERROR "Optional dependencies missing and USE_OPTIONAL not set")
+      endif()
     endif()
   endmacro()
 
@@ -313,7 +321,7 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
         set(${PLUGIN_MDEPS} ${${PLUGIN_MDEPS}} ${package})
       endif()
     ENDFOREACH()
-    option(${PLUGIN_OPTION} "Turn on Plugins that depend on python existing" ${PLUGIN_FOUND})
+    option(${PLUGIN_OPTION} "Turn on optional plugin based on availability of dependencies" ${PLUGIN_FOUND})
     LOG_PLUGIN(${PLUGIN_NAME} OPTION ${PLUGIN_OPTION} MDEPS ${${PLUGIN_MDEPS}})
     if(${PLUGIN_FOUND})
       set(bPLUGINS ${bPLUGINS} ${PLUGIN_NAME})
@@ -343,6 +351,10 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
 
   ###########################################################################
 
+  if (USE_OPTIONAL)
+    message ("-- USE_OPTIONAL set - missing dependencies for optional features will automatically disable them")
+  endif()
+
   if (NOT "${EXTERNALS_DIRECTORY}" STREQUAL "")
     message ("-- Using externals directory at ${EXTERNALS_DIRECTORY}")
   endif()

+ 12 - 5
plugins/CMakeLists.txt

@@ -25,8 +25,15 @@ if ("${BUILD_LEVEL}" STREQUAL "COMMUNITY")
   add_subdirectory (proxies)
 endif ()
 
-# Runtime plugins loaded to CMake build with ADD_PLUGIN Macro.
-add_subdirectory (v8embed)
-add_subdirectory (pyembed)
-add_subdirectory (javaembed)
-add_subdirectory (Rembed)
+if (USE_V8)
+  add_subdirectory (v8embed)
+endif ()
+if (USE_PYTHON)
+  add_subdirectory (pyembed)
+endif ()
+if (USE_JNI)
+  add_subdirectory (javaembed)
+endif()
+if (USE_RINSIDE)
+  add_subdirectory (Rembed)
+endif()