nixos-config/pkgs/backscrub/fix-cmake-for-nixos.patch
2021-12-06 09:58:39 +01:00

69 lines
2.3 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b7b425e..deff68d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,10 +7,10 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# allow override of Tensorflow location
-if(NOT DEFINED TENSORFLOW)
- set(TENSORFLOW tensorflow)
- set(TF_CHECKOUT true)
-endif()
+#if(NOT DEFINED TENSORFLOW)
+# set(TENSORFLOW tensorflow)
+# set(TF_CHECKOUT true)
+#endif()
# find Git and use it to get backscrub version
find_package(Git)
@@ -31,16 +31,16 @@ set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs video videoio highgui)
# use .gitmodules defined Tensorflow version unless a path was provided
-if (TF_CHECKOUT)
- if (GIT_FOUND)
- message(STATUS "Updating Tensorflow source")
- execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive)
- else()
- message(FATAL_ERROR "Git not found. Unable to checkout required Tensorflow version")
- endif()
-else()
- message(STATUS "Using specified Tensorflow: ${TENSORFLOW}")
-endif(TF_CHECKOUT)
+#if (TF_CHECKOUT)
+# if (GIT_FOUND)
+# message(STATUS "Updating Tensorflow source")
+# execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive)
+# else()
+# message(FATAL_ERROR "Git not found. Unable to checkout required Tensorflow version")
+# endif()
+#else()
+# message(STATUS "Using specified Tensorflow: ${TENSORFLOW}")
+#endif(TF_CHECKOUT)
# force compilation of XNNPACK delegate (without this the too clever-by-half use
# of weak/strong symbol linking fails in a static library)
@@ -52,8 +52,12 @@ set(CONFU_DEPENDENCIES_SOURCE_DIR ${CMAKE_BINARY_DIR})
set(CONFU_DEPENDENCIES_BINARY_DIR ${CMAKE_BINARY_DIR}/_deps)
# pull in Tensorflow Lite source build
-add_subdirectory(${TENSORFLOW}/tensorflow/lite
- "${CMAKE_CURRENT_BINARY_DIR}/tensorflow-lite" EXCLUDE_FROM_ALL)
+#add_subdirectory(${TENSORFLOW}/tensorflow/lite
+# "${CMAKE_CURRENT_BINARY_DIR}/tensorflow-lite" EXCLUDE_FROM_ALL)
+
+find_library(tensorflow-lite NAMES tensorflow-lite REQUIRED)
+
+find_package(Threads REQUIRED)
# build backscrub code
add_compile_definitions(DEEPSEG_VERSION=${DEEPSEG_VERSION})
@@ -91,6 +95,7 @@ target_link_libraries(deepseg
opencv_imgproc
opencv_imgcodecs
opencv_highgui
+ Threads::Threads
)
endif()