diff --git a/openbr/CMakeLists.txt b/openbr/CMakeLists.txt index ae761d7..e343c83 100644 --- a/openbr/CMakeLists.txt +++ b/openbr/CMakeLists.txt @@ -10,12 +10,12 @@ include(plugins/plugins.cmake) # Optional GUI module if(NOT ${BR_EMBEDDED}) aux_source_directory(gui BR_GUI) - qt5_add_resources(ICONS icons/icons.qrc) + qt5_add_resources(BR_ICONS icons/icons.qrc) file(GLOB HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/gui/*.h) install(FILES ${HEADERS} DESTINATION include/openbr/gui) endif() -add_library(openbr SHARED ${SRC} ${BR_CORE} ${BR_GUI} ${BR_PLUGIN} ${BR_THIRDPARTY_SRC} ${BR_RESOURCES} ${ICONS} ${NATURALSTRINGCOMPARE_SRC}) +add_library(openbr SHARED ${SRC} ${BR_CORE} ${BR_GUI} ${BR_ICONS} ${BR_THIRDPARTY_SRC} ${BR_RESOURCES} ${NATURALSTRINGCOMPARE_SRC}) qt5_use_modules(openbr ${QT_DEPENDENCIES}) set_target_properties(openbr PROPERTIES DEFINE_SYMBOL BR_LIBRARY diff --git a/openbr/plugins/plugins.cmake b/openbr/plugins/plugins.cmake index 21af22d..163e15c 100644 --- a/openbr/plugins/plugins.cmake +++ b/openbr/plugins/plugins.cmake @@ -1,5 +1,16 @@ -# Add source to BR_THIRDPARTY_SRC -# Add libs to BR_THIRDPARTY_LIBS +# Optional Appendable CMake Variables: +# BR_THIRDPARTY_PLUGINS - Additional plugins +# BR_THIRDPARTY_PLUGINS_DIR - Additional folder(s) of plugins +# BR_THIRDPARTY_SRC - Additional source code needed by a plugin +# BR_THIRDPARTY_LIBS - Additional libaries needed by a plugin + +# Also look for CMake modules in the thirdparty plugins folder(s) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${BR_THIRDPARTY_PLUGINS_DIR}) + +foreach(DIR ${BR_THIRDPARTY_PLUGINS_DIR}) + file(GLOB PLUGINS ${DIR}/*.cpp ${DIR}/*.h) # Add the headers too so MOC runs on them + set(BR_THIRDPARTY_PLUGINS ${BR_THIRDPARTY_PLUGINS} ${PLUGINS}) +endforeach() file(GLOB PLUGINS plugins/*.cpp plugins/*.h) foreach(PLUGIN ${PLUGINS} ${BR_THIRDPARTY_PLUGINS}) @@ -12,4 +23,3 @@ foreach(PLUGIN ${PLUGINS} ${BR_THIRDPARTY_PLUGINS}) set(BR_THIRDPARTY_SRC ${BR_THIRDPARTY_SRC} ${PLUGIN}) endif() endforeach() - diff --git a/openbr/plugins/pp5.cpp b/openbr/plugins/pp5.cpp index 045e15b..5c5ebfd 100644 --- a/openbr/plugins/pp5.cpp +++ b/openbr/plugins/pp5.cpp @@ -97,8 +97,8 @@ struct PP5Context static void createRawImage(const cv::Mat &src, ppr_raw_image_type &dst) { - if (!src.isContinuous()) qFatal("PP5Context::createRawImage requires continuous data."); - if (src.channels() == 3) ppr_raw_image_create(&dst, src.cols, src.rows, PPR_RAW_IMAGE_BGR24); + if (!src.isContinuous()) qFatal("PP5Context::createRawImage requires continuous data."); + else if (src.channels() == 3) ppr_raw_image_create(&dst, src.cols, src.rows, PPR_RAW_IMAGE_BGR24); else if (src.channels() == 1) ppr_raw_image_create(&dst, src.cols, src.rows, PPR_RAW_IMAGE_GRAY8); else qFatal("PP5Context::createRawImage invalid channel count."); memcpy(dst.data, src.data, src.channels()*src.rows*src.cols);