diff --git a/CI/windows/make_windows.ps1 b/CI/windows/make_windows.ps1 index 9c7493d6..096d616a 100644 --- a/CI/windows/make_windows.ps1 +++ b/CI/windows/make_windows.ps1 @@ -4,20 +4,29 @@ $ErrorView = "NormalView" $COMPILER = $Env:COMPILER $ARCH = $Env:ARCH +$PLATFORM = $Env:PLATFORM $SRC_DIR = Get-Location $OUTSIDE_BUILD = [System.IO.Path]::GetDirectoryName($SRC_DIR.Path) $DEPS_DIR= Join-Path $OUTSIDE_BUILD "deps" +$DIST_DIR = Join-Path $SRC_DIR "build-$PLATFORM/dist" +$TEMP_BUILD_DIR = Join-Path $SRC_DIR "tmp-build-$PLATFORM" +$DEST_LIBIIO = Join-Path $OUTSIDE_BUILD "libiio-$ARCH" + Write-Output "SRC DIR = $SRC_DIR" Write-Output "COMPILER = $COMPILER" Write-Output "ARCH = $ARCH" +Write-Output "DIST_DIR = $DIST_DIR" +Write-Output "TEMP_BUILD_DIR = $TEMP_BUILD_DIR" +Write-Output "DEST_LIBIIO = $DEST_LIBIIO" + function Build-Python-Wheel { param( [string]$PLATFORM, - [string]$PYTHON_PATH ) + Set-Location $TEMP_BUILD_DIR python.exe -m pip install --user --upgrade pip setuptools wheel twine build virtualenv $env:COMPILE_BINDINGS = $true @@ -32,31 +41,22 @@ function Build-Libm2k { param( [string]$PLATFORM, [string]$PYTHON_VERSION, - [string]$PYTHON_PATH, [string]$GENERATOR, [string]$ARCH ) - $DIST_DIR = Join-Path $SRC_DIR "build-$PLATFORM/dist" # Create the official build directory for this platform if (-not (Test-Path -Path $DIST_DIR)) { New-Item -Path $DIST_DIR -ItemType Directory } - # Create and clear up the temporary build directory for this platform - $TEMP_BUILD_DIR = Join-Path $SRC_DIR "tmp-build-$PLATFORM" if (Test-Path -Path $TEMP_BUILD_DIR) { Remove-Item $TEMP_BUILD_DIR -Recurse -Force } New-Item -Path $TEMP_BUILD_DIR -ItemType Directory - Write-Output "DIST_DIR = $DIST_DIR" - Write-Output "TEMP_BUILD_DIR = $TEMP_BUILD_DIR" - Set-Location $TEMP_BUILD_DIR - $DEST_LIBIIO = Join-Path $OUTSIDE_BUILD "libiio-$ARCH" - $pythonExecutable = (python -c "import sys; print(sys.executable)") -replace '\\', '/' $PATH_SWIG_DIR = (Join-Path $DEPS_DIR "swig\Lib") -replace '\\', '/' $PATH_SWIG_EXE = (Join-Path $DEPS_DIR "swig\swig.exe") -replace '\\', '/' @@ -87,32 +87,25 @@ function Build-Libm2k { Get-Content setup.py - - Build-Python-Wheel -PLATFORM $PLATFORM -PYTHON_PATH $PYTHON_PATH } function Move-to-Build-Dir { param( [string]$PLATFORM ) - $DEST_DIR = Join-Path $SRC_DIR "build-$PLATFORM\dist" $TEMP_BUILD_DIR = Join-Path $SRC_DIR "tmp-build-$PLATFORM" Set-Location $TEMP_BUILD_DIR - Copy-Item -Path "*.dll" -Destination $DEST_DIR Copy-Item -Path "*.exe" -Destination $DEST_DIR Copy-Item -Path "*.lib" -Destination $DEST_DIR Copy-Item -Path "*.iss" -Destination $DEST_DIR - Set-Location .. } -# Build-Libm2k -PLATFORM "win32" -PYTHON_VERSION 37 -PYTHON_PATH "C:\Python39" -GENERATOR $COMPILER -ARCH $ARCH -# Move-to-Build-Dir -PLATFORM "win32" - -Build-Libm2k -PLATFORM "win64" -GENERATOR $COMPILER -ARCH $ARCH -Move-to-Build-Dir -PLATFORM "win64" +# Build-Libm2k -PLATFORM $PLATFORM -GENERATOR $COMPILER -ARCH $ARCH +# Build-Python-Wheel -PLATFORM $PLATFORM +# Move-to-Build-Dir -PLATFORM $PLATFORM -Set-Location $SRC_DIR \ No newline at end of file +Set-Location $SRC_DIR diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3d3cc0d7..3547b98e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -173,12 +173,14 @@ jobs: vmImage: 'windows-2022' COMPILER: 'Visual Studio 17 2022' ARCH: 'x64' + $PLATFORM: 'win64' artifactName: 'Windows-VS-2022-x64' VS_2019: poolName: 'Azure Pipelines' vmImage: 'windows-2019' COMPILER: 'Visual Studio 16 2019' ARCH: 'x64' + $PLATFORM: 'win64' artifactName: 'Windows-VS-2019-x64' pool: vmImage: $[ variables['vmImage'] ] @@ -186,6 +188,7 @@ jobs: - checkout: self fetchDepth: 1 clean: true + # TODO: review if libiio needs to be rebuilt on every python version - task: UsePythonVersion@0 inputs: versionSpec: '3.11' @@ -194,11 +197,23 @@ jobs: inputs: targetType: filePath filePath: ./CI/windows/install_deps.ps1 - - task: PowerShell@2 + - powershell: | + . ./CI/windows/make_windows.ps1 + Build-Libm2k -PLATFORM $PLATFORM -COMPILER $COMPILER -ARCH $ARCH displayName: 'Build libm2k' - inputs: - targetType: 'filePath' - filePath: ./CI/windows/make_windows.ps1 + - ${{ each pyVersion in parameters.pythonVersions }}: + - task: UsePythonVersion@0 + displayName: Use Python ${{ pyVersion }} + inputs: + versionSpec: '${{ pyVersion }}' + - powershell: | + . ./CI/windows/make_windows.ps1 + Build-Python-Wheel -PLATFORM $PLATFORM -PYTHON_PATH $PYTHON_PATH + displayName: Wheel Python ${{ pyVersion }} + - powershell: | + . ./CI/windows/make_windows.ps1 + Move-to-Build-Dir -PLATFORM $PLATFORM + displayName: 'Move to build directory' - task: PowerShell@2 displayName: 'Create libm2k-system-setup installer' condition: eq(variables['System.JobName'], 'VS_2022') @@ -219,22 +234,7 @@ jobs: inputs: targetPath: '$(Build.ArtifactStagingDirectory)' artifactName: '$(artifactName)' - # TODO: review what we want to do: have an installer for each vmimage or just the latest one?? - # I think we should renaame installers based on the compiler used if we want to keep them all - # - job: GenerateSetupExe - # dependsOn: WindowsBuilds - # pool: - # vmImage: 'windows-2022' - # steps: - # - 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' +