diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e277a021..9f4a1376 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -395,7 +395,7 @@ if(ENABLE_OPENCV) set(ENABLE_OPENCV FALSE CACHE BOOL "Build with OpenCV algorithms (requires Boost, Protobuf 3)" FORCE) else() - add_subdirectory(protobuf_messsages) + add_subdirectory(protobuf_messages) # Add OpenCV source files target_sources(openshot PRIVATE ${OPENSHOT_CV_SOURCES} @@ -407,8 +407,10 @@ if(ENABLE_OPENCV) opencv_highgui opencv_dnn opencv_tracking - protobuf::libprotobuf + openshot_protobuf ) + set(HAVE_OPENCV TRUE CACHE BOOL "Building with OpenCV effects" FORCE) + mark_as_advanced(HAVE_OPENCV) endif() endif() add_feature_info("OpenCV algorithms" ENABLE_OPENCV "Use OpenCV algorithms") diff --git a/src/CVObjectDetection.h b/src/CVObjectDetection.h index 4ca55fc6..30b19ce6 100644 --- a/src/CVObjectDetection.h +++ b/src/CVObjectDetection.h @@ -42,9 +42,9 @@ #include "Json.h" #include "ProcessingController.h" #include "Clip.h" -#include "objdetectdata.pb.h" +#include "protobuf_messages/objdetectdata.pb.h" -#include "../src/sort_filter/sort.hpp" +#include "sort_filter/sort.hpp" namespace openshot { diff --git a/src/CVStabilization.h b/src/CVStabilization.h index f6502be3..4c40b811 100644 --- a/src/CVStabilization.h +++ b/src/CVStabilization.h @@ -40,7 +40,7 @@ #undef uint64 #undef int64 #include -#include "stabilizedata.pb.h" +#include "protobuf_messages/stabilizedata.pb.h" #include "ProcessingController.h" #include "Clip.h" #include "Json.h" diff --git a/src/CVTracker.h b/src/CVTracker.h index 8ea72371..d644e478 100644 --- a/src/CVTracker.h +++ b/src/CVTracker.h @@ -47,9 +47,9 @@ #include "Frame.h" #include "Json.h" #include "ProcessingController.h" -#include "trackerdata.pb.h" +#include "protobuf_messages/trackerdata.pb.h" -#include "../src/sort_filter/sort.hpp" +#include "sort_filter/sort.hpp" using namespace std; using google::protobuf::util::TimeUtil; diff --git a/src/OpenShotVersion.h.in b/src/OpenShotVersion.h.in index 5e86e8ce..e0829c00 100644 --- a/src/OpenShotVersion.h.in +++ b/src/OpenShotVersion.h.in @@ -49,6 +49,7 @@ #cmakedefine AVUTIL_VERSION_STR "@AVUTIL_VERSION_STR@" #cmakedefine01 HAVE_IMAGEMAGICK #cmakedefine01 HAVE_RESVG +#cmakedefine01 HAVE_OPENCV #cmakedefine01 APPIMAGE_BUILD #include diff --git a/src/effects/ObjectDetection.h b/src/effects/ObjectDetection.h index 45d30d58..f0d0f1bc 100644 --- a/src/effects/ObjectDetection.h +++ b/src/effects/ObjectDetection.h @@ -40,7 +40,7 @@ #include "../Color.h" #include "../Json.h" #include "../KeyFrame.h" -#include "objdetectdata.pb.h" +#include "protobuf_messages/objdetectdata.pb.h" // Struct that stores the detected bounding boxes for all the clip frames struct DetectionData{ diff --git a/src/effects/Stabilizer.h b/src/effects/Stabilizer.h index 31e9d2e3..8cc6f8d7 100644 --- a/src/effects/Stabilizer.h +++ b/src/effects/Stabilizer.h @@ -41,7 +41,7 @@ #include "../Color.h" #include "../Json.h" #include "../KeyFrame.h" -#include "stabilizedata.pb.h" +#include "protobuf_messages/stabilizedata.pb.h" using namespace std; using google::protobuf::util::TimeUtil; diff --git a/src/effects/Tracker.h b/src/effects/Tracker.h index 65997061..a64ab824 100644 --- a/src/effects/Tracker.h +++ b/src/effects/Tracker.h @@ -42,7 +42,7 @@ #include "../Color.h" #include "../Json.h" #include "../KeyFrame.h" -#include "trackerdata.pb.h" +#include "protobuf_messages/trackerdata.pb.h" using namespace std; using google::protobuf::util::TimeUtil; @@ -111,11 +111,11 @@ namespace openshot /// @param frame_number The frame number (starting at 1) of the effect on the timeline. std::shared_ptr GetFrame(std::shared_ptr frame, int64_t frame_number) override; std::shared_ptr GetFrame(int64_t frame_number) override { return GetFrame(std::shared_ptr (new Frame()), frame_number); } - + // Load protobuf data file bool LoadTrackedData(std::string inputFilePath); - - // Get tracker info for the desired frame + + // Get tracker info for the desired frame EffectFrameData GetTrackedData(size_t frameId); /// Get and Set JSON methods diff --git a/src/protobuf_messages/CMakeLists.txt b/src/protobuf_messages/CMakeLists.txt index 602e1b9e..e62fca64 100644 --- a/src/protobuf_messages/CMakeLists.txt +++ b/src/protobuf_messages/CMakeLists.txt @@ -26,8 +26,16 @@ ################################################################################ # Dependencies -find_package(Protobuf 3) -include_directories(${PROTOBUF_INCLUDE_DIRS}) +find_package(Protobuf 3 REQUIRED) + +# Create a target for libprotobuf, if necessary (CMake < 3.9) +if(NOT TARGET protobuf::libprotobuf) + add_library(protobuf_TARGET INTERFACE) + target_include_directories(protobuf_TARGET + INTERFACE ${Protobuf_INCLUDE_DIRS}) + target_link_libraries(protobuf_TARGET INTERFACE ${Protobuf_LIBRARIES}) + add_library(protobuf::libprotobuf ALIAS protobuf_TARGET) +endif() file(GLOB ProtoFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.proto") PROTOBUF_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles}) @@ -36,7 +44,7 @@ add_library(openshot_protobuf SHARED ${ProtoSources} ${ProtoHeaders}) set(ProtobufMessagePath ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "Path to generated protobuf header files.") -target_link_libraries(openshot_protobuf ${Boost_LIBRARIES} ${PROTOBUF_LIBRARY}) +target_link_libraries(openshot_protobuf protobuf::libprotobuf) # Set SONAME and other library properties set_target_properties(openshot_protobuf PROPERTIES @@ -45,7 +53,13 @@ set_target_properties(openshot_protobuf PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" ) -# Install primary library +# Install protobuf library and generated headers install(TARGETS openshot_protobuf - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) - + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libopenshot + ) +install(FILES ${ProtoHeaders} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libopenshot/protobuf_messages +)