CMake: Copy FFmpeg dylibs into Mac bundle
This commit is contained in:
parent
5786f3a8c9
commit
f48d3b4636
|
@ -97,7 +97,23 @@ function (_ffmpeg_find component headername)
|
||||||
PARENT_SCOPE)
|
PARENT_SCOPE)
|
||||||
|
|
||||||
set(version_header_path "${FFMPEG_${component}_INCLUDE_DIR}/lib${component}/version.h")
|
set(version_header_path "${FFMPEG_${component}_INCLUDE_DIR}/lib${component}/version.h")
|
||||||
if (EXISTS "${version_header_path}")
|
set(major_version_header_path "${FFMPEG_${component}_INCLUDE_DIR}/lib${component}/version_major.h")
|
||||||
|
if (EXISTS "${major_version_header_path}")
|
||||||
|
string(TOUPPER "${component}" component_upper)
|
||||||
|
file(STRINGS "${major_version_header_path}" major_version
|
||||||
|
REGEX "#define *LIB${component_upper}_VERSION_MAJOR ")
|
||||||
|
file(STRINGS "${version_header_path}" version
|
||||||
|
REGEX "#define *LIB${component_upper}_VERSION_(MINOR|MICRO) ")
|
||||||
|
string(REGEX REPLACE ".*_MAJOR *\([0-9]*\).*" "\\1" major "${major_version}")
|
||||||
|
string(REGEX REPLACE ".*_MINOR *\([0-9]*\).*" "\\1" minor "${version}")
|
||||||
|
string(REGEX REPLACE ".*_MICRO *\([0-9]*\).*" "\\1" micro "${version}")
|
||||||
|
if (NOT major STREQUAL "" AND
|
||||||
|
NOT minor STREQUAL "" AND
|
||||||
|
NOT micro STREQUAL "")
|
||||||
|
set("FFMPEG_${component}_VERSION" "${major}.${minor}.${micro}"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
endif ()
|
||||||
|
elseif (EXISTS "${version_header_path}")
|
||||||
string(TOUPPER "${component}" component_upper)
|
string(TOUPPER "${component}" component_upper)
|
||||||
file(STRINGS "${version_header_path}" version
|
file(STRINGS "${version_header_path}" version
|
||||||
REGEX "#define *LIB${component_upper}_VERSION_(MAJOR|MINOR|MICRO) ")
|
REGEX "#define *LIB${component_upper}_VERSION_(MAJOR|MINOR|MICRO) ")
|
||||||
|
|
|
@ -294,7 +294,15 @@ function(add_util_resources target)
|
||||||
|
|
||||||
# Copy shaderc into the bundle
|
# Copy shaderc into the bundle
|
||||||
get_target_property(SPIRV_CROSS_LIBRARY spirv-cross-c-shared IMPORTED_SONAME_RELEASE)
|
get_target_property(SPIRV_CROSS_LIBRARY spirv-cross-c-shared IMPORTED_SONAME_RELEASE)
|
||||||
target_sources(duckstation-qt PRIVATE "${SHADERC_LIBRARY}" "${SPIRV_CROSS_LIBRARY}")
|
target_sources(${target} PRIVATE "${SHADERC_LIBRARY}" "${SPIRV_CROSS_LIBRARY}")
|
||||||
set_source_files_properties("${SHADERC_LIBRARY}" "${SPIRV_CROSS_LIBRARY}" PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks)
|
set_source_files_properties("${SHADERC_LIBRARY}" "${SPIRV_CROSS_LIBRARY}" PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks)
|
||||||
|
|
||||||
|
# Copy FFmpeg libraries into the bundle
|
||||||
|
foreach(component avcodec avformat avutil swresample swscale)
|
||||||
|
string(REGEX REPLACE "\([0-9]+\)\.[0-9]+\.[0-9]+" "\\1" major "${FFMPEG_${component}_VERSION}")
|
||||||
|
string(REPLACE "lib${component}.dylib" "lib${component}.${major}.dylib" version_lib "${FFMPEG_${component}_LIBRARIES}")
|
||||||
|
target_sources(${target} PRIVATE ${version_lib})
|
||||||
|
set_source_files_properties(${target} PRIVATE ${version_lib} PROPERTIES MACOSX_PACKAGE_LOCATION Frameworks)
|
||||||
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
Loading…
Reference in New Issue