From fafee7b4fc1abefe1af4e2bd7f295674bb40fb65 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Thu, 7 Nov 2019 20:54:15 +0200
Subject: [PATCH] Allow for no opt flow

---
 components/operators/CMakeLists.txt                      | 9 +++++++--
 .../rgbd-sources/src/sources/stereovideo/stereovideo.cpp | 3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/components/operators/CMakeLists.txt b/components/operators/CMakeLists.txt
index 15dfb638e..4bdf407c4 100644
--- a/components/operators/CMakeLists.txt
+++ b/components/operators/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_library(ftloperators
+set(OPERSRC
 	src/smoothing.cpp
 	src/smoothing.cu
 	src/mls.cu
@@ -10,9 +10,14 @@ add_library(ftloperators
 	src/filling.cu
 	src/segmentation.cu
 	src/segmentation.cpp
-	src/nvopticalflow.cpp
 )
 
+if (HAVE_OPTFLOW)
+	list(APPEND OPERSRC src/nvopticalflow.cpp)
+endif()
+
+add_library(ftloperators ${OPERSRC})
+
 # These cause errors in CI build and are being removed from PCL in newer versions
 # target_compile_options(ftlrender PUBLIC ${PCL_DEFINITIONS})
 
diff --git a/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp b/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp
index b7c0c73c8..dc23f42e5 100644
--- a/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp
+++ b/components/rgbd-sources/src/sources/stereovideo/stereovideo.cpp
@@ -2,7 +2,10 @@
 #include "stereovideo.hpp"
 
 #include <ftl/configuration.hpp>
+
+#ifdef HAVE_OPTFLOW
 #include <ftl/operators/opticalflow.hpp>
+#endif
 
 #include <ftl/threads.hpp>
 #include "calibrate.hpp"
-- 
GitLab