Skip to content

Commit 7e818cb

Browse files
committed
CI: integrate dependencies build script for msvc
Switch to new script and modify the paths form cmake command and also the path from where the dll files were copied. The old script build_win.ps1 was renamed in build_win_msvc.ps1 because now it supports just the msvc compiler, eliminating the support for mingw because was not needed anymore. Signed-off-by: Andreea Andrisan <[email protected]>
1 parent 7708cf5 commit 7e818cb

File tree

5 files changed

+58
-71
lines changed

5 files changed

+58
-71
lines changed

CI/build_win.ps1

Lines changed: 0 additions & 26 deletions
This file was deleted.

CI/build_win_msvc.ps1

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.2#erroractionpreference
2+
$ErrorActionPreference = "Stop"
3+
$ErrorView = "NormalView"
4+
5+
echo "Running cmake for $Env:COMPILER on 64 bit..."
6+
mkdir build-msvc
7+
cp .\libiio.iss.cmakein .\build-msvc
8+
cd build-msvc
9+
if ( "$Env:COMPILER" -eq "Visual Studio 17 2022" ){
10+
$VS_version="VS2022"
11+
}elseif ( "$Env:COMPILER" -eq "Visual Studio 16 2019" ) {
12+
$VS_version="VS2019"
13+
}
14+
cmake -G "$Env:COMPILER" -DPYTHON_EXECUTABLE:FILEPATH=$(python -c "import os, sys; print(os.path.dirname(sys.executable) + '\python.exe')") -DCMAKE_SYSTEM_PREFIX_PATH="C:" `
15+
-Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_IPV6=ON -DWITH_USB_BACKEND=ON -DWITH_SERIAL_BACKEND=ON -DPYTHON_BINDINGS=ON -DCPP_BINDINGS=ON -DCSHARP_BINDINGS:BOOL=ON `
16+
-DLIBXML2_LIBRARIES="$Env:BUILD_SOURCESDIRECTORY\deps\libxml2-install\lib\libxml2.lib" -DLIBXML2_INCLUDE_DIR="$Env:BUILD_SOURCESDIRECTORY\deps\libxml2-install\include\libxml2" `
17+
-DLIBUSB_LIBRARIES="$Env:BUILD_SOURCESDIRECTORY\deps\libusb\$VS_version\MS64\dll\libusb-1.0.lib" -DLIBUSB_INCLUDE_DIR="$Env:BUILD_SOURCESDIRECTORY\deps\libusb\include" `
18+
-DLIBSERIALPORT_LIBRARIES="$Env:BUILD_SOURCESDIRECTORY\deps\libserialport\x64\Release\libserialport.lib" -DLIBSERIALPORT_INCLUDE_DIR="$Env:BUILD_SOURCESDIRECTORY\deps\libserialport" `
19+
-DLIBZSTD_LIBRARIES="$Env:BUILD_SOURCESDIRECTORY\deps\zstd\build\VS2010\bin\x64_Release\libzstd.lib" -DLIBZSTD_INCLUDE_DIR="$Env:BUILD_SOURCESDIRECTORY\deps\zstd\lib" ..
20+
21+
cmake --build . --config Release
22+
23+
if ( $LASTEXITCODE -ne 0 ) {
24+
throw "[*] cmake build failure"
25+
}
26+
cp .\libiio.iss $env:BUILD_ARTIFACTSTAGINGDIRECTORY
27+
28+
cd bindings/python
29+
python.exe setup.py sdist
30+
Get-ChildItem dist\pylibiio-*.tar.gz | Rename-Item -NewName "libiio-py39-amd64.tar.gz"
31+
mv .\dist\*.gz .
32+
rm .\dist\*.gz

CI/publish_deps.ps1

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,7 @@
22
$ErrorActionPreference = "Stop"
33
$ErrorView = "NormalView"
44

5-
$src_dir=$pwd
6-
$COMPILER=$Env:COMPILER
7-
8-
cd $src_dir
9-
mkdir dependencies
10-
cd dependencies
11-
wget http://swdownloads.analog.com/cse/build/libiio-deps-20220517.zip -OutFile "libiio-win-deps.zip"
12-
7z x -y "libiio-win-deps.zip"
13-
14-
# Version numbers inside this directory change all the time; print what's
15-
# currently in the folder to make it easier to debug CI breakages on MinGW.
16-
dir C:\ghcup\ghc\
17-
18-
if ($COMPILER -eq "MinGW Makefiles") {
5+
if ("$Env:COMPILER" -eq "MinGW Makefiles") {
196
cp C:\msys64\mingw64\bin\libserialport-0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
207
cp C:\msys64\mingw64\bin\libusb-1.0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
218
cp C:\msys64\mingw64\bin\libxml2-2.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
@@ -27,18 +14,19 @@ if ($COMPILER -eq "MinGW Makefiles") {
2714
cp C:\msys64\mingw64\bin\libwinpthread-1.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
2815
cp C:\msys64\mingw64\bin\libstdc++-6.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
2916
} else {
30-
cp $src_dir\dependencies\libs\64\libxml2.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
31-
cp $src_dir\dependencies\libs\64\libserialport-0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
32-
cp $src_dir\dependencies\libs\64\libusb-1.0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
33-
cp $src_dir\dependencies\libs\64\libzstd.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
34-
35-
if ($COMPILER -eq "Visual Studio 16 2019") {
36-
cd 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT'
17+
if ( "$Env:COMPILER" -eq "Visual Studio 17 2022" ){
18+
$VS_version="VS2022"
19+
cd 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT'
3720
cp .\msvcp140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
3821
cp .\vcruntime140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
39-
} else {
40-
cd 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT'
22+
}elseif ( "$Env:COMPILER" -eq "Visual Studio 16 2019" ) {
23+
$VS_version="VS2019"
24+
cd 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT'
4125
cp .\msvcp140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
4226
cp .\vcruntime140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
4327
}
28+
cp $Env:BUILD_SOURCESDIRECTORY\deps\libxml2-install\bin\libxml2.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
29+
cp $Env:BUILD_SOURCESDIRECTORY\deps\libusb\$VS_version\MS64\dll\libusb-1.0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
30+
cp $Env:BUILD_SOURCESDIRECTORY\deps\libserialport\x64\Release\libserialport.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
31+
cp $Env:BUILD_SOURCESDIRECTORY\deps\zstd\build\VS2010\bin\x64_Release\libzstd.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY
4432
}

azure-pipelines.yml

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,13 @@ stages:
180180
vmImage: 'windows-2022'
181181
COMPILER: 'Visual Studio 17 2022'
182182
ARCH: 'x64'
183-
USE_CSHARP: 'ON'
183+
PLATFORM_TOOLSET: 'v143'
184184
artifactName: 'Windows-VS-2022-x64'
185185
VS2019:
186186
vmImage: 'windows-2019'
187187
COMPILER: 'Visual Studio 16 2019'
188188
ARCH: 'x64'
189-
USE_CSHARP: 'ON'
189+
PLATFORM_TOOLSET: 'v142'
190190
artifactName: 'Windows-VS-2019-x64'
191191
pool:
192192
vmImage: $[ variables['vmImage'] ]
@@ -197,32 +197,21 @@ stages:
197197
- task: UsePythonVersion@0
198198
inputs:
199199
versionSpec: '3.9'
200-
- task: PowerShell@2
201-
displayName: 'Dependencies'
200+
- task: CmdLine@2
201+
displayName: 'Build dependecies'
202202
inputs:
203-
targetType: inline
204203
script: |
205204
git submodule update --init
206-
if ( !( Test-Path deps ) ) {
207-
mkdir deps
208-
}
209-
cd deps
210-
mkdir libxml
211-
wget https://www.zlatkovic.com/pub/libxml/64bit/libxml2-2.9.3-win32-x86_64.7z -OutFile "libxml.7z"
212-
7z x -y libxml.7z
213-
rm libxml.7z
214-
cd C:\
215-
wget http://swdownloads.analog.com/cse/build/libiio-deps-20220517.zip -OutFile "libiio-win-deps.zip"
216-
7z x -y "C:\libiio-win-deps.zip"
205+
.\CI\azure\windows_build_deps.cmd
217206
- task: PowerShell@2
218207
inputs:
219208
targetType: 'filePath'
220-
filePath: .\CI\build_win.ps1
209+
filePath: .\CI\build_win_msvc.ps1
221210
displayName: 'Build'
222211
- task: CopyFiles@2
223212
displayName: 'Copy libraries'
224213
inputs:
225-
sourceFolder: '$(Agent.BuildDirectory)/s/build-$(ARCH)/Release'
214+
sourceFolder: '$(Agent.BuildDirectory)/s/build-msvc/Release'
226215
targetFolder: '$(Build.ArtifactStagingDirectory)'
227216
- task: CopyFiles@2
228217
displayName: 'Copy public headers'
@@ -232,19 +221,19 @@ stages:
232221
- task: CopyFiles@2
233222
displayName: 'Copy .exe files'
234223
inputs:
235-
sourceFolder: '$(Agent.BuildDirectory)/s/build-$(ARCH)/utils/Release'
224+
sourceFolder: '$(Agent.BuildDirectory)/s/build-msvc/utils/Release'
236225
contents: '*.exe'
237226
targetFolder: '$(Build.ArtifactStagingDirectory)'
238227
- task: CopyFiles@2
239228
displayName: 'Copy .tar.gz files'
240229
inputs:
241-
sourceFolder: '$(Agent.BuildDirectory)/s/build-x64/bindings/python'
230+
sourceFolder: '$(Agent.BuildDirectory)/s/build-msvc/bindings/python'
242231
contents: '*.gz'
243232
targetFolder: '$(Build.ArtifactStagingDirectory)'
244233
- task: CopyFiles@2
245234
displayName: 'Copy libiio-sharp.dll file'
246235
inputs:
247-
sourceFolder: '$(Agent.BuildDirectory)/s/build-$(ARCH)/bindings/csharp'
236+
sourceFolder: '$(Agent.BuildDirectory)/s/build-msvc/bindings/csharp'
248237
contents: 'libiio-sharp.dll'
249238
targetFolder: '$(Build.ArtifactStagingDirectory)'
250239
- task: PowerShell@2
@@ -256,6 +245,10 @@ stages:
256245
inputs:
257246
targetPath: '$(Build.ArtifactStagingDirectory)'
258247
artifactName: '$(artifactName)'
248+
- task: PublishPipelineArtifact@1
249+
inputs:
250+
targetPath: '$(Agent.BuildDirectory)/s/Windows-msvc-deps.zip'
251+
artifactName: '$(artifactName)-msvc-deps.zip'
259252

260253
#############################################
261254
- job: GenerateSetupExe

libiio.iss.cmakein

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Source: "D:\a\1\a\Windows-VS-2019-x64\libiio1.lib"; DestDir: "{commonpf32}\Micro
4545
Source: "D:\a\1\a\Windows-VS-2019-x64\iio\*.h"; DestDir: "{commonpf32}\Microsoft Visual Studio 12.0\VC\include\iio"
4646
Source: "D:\a\1\a\Windows-VS-2019-x64\libxml2.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Flags: onlyifdoesntexist
4747
Source: "D:\a\1\a\Windows-VS-2019-x64\libusb-1.0.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Flags: onlyifdoesntexist
48-
Source: "D:\a\1\a\Windows-VS-2019-x64\libserialport-0.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Flags: onlyifdoesntexist
48+
Source: "D:\a\1\a\Windows-VS-2019-x64\libserialport.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Flags: onlyifdoesntexist
4949
Source: "D:\a\1\a\Windows-VS-2019-x64\libzstd.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Flags: onlyifdoesntexist
5050
Source: "D:\a\1\a\Windows-VS-2019-x64\libiio-sharp.dll"; DestDir: "{commoncf}\libiio"; Flags: replacesameversion
5151
Source: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT\msvcp140.dll"; DestDir: "{sys}"; Check: Is64BitInstallMode; Flags: onlyifdoesntexist

0 commit comments

Comments
 (0)