【Gstreamer 系列 4】构建ubuntu下的Gstreamer工程

1.将编译好的库放到工程内

 2.编写简单的cmake 

cmake_minimum_required(VERSION 2.8)

project(GstCameraAPI)

SET(SRC_LIST GstCameraAPI.c
    TOOLS/videotools.c
    DRIVER/usbcamera.c
   )

# add (.h) address
include_directories(${PROJECT_SOURCE_DIR}/CONFIG
                    ${PROJECT_SOURCE_DIR}/TOOLS
                    ${PROJECT_SOURCE_DIR}/DRIVER
                    )

# 这里将工程编译为动态库方便后续代码的扩展
add_library(${PROJECT_NAME} SHARED ${SRC_LIST})

add_definitions(-Wall -std=gnu99 -lm -pthread -lstdc++)

add_definitions(-DDEBUG)

# 添加多线程
find_package(Threads)
target_link_libraries (${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT})

# math 库
target_link_libraries(${PROJECT_NAME} m)

# 添加 gst so
find_package(PkgConfig REQUIRED)
pkg_check_modules(gstreamer REQUIRED IMPORTED_TARGET gstreamer-1.0 glib-2.0 gobject-2.0)
target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::gstreamer)

你可能感兴趣的:(gstreamer)