Skip to content

Commit 29b28f9

Browse files
committed
Improved protobuf message compiling
1 parent fabe580 commit 29b28f9

File tree

9 files changed

+46
-5394
lines changed

9 files changed

+46
-5394
lines changed

src/CMakeLists.txt

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,6 @@ set(OPENSHOT_CV_SOURCES
112112
./sort_filter/Hungarian.cpp
113113
./sort_filter/KalmanTracker.cpp)
114114

115-
# Compiled Protobuf messages
116-
set(PROTOBUF_MESSAGES
117-
stabilizedata.pb.cc
118-
trackerdata.pb.cc
119-
objdetectdata.pb.cc
120-
)
121-
122115
# Video effects
123116
set(EFFECTS_SOURCES
124117
effects/Bars.cpp
@@ -415,37 +408,16 @@ if (OpenCV_FOUND)
415408
message(FATAL_ERROR "\nPLEASE INSTALL PROTOBUF. Protobuf is required when compiling with opencv.\n")
416409
endif()
417410

418-
# compiling protobuf messages
419-
include_directories(${PROTOBUF_INCLUDE_DIR})
420-
set(PROTOBUF_MESSAGES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/protobuf_messages")
421-
422-
FILE(GLOB PROTO_MSGS "${PROTOBUF_MESSAGES_FOLDER}/*.proto")
423-
foreach(PROTO_MSG ${PROTO_MSGS})
424-
execute_process (
425-
COMMAND bash -c "${PROTOBUF_PROTOC_EXECUTABLE} -I=${PROTOBUF_MESSAGES_FOLDER} --cpp_out=${PROTOBUF_MESSAGES_FOLDER} ${PROTO_MSG}"
426-
)
427-
endforeach()
428-
429-
FILE(GLOB PROTO_CCS "${PROTOBUF_MESSAGES_FOLDER}/*.pb.cc")
430-
foreach(PROTO_CC ${PROTO_CCS})
431-
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${PROTO_CC} ${CMAKE_CURRENT_SOURCE_DIR})
432-
file(REMOVE ${PROTO_CC})
433-
endforeach()
434-
435-
FILE(GLOB PROTO_HS "${PROTOBUF_MESSAGES_FOLDER}/*.pb.h")
436-
foreach(PROTO_H ${PROTO_HS})
437-
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${PROTO_H} ${CMAKE_CURRENT_SOURCE_DIR})
438-
file(REMOVE ${PROTO_H})
439-
endforeach()
411+
add_subdirectory(protobuf_messages)
412+
413+
target_include_directories(openshot PUBLIC ${ProtobufMessagePath})
440414

441415
# Add OpenCV target sources
442416
target_sources(openshot PRIVATE
443-
${OPENSHOT_CV_SOURCES}
444-
${PROTOBUF_MESSAGES})
417+
${OPENSHOT_CV_SOURCES})
445418

446419
# Link libopenshot with OpenCV libs
447-
target_link_libraries(openshot PUBLIC ${OpenCV_LIBS} ${PROTOBUF_LIBRARY})
448-
420+
target_link_libraries(openshot PUBLIC ProtoMessages ${OpenCV_LIBS} ${PROTOBUF_LIBRARY} ${Protobuf_INCLUDE_DIRS})
449421
endif()
450422

451423
############### LINK LIBRARY #################
@@ -489,3 +461,5 @@ endif()
489461
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Jonathan Thomas") #required
490462

491463
include(CPack)
464+
465+

src/effects/ObjectDetection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#include "../Color.h"
4141
#include "../Json.h"
4242
#include "../KeyFrame.h"
43-
#include "../objdetectdata.pb.h"
43+
#include "objdetectdata.pb.h"
4444

4545
// Struct that stores the detected bounding boxes for all the clip frames
4646
struct DetectionData{

0 commit comments

Comments
 (0)