Skip to content

Commit

Permalink
deps.windows: Build libdatachannel
Browse files Browse the repository at this point in the history
The libdatachannel compilation on MSVC relies on mbedTLS.
But since the latter DLLs fail to compile on MSVC due to long-standing
bugs, mbedTLS is linked statically to libdatachannel.
The library is checked out at a commit enabling simulcast.

Signed-off-by: pkv <pkv@obsproject.com>
  • Loading branch information
pkviet authored and RytoEX committed Jul 19, 2023
1 parent 3a32c5e commit 9e98dad
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions deps.windows/70-libdatachannel.ps1
@@ -0,0 +1,83 @@
param(
[string] $Name = 'libdatachannel',
[string] $Version = '0.19.0-alpha.4',
[string] $Uri = 'https://github.com/paullouisageneau/libdatachannel.git',
[string] $Hash = '709a66339451bb4c8d4e5ced78c67605ec09da31',
[switch] $ForceShared = $true
)

function Setup {
Invoke-GitCheckout -Uri $Uri -Commit $Hash
}

function Clean {
Set-Location $Path

if ( Test-Path "build_${Target}" ) {
Log-Information "Clean build directory (${Target})"
Remove-Item -Path "build_${Target}" -Recurse -Force
}
}

function Configure {
Log-Information "Configure (${Target})"
Set-Location $Path

if ( $ForceShared -and ( $script:Shared -eq $false ) ) {
$Shared = $true
} else {
$Shared = $script:Shared.isPresent
}

$OnOff = @('OFF', 'ON')
$Options = @(
$CmakeOptions
"-DENABLE_SHARED:BOOL=$($OnOff[$Shared])"
'-DUSE_MBEDTLS=BOOL=ON'
'-DNO_WEBSOCKET=BOOL=ON'
'-DNO_TESTS=BOOL=ON'
'-DNO_EXAMPLES=BOOL=ON'
)

Invoke-External cmake -S . -B "build_${Target}" @Options
}

function Build {
Log-Information "Build (${Target})"
Set-Location $Path

$Options = @(
'--build', "build_${Target}"
'--config', $Configuration
)

if ( $VerbosePreference -eq 'Continue' ) {
$Options += '--verbose'
}

$Options += @(
'--'
'/consoleLoggerParameters:Summary'
'/noLogo'
'/p:UseMultiToolTask=true'
'/p:EnforceProcessCountAcrossBuilds=true'
)

Invoke-External cmake @Options
}

function Install {
Log-Information "Install (${Target})"
Set-Location $Path

$Options = @(
'--install', "build_${Target}"
'--config', $Configuration
)

if ( $Configuration -match "(Release|MinSizeRel)" ) {
$Options += '--strip'
}

Invoke-External cmake @Options
}

0 comments on commit 9e98dad

Please sign in to comment.