diff --git a/CI/azure/zip.txt b/CI/azure/README.txt similarity index 86% rename from CI/azure/zip.txt rename to CI/azure/README.txt index 042735739..b67369afc 100644 --- a/CI/azure/zip.txt +++ b/CI/azure/README.txt @@ -7,17 +7,16 @@ In this archive, you should find the following directories: o ./include : Common include files -o ./MinGW32 : 32-bit binaries compiled by the MinGW toolchain -o ./MinGW64 : 64-bit binaries compiled by the MinGW toolchain -o ./MS32 : 32-bit binaries compiled by the MicroSoft toolchain -o ./MS64 : 364bit binaries compiled by the MicroSoft toolchain +o ./Windows-MinGW-W64 : 64-bit binaries compiled by the MinGW toolchain +o ./Windows-VS-2019-x64 : 64-bit binaries compiled by the MicroSoft toolchain, VS-2019 +o ./Windows-VS-2022-x64 : 64-bit binaries compiled by the MicroSoft toolchain, VS-2022 o Visual Studio: - Open existing or create a new project for your application - Copy iio.h, from the include\ directory, into your project and make sure that the location where the file reside appears in the 'Additional Include Directories' section (Configuration Properties -> C/C++ -> General). - - Copy the relevant .lib file from MS32\ or MS64\ and add 'libiio.lib' to + - Copy the relevant .lib file from Windows-VS-2019-x64\ or Windows-VS-2022-x64\ and add 'libiio.lib' to your 'Additional Dependencies' (Configuration Properties -> Linker -> Input) Also make sure that the directory where libiio.lib resides is added to 'Additional Library Directories' (Configuration Properties -> Linker @@ -44,7 +43,7 @@ o WDK/DDK: SOURCES=your_app.c o MinGW/cygwin - - Copy libiio.h, from include/ to your default include directory, + - Copy iio.h, from include/ to your default include directory, and copy the MinGW32/ or MinGW64/ .a files to your default library directory. Or, if you don't want to use the default locations, make sure that you feed the relevant -I and -L options to the compiler. diff --git a/CI/azure/prepare_assets.sh b/CI/azure/prepare_assets.sh index 18912d024..a32ef7959 100755 --- a/CI/azure/prepare_assets.sh +++ b/CI/azure/prepare_assets.sh @@ -31,12 +31,23 @@ release_artifacts() { rm -r "${i}" done - local zip_assets='2019 2022' + local zip_assets='VS-2019-x64 VS-2022-x64 MinGW-W64' cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}" + mkdir Windows + cd Windows + mkdir include + cd .. + cp ./Windows-VS-2019-x64/iio.h ./Windows/include for i in $zip_assets; do - zip -r "Windows-VS-${i}-x64".zip "Windows-VS-${i}-x64" - rm -r "Windows-VS-${i}-x64" + rm ./"Windows-${i}"/iio.h + mv ./"Windows-${i}" Windows done + cp /home/vsts/work/1/s/CI/azure/README.txt ./Windows + cd Windows + zip Windows.zip ./* + cp ./Windows.zip ../ + cd .. + rm -r Windows local deb_arm_assets='arm32v7 arm64v8 ppc64le x390x' cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}" @@ -88,6 +99,10 @@ swdownloads_artifacts() { cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}/Libiio-Setup-Exe" mv libiio-setup.exe ../libiio-setup.exe rm -r ../Libiio-Setup-Exe + + cd "${BUILD_ARTIFACTSTAGINGDIRECTORY}" + zip -r Windows-MinGW-W64-latest_master_libiio.zip Windows-MinGW-W64 + rm -r Windows-MinGW-W64 } check_artifacts() { diff --git a/CI/build_win.ps1 b/CI/build_win.ps1 index 2d35ceb19..34d04bc4f 100644 --- a/CI/build_win.ps1 +++ b/CI/build_win.ps1 @@ -3,6 +3,7 @@ $ErrorActionPreference = "Stop" $ErrorView = "NormalView" $COMPILER=$Env:COMPILER +$USE_CSHARP=$Env:USE_CSHARP $src_dir=$pwd echo "Running cmake for $COMPILER on 64 bit..." @@ -10,7 +11,7 @@ mkdir build-x64 cp .\libiio.iss.cmakein .\build-x64 cd build-x64 -cmake -G "$COMPILER" -DCMAKE_SYSTEM_PREFIX_PATH="C:" -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_IPV6=ON -DWITH_USB_BACKEND=ON -DWITH_SERIAL_BACKEND=ON -DPYTHON_BINDINGS=ON -DCSHARP_BINDINGS:BOOL=ON -DLIBXML2_LIBRARIES="C:\\libs\\64\\libxml2.lib" -DLIBUSB_LIBRARIES="C:\\libs\\64\\libusb-1.0.lib" -DLIBSERIALPORT_LIBRARIES="C:\\libs\\64\\libserialport.dll.a" -DLIBUSB_INCLUDE_DIR="C:\\include\\libusb-1.0" -DLIBXML2_INCLUDE_DIR="C:\\include\\libxml2" .. +cmake -G "$COMPILER" -DCMAKE_SYSTEM_PREFIX_PATH="C:" -Werror=dev -DCOMPILE_WARNING_AS_ERROR=ON -DENABLE_IPV6=ON -DWITH_USB_BACKEND=ON -DWITH_SERIAL_BACKEND=ON -DPYTHON_BINDINGS=ON -DCSHARP_BINDINGS:BOOL=$USE_CSHARP -DLIBXML2_LIBRARIES="C:\\libs\\64\\libxml2.lib" -DLIBUSB_LIBRARIES="C:\\libs\\64\\libusb-1.0.lib" -DLIBSERIALPORT_LIBRARIES="C:\\libs\\64\\libserialport.dll.a" -DLIBUSB_INCLUDE_DIR="C:\\include\\libusb-1.0" -DLIBXML2_INCLUDE_DIR="C:\\include\\libxml2" .. cmake --build . --config Release if ( $LASTEXITCODE -ne 0 ) { throw "[*] cmake build failure" diff --git a/CI/publish_deps.ps1 b/CI/publish_deps.ps1 index 76ec7955a..1ac02fb86 100644 --- a/CI/publish_deps.ps1 +++ b/CI/publish_deps.ps1 @@ -5,22 +5,34 @@ $ErrorView = "NormalView" $src_dir=$pwd $COMPILER=$Env:COMPILER -if ($COMPILER -eq "Visual Studio 16 2019") { - cd 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT' - cp .\msvcp140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY - cp .\vcruntime140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY -}else { - cd 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT' - cp .\msvcp140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY - cp .\vcruntime140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY -} - cd $src_dir mkdir dependencies cd dependencies wget http://swdownloads.analog.com/cse/build/libiio-win-deps-libusb1.0.24.zip -OutFile "libiio-win-deps.zip" 7z x -y "libiio-win-deps.zip" -cp .\libs\64\libxml2.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY -cp .\libs\64\libserialport-0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY -cp .\libs\64\libusb-1.0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY +if ($COMPILER -eq "MinGW Makefiles") { + cp $src_dir\dependencies\libs\64\libserialport-0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp $src_dir\dependencies\libs\64\libusb-1.0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp C:\ghcup\ghc\9.2.8\mingw\bin\libgcc_s_seh-1.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp C:\ghcup\ghc\9.4.5\mingw\bin\libiconv-2.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp C:\ghcup\ghc\9.4.5\mingw\bin\zlib1.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp C:\ghcup\ghc\9.4.5\mingw\bin\liblzma-5.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp C:\ghcup\ghc\9.4.5\mingw\bin\libwinpthread-1.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp C:\ghcup\ghc\9.4.5\mingw\bin\libxml2-2.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp C:\ghcup\ghc\9.2.8\mingw\bin\libstdc++-6.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY +} else { + cp $src_dir\dependencies\libs\64\libxml2.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp $src_dir\dependencies\libs\64\libserialport-0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp $src_dir\dependencies\libs\64\libusb-1.0.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + + if ($COMPILER -eq "Visual Studio 16 2019") { + cd 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT' + cp .\msvcp140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp .\vcruntime140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + } else { + cd 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.29.30133\x64\Microsoft.VC142.CRT' + cp .\msvcp140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + cp .\vcruntime140.dll $env:BUILD_ARTIFACTSTAGINGDIRECTORY + } +} diff --git a/artifact_manifest.txt.cmakein b/artifact_manifest.txt.cmakein index 9e296aac4..0d7427b20 100644 --- a/artifact_manifest.txt.cmakein +++ b/artifact_manifest.txt.cmakein @@ -83,3 +83,23 @@ Windows-VS-2022-x64/libusb-1.0.dll Windows-VS-2022-x64/libxml2.dll Windows-VS-2022-x64/msvcp140.dll Windows-VS-2022-x64/vcruntime140.dll + +Windows-MinGW--W64/iio.h +Windows-MinGW-W64/iio_attr.exe +Windows-MinGW-W64/iio_genxml.exe +Windows-MinGW-W64/iio_info.exe +Windows-MinGW-W64/iio_readdev.exe +Windows-MinGW-W64/iio_reg.exe +Windows-MinGW-W64/iio_writedev.exe +Windows-MinGW-W64/libgcc_s_seh-1.dll +Windows-MinGW-W64/libiconv-2.dll +Windows-MinGW-W64/libiio.dll +Windows-MinGW-W64/libiio.dll.a +Windows-MinGW-W64/liblzma-5.dll +Windows-MinGW-W64/libserialport-0.dll +Windows-MinGW-W64/libstdc++-6.dll +Windows-MinGW-W64/libusb-1.0.dll +Windows-MinGW-W64/libwinpthread-1.dll +Windows-MinGW-W64/libxml2-2.dll +Windows-MinGW-W64/zlib1.dll +Windows-MinGW-W64/libiio-py39-amd64.tar.gz diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e39eeb035..ee86d0e92 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -96,6 +96,82 @@ stages: targetPath: '$(Build.ArtifactStagingDirectory)' artifactName: '$(artifactName)' + ############################################# + - job: MinGWBuilds + strategy: + matrix: + MinGW_W64: + COMPILER: 'MinGW Makefiles' + ARCH: 'x86_64' + USE_CSHARP: 'OFF' + artifactName: 'Windows-MinGW-W64' + pool: + vmImage: 'windows-2022' + steps: + - checkout: self + fetchDepth: 1 + clean: true + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.9' + - task: PowerShell@2 + displayName: 'Dependencies' + inputs: + targetType: inline + script: | + git submodule update --init + if ( !( Test-Path deps ) ) { + mkdir deps + } + cd deps + mkdir libxml + wget https://www.zlatkovic.com/pub/libxml/64bit/libxml2-2.9.3-win32-x86_64.7z -OutFile "libxml.7z" + 7z x -y libxml.7z + rm libxml.7z + cd C:\ + wget http://swdownloads.analog.com/cse/build/libiio-win-deps-libusb1.0.24.zip -OutFile "libiio-win-deps.zip" + 7z x -y "C:\libiio-win-deps.zip" + - task: PowerShell@2 + inputs: + targetType: 'filePath' + filePath: .\CI\build_win.ps1 + displayName: 'Build' + - task: CopyFiles@2 + displayName: 'Copy .exe files' + inputs: + sourceFolder: '$(Agent.BuildDirectory)/s/build-x64/tests' + contents: '*.exe' + targetFolder: '$(Build.ArtifactStagingDirectory)' + - task: CopyFiles@2 + displayName: 'Copy iio.h header' + inputs: + sourceFolder: '$(Agent.BuildDirectory)/s/' + contents: 'iio.h' + targetFolder: '$(Build.ArtifactStagingDirectory)' + - task: CopyFiles@2 + displayName: 'Copy libiio.dll and libiio.dll.a' + inputs: + sourceFolder: '$(Agent.BuildDirectory)/s/build-x64' + contents: | + libiio.dll + libiio.dll.a + targetFolder: '$(Build.ArtifactStagingDirectory)' + - task: CopyFiles@2 + displayName: 'Copy .tar.gz files' + inputs: + sourceFolder: '$(Agent.BuildDirectory)/s/build-x64/bindings/python' + contents: '*.gz' + targetFolder: '$(Build.ArtifactStagingDirectory)' + - task: PowerShell@2 + displayName: 'Copy dependencies' + inputs: + targetType: 'filePath' + filePath: .\CI\publish_deps.ps1 + - task: PublishPipelineArtifact@1 + inputs: + targetPath: '$(Build.ArtifactStagingDirectory)' + artifactName: '$(artifactName)' + ############################################# - job: WindowsBuilds # Host Box @@ -105,11 +181,13 @@ stages: vmImage: 'windows-2022' COMPILER: 'Visual Studio 17 2022' ARCH: 'x64' + USE_CSHARP: 'ON' artifactName: 'Windows-VS-2022-x64' VS2019: vmImage: 'windows-2019' COMPILER: 'Visual Studio 16 2019' ARCH: 'x64' + USE_CSHARP: 'ON' artifactName: 'Windows-VS-2019-x64' pool: vmImage: $[ variables['vmImage'] ]