@@ -114,6 +114,52 @@ if (ENABLE_BLACKMAGIC)
114114
115115endif ()
116116
117+ ################ OPENCV ##################
118+
119+ find_package ( OpenCV 4 )
120+ if (OpenCV_FOUND)
121+ message ("\n COMPILING WITH OPENCV\n " )
122+ set (CMAKE_SWIG_FLAGS "-DUSE_OPENCV=1" )
123+ add_definitions ( -DUSE_OPENCV=1 )
124+ else ()
125+ message ("\n OPENCV NOT FOUND, SOME FUNCTIONALITIES WILL BE DISABLED\n " )
126+ endif ()
127+
128+ ################ PROTOBUF ##################
129+ if (OpenCV_FOUND)
130+ find_package (Protobuf 3)
131+
132+ if (NOT Protobuf_FOUND)
133+ # Protobuf is required when compiling with opencv
134+ message (FATAL_ERROR "\n PLEASE INSTALL PROTOBUF. Protobuf is required when compiling with opencv.\n " )
135+ endif ()
136+
137+ include_directories (${PROTOBUF_INCLUDE_DIR} )
138+
139+ set (PROTOBUF_MESSAGES_FOLDER "${CMAKE_CURRENT_SOURCE_DIR} /protobuf_messages" )
140+
141+ FILE (GLOB PROTO_MSGS "${PROTOBUF_MESSAGES_FOLDER} /*.proto" )
142+ foreach (PROTO_MSG ${PROTO_MSGS} )
143+ execute_process (
144+ COMMAND bash -c "${PROTOBUF_PROTOC_EXECUTABLE} -I=${PROTOBUF_MESSAGES_FOLDER} --cpp_out=${PROTOBUF_MESSAGES_FOLDER} ${PROTO_MSG} "
145+ )
146+ endforeach ()
147+
148+ FILE (GLOB PROTO_CCS "${PROTOBUF_MESSAGES_FOLDER} /*.pb.cc" )
149+ foreach (PROTO_CC ${PROTO_CCS} )
150+ execute_process (COMMAND ${CMAKE_COMMAND} -E copy ${PROTO_CC} ${CMAKE_CURRENT_SOURCE_DIR} )
151+ file (REMOVE ${PROTO_CC} )
152+ endforeach ()
153+
154+ FILE (GLOB PROTO_HS "${PROTOBUF_MESSAGES_FOLDER} /*.pb.h" )
155+ foreach (PROTO_H ${PROTO_HS} )
156+ execute_process (COMMAND ${CMAKE_COMMAND} -E copy ${PROTO_H} ${CMAKE_CURRENT_SOURCE_DIR} )
157+ file (REMOVE ${PROTO_H} )
158+ endforeach ()
159+
160+ endif ()
161+
162+
117163############### PROFILING #################
118164#set(PROFILER "/usr/lib/libprofiler.so.0.3.2")
119165#set(PROFILER "/usr/lib/libtcmalloc.so.4")
@@ -515,45 +561,6 @@ endif()
515561### INSTALL HEADERS & LIBRARY
516562###
517563
518- ############### CLI EXECUTABLES ################
519- # Create test executable
520- add_executable (openshot-example examples/Example.cpp)
521-
522-
523- # Define path to test input files
524- set (TEST_MEDIA_PATH "${PROJECT_SOURCE_DIR} /src/examples/" )
525- if (WIN32 )
526- string (REPLACE "/" "\\\\ " TEST_MEDIA_PATH TEST_MEDIA_PATH)
527- endif ()
528- target_compile_definitions (openshot-example PRIVATE
529- -DTEST_MEDIA_PATH="${TEST_MEDIA_PATH} " )
530-
531- # Link test executable to the new library
532- target_link_libraries (openshot-example openshot)
533-
534-
535- add_executable (openshot-html-test examples/ExampleHtml.cpp)
536- target_link_libraries (openshot-html-test openshot Qt5::Gui)
537-
538- ############### OPENCV EXAMPLE EXECUTABLE ################
539- if (OpenCV_FOUND)
540- # Create test Opencv executable
541- add_executable ( openshotCV-example examples/Example_opencv.cpp )
542- # Define path to test input files
543- target_link_libraries ( openshotCV-example ${OpenCV_LIBS} openshot)
544- target_compile_definitions (openshotCV-example PRIVATE
545- -DTEST_MEDIA_PATH="${TEST_MEDIA_PATH} " )
546- # Link test executable to the new library
547- target_link_libraries (openshot-example openshot)
548- endif ()
549-
550-
551- ############### PLAYER EXECUTABLE ################
552- # Create test executable
553- add_executable (openshot-player Qt/demo/main.cpp)
554-
555- # Link test executable to the new library
556- target_link_libraries (openshot-player openshot)
557564
558565############### TEST BLACKMAGIC CAPTURE APP ################
559566if (BLACKMAGIC_FOUND)
@@ -565,8 +572,6 @@ if (BLACKMAGIC_FOUND)
565572 target_link_libraries (openshot-blackmagic openshot)
566573endif ()
567574
568- ############### INCLUDE SWIG BINDINGS ################
569- add_subdirectory (bindings)
570575
571576############### INSTALL HEADERS & LIBRARY ################
572577
0 commit comments