Improve FFmpeg detection on debian systems; fix build when git is installed but there is no .git folder.

This commit is contained in:
sergiobenrocha2 2015-09-16 19:07:25 -03:00
parent 18f452ff29
commit e81fa01bf0
3 changed files with 150 additions and 119 deletions

View file

@ -430,7 +430,7 @@ include_directories(ext/native/ext/stb_vorbis)
if(USE_FFMPEG) if(USE_FFMPEG)
if(USE_SYSTEM_FFMPEG) if(USE_SYSTEM_FFMPEG)
include(FindFFMPEG) find_package(FFMPEG)
else() else()
set(FFMPEG_FOUND OFF) set(FFMPEG_FOUND OFF)
endif() endif()

View file

@ -30,6 +30,17 @@
# (To distribute this file outside of ppsspp, substitute the full # (To distribute this file outside of ppsspp, substitute the full
# License text for the above reference.) # License text for the above reference.)
if(EXISTS "/etc/debian_version")
set (PLATFORM "Debian")
endif()
if(${PLATFORM} MATCHES "Debian")
find_path(FFMPEG_INCLUDE_DIR1 libavformat/avformat.h)
find_path(FFMPEG_INCLUDE_DIR2 libavcodec/avcodec.h)
find_path(FFMPEG_INCLUDE_DIR3 libavutil/avutil.h)
find_path(FFMPEG_INCLUDE_DIR4 libswresample/swresample.h)
find_path(FFMPEG_INCLUDE_DIR5 libswscale/swscale.h)
else()
find_path(FFMPEG_INCLUDE_DIR1 avformat.h find_path(FFMPEG_INCLUDE_DIR1 avformat.h
$ENV{FFMPEG_DIR} $ENV{FFMPEG_DIR}
$ENV{FFMPEG_DIR}/ffmpeg $ENV{FFMPEG_DIR}/ffmpeg
@ -94,6 +105,7 @@ find_path(FFMPEG_INCLUDE_DIR5 swscale.h
/usr/include/ffmpeg/libswscale /usr/include/ffmpeg/libswscale
/usr/local/include/libswscale /usr/local/include/libswscale
) )
endif()
if(FFMPEG_INCLUDE_DIR1 AND if(FFMPEG_INCLUDE_DIR1 AND
FFMPEG_INCLUDE_DIR2 AND FFMPEG_INCLUDE_DIR2 AND
@ -109,6 +121,13 @@ if(FFMPEG_INCLUDE_DIR1 AND
) )
endif() endif()
if(${PLATFORM} MATCHES "Debian")
find_library(FFMPEG_avformat_LIBRARY avformat-ffmpeg)
find_library(FFMPEG_avcodec_LIBRARY avcodec-ffmpeg)
find_library(FFMPEG_avutil_LIBRARY avutil-ffmpeg)
find_library(FFMPEG_swresample_LIBRARY swresample-ffmpeg)
find_library(FFMPEG_swscale_LIBRARY swscale-ffmpeg)
else()
find_library(FFMPEG_avformat_LIBRARY avformat find_library(FFMPEG_avformat_LIBRARY avformat
$ENV{FFMPEG_DIR} $ENV{FFMPEG_DIR}
$ENV{FFMPEG_DIR}/lib $ENV{FFMPEG_DIR}/lib
@ -148,6 +167,7 @@ find_library(FFMPEG_swscale_LIBRARY swscale
/usr/local/lib /usr/local/lib
/usr/lib /usr/lib
) )
endif()
if(FFMPEG_INCLUDE_DIR) if(FFMPEG_INCLUDE_DIR)
if(FFMPEG_avformat_LIBRARY AND if(FFMPEG_avformat_LIBRARY AND
@ -157,6 +177,14 @@ if(FFMPEG_INCLUDE_DIR)
FFMPEG_swscale_LIBRARY FFMPEG_swscale_LIBRARY
) )
set(FFMPEG_FOUND "YES") set(FFMPEG_FOUND "YES")
if(${PLATFORM} MATCHES "Debian")
set(FFMPEG_LIBRARIES avformat-ffmpeg
avcodec-ffmpeg
avutil-ffmpeg
swresample-ffmpeg
swscale-ffmpeg
)
else()
set(FFMPEG_LIBRARIES ${FFMPEG_avformat_LIBRARY} set(FFMPEG_LIBRARIES ${FFMPEG_avformat_LIBRARY}
${FFMPEG_avcodec_LIBRARY} ${FFMPEG_avcodec_LIBRARY}
${FFMPEG_avutil_LIBRARY} ${FFMPEG_avutil_LIBRARY}
@ -165,3 +193,6 @@ if(FFMPEG_INCLUDE_DIR)
) )
endif() endif()
endif() endif()
endif()
unset (PLATFORM)

View file

@ -3,7 +3,7 @@ set(GIT_VERSION "unknown")
set(GIT_VERSION_UPDATE "1") set(GIT_VERSION_UPDATE "1")
find_package(Git) find_package(Git)
if(GIT_FOUND) if(GIT_FOUND AND EXISTS ".git")
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always execute_process(COMMAND ${GIT_EXECUTABLE} describe --always
WORKING_DIRECTORY ${SOURCE_DIR} WORKING_DIRECTORY ${SOURCE_DIR}
RESULT_VARIABLE exit_code RESULT_VARIABLE exit_code