Add OpenCV and FFMPEG to CMake
This commit is contained in:
+19
-11
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.15)
|
|||||||
project (
|
project (
|
||||||
RoboMasterSDK
|
RoboMasterSDK
|
||||||
VERSION 2.0.0
|
VERSION 2.0.0
|
||||||
LANGUAGES C
|
LANGUAGES C CXX
|
||||||
)
|
)
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY C_STANDARD 17)
|
set_property(GLOBAL PROPERTY C_STANDARD 17)
|
||||||
@@ -30,19 +30,27 @@ target_include_directories(robomaster
|
|||||||
include
|
include
|
||||||
)
|
)
|
||||||
|
|
||||||
include(FetchContent)
|
find_package(SDL2 REQUIRED)
|
||||||
FetchContent_Declare (
|
find_package(OpenCV REQUIRED)
|
||||||
SDL2
|
find_package(PkgConfig REQUIRED)
|
||||||
GIT_REPOSITORY https://github.com/libsdl-org/SDL
|
|
||||||
GIT_TAG release-2.0.20
|
pkg_check_modules(FFMPEG REQUIRED IMPORTED_TARGET libavcodec libavformat libavutil libswscale)
|
||||||
GIT_SHALLOW TRUE
|
|
||||||
)
|
|
||||||
FetchContent_MakeAvailable(SDL2)
|
|
||||||
|
|
||||||
add_executable(robomasterapp
|
add_executable(robomasterapp
|
||||||
src/sdl.c
|
src/sdl.cpp
|
||||||
)
|
)
|
||||||
target_link_libraries(robomasterapp
|
target_link_libraries(robomasterapp
|
||||||
robomaster
|
robomaster
|
||||||
SDL2-static
|
SDL2::SDL2
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
PkgConfig::FFMPEG
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(stream
|
||||||
|
src/stream.cpp
|
||||||
|
)
|
||||||
|
target_link_libraries(stream
|
||||||
|
SDL2::SDL2
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
PkgConfig::FFMPEG
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user