Skip to content

Commit

Permalink
add more binaries from dependencies to a lib target too
Browse files Browse the repository at this point in the history
  • Loading branch information
summeroff committed Jan 20, 2025
1 parent d2760d3 commit 40db1bf
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 26 deletions.
50 changes: 25 additions & 25 deletions cmake/Modules/CopyMSVCBins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ set(QtCore_DIR "${Qt6Core_DIR}")
cmake_path(SET QtCore_DIR_NORM NORMALIZE "${QtCore_DIR}/../../..")
set(QtCore_BIN_DIR "${QtCore_DIR_NORM}bin")
set(QtCore_PLUGIN_DIR "${QtCore_DIR_NORM}plugins")
obs_status(STATUS "QtCore_BIN_DIR: ${QtCore_BIN_DIR}")
obs_status(STATUS "QtCore_PLUGIN_DIR: ${QtCore_PLUGIN_DIR}")
message(STATUS "QtCore_BIN_DIR: ${QtCore_BIN_DIR}")
message(STATUS "QtCore_PLUGIN_DIR: ${QtCore_PLUGIN_DIR}")

file(
GLOB
Expand Down Expand Up @@ -265,39 +265,39 @@ foreach(
endif()
endforeach()

obs_status(STATUS "FFmpeg files: ${FFMPEG_BIN_FILES}")
obs_status(STATUS "x264 files: ${X264_BIN_FILES}")
obs_status(STATUS "Libfdk files: ${LIBFDK_BIN_FILES}")
obs_status(STATUS "Freetype files: ${FREETYPE_BIN_FILES}")
obs_status(STATUS "rnnoise files: ${RNNOISE_BIN_FILES}")
obs_status(STATUS "curl files: ${CURL_BIN_FILES}")
obs_status(STATUS "lua files: ${LUA_BIN_FILES}")
obs_status(STATUS "ssl files: ${SSL_BIN_FILES}")
obs_status(STATUS "zlib files: ${ZLIB_BIN_FILES}")
obs_status(STATUS "Qt Debug files: ${QT_DEBUG_BIN_FILES}")
obs_status(STATUS "Qt Debug Platform files: ${QT_DEBUG_PLAT_BIN_FILES}")
obs_status(STATUS "Qt Debug Styles files: ${QT_DEBUG_STYLES_BIN_FILES}")
obs_status(STATUS "Qt Debug Iconengine files: ${QT_DEBUG_ICONENGINE_BIN_FILES}")
obs_status(STATUS "Qt Debug Imageformat files: ${QT_DEBUG_IMAGEFORMATS_BIN_FILES}")
obs_status(STATUS "Qt Release files: ${QT_BIN_FILES}")
obs_status(STATUS "Qt Release Platform files: ${QT_PLAT_BIN_FILES}")
obs_status(STATUS "Qt Release Styles files: ${QT_STYLES_BIN_FILES}")
obs_status(STATUS "Qt Release Iconengine files: ${QT_ICONENGINE_BIN_FILES}")
obs_status(STATUS "Qt Release Imageformat files: ${QT_IMAGEFORMATS_BIN_FILES}")
obs_status(STATUS "Qt ICU files: ${QT_ICU_BIN_FILES}")
message(STATUS "FFmpeg files: ${FFMPEG_BIN_FILES}")
message(STATUS "x264 files: ${X264_BIN_FILES}")
message(STATUS "Libfdk files: ${LIBFDK_BIN_FILES}")
message(STATUS "Freetype files: ${FREETYPE_BIN_FILES}")
message(STATUS "rnnoise files: ${RNNOISE_BIN_FILES}")
message(STATUS "curl files: ${CURL_BIN_FILES}")
message(STATUS "lua files: ${LUA_BIN_FILES}")
message(STATUS "ssl files: ${SSL_BIN_FILES}")
message(STATUS "zlib files: ${ZLIB_BIN_FILES}")
message(STATUS "Qt Debug files: ${QT_DEBUG_BIN_FILES}")
message(STATUS "Qt Debug Platform files: ${QT_DEBUG_PLAT_BIN_FILES}")
message(STATUS "Qt Debug Styles files: ${QT_DEBUG_STYLES_BIN_FILES}")
message(STATUS "Qt Debug Iconengine files: ${QT_DEBUG_ICONENGINE_BIN_FILES}")
message(STATUS "Qt Debug Imageformat files: ${QT_DEBUG_IMAGEFORMATS_BIN_FILES}")
message(STATUS "Qt Release files: ${QT_BIN_FILES}")
message(STATUS "Qt Release Platform files: ${QT_PLAT_BIN_FILES}")
message(STATUS "Qt Release Styles files: ${QT_STYLES_BIN_FILES}")
message(STATUS "Qt Release Iconengine files: ${QT_ICONENGINE_BIN_FILES}")
message(STATUS "Qt Release Imageformat files: ${QT_IMAGEFORMATS_BIN_FILES}")
message(STATUS "Qt ICU files: ${QT_ICU_BIN_FILES}")

foreach(BinFile ${ALL_BASE_BIN_FILES})
obs_status(STATUS "copying ${BinFile} to ${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}")
message(STATUS "copying ${BinFile} to ${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}")
file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}/")
endforeach()

foreach(BinFile ${ALL_REL_BIN_FILES})
obs_status(STATUS "copying ${BinFile} to ${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r")
message(STATUS "copying ${BinFile} to ${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r")
file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}r/")
endforeach()

foreach(BinFile ${ALL_DBG_BIN_FILES})
obs_status(STATUS "copying ${BinFile} to ${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d")
message(STATUS "copying ${BinFile} to ${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d")
file(COPY "${BinFile}" DESTINATION "${CMAKE_SOURCE_DIR}/additional_install_files/exec${_bin_suffix}d/")
endforeach()

Expand Down
56 changes: 55 additions & 1 deletion cmake/finders/FindFFmpeg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,24 @@ macro(FFmpeg_find_dll)
set(FFmpeg_${component}_LIBRARY "${FFmpeg_${component}_IMPLIB}")
endif()

if(NOT FFmpeg_FFMPEG_EXECUTABLE)
find_program(
FFmpeg_FFMPEG_EXECUTABLE
NAMES ffmpeg.exe
HINTS ${_implib_path} ${_bin_path}
DOC "Path to ffmpeg.exe"
)
endif()

if(NOT FFmpeg_FFPROBE_EXECUTABLE)
find_program(
FFmpeg_FFPROBE_EXECUTABLE
NAMES ffprobe.exe
HINTS ${_implib_path} ${_bin_path}
DOC "Path to ffprobe.exe"
)
endif()

unset(_implib_path)
unset(_bin_path)
unset(_dll_version)
Expand Down Expand Up @@ -275,6 +293,42 @@ if(NOT FFmpeg_avutil_FOUND)
ffmpeg_find_component(avutil)
endif()

if(NOT WIN32)
if(NOT FFmpeg_FFMPEG_EXECUTABLE)
find_program(
FFmpeg_FFMPEG_EXECUTABLE
NAMES ffmpeg
DOC "Path to ffmpeg (non-Windows fallback)"
)
endif()

if(NOT FFmpeg_FFPROBE_EXECUTABLE)
find_program(
FFmpeg_FFPROBE_EXECUTABLE
NAMES ffprobe
DOC "Path to ffprobe (non-Windows fallback)"
)
endif()
endif()

if(FFmpeg_FFMPEG_EXECUTABLE AND NOT TARGET FFmpeg::ffmpegexe)
add_executable(FFmpeg::ffmpegexe IMPORTED)
set_target_properties(FFmpeg::ffmpegexe
PROPERTIES
IMPORTED_LOCATION "${FFmpeg_FFMPEG_EXECUTABLE}"
)
endif()

if(FFmpeg_FFPROBE_EXECUTABLE AND NOT TARGET FFmpeg::ffprobeexe)
add_executable(FFmpeg::ffprobeexe IMPORTED)
set_target_properties(FFmpeg::ffprobeexe
PROPERTIES
IMPORTED_LOCATION "${FFmpeg_FFPROBE_EXECUTABLE}"
)
endif()

mark_as_advanced(FFmpeg_FFMPEG_EXECUTABLE FFmpeg_FFPROBE_EXECUTABLE)

if(EXISTS "${FFmpeg_avutil_INCLUDE_DIR}/libavutil/ffversion.h")
file(STRINGS "${FFmpeg_avutil_INCLUDE_DIR}/libavutil/ffversion.h" _version_string
REGEX "^.*FFMPEG_VERSION[ \t]+\"n?[0-9a-z\\~.-]+\"[ \t]*$")
Expand Down Expand Up @@ -342,4 +396,4 @@ include(FeatureSummary)
set_package_properties(
FFmpeg PROPERTIES
URL "https://www.ffmpeg.org"
DESCRIPTION "A complete, cross-platform solution to record, convert and stream audio and video.")
DESCRIPTION "A complete, cross-platform solution to record, convert, and stream audio/video.")
30 changes: 30 additions & 0 deletions libobs/cmake/os-windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,33 @@ target_link_libraries(
target_link_options(libobs PRIVATE /IGNORE:4098 /SAFESEH:NO)

set_target_properties(libobs PROPERTIES PREFIX "" OUTPUT_NAME "obs")

if(NOT ENABLE_UI)
set(DEP_BINARIES
$<TARGET_FILE:FFmpeg::avcodec>
$<TARGET_FILE:FFmpeg::avformat>
$<TARGET_FILE:FFmpeg::avutil>
$<TARGET_FILE:FFmpeg::swscale>
$<TARGET_FILE:FFmpeg::swresample>
$<TARGET_FILE:FFmpeg::avfilter>
$<TARGET_FILE:FFmpeg::avdevice>

$<TARGET_FILE:FFmpeg::ffmpegexe>
$<TARGET_FILE:FFmpeg::ffprobeexe>

$<TARGET_FILE:Libx264::Libx264>
$<TARGET_FILE:ZLIB::ZLIB>
)

foreach(DEP_BINARY ${DEP_BINARIES})
message(STATUS "Adding custom command to copy ${DEP_BINARY} to ${OBS_EXECUTABLE_DESTINATION}")

add_custom_command(TARGET libobs POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E echo "Copying dependencies binaries ${DEP_BINARY} to ${OBS_EXECUTABLE_DESTINATION}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${DEP_BINARY}" "${OBS_EXECUTABLE_DESTINATION}"
COMMENT "."
VERBATIM COMMAND_EXPAND_LISTS)
endforeach()

install(FILES ${DEP_BINARIES} DESTINATION ${OBS_EXECUTABLE_DESTINATION})
endif()

0 comments on commit 40db1bf

Please sign in to comment.