diff --git a/CI/windows/create_installer.ps1 b/CI/windows/create_installer.ps1 new file mode 100644 index 00000000..ca368cbe --- /dev/null +++ b/CI/windows/create_installer.ps1 @@ -0,0 +1,63 @@ +$ErrorActionPreference = "Stop" +$ErrorView = "NormalView" + +$SRC_DIR = Get-Location + +function Get-Dll-Paths() { + $vsPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" + if ($vsPath -eq $null) { + Write-Host "Visual Studio (vswhere.exe) not found - can't find dll paths." + return $null + } + + $vsInstallerPath = & $vsPath -latest -requires Microsoft.Component.MSBuild -property installationPath + if ($vsInstallerPath -eq $null) { + Write-Host "Visual Studio Installer path is not available" + return $null + } + + $msvcp140Path = Join-Path $vsInstallerPath 'VC\Tools\MSVC\14.*\bin\Hostx64\x64\msvcp140.dll' + $vcruntime140Path = Join-Path $vsInstallerPath 'VC\Tools\MSVC\14.*\bin\Hostx64\x64\vcruntime140.dll' + if (($msvcp140Path -eq $null) -or ($vcruntime140Path -eq $null)) { + Write-Host "Dll paths not found in Visual Studion installation path." + return $null + } + + $result = New-Object PSObject -Property @{ + msvcp140Path = $msvcp140Path + vcruntime140Path = $vcruntime140Path + } + return $result +} + + +Set-Location $SRC_DIR + +$ddlPaths = Get-Dll-Paths + +if ($ddlPaths -ne $null) { + Write-Host "msvcp140Path: $($ddlPaths.msvcp140Path)" + Write-Host "vcruntime140Path: $($ddlPaths.vcruntime140Path)" +} else { + Write-Host "Dll Paths not found." +} + +$INSALLER_PATH = Join-Path($SRC_DIR "build-win64\installer") +$DIST_PATH = Join-Path($SRC_DIR "build-win64\dist") + +Copy-Item -Path $ddlPaths.msvcp140Path -Destination $DIST_PATH +Copy-Item -Path $ddlPaths.vcruntime140Path -Destination $DIST_PATH + +# creates installer in: C:\libm2k-system-setup.exe +ISCC (Join-Path $DIST_PATH "libm2k.iss") + +if (-not (Test-Path -Path $INSALLER_PATH)) { + New-Item -Path $INSALLER_PATH -ItemType Directory +} +Move-Item -Path "C:\libm2k-system-setup.exe" -Destination $INSALLER_PATH + +# clear artifacts staging directory and copy the installer -> new step is to push an artifact +Get-ChildItem $env:BUILD_ARTIFACTSTAGINGDIRECTORY -Force -Recurse | Remove-Item -Force -Recurse +Copy-Item -Path (Join-Path $INSALLER_PATH "C:\libm2k-system-setup.exe") -Destination $env:BUILD_ARTIFACTSTAGINGDIRECTORY + +Set-Location $SRC_DIR \ No newline at end of file diff --git a/CI/windows/install_deps.ps1 b/CI/windows/install_deps.ps1 index 595a3e78..d69c3d32 100644 --- a/CI/windows/install_deps.ps1 +++ b/CI/windows/install_deps.ps1 @@ -1,6 +1,9 @@ $ErrorActionPreference = "Stop" $ErrorView = "NormalView" +# NOTE: this is needed for the Invoke-WebRequest to work +[Net.ServicePointManager]::SecurityProtocol = "Tls, Tls11, Tls12, Ssl3" + $COMPILER = $Env:COMPILER $ARCH = $Env:ARCH @@ -129,6 +132,9 @@ function Install-Libiiio { Set-Location -Path .. Copy-Item -Path "iio.h" -Destination ($DEST_LIBIIO) + # Note: also copy the dll from the libiio dependencies inside the DEST_LIBIIO folder -> used while making the installer through the .iss file + Set-Location (Join-Path $SRC_DIR "deps\libiio-deps\libs\64") + Copy-Item -Path ".\*.dll" -Destination ($DEST_LIBIIO) # NOTE: the result of these commands is a .tar.gz file Set-Location (Join-Path $SRC_DIR "libiio\build-$ARCH") diff --git a/CI/windows/make_windows.ps1 b/CI/windows/make_windows.ps1 index f830d8ef..d920333e 100644 --- a/CI/windows/make_windows.ps1 +++ b/CI/windows/make_windows.ps1 @@ -117,4 +117,6 @@ function Move-to-Build-Dir { # Move-to-Build-Dir -PLATFORM "win32" Build-Libm2k -PLATFORM "win64" -GENERATOR $COMPILER -ARCH $ARCH -Move-to-Build-Dir -PLATFORM "win64" \ No newline at end of file +Move-to-Build-Dir -PLATFORM "win64" + +Set-Location $SRC_DIR \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3663fd3d..5b531d0f 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -195,10 +195,25 @@ jobs: targetType: filePath filePath: ./CI/windows/install_deps.ps1 - task: PowerShell@2 + displayName: 'Build libm2k' inputs: targetType: 'filePath' filePath: ./CI/windows/make_windows.ps1 - displayName: 'Build libm2k' + - task: PowerShell@2 + displayName: 'Create libm2k-system-setup installer' + inputs: + targetType: 'filePath' + filePath: ./CI/windows/create_installer.ps1 + - task: PublishPipelineArtifact@1 + inputs: + targetPath: '$(Build.ArtifactStagingDirectory)' + artifactName: 'Libm2k-System-Setup-Exe' + + + # Should do the create installer step + + # Zips +