Skip to content

Commit

Permalink
fix install dev component
Browse files Browse the repository at this point in the history
  • Loading branch information
summeroff committed Jan 22, 2025
1 parent cdc615f commit ddb87ba
Show file tree
Hide file tree
Showing 8 changed files with 200 additions and 83 deletions.
5 changes: 5 additions & 0 deletions .github/scripts/Build-Windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
29 changes: 25 additions & 4 deletions .github/workflows/build-project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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'
Expand Down Expand Up @@ -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 }}

Expand Down
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
76 changes: 34 additions & 42 deletions cmake/common/helpers_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -304,40 +304,32 @@ 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)
if(is_framework)
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)

Expand All @@ -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()

Expand All @@ -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)
Expand All @@ -387,30 +378,29 @@ function(target_export target)
generate_export_header(${target} EXPORT_FILE_NAME "${target}_EXPORT.h")
target_sources(${target} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/${target}_EXPORT.h>)

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})

Expand All @@ -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
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.")
18 changes: 9 additions & 9 deletions libobs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading

0 comments on commit ddb87ba

Please sign in to comment.