1
1
cmake_minimum_required (VERSION 3.9)
2
2
project (dji_edge_sdk_demo CXX)
3
3
4
- set (LIB_SAMPLE edge_sample)
4
+ set (MODULE_SAMPLE_SRC "" )
5
+ set (SAMPLE_LIB edge_sample)
5
6
set (CMAKE_C_FLAGS "-pthread -std=gnu99" )
6
7
set (CMAKE_EXE_LINKER_FLAGS "-pthread" )
7
8
set (CMAKE_C_COMPILER "gcc" )
8
9
set (CMAKE_CXX_COMPILER "g++" )
9
- add_definitions (-D_GNU_SOURCE)
10
10
11
11
set (COMMON_CXX_FLAGS "-std=c++14 -pthread" )
12
12
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_CXX_FLAGS} -fprofile-arcs -ftest-coverage -Wno-deprecated-declarations" )
13
13
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage" )
14
14
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov" )
15
15
16
- include_directories (include )
17
- include_directories (examples/common)
16
+ add_definitions (-D_GNU_SOURCE)
18
17
19
18
file (GLOB_RECURSE MODULE_SAMPLE_SRC
20
19
examples/init/pre_init.cc
21
- examples/init/key_store_default.cc
22
- examples/liveview/sample_liveview.cc
23
- examples/liveview/stream_decoder.cc
24
- examples/liveview/ffmpeg_stream_decoder.cc
25
- examples/liveview/image_processor_thread.cc
26
- examples/liveview/stream_processor_thread.cc
27
- examples/common/image_processor_dnn.cc)
20
+ examples/init/key_store_default.cc)
21
+
22
+ include_directories (include )
23
+ include_directories (examples/common)
28
24
29
25
link_directories (${CMAKE_CURRENT_LIST_DIR} /lib/${CMAKE_HOST_SYSTEM_PROCESSOR} )
30
26
link_directories (${CMAKE_BINARY_DIR} )
@@ -46,11 +42,11 @@ if (OpenCV_FOUND)
46
42
add_definitions (-DOPEN_CV_VERSION_4)
47
43
endif ()
48
44
else ()
49
- message (STATUS "Did not find OpenCV in the system, image data is inside RecvContainer as raw data " )
45
+ message (STATUS "\n DID NOT FIND OPENCV IN THE SYSTEM, SOME EXECUTABLE FILES WILL NOT BE BUILT!! \n " )
50
46
endif ()
51
47
52
48
set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} /third_party)
53
- find_package (FFMPEG REQUIRED )
49
+ find_package (FFMPEG QUIET )
54
50
if (FFMPEG_FOUND)
55
51
message (STATUS "Found FFMPEG installed in the system" )
56
52
message (STATUS " - Includes: ${FFMPEG_INCLUDE_DIR} " )
@@ -73,38 +69,46 @@ if (FFMPEG_FOUND)
73
69
include_directories (${FFMPEG_INCLUDE_DIR} )
74
70
add_definitions (-DFFMPEG_INSTALLED)
75
71
else ()
76
- message (STATUS "Cannot Find FFMPEG" )
72
+ message (STATUS "\n DID NOT FIND FFMPEG IN THE SYSTEM, SOME EXECUTABLE FILES WILL NOT BE BUILT!! \n " )
77
73
endif (FFMPEG_FOUND)
78
74
79
- if (OpenCV_FOUND)
75
+ if (OpenCV_FOUND AND FFMPEG_FOUND)
76
+ file (GLOB_RECURSE MODULE_SAMPLE_SRC
77
+ ${MODULE_SAMPLE_SRC}
78
+ examples/liveview/sample_liveview.cc
79
+ examples/liveview/stream_decoder.cc
80
+ examples/liveview/ffmpeg_stream_decoder.cc
81
+ examples/liveview/image_processor_thread.cc
82
+ examples/liveview/stream_processor_thread.cc
83
+ examples/common/util_misc.cc
84
+ examples/common/image_processor.cc
85
+ examples/common/image_processor_yolovfastest.cc)
86
+
80
87
link_libraries (${OpenCV_LIBS} )
81
- endif ()
82
- if (FFMPEG_FOUND)
83
88
link_libraries (${FFMPEG_LIBRARIES} )
84
- endif ()
89
+ add_executable (sample_liveview examples/liveview/sample_liveview_main.cc)
90
+ target_link_libraries (sample_liveview ${SAMPLE_LIB} )
85
91
86
- add_library (${LIB_SAMPLE} STATIC ${MODULE_SAMPLE_SRC} )
92
+ add_executable (test_liveview examples/liveview/test_liveview_main.cc)
93
+ target_link_libraries (test_liveview ${SAMPLE_LIB} )
87
94
88
- add_executable (sample_liveview examples/liveview/sample_liveview_main.cc)
89
- target_link_libraries (sample_liveview edge_sample)
95
+ add_executable (pressure_test examples/test /pressure_test.cc)
96
+ target_link_libraries (pressure_test ${SAMPLE_LIB} )
97
+ endif ()
90
98
91
- add_executable (test_liveview examples/liveview/test_liveview_main.cc)
92
- target_link_libraries (test_liveview edge_sample)
99
+ add_library (${SAMPLE_LIB} STATIC ${MODULE_SAMPLE_SRC} )
93
100
94
101
add_executable (sample_read_media_file examples/media_manager/sample_read_media_file.cc)
95
- target_link_libraries (sample_read_media_file edge_sample )
102
+ target_link_libraries (sample_read_media_file ${SAMPLE_LIB} )
96
103
97
104
add_executable (sample_media_file_list examples/media_manager/sample_media_file_list.cc)
98
- target_link_libraries (sample_media_file_list edge_sample )
105
+ target_link_libraries (sample_media_file_list ${SAMPLE_LIB} )
99
106
100
107
add_executable (sample_set_upload_cloud_strategy examples/media_manager/sample_set_upload_cloud_strategy.cc)
101
- target_link_libraries (sample_set_upload_cloud_strategy edge_sample )
108
+ target_link_libraries (sample_set_upload_cloud_strategy ${SAMPLE_LIB} )
102
109
103
110
add_executable (sample_cloud_api examples/cloud_api/sample_cloud_api.cc)
104
- target_link_libraries (sample_cloud_api edge_sample)
105
-
106
- add_executable (pressure_test examples/test /pressure_test.cc)
107
- target_link_libraries (pressure_test edge_sample)
111
+ target_link_libraries (sample_cloud_api ${SAMPLE_LIB} )
108
112
109
113
if (NOT EXECUTABLE_OUTPUT_PATH )
110
114
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR} /bin)
0 commit comments