Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that _geoslib is built with MSVC 14.0 for Windows Python3 #565

Merged
merged 9 commits into from
Nov 1, 2022
45 changes: 25 additions & 20 deletions .github/workflows/basemap-for-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ jobs:
["x64", "x86"]
msvc-toolset:
["9.0", "14.0"]
include:
- msvc-toolset: "9.0"
python-version: "2.7"
- msvc-toolset: "14.0"
python-version: "3.5"
max-parallel: 4
fail-fast: false
needs: lint
Expand All @@ -106,26 +111,26 @@ jobs:
path: .
-
name: Set MSVC toolset
uses: pylegacy/actions/setup-msvc@v1
uses: pylegacy/actions/setup-msvc@v2
with:
architecture: ${{ matrix.arch }}
version: ${{ matrix.msvc-toolset }}
arch: ${{ matrix.arch }}
toolset: ${{ matrix.msvc-toolset }}
-
name: Set CMake
uses: jwlawson/[email protected]
with:
cmake-version: "3.14.7"
cmake-version: "3.24.2"
-
name: Set Python
uses: actions/setup-python@v4
with:
architecture: ${{ matrix.arch }}
python-version: "3.6"
python-version: ${{ matrix.python-version }}
-
name: Build GEOS from source
run: |
cd ${{ env.PKGDIR }}
python -c "import utils; utils.GeosLibrary('3.6.5').build('extern', njobs=16)"
python -c "import utils; utils.GeosLibrary('3.6.5').build('extern', toolset='${{ matrix.msvc-toolset }}', njobs=16)"
-
name: Upload GEOS artifacts
uses: actions/upload-artifact@v1
Expand All @@ -151,20 +156,6 @@ jobs:
with:
name: checkout
path: .
-
name: Set MSVC toolset version
run: |
if ("${{ matrix.python-version }}" -eq "2.7") {
echo "msvc-toolset=9.0" >> $env:GITHUB_ENV
} else {
echo "msvc-toolset=14.0" >> $env:GITHUB_ENV
}
-
name: Set MSVC toolset
uses: pylegacy/actions/setup-msvc@v1
with:
architecture: ${{ matrix.arch }}
version: ${{ env.msvc-toolset }}
-
name: Set Python
uses: actions/setup-python@v4
Expand All @@ -186,6 +177,20 @@ jobs:
}
$env:SETUPTOOLS_USE_DISTUTILS = "stdlib"
python -m pip install "numpy == ${pkgvers}"
-
name: Set MSVC toolset version
run: |
if ("${{ matrix.python-version }}" -eq "2.7") {
echo "msvc-toolset=9.0" >> $env:GITHUB_ENV
} else {
echo "msvc-toolset=14.0" >> $env:GITHUB_ENV
}
-
name: Set MSVC toolset
uses: pylegacy/actions/setup-msvc@v2
with:
arch: ${{ matrix.arch }}
toolset: ${{ env.msvc-toolset }}
-
name: Download GEOS artifacts
uses: actions/download-artifact@v1
Expand Down
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ https://semver.org/spec/v2.0.0.html
### Changed
- Upgrade bundled GEOS library to 3.6.5.

### Fixed
- Set MSVC 14.0 (VS2015) to build the `_geoslib` module in the
precompiled Windows wheels (PR [#565]).

## [1.3.6] - 2022-10-31

### Added
Expand All @@ -32,8 +36,8 @@ https://semver.org/spec/v2.0.0.html
- Upgrade `pyproj` upper pin to 3.5.

### Fixed
- Set MSVC 14.0 (VS2015) to build the precompiled Windows wheels in
GitHub workflows (PR [#564]).
- Set MSVC 14.0 (VS2015) to build the GEOS library bundled in the
precompiled Windows wheels (PR [#564]).

## [1.3.5] - 2022-10-25

Expand Down Expand Up @@ -959,6 +963,8 @@ https://semver.org/spec/v2.0.0.html
- Fix glitches in drawing of parallels and meridians.


[#565]:
https://github.com/matplotlib/basemap/pull/565
[#564]:
https://github.com/matplotlib/basemap/pull/564
[#563]:
Expand Down
11 changes: 8 additions & 3 deletions packages/basemap/utils/GeosLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,18 @@ def build(self, installdir=None, toolset=None, njobs=1):

# Define custom configure and build options.
if os.name == "nt":
config_opts += ["-DCMAKE_CXX_FLAGS='/wd4251 /wd4458 /wd4530 /EHsc'"]
win64 = (8 * struct.calcsize("P") == 64)
config_opts += ["-DCMAKE_CXX_FLAGS='/wd4251 /wd4355 /wd4458 /wd4530 /EHsc'"]
if version >= (3, 6, 0) and sys.version_info[:2] >= (3, 3):
config_opts = ["-A", "x64" if win64 else "Win32"] + config_opts
if toolset is not None:
config_opts += ["-DCMAKE_GENERATOR_TOOLSET={0}".format(toolset)]
try:
msvc = "v{0:d}".format(int(float(toolset) * 10))
except (TypeError, ValueError):
msvc = toolset
config_opts += ["-DCMAKE_GENERATOR_TOOLSET={0}".format(msvc)]
build_opts = ["-j", "{0:d}".format(njobs)] + build_opts
else:
win64 = (8 * struct.calcsize("P") == 64)
config_opts = ["-G", "NMake Makefiles"] + config_opts
build_opts.extend([
"--",
Expand Down