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 9, 2025
1 parent b1e4ad8 commit afad646
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 51 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
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
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

0 comments on commit afad646

Please sign in to comment.