1# cmake file for ffmpeg 2 3if (NOT DE_DEFS) 4 message(FATAL_ERROR "Include Defs.cmake") 5endif () 6 7if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/include/libavformat/avformat.h") 8 set(DEFAULT_FFMPEG_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src) 9else () 10 # Assume build inside Android source tree 11 set(DEFAULT_FFMPEG_SRC_PATH "../ffmpeg") 12endif () 13 14set(FFMPEG_SRC_PATH ${DEFAULT_FFMPEG_SRC_PATH} CACHE STRING "Path to ffmpeg source tree") 15 16if (IS_ABSOLUTE ${FFMPEG_SRC_PATH}) 17 set(FFMPEG_ABS_PATH ${FFMPEG_SRC_PATH}) 18else () 19 set(FFMPEG_ABS_PATH "${CMAKE_SOURCE_DIR}/${FFMPEG_SRC_PATH}") 20endif () 21 22#set(FFMPEG_SRCS 23# ${FFMPEG_ABS_PATH}/include/libavformat/avformat.h 24# ${FFMPEG_ABS_PATH}/include/libavformat/avio.h 25# ${FFMPEG_ABS_PATH}/include/libavcodec/avcodec.h 26# ) 27 28#set(FFMPEG_INCLUDE_PATH ${FFMPEG_ABS_PATH}/include PARENT_SCOPE) 29 30if (DE_OS_IS_WIN32) 31 file(GLOB FFMPEG_LIBRARIES_FILES_FULL ${FFMPEG_ABS_PATH}/lib/*.lib) 32elseif (DE_OS_IS_UNIX) 33 file(GLOB FFMPEG_LIBRARIES_FILES_FULL ${FFMPEG_ABS_PATH}/lib/*) 34else () 35 message( FATAL_ERROR "System is not supported" ) 36endif () 37 38#set(FFMPEG_LIBRARIES_FILES_SHORT ) 39#foreach(FFMPEG_LIBRARY_FILE_FULL ${FFMPEG_LIBRARIES_FILES_FULL}) 40# get_filename_component(FFMPEG_LIBRARY_FILE "${FFMPEG_LIBRARY_FILE_FULL}" NAME_WE) 41# set(FFMPEG_LIBRARIES_FILES_SHORT ${FFMPEG_LIBRARY_FILE} ${FFMPEG_LIBRARIES_FILES_SHORT}) 42#endforeach() 43 44#message(WARNING ${FFMPEG_LIBRARIES_FILES_SHORT}) 45 46set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES_FILES_FULL} PARENT_SCOPE) 47set(FFMPEG_LIBRARIES_PATH ${FFMPEG_ABS_PATH}/lib PARENT_SCOPE) 48 49#message(WARNING ${FFMPEG_LIBRARIES_FILES_FULL}) 50 51# 52#file(GLOB ConfigFiles ${FFMPEG_ABS_PATH}/lib/*.lib 53# ${FFMPEG_ABS_PATH}/bin/*.dll) 54# 55#add_custom_target(ffmpeg) 56#foreach(ConfigFile ${ConfigFiles}) 57# add_custom_command(TARGET ffmpeg PRE_BUILD 58# COMMAND ${CMAKE_COMMAND} -E 59# copy ${ConfigFile} ${CMAKE_CURRENT_BINARY_DIR}/.) 60#endforeach() 61 62if (DE_OS_IS_UNIX) 63 add_custom_target(ffmpeg ALL) 64 foreach(FFMPEG_LIBRARIES_FILE ${FFMPEG_LIBRARIES_FILES_FULL}) 65 #message(WARNING ${FFMPEG_LIBRARIES_FILE}) 66 #add_custom_command(TARGET ffmpeg PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FFMPEG_LIBRARIES_FILE} ${CMAKE_BINARY_DIR}) 67 add_custom_command(TARGET ffmpeg PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${FFMPEG_LIBRARIES_FILE} ${CMAKE_BINARY_DIR}/external/ffmpeg) 68 endforeach() 69 #message(WARNING ${CMAKE_BINARY_DIR}) 70endif () 71