OpenCV/Protobuf: Install library and headers

This commit is contained in:
FeRD (Frank Dana)
2021-01-13 12:06:32 -05:00
parent d1019f204e
commit 0fcb84bda3
9 changed files with 36 additions and 19 deletions

View File

@@ -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")

View File

@@ -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
{

View File

@@ -40,7 +40,7 @@
#undef uint64
#undef int64
#include <cmath>
#include "stabilizedata.pb.h"
#include "protobuf_messages/stabilizedata.pb.h"
#include "ProcessingController.h"
#include "Clip.h"
#include "Json.h"

View File

@@ -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;

View File

@@ -49,6 +49,7 @@
#cmakedefine AVUTIL_VERSION_STR "@AVUTIL_VERSION_STR@"
#cmakedefine01 HAVE_IMAGEMAGICK
#cmakedefine01 HAVE_RESVG
#cmakedefine01 HAVE_OPENCV
#cmakedefine01 APPIMAGE_BUILD
#include <sstream>

View File

@@ -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{

View File

@@ -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;

View File

@@ -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<Frame> GetFrame(std::shared_ptr<Frame> frame, int64_t frame_number) override;
std::shared_ptr<openshot::Frame> GetFrame(int64_t frame_number) override { return GetFrame(std::shared_ptr<Frame> (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

View File

@@ -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
)