1. 程式人生 > >MAC下開發FFMPEG的cmake

MAC下開發FFMPEG的cmake

cmake_minimum_required(VERSION 3.6)
project(FFMPEG_DEMO3)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -v -stdlib=libc++ -framework OpenGL -framework AppKit -framework Security -framework CoreFoundation -framework CoreVideo -framework CoreMedia -framework QuartzCore -framework CoreFoundation -framework VideoDecodeAcceleration -framework Cocoa -framework AudioToolbox -framework VideoToolbox -framework OpenCL -I/usr/local/include -L/usr/local/lib/ -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/
") set(SOURCE_FILES main.cpp) add_executable(FFMPEG_DEMO3 ${SOURCE_FILES}) INCLUDE_DIRECTORIES(/usr/local/Cellar/ffmpeg/3.2.2/include) INCLUDE_DIRECTORIES(/usr/local/Cellar/ffmpeg/3.2.2/lib) INCLUDE_DIRECTORIES(/usr/local/Cellar/libass/0.13.6/include) INCLUDE_DIRECTORIES(/usr/local/Cellar/libass/0.13.6/lib) INCLUDE_DIRECTORIES(/usr/X11/lib
) INCLUDE_DIRECTORIES(/usr/lib) FIND_LIBRARY(LIBAVCODEC libavcodec.dylib) FIND_LIBRARY(LIBAVDEVICE libavdevice.dylib) FIND_LIBRARY(LIBAVFILTER libavfilter.dylib) FIND_LIBRARY(LIBAVFORMAT libavformat.dylib) FIND_LIBRARY(LIBAVUTIL libavutil.dylib) FIND_LIBRARY(LIBPOSTPROC libpostproc.dylib) FIND_LIBRARY(LIBSWRESAMPLE libswresample.dylib
) FIND_LIBRARY(LIBSWSCALE libswscale.dylib) FIND_LIBRARY(LIBPOSTPROC libpostproc.dylib) FIND_LIBRARY(LIBICONV libiconv.dylib) FIND_LIBRARY(LIBAVRESAMPLE libavresample.dylib) FIND_LIBRARY(LIBFREETYPE libfreetype.dylib) FIND_LIBRARY(LIBASS libass.dylib) MARK_AS_ADVANCED(LIBAVCODEC LIBAVDEVICE LIBAVFILTER LIBMP3LAME LIBAVUTIL LIBAVRESAMPLE LIBSWSCALE LIBAVFORMAT LIBPOSTPROC LIBSWRESAMPLE LIBICONV LIBFREETYPE LIBASS) set(extra_libs ${LIBAVCODEC} ${LIBAVDEVICE} ${LIBAVFILTER} ${LIBMP3LAME} ${LIBAVUTIL} ${LIBAVRESAMPLE} ${LIBSWSCALE} ${LIBAVFORMAT} ${LIBPOSTPROC} ${LIBSWRESAMPLE} ${LIBICONV} ${LIBFREETYPE} ${LIBASS}) target_link_libraries(FFMPEG_DEMO3 ${extra_libs})
Version 2
cmake_minimum_required(VERSION 3.6)
project(FFMPEG_DEMO3)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -v -stdlib=libc++ -framework OpenGL -framework AppKit -framework Security -framework CoreFoundation -framework CoreVideo -framework CoreMedia -framework QuartzCore -framework CoreFoundation -framework VideoDecodeAcceleration -framework Cocoa -framework AudioToolbox -framework VideoToolbox -framework OpenCL -framework AVFoundation -I/usr/local/include -L/usr/local/lib/ -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/")

set(SOURCE_FILES main.cpp)
add_executable(FFMPEG_DEMO3 ${SOURCE_FILES})
INCLUDE_DIRECTORIES(/usr/local/Cellar/ffmpeg/3.2.2/include)
INCLUDE_DIRECTORIES(/usr/local/Cellar/ffmpeg/3.2.2/lib)
INCLUDE_DIRECTORIES(/usr/local/Cellar/libass/0.13.6/include)
INCLUDE_DIRECTORIES(/usr/local/Cellar/libass/0.13.6/lib)
INCLUDE_DIRECTORIES(/usr/X11/lib)
INCLUDE_DIRECTORIES(/usr/lib)
INCLUDE_DIRECTORIES(/usr/local/Cellar/sdl/1.2.15/lib)
#INCLUDE_DIRECTORIES(/usr/local/Cellar/sdl/1.2.15/include/SDL)
FIND_LIBRARY(LIBAVCODEC libavcodec.dylib)
FIND_LIBRARY(LIBAVDEVICE libavdevice.dylib)
FIND_LIBRARY(LIBAVFILTER libavfilter.dylib)
FIND_LIBRARY(LIBAVFORMAT libavformat.dylib)
FIND_LIBRARY(LIBAVUTIL libavutil.dylib)
FIND_LIBRARY(LIBPOSTPROC libpostproc.dylib)
FIND_LIBRARY(LIBSWRESAMPLE libswresample.dylib)
FIND_LIBRARY(LIBSWSCALE libswscale.dylib)
FIND_LIBRARY(LIBPOSTPROC libpostproc.dylib)
FIND_LIBRARY(LIBICONV libiconv.dylib)
FIND_LIBRARY(LIBAVRESAMPLE libavresample.dylib)
FIND_LIBRARY(LIBFREETYPE libfreetype.dylib)
FIND_LIBRARY(LIBASS libass.dylib)
#FIND_LIBRARY(LIBSDL2 libSDL2.dylib)
FIND_LIBRARY(LIBSDL libSDL.dylib)


MARK_AS_ADVANCED(LIBAVCODEC LIBAVDEVICE LIBAVFILTER LIBMP3LAME LIBAVUTIL LIBAVRESAMPLE LIBSWSCALE LIBAVFORMAT LIBPOSTPROC LIBSWRESAMPLE LIBICONV LIBFREETYPE LIBASS LIBSDL)
set(extra_libs ${LIBAVCODEC} ${LIBAVDEVICE} ${LIBAVFILTER} ${LIBMP3LAME} ${LIBAVUTIL} ${LIBAVRESAMPLE} ${LIBSWSCALE} ${LIBAVFORMAT} ${LIBPOSTPROC} ${LIBSWRESAMPLE} ${LIBICONV} ${LIBFREETYPE} ${LIBASS} ${LIBSDL})

target_link_libraries(FFMPEG_DEMO3 ${extra_libs})
verson 3
cmake_minimum_required(VERSION 3.8)
project(ffmpeg_demo1)


set(CMAKE_INCLUDE_DIRECTORIES_BEFORE ON)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -v -stdlib=libc++ -framework OpenGL -framework AppKit -framework Security -framework CoreFoundation -framework CoreVideo -framework CoreMedia -framework QuartzCore -framework CoreFoundation -framework VideoDecodeAcceleration -framework Cocoa -framework AudioToolbox -framework VideoToolbox -framework OpenCL -I/usr/local/include -L/usr/local/lib/ -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/")


include_directories(
        /usr/local/Cellar/ffmpeg/3.3.4/include/
        /usr/local/Cellar/lame/3.99.5/include/
        /usr/local/Cellar/libass/0.13.7/include/
        /usr/local/Cellar/libffi/3.2.1/lib/libffi-3.2.1/include
        /usr/local/Cellar/libogg/1.3.2/include
        /usr/local/Cellar/libpng/1.6.32/include
        /usr/local/Cellar/libtool/2.4.6_1/include
        /usr/local/Cellar/libvorbis/1.3.5_1/include
        /usr/local/Cellar/libvpx/1.6.1/include
        /usr/local/Cellar/sdl/1.2.15/include
        /usr/local/Cellar/x264/r2795/include
        /usr/local/Cellar/x265/2.5/include
        /usr/local/Cellar/xvid/1.3.4/include
        /usr/local/Cellar/yasm/1.3.0_1/include
        /usr/local/Cellar/freetype/2.8/include
        /usr/local/Cellar/fontconfig/2.12.5/include
        /usr/local/Cellar/harfbuzz/1.6.3/include
        /usr/local/Cellar/fribidi/0.19.7_1/include
        /usr/local/Cellar/graphite2/1.3.10/include
)

#file(GLOB_RECURSE FF_HEADS /usr/local/Cellar/ffmpeg/3.3.4/include/*.h)
set(CMAKE_CXX_STANDARD 11)

add_executable(ffmpeg_demo1 ./src/main.cpp )

add_subdirectory(./src/math)

target_link_libraries(ffmpeg_demo1
        MathFunctions
        /usr/local/Cellar/ffmpeg/3.3.4/lib/libavcodec.a
        /usr/local/Cellar/ffmpeg/3.3.4/lib/libavdevice.a
        /usr/local/Cellar/ffmpeg/3.3.4/lib/libavfilter.a
        /usr/local/Cellar/ffmpeg/3.3.4/lib/libavformat.a
        /usr/local/Cellar/ffmpeg/3.3.4/lib/libavresample.a
        /usr/local/Cellar/ffmpeg/3.3.4/lib/libavutil.a
        /usr/local/Cellar/ffmpeg/3.3.4/lib/libpostproc.a
        /usr/local/Cellar/ffmpeg/3.3.4/lib/libswresample.a
        /usr/local/Cellar/ffmpeg/3.3.4/lib/libswscale.a
        /usr/local/Cellar/lame/3.99.5/lib/libmp3lame.a
        /usr/local/Cellar/libass/0.13.7/lib/libass.a
        /usr/local/Cellar/libffi/3.2.1/lib/libffi.a
        /usr/local/Cellar/libogg/1.3.2/lib/libogg.a
        /usr/local/Cellar/libpng/1.6.32/lib/libpng.a
        /usr/local/Cellar/libpng/1.6.32/lib/libpng16.a
        /usr/local/Cellar/libtool/2.4.6_1/lib/libltdl.a
        /usr/local/Cellar/libvorbis/1.3.5_1/lib/libvorbis.a
        /usr/local/Cellar/libvorbis/1.3.5_1/lib/libvorbisenc.a
        /usr/local/Cellar/libvorbis/1.3.5_1/lib/libvorbisfile.a
        /usr/local/Cellar/libvpx/1.6.1/lib/libvpx.a
        /usr/local/Cellar/sdl/1.2.15/lib/libSDL.a
        /usr/local/Cellar/sdl/1.2.15/lib/libSDLmain.a
        /usr/local/Cellar/x264/r2795/lib/libx264.a
        /usr/local/Cellar/x265/2.5/lib/libx265.a
        /usr/local/Cellar/xvid/1.3.4/lib/libxvidcore.a
        /usr/local/Cellar/yasm/1.3.0_1/lib/libyasm.a
        /usr/local/Cellar/freetype/2.8/lib/libfreetype.a
        /usr/local/Cellar/fontconfig/2.12.5/lib/libfontconfig.a
        /usr/local/lib/libfdk-aac.a
        /usr/local/Cellar/harfbuzz/1.6.3/lib/libharfbuzz.a
        /usr/lib/libbz2.dylib
        /usr/lib/libiconv.dylib
        /usr/lib/libssl.dylib
        /usr/lib/libxml2.dylib
        /usr/lib/libexpat.dylib
        /usr/lib/libxslt.dylib
        /usr/lib/libz.dylib
        /usr/local/Cellar/fribidi/0.19.7_1/lib/libfribidi.dylib
        /usr/local/Cellar/graphite2/1.3.10/lib/libgraphite2.dylib
)