Skip to content

Commit

Permalink
OpenCV/Protobuf: Install library and headers
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc committed Jan 13, 2021
1 parent d1019f2 commit 0fcb84b
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 19 deletions.
6 changes: 4 additions & 2 deletions src/CMakeLists.txt
Expand Up @@ -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}
Expand All @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions src/CVObjectDetection.h
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion src/CVStabilization.h
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/CVTracker.h
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/OpenShotVersion.h.in
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/effects/ObjectDetection.h
Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion src/effects/Stabilizer.h
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/effects/Tracker.h
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
26 changes: 20 additions & 6 deletions src/protobuf_messages/CMakeLists.txt
Expand Up @@ -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})
Expand All @@ -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
Expand All @@ -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
)

0 comments on commit 0fcb84b

Please sign in to comment.