diff --git a/CMakeLists.txt b/CMakeLists.txt index e7a350667c..5204a91cf5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -430,7 +430,7 @@ include_directories(ext/native/ext/stb_vorbis) if(USE_FFMPEG) if(USE_SYSTEM_FFMPEG) - include(FindFFMPEG) + find_package(FFMPEG) else() set(FFMPEG_FOUND OFF) endif() @@ -549,29 +549,29 @@ endif(USE_FFMPEG) if(USE_FFMPEG AND DEFINED FFMPEG_LIBRARIES) message(STATUS "FFMPEG library locations:") if(FFMPEG_FOUND) - message(STATUS "libavcodec location: ${FFMPEG_avcodec_LIBRARY}") - message(STATUS "libavformat location: ${FFMPEG_avformat_LIBRARY}") - message(STATUS "libavutil location: ${FFMPEG_avutil_LIBRARY}") - message(STATUS "libswresample location: ${FFMPEG_swresample_LIBRARY}") - message(STATUS "libswscale location: ${FFMPEG_swscale_LIBRARY}") + message(STATUS " libavcodec location: ${FFMPEG_avcodec_LIBRARY}") + message(STATUS " libavformat location: ${FFMPEG_avformat_LIBRARY}") + message(STATUS " libavutil location: ${FFMPEG_avutil_LIBRARY}") + message(STATUS " libswresample location: ${FFMPEG_swresample_LIBRARY}") + message(STATUS " libswscale location: ${FFMPEG_swscale_LIBRARY}") elseif(DEFINED PLATFORM_ARCH) set(TEMP ${CMAKE_SOURCE_DIR}/ffmpeg/${PLATFORM_ARCH}/lib) - message(STATUS "libavcodec location: ${TEMP}/libavcodec.a") - message(STATUS "libavformat location: ${TEMP}/libavformat.a") - message(STATUS "libavutil location: ${TEMP}/libavutil.a") - message(STATUS "libswresample location: ${TEMP}/libswresample.a") - message(STATUS "libswscale location: ${TEMP}/libswscale.a") + message(STATUS " libavcodec location: ${TEMP}/libavcodec.a") + message(STATUS " libavformat location: ${TEMP}/libavformat.a") + message(STATUS " libavutil location: ${TEMP}/libavutil.a") + message(STATUS " libswresample location: ${TEMP}/libswresample.a") + message(STATUS " libswscale location: ${TEMP}/libswscale.a") else() get_target_property(TEMP libavcodec IMPORTED_LOCATION) - message(STATUS "libavcodec location: ${TEMP}") + message(STATUS " libavcodec location: ${TEMP}") get_target_property(TEMP libavformat IMPORTED_LOCATION) - message(STATUS "libavformat location: ${TEMP}") + message(STATUS " libavformat location: ${TEMP}") get_target_property(TEMP libavutil IMPORTED_LOCATION) - message(STATUS "libavutil location: ${TEMP}") + message(STATUS " libavutil location: ${TEMP}") get_target_property(TEMP libswresample IMPORTED_LOCATION) - message(STATUS "libswresample location: ${TEMP}") + message(STATUS " libswresample location: ${TEMP}") get_target_property(TEMP libswscale IMPORTED_LOCATION) - message(STATUS "libswscale location: ${TEMP}") + message(STATUS " libswscale location: ${TEMP}") endif() else() message(STATUS "ERROR: No FFMPEG library locations") diff --git a/CMakeTests/FindFFMPEG.cmake b/CMakeTests/FindFFMPEG.cmake index 8fac08fb48..7b791cdf9a 100644 --- a/CMakeTests/FindFFMPEG.cmake +++ b/CMakeTests/FindFFMPEG.cmake @@ -30,70 +30,82 @@ # (To distribute this file outside of ppsspp, substitute the full # License text for the above reference.) -find_path(FFMPEG_INCLUDE_DIR1 avformat.h - $ENV{FFMPEG_DIR} - $ENV{FFMPEG_DIR}/ffmpeg - $ENV{FFMPEG_DIR}/libavformat - $ENV{FFMPEG_DIR}/include/libavformat - $ENV{FFMPEG_DIR}/include/ffmpeg - /usr/local/include/ffmpeg - /usr/include/ffmpeg - /usr/include/libavformat - /usr/include/ffmpeg/libavformat - /usr/local/include/libavformat -) +if(EXISTS "/etc/debian_version") + set (PLATFORM "Debian") +endif() -find_path(FFMPEG_INCLUDE_DIR2 avcodec.h - $ENV{FFMPEG_DIR} - $ENV{FFMPEG_DIR}/ffmpeg - $ENV{FFMPEG_DIR}/libavcodec - $ENV{FFMPEG_DIR}/include/libavcodec - $ENV{FFMPEG_DIR}/include/ffmpeg - /usr/local/include/ffmpeg - /usr/include/ffmpeg - /usr/include/libavcodec - /usr/include/ffmpeg/libavcodec - /usr/local/include/libavcodec -) +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 + $ENV{FFMPEG_DIR} + $ENV{FFMPEG_DIR}/ffmpeg + $ENV{FFMPEG_DIR}/libavformat + $ENV{FFMPEG_DIR}/include/libavformat + $ENV{FFMPEG_DIR}/include/ffmpeg + /usr/local/include/ffmpeg + /usr/include/ffmpeg + /usr/include/libavformat + /usr/include/ffmpeg/libavformat + /usr/local/include/libavformat + ) -find_path(FFMPEG_INCLUDE_DIR3 avutil.h - $ENV{FFMPEG_DIR} - $ENV{FFMPEG_DIR}/ffmpeg - $ENV{FFMPEG_DIR}/libavutil - $ENV{FFMPEG_DIR}/include/libavutil - $ENV{FFMPEG_DIR}/include/ffmpeg - /usr/local/include/ffmpeg - /usr/include/ffmpeg - /usr/include/libavutil - /usr/include/ffmpeg/libavutil - /usr/local/include/libavutil -) + find_path(FFMPEG_INCLUDE_DIR2 avcodec.h + $ENV{FFMPEG_DIR} + $ENV{FFMPEG_DIR}/ffmpeg + $ENV{FFMPEG_DIR}/libavcodec + $ENV{FFMPEG_DIR}/include/libavcodec + $ENV{FFMPEG_DIR}/include/ffmpeg + /usr/local/include/ffmpeg + /usr/include/ffmpeg + /usr/include/libavcodec + /usr/include/ffmpeg/libavcodec + /usr/local/include/libavcodec + ) -find_path(FFMPEG_INCLUDE_DIR4 swresample.h - $ENV{FFMPEG_DIR} - $ENV{FFMPEG_DIR}/ffmpeg - $ENV{FFMPEG_DIR}/libswresample - $ENV{FFMPEG_DIR}/include/libswresample - $ENV{FFMPEG_DIR}/include/ffmpeg - /usr/local/include/ffmpeg - /usr/include/ffmpeg - /usr/include/libswresample - /usr/include/ffmpeg/libswresample - /usr/local/include/libswresample -) + find_path(FFMPEG_INCLUDE_DIR3 avutil.h + $ENV{FFMPEG_DIR} + $ENV{FFMPEG_DIR}/ffmpeg + $ENV{FFMPEG_DIR}/libavutil + $ENV{FFMPEG_DIR}/include/libavutil + $ENV{FFMPEG_DIR}/include/ffmpeg + /usr/local/include/ffmpeg + /usr/include/ffmpeg + /usr/include/libavutil + /usr/include/ffmpeg/libavutil + /usr/local/include/libavutil + ) -find_path(FFMPEG_INCLUDE_DIR5 swscale.h - $ENV{FFMPEG_DIR} - $ENV{FFMPEG_DIR}/ffmpeg - $ENV{FFMPEG_DIR}/libswscale - $ENV{FFMPEG_DIR}/include/libswscale - $ENV{FFMPEG_DIR}/include/ffmpeg - /usr/local/include/ffmpeg - /usr/include/ffmpeg - /usr/include/libswscale - /usr/include/ffmpeg/libswscale - /usr/local/include/libswscale -) + find_path(FFMPEG_INCLUDE_DIR4 swresample.h + $ENV{FFMPEG_DIR} + $ENV{FFMPEG_DIR}/ffmpeg + $ENV{FFMPEG_DIR}/libswresample + $ENV{FFMPEG_DIR}/include/libswresample + $ENV{FFMPEG_DIR}/include/ffmpeg + /usr/local/include/ffmpeg + /usr/include/ffmpeg + /usr/include/libswresample + /usr/include/ffmpeg/libswresample + /usr/local/include/libswresample + ) + + find_path(FFMPEG_INCLUDE_DIR5 swscale.h + $ENV{FFMPEG_DIR} + $ENV{FFMPEG_DIR}/ffmpeg + $ENV{FFMPEG_DIR}/libswscale + $ENV{FFMPEG_DIR}/include/libswscale + $ENV{FFMPEG_DIR}/include/ffmpeg + /usr/local/include/ffmpeg + /usr/include/ffmpeg + /usr/include/libswscale + /usr/include/ffmpeg/libswscale + /usr/local/include/libswscale + ) +endif() if(FFMPEG_INCLUDE_DIR1 AND FFMPEG_INCLUDE_DIR2 AND @@ -109,45 +121,53 @@ if(FFMPEG_INCLUDE_DIR1 AND ) endif() -find_library(FFMPEG_avformat_LIBRARY avformat - $ENV{FFMPEG_DIR} - $ENV{FFMPEG_DIR}/lib - $ENV{FFMPEG_DIR}/libavformat - /usr/local/lib - /usr/lib -) +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 + $ENV{FFMPEG_DIR} + $ENV{FFMPEG_DIR}/lib + $ENV{FFMPEG_DIR}/libavformat + /usr/local/lib + /usr/lib + ) -find_library(FFMPEG_avcodec_LIBRARY avcodec - $ENV{FFMPEG_DIR} - $ENV{FFMPEG_DIR}/lib - $ENV{FFMPEG_DIR}/libavcodec - /usr/local/lib - /usr/lib -) + find_library(FFMPEG_avcodec_LIBRARY avcodec + $ENV{FFMPEG_DIR} + $ENV{FFMPEG_DIR}/lib + $ENV{FFMPEG_DIR}/libavcodec + /usr/local/lib + /usr/lib + ) -find_library(FFMPEG_avutil_LIBRARY avutil - $ENV{FFMPEG_DIR} - $ENV{FFMPEG_DIR}/lib - $ENV{FFMPEG_DIR}/libavutil - /usr/local/lib - /usr/lib -) + find_library(FFMPEG_avutil_LIBRARY avutil + $ENV{FFMPEG_DIR} + $ENV{FFMPEG_DIR}/lib + $ENV{FFMPEG_DIR}/libavutil + /usr/local/lib + /usr/lib + ) -find_library(FFMPEG_swresample_LIBRARY swresample - $ENV{FFMPEG_DIR} - $ENV{FFMPEG_DIR}/lib - $ENV{FFMPEG_DIR}/libswresample - /usr/local/lib - /usr/lib -) + find_library(FFMPEG_swresample_LIBRARY swresample + $ENV{FFMPEG_DIR} + $ENV{FFMPEG_DIR}/lib + $ENV{FFMPEG_DIR}/libswresample + /usr/local/lib + /usr/lib + ) -find_library(FFMPEG_swscale_LIBRARY swscale - $ENV{FFMPEG_DIR} - $ENV{FFMPEG_DIR}/lib - $ENV{FFMPEG_DIR}/libswscale - /usr/local/lib - /usr/lib -) + find_library(FFMPEG_swscale_LIBRARY swscale + $ENV{FFMPEG_DIR} + $ENV{FFMPEG_DIR}/lib + $ENV{FFMPEG_DIR}/libswscale + /usr/local/lib + /usr/lib + ) +endif() if(FFMPEG_INCLUDE_DIR) if(FFMPEG_avformat_LIBRARY AND @@ -157,11 +177,22 @@ if(FFMPEG_INCLUDE_DIR) FFMPEG_swscale_LIBRARY ) set(FFMPEG_FOUND "YES") - set(FFMPEG_LIBRARIES ${FFMPEG_avformat_LIBRARY} - ${FFMPEG_avcodec_LIBRARY} - ${FFMPEG_avutil_LIBRARY} - ${FFMPEG_swresample_LIBRARY} - ${FFMPEG_swscale_LIBRARY} - ) + if(${PLATFORM} MATCHES "Debian") + set(FFMPEG_LIBRARIES avformat-ffmpeg + avcodec-ffmpeg + avutil-ffmpeg + swresample-ffmpeg + swscale-ffmpeg + ) + else() + set(FFMPEG_LIBRARIES ${FFMPEG_avformat_LIBRARY} + ${FFMPEG_avcodec_LIBRARY} + ${FFMPEG_avutil_LIBRARY} + ${FFMPEG_swresample_LIBRARY} + ${FFMPEG_swscale_LIBRARY} + ) + endif() endif() endif() + +unset (PLATFORM) diff --git a/git-version.cmake b/git-version.cmake index a507a93045..ff276d7f59 100644 --- a/git-version.cmake +++ b/git-version.cmake @@ -3,7 +3,7 @@ set(GIT_VERSION "unknown") set(GIT_VERSION_UPDATE "1") find_package(Git) -if(GIT_FOUND) +if(GIT_FOUND AND EXISTS ".git") execute_process(COMMAND ${GIT_EXECUTABLE} describe --always WORKING_DIRECTORY ${SOURCE_DIR} RESULT_VARIABLE exit_code @@ -39,4 +39,4 @@ set(code_string "// This is a generated file.\n\n" if ("${GIT_VERSION_UPDATE}" EQUAL "1") file(WRITE ${GIT_VERSION_FILE} ${code_string}) -endif() \ No newline at end of file +endif()