From cdd4c5f336e842a9956e527a84ed66ad57e42975 Mon Sep 17 00:00:00 2001 From: Graham Markall Date: Thu, 14 Mar 2024 13:43:56 +0000 Subject: [PATCH] Run CI with LLVM 15 on Windows This includes changes: - Adding the Windows LLVM 15 config to the Azure setup. - Converting the commands in the Azure pipeline file to a call to the setup_conda_environment.cmd script (it's easier to edit a script rather than individual lines in the Azure file). - Installation of LLVM 15 from conda-forge. - A workaround / supporting change for the conda-forge solution to conda-forge/llvmdev-feedstock#175. --- buildscripts/azure/azure-windows.yml | 10 ++++----- buildscripts/incremental/build.cmd | 19 ++++++++++++++++ .../incremental/setup_conda_environment.cmd | 22 +++++++++---------- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/buildscripts/azure/azure-windows.yml b/buildscripts/azure/azure-windows.yml index bfb20e177..fd61bb7a8 100644 --- a/buildscripts/azure/azure-windows.yml +++ b/buildscripts/azure/azure-windows.yml @@ -22,6 +22,10 @@ jobs: PYTHON: '3.12' CONDA_ENV: cienv + llvm15: + PYTHON: '3.12' + CONDA_ENV: cienv + LLVM: '15' steps: @@ -33,11 +37,7 @@ jobs: - script: | call C:\Miniconda3\Scripts\activate.bat - call conda list - call conda remove --all -q -y -n %CONDA_ENV% - call conda create -n %CONDA_ENV% -q -y python=%PYTHON% cmake - call activate %CONDA_ENV% - call conda install -y -q -c numba/label/dev llvmdev="14.*" libxml2 + call buildscripts\\incremental\\setup_conda_environment.cmd displayName: 'Before Install' - script: | diff --git a/buildscripts/incremental/build.cmd b/buildscripts/incremental/build.cmd index 4588d2490..182cdde8f 100644 --- a/buildscripts/incremental/build.cmd +++ b/buildscripts/incremental/build.cmd @@ -1,4 +1,23 @@ call activate %CONDA_ENV% +@rem LLVM derives the location of diaguids.lib from the build-time environment. +@rem Conda-forge packaging works around this by substituting the build-time +@rem location of Visual Studio with $ENV{VSINSTALLDIR}. In order to ensure that +@rem this environment variable is set appropriately, we activate the Visual +@rem Studio Developer Command Prompt prior to running setup.py +@rem +@rem This workaround is required whilst using LLVM from conda-forge; it may also +@rem be necessary to consider a workaround for our own llvmdev packages. +@rem +@rem For more info, see: +@rem +@rem - https://github.com/conda-forge/llvmdev-feedstock/issues/175 +@rem - https://github.com/conda-forge/llvmdev-feedstock/pull/223 +@rem - https://github.com/MicrosoftDocs/visualstudio-docs/issues/7774 +if "%LLVM%"=="15" ( + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" + if %errorlevel% neq 0 exit /b %errorlevel% +) + python setup.py build diff --git a/buildscripts/incremental/setup_conda_environment.cmd b/buildscripts/incremental/setup_conda_environment.cmd index e3b66574e..afd47c5f2 100644 --- a/buildscripts/incremental/setup_conda_environment.cmd +++ b/buildscripts/incremental/setup_conda_environment.cmd @@ -1,24 +1,24 @@ -@rem The cmd /C hack circumvents a regression where conda installs a conda.bat -@rem script in non-root environments. -set CONDA_INSTALL=cmd /C conda install -q -y -set PIP_INSTALL=pip install -q - @echo on -@rem Deactivate any environment -call deactivate @rem Display root environment (for debugging) -conda list +call conda list + @rem Clean up any left-over from a previous build -conda remove --all -q -y -n %CONDA_ENV% +call conda remove --all -q -y -n %CONDA_ENV% @rem Create and populate environment -conda create -n %CONDA_ENV% -q -y python=%PYTHON% cmake +call conda create -n %CONDA_ENV% -q -y python=%PYTHON% cmake if %errorlevel% neq 0 exit /b %errorlevel% call activate %CONDA_ENV% if %errorlevel% neq 0 exit /b %errorlevel% @rem Install llvmdev -%CONDA_INSTALL% -c numba/label/dev llvmdev="14.*" +if "%LLVM%"=="15" ( + set LLVMDEV_CHANNEL="conda-forge" +) else ( + set LLVMDEV_CHANNEL="numba/label/dev" +) + +call conda install -y -q -c %LLVMDEV_CHANNEL% llvmdev="%LLVM%" libxml2 if %errorlevel% neq 0 exit /b %errorlevel%