Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripts update #11

Merged
merged 16 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ build_script:
- ps: if ($VSIMG -match '2019' -and $CNFG -eq "Debug") { .\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS ON -ENABLE_SWIG ON}
- ps: if ($VSIMG -match '2015' -and $CNFG -eq "Release") { .\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS ON -UNIT_TESTS ON -BONDING ON}
- ps: if ($VSIMG -match '2015' -and $CNFG -eq "Debug") { .\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS OFF }
- sh: ./scripts/build-lin-docker.ps1 -ENABLE_SWIG ON
- sh: pwsh ./scripts/build-lin-docker.ps1 -ENABLE_SWIG ON

test_script:
- ps: if ( $Env:RUN_UNIT_TESTS ) { cd ./_build; ctest -E "TestIPv6.v6_calls_v4" --extra-verbose -C $Env:CONFIGURATION; cd ../ }
Expand Down
18 changes: 10 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1342,17 +1342,19 @@ endif()
srt_add_example(testcapi-connect.c)
endif()


#SWIG support - adding bindings for other languages into a new library that statically include the main SRT lib
cmake_policy(SET CMP0078 NEW)
cmake_policy(SET CMP0086 NEW)
if(ENABLE_SWIG)

#older cmakes do not understand this policy, so filter (VS2015 AppVeyor cmake is too old)
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.21)
cmake_policy(SET CMP0122 NEW)
endif()
#older cmakes do not understand SWIG in a trusted manner (e.g. VS2015 AppVeyor cmake is too old, and Travis Xenial)
if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.21)
cmake_policy(SET CMP0078 NEW)
cmake_policy(SET CMP0086 NEW)
cmake_policy(SET CMP0122 NEW)
else
message(FATAL_ERROR "ENABLE_SWIG is set, but cmake version is not at least 3.21 and SWIG support may be broken on earlier editions")
endif()

#experimental SWIG support for csharp
if(ENABLE_SWIG)
#on windows, there is no swig just in the path - nuget / scripted downloads must be pointed at (linux it just works)
if(MICROSOFT)
#if nuget has been used to install swig in the project packages, bind to that
Expand Down
1 change: 1 addition & 0 deletions googletest/googletest-src
Submodule googletest-src added at 703bd9
6 changes: 5 additions & 1 deletion scripts/Dockerfile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y \
build-essential git nano gnupg apt-utils unzip sudo bzip2 \
apt-transport-https curl wget ca-certificates cpio \
libssl-dev software-properties-common \
p7zip-full swig && \
p7zip-full libpcre2-dev bison automake && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

Expand All @@ -33,3 +33,7 @@ RUN mkdir -p /usr/src/cmake \
&& tar -C /usr/src/cmake -xzf /usr/src/cmake/cmake.tar.gz \
&& ln -s /usr/src/cmake/cmake-3.24.1-linux-x86_64/bin/cmake /usr/bin/cmake \
&& rm /usr/src/cmake/cmake.tar.gz

#add swig 4.1
RUN cd /usr/src && git clone https://github.com/swig/swig.git && cd swig && git checkout release-4.1 \
&& ./autogen.sh && ./configure && make && make install && cd ../ && rm -rf /usr/src/swig
Empty file modified scripts/build-lin-docker.ps1
100644 → 100755
Empty file.
35 changes: 20 additions & 15 deletions scripts/build-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
# Usable on a Windows PC with Powershell and Visual studio,
# or called by CI systems like AppVeyor
#
# By default produces a VS2019 64-bit Release binary using C++11 threads, without
# By default produces a VS2022 64-bit Release binary using C++11 threads, without
# encryption or unit tests enabled, but including test apps.
# Before enabling any encryption options, install OpenSSL or set VCKPG flag to build
################################################################################

param (
[Parameter()][String]$VS_VERSION = "2019",
[Parameter()][String]$VS_VERSION = "2022",
[Parameter()][String]$CONFIGURATION = "Release",
[Parameter()][String]$DEVENV_PLATFORM = "x64",
[Parameter()][String]$ENABLE_ENCRYPTION = "OFF",
Expand All @@ -28,7 +28,7 @@ param (
# cmake can be optionally installed (useful when running interactively on a developer station).
# The URL for automatic download is defined later in the script, but it should be possible to just vary the
# specific version set below and the URL should be stable enough to still work - you have been warned.
$cmakeVersion = "3.23.2"
$cmakeVersion = "3.25.3"

# make all errors trigger a script stop, rather than just carry on
$ErrorActionPreference = "Stop"
Expand All @@ -38,6 +38,7 @@ $projectRoot = Join-Path $PSScriptRoot "/.." -Resolve
# if running within AppVeyor, use environment variables to set params instead of passed-in values
if ( $Env:APPVEYOR ) {
if ( $Env:PLATFORM -eq 'x86' ) { $DEVENV_PLATFORM = 'Win32' } else { $DEVENV_PLATFORM = 'x64' }
if ( $Env:APPVEYOR_BUILD_WORKER_IMAGE -eq 'Visual Studio 2022' ) { $VS_VERSION='2022' }
if ( $Env:APPVEYOR_BUILD_WORKER_IMAGE -eq 'Visual Studio 2019' ) { $VS_VERSION='2019' }
if ( $Env:APPVEYOR_BUILD_WORKER_IMAGE -eq 'Visual Studio 2015' ) { $VS_VERSION='2015' }

Expand All @@ -56,9 +57,9 @@ if ( $Env:APPVEYOR ) {
Copy-Item -Path "C:\OpenSSL-v111-Win64" "C:\OpenSSL-Win64" -Recurse | Out-Null
}

# if running within TeamCity, force SWIG and BONDING to ON (to avoid changing default behaviour on pre-existing CI systems)
# if running within TeamCity and VS2022 compilation, force SWIG and BONDING to ON (to avoid changing default behaviour on pre-existing CI systems)
# this should be removable ones master branch is merged to always have these params available (so CI can set them reliably itself)
if($Env:TEAMCITY_VERSION){
if($Env:TEAMCITY_VERSION -and ($VS_VERSION -eq "2022")){
$ENABLE_SWIG = "ON"
$BONDING = "ON"
}
Expand All @@ -67,6 +68,7 @@ if($Env:TEAMCITY_VERSION){
$Env:VS_VERSION = $VS_VERSION

# select the appropriate cmake generator string given the environment
if ( $VS_VERSION -eq '2022' ) { $CMAKE_GENERATOR = 'Visual Studio 17 2022'; $MSBUILDVER = "17.0"; }
if ( $VS_VERSION -eq '2019' ) { $CMAKE_GENERATOR = 'Visual Studio 16 2019'; $MSBUILDVER = "16.0"; }
if ( $VS_VERSION -eq '2015' -and $DEVENV_PLATFORM -eq 'Win32' ) { $CMAKE_GENERATOR = 'Visual Studio 14 2015'; $MSBUILDVER = "14.0"; }
if ( $VS_VERSION -eq '2015' -and $DEVENV_PLATFORM -eq 'x64' ) { $CMAKE_GENERATOR = 'Visual Studio 14 2015 Win64'; $MSBUILDVER = "14.0"; }
Expand Down Expand Up @@ -142,23 +144,26 @@ if ( $ENABLE_SWIG -eq "ON" ) {
Write-Output "Found pre-existing copy of Swigwin 4.1.1 - using this binary"
}
else {
#originally, script downloaded from sourceforge from link below, but this was flakey
#and therefore was copied to a Cinegy-controlled S3 mirror bucket
#original source URL: https://deac-fra.dl.sourceforge.net/project/swig/swigwin/swigwin-4.1.1/swigwin-4.1.1.zip
Write-Output "Swigwin 4.1.1 not found - downloading and unpacking..."
Remove-Item -LiteralPath $projectRoot/packages/swig/ -Force -Recurse -ErrorAction Ignore
Invoke-WebRequest 'https://deac-fra.dl.sourceforge.net/project/swig/swigwin/swigwin-4.1.1/swigwin-4.1.1.zip' -OutFile swig.zip
Invoke-WebRequest 'https://caas-deploy.s3.eu-central-1.amazonaws.com/v1/Thirdparty-Swig-v4.x/swigwin-4.1.1.zip' -OutFile swig.zip
Expand-Archive swig.zip -DestinationPath $projectRoot/packages/swig
Remove-Item swig.zip
}
}

# build the cmake command flags from arguments
$cmakeFlags = "-DCMAKE_BUILD_TYPE=$CONFIGURATION " +
"-DENABLE_STDCXX_SYNC=$CXX11 " +
"-DENABLE_APPS=$BUILD_APPS " +
"-DENABLE_ENCRYPTION=$ENABLE_ENCRYPTION " +
"-DENABLE_BONDING=$BONDING " +
"-DENABLE_UNITTESTS=$UNIT_TESTS " +
"-DENABLE_SWIG=$ENABLE_SWIG " +
"-DENABLE_SWIG_CSHARP=$ENABLE_SWIG_CSHARP"
"-DENABLE_STDCXX_SYNC=$CXX11 " +
"-DENABLE_APPS=$BUILD_APPS " +
"-DENABLE_ENCRYPTION=$ENABLE_ENCRYPTION " +
"-DENABLE_BONDING=$BONDING " +
"-DENABLE_UNITTESTS=$UNIT_TESTS " +
"-DENABLE_SWIG=$ENABLE_SWIG " +
"-DENABLE_SWIG_CSHARP=$ENABLE_SWIG_CSHARP"

# if VCPKG is flagged to provide OpenSSL, checkout VCPKG and install package
if ( $VCPKG_OPENSSL -eq 'ON' ) {
Expand Down Expand Up @@ -201,8 +206,8 @@ else {
$cmakeFlags += " -DOPENSSL_USE_STATIC_LIBS=$STATIC_LINK_SSL "
}

# cmake uses a flag for architecture from vs2019, so add that as a suffix
if ( $VS_VERSION -eq '2019' ) {
# cmake uses a flag for architecture from vs2019 onwards, so add that as a suffix
if ( $VS_VERSION -eq '2019' -or $VS_VERSION -eq '2022') {
$cmakeFlags += " -A `"$DEVENV_PLATFORM`""
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/create-nuget.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Get-ChildItem $packageDir -Filter *.zip | Foreach-Object {
Expand-Archive -Force -Path $_.FullName -DestinationPath $(Join-Path $packageDir "extracted")
}

nuget pack .\nuget\SrtSharp\SrtSharp.nuspec -version $VERSION
nuget pack .\nuget\SrtSharp\SrtSharp.nuspec -version $VERSION-alpha

# if antyhing returned non-zero, throw to cause failure in CI
if( $LASTEXITCODE -ne 0 ) {
Expand Down
5 changes: 1 addition & 4 deletions scripts/nuget/SrtSharp/SrtSharp.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@
<files>
<file src="..\..\..\package\extracted\bin\srt_swig_csharp.dll" target="runtimes\win-x64\native\release"/>
<file src="..\..\..\package\extracted\Release.linux\libsrt_swig_csharp.so" target="runtimes\linux-x64\native\release"/>
<file src="..\..\..\package\extracted\bin\srtsharp.dll" target="lib\netstandard2.0" />

<file src="..\..\..\package\extracted\include\**\*.h" target="sources"/>

<!-- <file src="..\..\..\_build\swig_bindings\**\*.*" target="bindings" exclude="**\*.dll"/> -->

<file src="build\*" target="build" />
</files>
</package>
9 changes: 0 additions & 9 deletions scripts/nuget/SrtSharp/build/SrtSharp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,6 @@
<IncludeSrtInterop Condition="'$(IncludeSrtInterop)'==''">True</IncludeSrtInterop>
<EmbedSrtInterop Condition="'$(EmbedSrtInterop)'==''">False</EmbedSrtInterop>
</PropertyGroup>

<!--
<ItemGroup>
<Reference Include="srt_swig_netcore" Condition="'$(IncludeSrtInterop)'=='True'">
<HintPath>$(MSBuildThisFileDirectory)\..\runtimes\any\netstandard2.0\srt_swig_netcore.dll</HintPath>
<EmbedInteropTypes Condition="'$(EmbedSrtInterop)'=='True'">True</EmbedInteropTypes>
</Reference>
</ItemGroup>
-->

<Target Name="Copy Native SRT references" AfterTargets="AfterBuild">
<ItemGroup>
Expand Down
Loading