Skip to content

Commit

Permalink
ci/windows: create installer for windows x64
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Stanea <Adrian.Stanea@analog.com>
  • Loading branch information
Adrian-Stanea committed Nov 14, 2023
1 parent 34a963b commit 2f176a5
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 2 deletions.
63 changes: 63 additions & 0 deletions CI/windows/create_installer.ps1
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions CI/windows/install_deps.ps1
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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")
Expand Down
4 changes: 3 additions & 1 deletion CI/windows/make_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Move-to-Build-Dir -PLATFORM "win64"

Set-Location $SRC_DIR
17 changes: 16 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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




0 comments on commit 2f176a5

Please sign in to comment.