diff --git a/.github/scripts/Build-Windows.ps1 b/.github/scripts/Build-Windows.ps1 index 34376665604475..df58dcfad8d4a3 100644 --- a/.github/scripts/Build-Windows.ps1 +++ b/.github/scripts/Build-Windows.ps1 @@ -89,11 +89,16 @@ function Build { Log-Group "Building obs-studio..." Invoke-External cmake @CmakeBuildArgs + Log-Group "Chech for changes in dependencies..." Invoke-External cmake @CmakeCheckArgs Log-Group "Installing obs-studio..." Invoke-External cmake @CmakeInstallArgs + Log-Group "Installing Development component..." + $CmakeInstallDevArgs = $CmakeInstallArgs + @('--component', 'Development') + Invoke-External cmake @CmakeInstallDevArgs + Pop-Location -Stack BuildTemp Log-Group } diff --git a/.github/workflows/build-project.yaml b/.github/workflows/build-project.yaml index 83b30ad0b5de77..038923f4d74fb9 100644 --- a/.github/workflows/build-project.yaml +++ b/.github/workflows/build-project.yaml @@ -344,8 +344,9 @@ jobs: needs: check-event env: PACKAGE_NAME: libobs - OS_TAG: windows-x64 - InstallPath: "build_x64/install" + OS_TAG: windows64 + InstallDir: "install" + BuildDir: "build_x64" RELEASE_BUCKET: "obsstudios3.streamlabs.com" ReleaseName: release defaults: @@ -356,7 +357,24 @@ jobs: with: submodules: recursive fetch-depth: 0 - + - name: 'Add msbuild to PATH' + uses: microsoft/setup-msbuild@v1 + - name: Install build components + run: | + # For versions update see here: https://learn.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022 + Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" + $InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" + $componentsToInstall= @( + "Microsoft.VisualStudio.Component.VC.v141.x86.x64" + "Microsoft.VisualStudio.Component.VC.14.39.17.9.x86.x64" + "Microsoft.VisualStudio.Component.VC.14.39.17.9.ATL" + ) + [string]$workloadArgs = $componentsToInstall | ForEach-Object {" --add " + $_} + $Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache') + # should be run twice + $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden + $process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden + shell: powershell - uses: actions/cache@v4 id: ccache-cache if: github.event_name == 'pull_request' @@ -415,7 +433,10 @@ jobs: $version = "${{ github.ref }}".Replace("refs/tags/", "") echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append - name: Package OBS lib 🗜️ - run: 7z a -r ${{env.TARGET_ARTIFACT}}.7z ${{env.InstallPath}} + run: | + cd ${{env.BuildDir}} + 7z a -r ../${{env.TARGET_ARTIFACT}}.7z ${{env.InstallDir}} + cd .. env: TARGET_ARTIFACT: ${{ env.PACKAGE_NAME }}-${{ env.OS_TAG }}-${{ env.ReleaseName }}-${{ steps.get_version.outputs.VERSION }} diff --git a/cmake/Modules/CopyMSVCBins.cmake b/cmake/Modules/CopyMSVCBins.cmake index 93c413cfe853ec..0d991739f16f31 100644 --- a/cmake/Modules/CopyMSVCBins.cmake +++ b/cmake/Modules/CopyMSVCBins.cmake @@ -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 @@ -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() diff --git a/cmake/common/helpers_common.cmake b/cmake/common/helpers_common.cmake index 035c4ea025b0a5..8ceb64cd9b8c7e 100644 --- a/cmake/common/helpers_common.cmake +++ b/cmake/common/helpers_common.cmake @@ -304,8 +304,7 @@ endfunction() # target_export: Helper function to export target as CMake package function(target_export target) if(NOT DEFINED exclude_variant) - #set(exclude_variant EXCLUDE_FROM_ALL ) - set(exclude_variant "") + set(exclude_variant EXCLUDE_FROM_ALL) endif() get_target_property(is_framework ${target} FRAMEWORK) @@ -313,31 +312,24 @@ function(target_export target) set(package_destination "Frameworks/${target}.framework/Resources/cmake") set(include_destination "Frameworks/${target}.framework/Headers") else() - set(package_destination "${OBS_CMAKE_DESTINATION}/${target}") + if(OS_WINDOWS) + set(package_destination "${OBS_CMAKE_DESTINATION}") + else() + set(package_destination "${OBS_CMAKE_DESTINATION}/${target}") + endif() set(include_destination "${OBS_INCLUDE_DESTINATION}") endif() install( TARGETS ${target} EXPORT ${target}Targets - RUNTIME DESTINATION "${OBS_EXECUTABLE_DESTINATION}" - COMPONENT Development - ${exclude_variant} - LIBRARY DESTINATION "${OBS_LIBRARY_DESTINATION}" - COMPONENT Development - ${exclude_variant} - ARCHIVE DESTINATION "${OBS_LIBRARY_DESTINATION}" - COMPONENT Development - ${exclude_variant} - FRAMEWORK DESTINATION Frameworks - COMPONENT Development - ${exclude_variant} - INCLUDES - DESTINATION "${include_destination}" - PUBLIC_HEADER - DESTINATION "${include_destination}" - COMPONENT Development - ${exclude_variant}) + RUNTIME DESTINATION "${OBS_EXECUTABLE_DESTINATION}" COMPONENT Development ${exclude_variant} + LIBRARY DESTINATION "${OBS_LIBRARY_DESTINATION}" COMPONENT Development ${exclude_variant} + ARCHIVE DESTINATION "${OBS_LIBRARY_DESTINATION}" COMPONENT Development ${exclude_variant} + FRAMEWORK DESTINATION Frameworks COMPONENT Development ${exclude_variant} + INCLUDES DESTINATION "${include_destination}" + PUBLIC_HEADER DESTINATION "${include_destination}" COMPONENT Development ${exclude_variant} + ) get_target_property(obs_public_headers ${target} OBS_PUBLIC_HEADERS) @@ -355,19 +347,17 @@ function(target_export target) endforeach() foreach(header_dir IN LISTS header_dirs) + message(STATUS "Exporting public headers dir ${header_dir}") install( FILES ${headers_${header_dir}} DESTINATION "${include_destination}/${header_dir}" COMPONENT Development - ${exclude_variant}) + ${exclude_variant} + ) endforeach() if(headers) - install( - FILES ${headers} - DESTINATION "${include_destination}" - COMPONENT Development - ${exclude_variant}) + install(FILES ${headers} DESTINATION "${include_destination}" COMPONENT Development ${exclude_variant}) endif() endif() @@ -376,7 +366,8 @@ function(target_export target) FILES "${CMAKE_BINARY_DIR}/config/obsconfig.h" DESTINATION "${include_destination}" COMPONENT Development - ${exclude_variant}) + ${exclude_variant} + ) endif() get_target_property(target_type ${target} TYPE) @@ -387,30 +378,29 @@ function(target_export target) generate_export_header(${target} EXPORT_FILE_NAME "${target}_EXPORT.h") target_sources(${target} PUBLIC $) - set_property( - TARGET ${target} - APPEND - PROPERTY PUBLIC_HEADER "${target}_EXPORT.h") + set_property(TARGET ${target} APPEND PROPERTY PUBLIC_HEADER "${target}_EXPORT.h") endif() set(TARGETS_EXPORT_NAME ${target}Targets) message( DEBUG - "Generating CMake package configuration file ${target}Config.cmake with targets file ${TARGETS_EXPORT_NAME}...") + "Generating CMake package configuration file ${target}Config.cmake with targets file ${TARGETS_EXPORT_NAME}..." + ) include(CMakePackageConfigHelpers) - configure_package_config_file(cmake/${target}Config.cmake.in ${target}Config.cmake - INSTALL_DESTINATION "${package_destination}") + configure_package_config_file( + cmake/${target}Config.cmake.in + ${target}Config.cmake + INSTALL_DESTINATION "${package_destination}" + ) message(DEBUG "Generating CMake package version configuration file ${target}ConfigVersion.cmake...") write_basic_package_version_file( "${target}ConfigVersion.cmake" VERSION ${OBS_VERSION_CANONICAL} - COMPATIBILITY SameMajorVersion) + COMPATIBILITY SameMajorVersion + ) - export( - EXPORT ${target}Targets - FILE "${TARGETS_EXPORT_NAME}.cmake" - NAMESPACE OBS::) + export(EXPORT ${target}Targets FILE "${TARGETS_EXPORT_NAME}.cmake" NAMESPACE OBS::) export(PACKAGE ${target}) @@ -420,13 +410,15 @@ function(target_export target) NAMESPACE OBS:: DESTINATION "${package_destination}" COMPONENT Development - ${exclude_variant}) + ${exclude_variant} + ) install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${target}Config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${target}ConfigVersion.cmake" DESTINATION "${package_destination}" COMPONENT Development - ${exclude_variant}) + ${exclude_variant} + ) endfunction() # check_uuid: Helper function to check for valid UUID diff --git a/cmake/finders/FindFFmpeg.cmake b/cmake/finders/FindFFmpeg.cmake index e4e746915971f9..97df59ad70c226 100644 --- a/cmake/finders/FindFFmpeg.cmake +++ b/cmake/finders/FindFFmpeg.cmake @@ -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) @@ -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]*$") @@ -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.") diff --git a/libobs/CMakeLists.txt b/libobs/CMakeLists.txt index f24aff8a5ad8f7..fe9445f0f7670a 100644 --- a/libobs/CMakeLists.txt +++ b/libobs/CMakeLists.txt @@ -382,15 +382,15 @@ if(OS_WINDOWS) list( APPEND public_headers - ${CMAKE_CURRENT_SOURCE_DIR}/util/threading-windows.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/ComPtr.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/CoTaskMemPtr.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/device-enum.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/HRError.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/win-registry.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/win-version.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/window-helpers.h - ${CMAKE_CURRENT_SOURCE_DIR}/util/windows/WinHandle.hpp) + util/threading-windows.h + util/windows/ComPtr.hpp + util/windows/CoTaskMemPtr.hpp + util/windows/device-enum.h + util/windows/HRError.hpp + util/windows/win-registry.h + util/windows/win-version.h + util/windows/window-helpers.h + util/windows/WinHandle.hpp) elseif(OS_MACOS) list(APPEND public_headers util/apple/cfstring-utils.h) endif() diff --git a/libobs/cmake/os-windows.cmake b/libobs/cmake/os-windows.cmake index 362d935a4ad694..9961956c1f9c46 100644 --- a/libobs/cmake/os-windows.cmake +++ b/libobs/cmake/os-windows.cmake @@ -47,7 +47,7 @@ target_include_directories( libobs PUBLIC $ - $ +# $ ) target_compile_options(libobs PRIVATE $<$:/EHc->) @@ -70,3 +70,48 @@ target_link_libraries( target_link_options(libobs PRIVATE /IGNORE:4098 /SAFESEH:NO) set_target_properties(libobs PROPERTIES PREFIX "" OUTPUT_NAME "obs") + +find_package(LibDataChannel 0.20 REQUIRED) + +if(NOT ENABLE_UI) + set(DEPENDENCY_DLLS + $ + $ + $ + $ + $ + $ + $ + $ + $ + $ + + "$/../bin/zlib.dll" + "$/../bin/librist.dll" + "$/../bin/srt.dll" + + "$/../bin/libcurl.dll" + "$/../bin/datachannel.dll" + ) + + set(DEPENDENCY_LIBS + $ + $ + $ + $ + $ + ) + + # foreach(DEP_BINARY ${DEPENDENCY_DLLS}) + # 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 ${DEPENDENCY_DLLS} DESTINATION ${OBS_EXECUTABLE_DESTINATION}) + install(FILES ${DEPENDENCY_LIBS} DESTINATION ${OBS_LIBRARY_DESTINATION}) +endif() diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 9fa2738011b3ec..f8a3de4aea2361 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -64,7 +64,7 @@ if(OBS_CMAKE_VERSION VERSION_GREATER_EQUAL 3.0.0) add_obs_plugin(sl-vst PLATFORMS WINDOWS WITH_MESSAGE) add_obs_plugin(obs-webrtc) - check_obs_websocket() + #check_obs_websocket() add_obs_plugin(obs-x264) add_obs_plugin(oss-audio PLATFORMS FREEBSD OPENBSD)