sw/vec_iree: Use one single flag to enable/disable RVV

Use one single flag "BUILD_WITH_RVV" to enable/disable RVV used in risp4ml, mfcc, vmvx_ukernel and sparrow_modules. This simplify things and faciliates upcoming support for kelvin.

Change-Id: I6e3ea4f3e477047bd16f8a94e8f09213db9dcbad
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 023e4c6..3c06d3d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,8 +27,7 @@
 add_link_options("LINKER:--defsym=__stack_size__=${STACK_SIZE}")
 set(SPRINGBOK_LINKER_SCRIPT "$ENV{ROOTDIR}/sw/vec/springbok/springbok.ld" CACHE PATH "Springbok linker script path (default: springbok.ld)")
 set(BUILD_WITH_SPRINGBOK ON CACHE BOOL "Build the target with springbok BSP (default: ON)")
-set(BUILD_ISP_WITH_RVV ON CACHE BOOL "Build the ISP pipeline with RVV (default: ON)")
-set(BUILD_MFCC_WITH_RVV OFF CACHE BOOL "Build audio preprocessing with RVV (default: OFF)")
+set(BUILD_WITH_RVV ON CACHE BOOL "Build the target with RVV (default: ON)")
 set(BUILD_NO_WMMU OFF CACHE BOOL "Build targets with no WMMU (default: OFF)")
 
 #-------------------------------------------------------------------------------
diff --git a/audio_prep/CMakeLists.txt b/audio_prep/CMakeLists.txt
index 2261fbe..6bfd7cd 100644
--- a/audio_prep/CMakeLists.txt
+++ b/audio_prep/CMakeLists.txt
@@ -20,7 +20,7 @@
     ::util
 )
 
-if (${BUILD_MFCC_WITH_RVV})
+if (${BUILD_WITH_RVV})
   target_compile_definitions(audio_prep_mfcc PUBLIC MFCC_WITH_RVV)
 endif()
 
diff --git a/cmake/sparrow_modules.cmake b/cmake/sparrow_modules.cmake
index ce95e87..971564e 100644
--- a/cmake/sparrow_modules.cmake
+++ b/cmake/sparrow_modules.cmake
@@ -46,7 +46,7 @@
     ${ARGN}
   )
 
-  if (${_RULE_RVV_OFF})
+  if (${_RULE_RVV_OFF} OR (NOT ${BUILD_WITH_RVV}))
     set(_RVV_OFF_ARG "RVV_OFF")
   endif()
 
diff --git a/risp4ml/isp_stages/CMakeLists.txt b/risp4ml/isp_stages/CMakeLists.txt
index 7b039bb..080dad2 100644
--- a/risp4ml/isp_stages/CMakeLists.txt
+++ b/risp4ml/isp_stages/CMakeLists.txt
@@ -12,7 +12,7 @@
 set(DOWNSCALE_TEST_SRC "downscale_test.cc")
 set(GAMMA_TEST_SRC "gamma_test.cc")
 
-if (${BUILD_ISP_WITH_RVV})
+if (${BUILD_WITH_RVV})
   set(BLC_SRC "blc_rvv.c")
   set(DEMOSAIC_SRC "demosaic_rvv.c")
   set(DG_SRC "dg_rvv.c")
diff --git a/vmvx_ukernel/CMakeLists.txt b/vmvx_ukernel/CMakeLists.txt
index ecc70bc..9148a13 100644
--- a/vmvx_ukernel/CMakeLists.txt
+++ b/vmvx_ukernel/CMakeLists.txt
@@ -1,14 +1,20 @@
 set(IREE_RUNTIME_SOURCE_DIR "${IREE_SOURCE_DIR}/runtime/src/iree")
 
+# use IREE builtin reference ukernel implementation if RVV is off
+set(PREFIX_SRC "${IREE_RUNTIME_SOURCE_DIR}/builtins/ukernel")
+if (${BUILD_WITH_RVV})
+  set(PREFIX_SRC "${CMAKE_CURRENT_SOURCE_DIR}")
+endif()
+
 iree_cc_library(
   NAME
     ukernel
   HDRS
     "${IREE_RUNTIME_SOURCE_DIR}/builtins/ukernel/api.h"
   SRCS
-    "elementwise.c"
-    "mmt4d_tile.c"
-    "query_tile_sizes.c"
+    "${PREFIX_SRC}/elementwise.c"
+    "${PREFIX_SRC}/mmt4d_tile.c"
+    "${PREFIX_SRC}/query_tile_sizes.c"
     "${IREE_RUNTIME_SOURCE_DIR}/builtins/ukernel/mmt4d.c"
     "${IREE_RUNTIME_SOURCE_DIR}/builtins/ukernel/pack.c"
     "${IREE_RUNTIME_SOURCE_DIR}/builtins/ukernel/pack_tile.c"