Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Backport build fixes from main. #151

Merged
merged 3 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- template: azure/windows.yml
parameters:
name: "windows2019"
vmImage: "windows-latest"
vmImage: "windows-2019"
timeoutInMinutes: 90
matrix:
py_3.8_32:
Expand Down
2 changes: 1 addition & 1 deletion azure/posix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
# Platform variables used in multibuild scripts
if [ `uname` == 'Darwin' ]; then
echo "##vso[task.setvariable variable=TRAVIS_OS_NAME]osx"
echo "##vso[task.setvariable variable=MACOSX_DEPLOYMENT_TARGET]10.9"
echo "##vso[task.setvariable variable=MACOSX_DEPLOYMENT_TARGET]10.14"
else
echo "##vso[task.setvariable variable=TRAVIS_OS_NAME]linux"
fi
Expand Down
77 changes: 77 additions & 0 deletions azure/set_vs_toolchain.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
@@echo on
REM set Visual Studio toolchain given bitness, VS year and toolchain number.

REM Parts of this file copied from:
REM https://github.com/conda-forge/vc-feedstock/blob/7c0aa76218f369227d6a7fc78f981b100d68d50a/recipe/activate.bat
REM licensed as follows:
REM BSD-3-Clause
REM Copyright conda-forge contributors

IF [%1] == [] GOTO NoArgErr
set VS_BITS=%1
IF [%2] == [] GOTO NoArgErr
set VS_YEAR=%2
IF [%3] == [] GOTO NoArgErr
set VS_TOOLCHAIN=%3

REM Tools can come from any of Professional, Community, BuildTools or Enterprise install.
if not exist "%VSINSTALLDIR%" (
set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\%VS_YEAR%\Professional\"
)
if not exist "%VSINSTALLDIR%" (
set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\%VS_YEAR%\Community\"
)
if not exist "%VSINSTALLDIR%" (
set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\%VS_YEAR%\BuildTools\"
)
if not exist "%VSINSTALLDIR%" (
set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\%VS_YEAR%\Enterprise\"
)

REM Discover the latest Windows SDK available.
call :GetWin10SdkDir
:: dir /ON here is sorting the list of folders, such that we use the latest one that we have
for /F %%i in ('dir /ON /B "%WindowsSdkDir%\include\10.*"') DO (
SET WindowsSDKVer=%%~i
)
if errorlevel 1 (
echo "Didn't find any windows 10 SDK. I'm not sure if things will work, but let's try..."
) else (
echo Windows SDK version found as: "%WindowsSDKVer%"
)

REM Set bitness, toolchain version and SDK.
call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvars%1.bat" -vcvars_ver=%VS_TOOLCHAIN% %WindowsSDKVer%
REM https://docs.python.org/3.9/distutils/apiref.html#module-distutils.msvccompiler
REM or
REM https://setuptools.pypa.io/en/latest/deprecated/distutils/apiref.html#module-distutils.msvccompiler
REM Force our SDK, rather than the Python was built with.
set DISTUTILS_USE_SDK=1
set MSSdk=1

REM All done, finish here.
goto:eof

REM Various subroutines.

:GetWin10SdkDir
call :GetWin10SdkDirHelper HKLM\SOFTWARE\Wow6432Node > nul 2>&1
if errorlevel 1 call :GetWin10SdkDirHelper HKCU\SOFTWARE\Wow6432Node > nul 2>&1
if errorlevel 1 call :GetWin10SdkDirHelper HKLM\SOFTWARE > nul 2>&1
if errorlevel 1 call :GetWin10SdkDirHelper HKCU\SOFTWARE > nul 2>&1
if errorlevel 1 exit /B 1
exit /B 0

:GetWin10SdkDirHelper
@@REM `Get Windows 10 SDK installed folder`
for /F "tokens=1,2*" %%i in ('reg query "%1\Microsoft\Microsoft SDKs\Windows\v10.0" /v "InstallationFolder"') DO (
if "%%i"=="InstallationFolder" (
SET WindowsSdkDir=%%~k
)
)
exit /B 0

:NoArgErr
echo "Need to specify input bitness, VS year and toolchain number"
echo "e.g 64 2019 14.16"
exit 1
9 changes: 9 additions & 0 deletions azure/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ jobs:
- checkout: self
submodules: true

- task: BatchScript@1
inputs:
filename: azure/set_vs_toolchain.cmd
arguments: $(BITS) 2019 14.16
modifyEnvironment: True
displayName: Set VS toolchain version

- task: UsePythonVersion@0
inputs:
versionSpec: $(PYTHON_VERSION)
Expand Down Expand Up @@ -122,6 +129,8 @@ jobs:
popd
displayName: Build wheel
- bash: |
# Undo use specify VS build tools.
unset DISTUTILS_USE_SDK MSSdk
set -ex
source extra_functions.sh
source config.sh
Expand Down
2 changes: 1 addition & 1 deletion env_vars.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Environment variables for build
MACOSX_DEPLOYMENT_TARGET=10.9
MACOSX_DEPLOYMENT_TARGET=10.14
CFLAGS="-std=c99 -fno-strict-aliasing"
# Macos's linker doesn't support stripping symbols
if [ "$(uname)" != "Darwin" ]; then
Expand Down
2 changes: 1 addition & 1 deletion env_vars_32.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# The important difference from the 64-bit build is `-msse2` to
# compile sse loops for ufuncs.
set -x
MACOSX_DEPLOYMENT_TARGET=10.9
MACOSX_DEPLOYMENT_TARGET=10.14

# Fails test_umath.TestAVXUfuncs with reciprocal on Azure
# CFLAGS="-msse2 -std=c99 -fno-strict-aliasing"
Expand Down