Improved protobuf message compiling

This commit is contained in:
Brenno
2020-12-12 19:28:08 -03:00
parent dd9e203695
commit e3bd2e4b15
9 changed files with 44 additions and 5393 deletions

View File

@@ -113,13 +113,6 @@ set(OPENSHOT_CV_SOURCES
./sort_filter/Hungarian.cpp
./sort_filter/KalmanTracker.cpp)
# Compiled Protobuf messages
set(PROTOBUF_MESSAGES
stabilizedata.pb.cc
trackerdata.pb.cc
objdetectdata.pb.cc
)
# Video effects
set(EFFECTS_SOURCES
effects/Bars.cpp
@@ -416,37 +409,16 @@ if (OpenCV_FOUND)
message(FATAL_ERROR "\nPLEASE INSTALL PROTOBUF. Protobuf is required when compiling with opencv.\n")
endif()
# compiling protobuf messages
include_directories(${PROTOBUF_INCLUDE_DIR})
set(PROTOBUF_MESSAGES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}/protobuf_messages")
add_subdirectory(protobuf_messages)
FILE(GLOB PROTO_MSGS "${PROTOBUF_MESSAGES_FOLDER}/*.proto")
foreach(PROTO_MSG ${PROTO_MSGS})
execute_process (
COMMAND bash -c "${PROTOBUF_PROTOC_EXECUTABLE} -I=${PROTOBUF_MESSAGES_FOLDER} --cpp_out=${PROTOBUF_MESSAGES_FOLDER} ${PROTO_MSG}"
)
endforeach()
FILE(GLOB PROTO_CCS "${PROTOBUF_MESSAGES_FOLDER}/*.pb.cc")
foreach(PROTO_CC ${PROTO_CCS})
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${PROTO_CC} ${CMAKE_CURRENT_SOURCE_DIR})
file(REMOVE ${PROTO_CC})
endforeach()
FILE(GLOB PROTO_HS "${PROTOBUF_MESSAGES_FOLDER}/*.pb.h")
foreach(PROTO_H ${PROTO_HS})
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${PROTO_H} ${CMAKE_CURRENT_SOURCE_DIR})
file(REMOVE ${PROTO_H})
endforeach()
target_include_directories(openshot PUBLIC ${ProtobufMessagePath})
# Add OpenCV target sources
target_sources(openshot PRIVATE
${OPENSHOT_CV_SOURCES}
${PROTOBUF_MESSAGES})
${OPENSHOT_CV_SOURCES})
# Link libopenshot with OpenCV libs
target_link_libraries(openshot PUBLIC ${OpenCV_LIBS} ${PROTOBUF_LIBRARY})
target_link_libraries(openshot PUBLIC ProtoMessages ${OpenCV_LIBS} ${PROTOBUF_LIBRARY} ${Protobuf_INCLUDE_DIRS})
endif()
############### LINK LIBRARY #################
@@ -490,3 +462,4 @@ endif()
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Jonathan Thomas") #required
include(CPack)

View File

@@ -40,7 +40,7 @@
#include "../Color.h"
#include "../Json.h"
#include "../KeyFrame.h"
#include "../objdetectdata.pb.h"
#include "objdetectdata.pb.h"
// Struct that stores the detected bounding boxes for all the clip frames
struct DetectionData{

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,38 @@
####################### CMakeLists.txt (libopenshot) #########################
# @brief CMake build file for libopenshot (used to generate makefiles)
# @author Jonathan Thomas <jonathan@openshot.org>
# @author FeRD (Frank Dana) <ferdnyc@gmail.com>
#
# @section LICENSE
#
# Copyright (c) 2008-2020 OpenShot Studios, LLC
# <http://www.openshotstudios.com/>. This file is part of
# OpenShot Library (libopenshot), an open-source project dedicated to
# delivering high quality video editing and animation solutions to the
# world. For more information visit <http://www.openshot.org/>.
#
# OpenShot Library (libopenshot) is free software: you can redistribute it
# and/or modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# OpenShot Library (libopenshot) is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
################################################################################
# Dependencies
find_package(Protobuf 3)
file(GLOB ProtoFiles "${CMAKE_CURRENT_SOURCE_DIR}/*.proto")
PROTOBUF_GENERATE_CPP(ProtoSources ProtoHeaders ${ProtoFiles})
add_library(ProtoMessages SHARED ${ProtoSources} ${ProtoHeaders})
set(ProtobufMessagePath ${CMAKE_CURRENT_BINARY_DIR}
CACHE INTERNAL "Path to generated protobuf header files.")
target_link_libraries(ProtoMessages ${Boost_LIBRARIES} ${PROTOBUF_LIBRARY})

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff