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