fix: WITHOUT_FACERECOGNITION build flag

to avoid double loading of protobuf, implicitly loaded by opencv,
we need to deactivate the build of two face detection plugins that
use opencv (which loads protobuf implicitly). This fixes bug #185
This commit is contained in:
Jaromil
2025-11-27 00:11:16 +01:00
parent 27af2abfb4
commit 7a044cba04
4 changed files with 45 additions and 20 deletions

View File

@@ -10,6 +10,10 @@ The presence of optional libraries on the system will trigger compilation of ext
+ [Cairo](http://cairographics.org) required for cairo- filters and mixers + [Cairo](http://cairographics.org) required for cairo- filters and mixers
## Optional build flags
+ `-DWITHOUT_FACERECOGNITION=ON` - Disable face recognition plugins (facedetect and facebl0r) to avoid protobuf conflicts with applications like MLT
It is recommended to use a separate `build` sub-folder. It is recommended to use a separate `build` sub-folder.
``` ```
@@ -18,6 +22,13 @@ cd build && cmake ../
make make
``` ```
To disable face recognition plugins (recommended when using with MLT):
```
mkdir -p build
cd build && cmake -DWITHOUT_FACERECOGNITION=ON ../
make
```
Also ninja and nmake are supported through cmake: Also ninja and nmake are supported through cmake:
``` ```
cmake -G 'Ninja' ../ cmake -G 'Ninja' ../

View File

@@ -8,6 +8,8 @@ set (VERSION 2.5.1)
include(GNUInstallDirs) include(GNUInstallDirs)
option (WITHOUT_OPENCV "Disable plugins dependent upon OpenCV" OFF) option (WITHOUT_OPENCV "Disable plugins dependent upon OpenCV" OFF)
option (WITHOUT_FACERECOGNITION "Disable facedetect plugin to avoid protobuf conflicts" OFF)
if (NOT WITHOUT_OPENCV) if (NOT WITHOUT_OPENCV)
find_package (OpenCV) find_package (OpenCV)
endif () endif ()

View File

@@ -1,13 +1,19 @@
set (SOURCES facebl0r.cpp) # facebl0r filter - requires OpenCV (and protobuf)
set (TARGET facebl0r) # This filter can cause conflicts with applications that also use protobuf
# such as MLT, so it can be disabled with -DWITHOUT_FACERECOGNITION=ON
if (MSVC) if (OpenCV_FOUND AND NOT WITHOUT_FACERECOGNITION)
set (SOURCES facebl0r.cpp)
set (TARGET facebl0r)
if (MSVC)
set (SOURCES ${SOURCES} ${FREI0R_DEF}) set (SOURCES ${SOURCES} ${FREI0R_DEF})
endif (MSVC) endif (MSVC)
include_directories(${OpenCV_INCLUDE_DIRS}) include_directories(${OpenCV_INCLUDE_DIRS})
add_library (${TARGET} MODULE ${SOURCES}) add_library (${TARGET} MODULE ${SOURCES})
set_target_properties (${TARGET} PROPERTIES PREFIX "") set_target_properties (${TARGET} PROPERTIES PREFIX "")
target_link_libraries(${TARGET} ${OpenCV_LIBS}) target_link_libraries(${TARGET} ${OpenCV_LIBS})
install (TARGETS ${TARGET} LIBRARY DESTINATION ${LIBDIR}) install (TARGETS ${TARGET} LIBRARY DESTINATION ${LIBDIR})
endif()

View File

@@ -1,13 +1,19 @@
set (SOURCES facedetect.cpp) # facedetect filter - requires OpenCV (and protobuf)
set (TARGET facedetect) # This filter can cause conflicts with applications that also use protobuf
# such as MLT, so it can be disabled with -DWITHOUT_FACERECOGNITION=ON
if (MSVC) if (OpenCV_FOUND AND NOT WITHOUT_FACERECOGNITION)
set (SOURCES facedetect.cpp)
set (TARGET facedetect)
if (MSVC)
set (SOURCES ${SOURCES} ${FREI0R_DEF}) set (SOURCES ${SOURCES} ${FREI0R_DEF})
endif (MSVC) endif (MSVC)
include_directories(${OpenCV_INCLUDE_DIRS}) include_directories(${OpenCV_INCLUDE_DIRS})
add_library (${TARGET} MODULE ${SOURCES}) add_library (${TARGET} MODULE ${SOURCES})
set_target_properties (${TARGET} PROPERTIES PREFIX "") set_target_properties (${TARGET} PROPERTIES PREFIX "")
target_link_libraries(${TARGET} ${OpenCV_LIBS}) target_link_libraries(${TARGET} ${OpenCV_LIBS})
install (TARGETS ${TARGET} LIBRARY DESTINATION ${LIBDIR}) install (TARGETS ${TARGET} LIBRARY DESTINATION ${LIBDIR})
endif()