ffmpeg程序交叉编译
对ffmpeg源码路径下doc/examples/remuxing.c
进行交叉编译。
cmake_minimum_required(VERSION 2.8)
#指定交叉编译器路径
set(TOOLSCHAIN_PATH "/opt/arm-2014.05")
set(TOOLCHAIN_HOST "/opt/arm-2014.05/bin/arm-none-linux-gnueabi")
set(TOOLCHAIN_CC "${TOOLCHAIN_HOST}-gcc")
set(TOOLCHAIN_CXX "${TOOLCHAIN_HOST}-g++")
#告诉cmake是进行交叉编译
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSTEM_NAME "Linux")
# Define the compiler
set(CMAKE_C_COMPILER ${TOOLCHAIN_CC})
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_CXX})
#库和同头文件查找的路径
set(CMAKE_FIND_ROOT_PATH "${TOOLSCHAIN_PATH}")
aux_source_directory(. remuxing.c)
include_directories (/root/app/lib/ffmpeg_3.4.8/include
/root/app/lib/x264/include)
# 添加编译参数
add_compile_options(-std=gnu99 -Os -g)
set (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/out)
link_directories(/root/app/lib/ffmpeg_3.4.8/lib
/root/app/lib/x264/lib)
add_executable(remuxing_test remuxing.c)
# 添加链接库
target_link_libraries(remuxing_test -lpthread -ldl -lm libavdevice.a libavfilter.a libavformat.a libavcodec.a libpostproc.a libswresample.a libswscale.a libavutil.a libx264.a)