forked from OSGeo/gdal
-
Notifications
You must be signed in to change notification settings - Fork 0
269 lines (255 loc) · 13.9 KB
/
windows_build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
name: Windows builds
on:
push:
paths-ignore:
- 'gdal/doc/**'
pull_request:
paths-ignore:
- 'gdal/doc/**'
jobs:
windows_build:
runs-on: windows-latest
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
include:
- VS_VERSION: Visual Studio 16
VS_VER: 2019
SDK: release-1911 # gisinternals SDK version still to 2017
MSVC_VER: 1920
platform: x86
PROJ_BRANCH: "7.2"
LIBWEBP_URL: "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.3-windows-x86.zip"
LIBZSTD_URL: "https://github.com/facebook/zstd/releases/download/v1.4.5/zstd-v1.4.5-win32.zip"
LIBDEFLATE_URL: "https://github.com/ebiggers/libdeflate/releases/download/v1.6/libdeflate-1.6-windows-i686-bin.zip"
env:
VS_VERSION: ${{ matrix.VS_VERSION }}
VS_VER: ${{ matrix.VS_VER }}
SDK: ${{ matrix.SDK }}
MSVC_VER: ${{ matrix.MSVC_VER }}
platform: ${{ matrix.platform }}
PROJ_BRANCH: "${{ matrix.PROJ_BRANCH }}"
LIBWEBP_URL: "${{ matrix.LIBWEBP_URL }}"
LIBZSTD_URL: "${{ matrix.LIBZSTD_URL }}"
LIBDEFLATE_URL: "${{ matrix.LIBDEFLATE_URL }}"
APPVEYOR: true # to skip some tests
PYTHON_VERSION: "3.7.9"
steps:
# To avoid git clone to mess with the line endings of GDAL autotest data
# files that look like text, but should be handled as binary content
- name: Set git core.autocrlf to false
run: |
git config --global core.autocrlf false
- name: Checkout
uses: actions/checkout@v2
- name: Set environment
shell: pwsh
run: |
$env:PATH="C:\hostedtoolcache\windows\Python\$env:PYTHON_VERSION\$env:platform;C:\hostedtoolcache\windows\Python\$env:PYTHON_VERSION\$env:platform\Scripts;$env:PATH"
if($env:platform -eq "x86")
{
$env:ARCHITECTURE="x86"
$env:WIN64_ARG=""
$env:CMAKE_ARCHITECTURE="Win32"
}
else
{
$env:ARCHITECTURE="amd64"
$env:WIN64_ARG="WIN64=YES"
$env:CMAKE_ARCHITECTURE="x64"
}
echo "PATH=$env:PATH" >> $env:GITHUB_ENV
echo "ARCHITECTURE=$env:ARCHITECTURE" >> $env:GITHUB_ENV
echo "WIN64_ARG=$env:WIN64_ARG" >> $env:GITHUB_ENV
echo "CMAKE_ARCHITECTURE=$env:CMAKE_ARCHITECTURE" >> $env:GITHUB_ENV
- name: Set compiler environment
shell: cmd
run: |
if "%VS_VER%" == "2019" CALL "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=%ARCHITECTURE%
echo PATH=%PATH%>> %GITHUB_ENV%
echo INCLUDE=%INCLUDE%>> %GITHUB_ENV%
echo LIB=%LIB%>> %GITHUB_ENV%
echo LIBPATH=%LIBPATH%>> %GITHUB_ENV%
- name: Detect AVX2
shell: bash
run: |
set -e
cl .github/workflows/detect-avx2.c
if ./detect-avx2.exe; then
echo "AVX2 available on CPU"
echo "ARCH_FLAGS=/arch:AVX2" >> $GITHUB_ENV
else
echo "AVX2 not available on CPU."
echo "ARCH_FLAGS=" >> $GITHUB_ENV
fi
- name: Build
shell: pwsh
run: |
$ErrorActionPreference = 'continue'
function exec
{
param ( [ScriptBlock] $ScriptBlock )
& $ScriptBlock 2>&1 | ForEach-Object -Process { "$_" }
if ($LastExitCode -ne 0) { exit $LastExitCode }
}
echo "ARCH_FLAGS = $env:ARCH_FLAGS"
exec { git clone --depth=1 -b $env:PROJ_BRANCH https://github.com/OSGeo/PROJ proj }
Import-PackageProvider NuGet -Force
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module Pscx -AllowClobber
Install-Module VSSetup -Scope CurrentUser
# Install SWIG by Choco
exec { cinst -y --no-progress --version 3.0.12 --force swig }
if($env:VS_VER -eq "2019")
{
}
else
{
Import-VisualStudioVars -VisualStudioVersion $env:VS_VER -Architecture $env:ARCHITECTURE
}
exec { pip install numpy }
$env:SDK_ZIP="$env:SDK"+"-dev.zip"
$env:SDK_URL="http://download.gisinternals.com/sdk/downloads/$env:SDK_ZIP"
if(-Not (Test-Path -Path downloads)) { mkdir downloads }
cd downloads
if(-Not (Test-Path -Path $env:SDK_ZIP )) { Invoke-WebRequest "$env:SDK_URL" -OutFile "$env:SDK_ZIP" }
$env:LIBZSTD_ZIP="libzstd.zip"
if(-Not (Test-Path -Path $env:LIBZSTD_ZIP -PathType Leaf)) { Invoke-WebRequest "$env:LIBZSTD_URL" -OutFile "$env:LIBZSTD_ZIP" }
$env:LIBWEBP_ZIP="libwebp.zip"
if(-Not (Test-Path -Path $env:LIBWEBP_ZIP -PathType Leaf)) { Invoke-WebRequest "$env:LIBWEBP_URL" -OutFile "$env:LIBWEBP_ZIP" }
$env:LIBDEFLATE_ZIP="libdeflate.zip"
if(-Not (Test-Path -Path $env:LIBDEFLATE_ZIP -PathType Leaf)) { Invoke-WebRequest "$env:LIBDEFLATE_URL" -OutFile "$env:LIBDEFLATE_ZIP" }
cd ..
mkdir sdk
cd sdk
exec { 7z x ..\downloads\$env:SDK_ZIP }
cd $env:SDK
#exec { 7z x ..\..\downloads\$env:LIBZSTD_ZIP }
exec { 7z x ..\..\downloads\$env:LIBWEBP_ZIP }
exec { 7z x -y ..\..\downloads\$env:LIBDEFLATE_ZIP }
cd ..
$env:SDK_PREFIX="$env:GITHUB_WORKSPACE\sdk\$env:SDK"
$env:SDK_INC="$env:SDK_PREFIX\include"
$env:SDK_LIB="$env:SDK_PREFIX\lib"
$env:NMAKE_LOCAL= "GEOS_CFLAGS=-I`$(SDK_INC) -DHAVE_GEOS`n"
$env:NMAKE_LOCAL+="GEOS_LIB=`$(SDK_LIB)\geos_c.lib`n"
$env:NMAKE_LOCAL+="PG_INC_DIR=`$(SDK_INC)`n"
$env:NMAKE_LOCAL+="PG_LIB=`$(SDK_LIB)\libpqdll.lib wsock32.lib`n"
$env:NMAKE_LOCAL+="CURL_DIR=bla`n"
$env:NMAKE_LOCAL+="CURL_INC=-I`$(SDK_INC)`n"
$env:NMAKE_LOCAL+="CURL_LIB=`$(SDK_LIB)\libcurl_imp.lib wsock32.lib wldap32.lib winmm.lib`n"
$env:NMAKE_LOCAL+="SQLITE_INC=-I`$(SDK_INC) -DHAVE_SPATIALITE -DSPATIALITE_AMALGAMATION`n"
$env:NMAKE_LOCAL+="SQLITE_LIB=`$(SDK_LIB)\spatialite_i.lib `$(SDK_LIB)\sqlite3_i.lib`n"
$env:NMAKE_LOCAL+="KMLSUPEROVERLAY_SUPPORTED = YES`n"
$env:NMAKE_LOCAL+="MINIZIP_INCLUDE = -I`$(SDK_INC)`n"
$env:NMAKE_LOCAL+="MINIZIP_LIBRARY = `$(SDK_LIB)\minizip.lib`n"
$env:NMAKE_LOCAL+="MYSQL_INC_DIR=`$(SDK_INC)`n"
$env:NMAKE_LOCAL+="MYSQL_LIB=`$(SDK_LIB)\libmysql.lib advapi32.lib`n"
$env:NMAKE_LOCAL+="XERCES_DIR=bla`n"
$env:NMAKE_LOCAL+="XERCES_INCLUDE=-I`$(SDK_INC) -I`$(SDK_INC)\xercesc`n"
$env:NMAKE_LOCAL+="XERCES_LIB=`$(SDK_LIB)\xerces-c_3.lib`n"
$env:NMAKE_LOCAL+="ILI_ENABLED = YES`n"
$env:NMAKE_LOCAL+="EXPAT_DIR=bla`n"
$env:NMAKE_LOCAL+="EXPAT_INCLUDE=-I`$(SDK_INC)`n"
$env:NMAKE_LOCAL+="EXPAT_LIB=`$(SDK_LIB)\expat.lib`n"
$env:NMAKE_LOCAL+="LIBKML_DIR=bla`n"
$env:NMAKE_LOCAL+="LIBKML_INCLUDE=-I`$(SDK_INC)`n"
$env:NMAKE_LOCAL+="LIBKML_LIBS=`$(SDK_LIB)\libkmlbase.lib `$(SDK_LIB)\libkmlconvenience.lib `$(SDK_LIB)\libkmldom.lib `$(SDK_LIB)\libkmlengine.lib `$(SDK_LIB)\libkmlregionator.lib `$(SDK_LIB)\libkmlxsd.lib `$(SDK_LIB)\expat.lib `$(SDK_LIB)\zdll.lib`n"
$env:NMAKE_LOCAL+="POPPLER_ENABLED = YES`n"
$env:NMAKE_LOCAL+="POPPLER_CFLAGS = -I`$(SDK_INC) -I`$(SDK_INC)\poppler`n"
$env:NMAKE_LOCAL+="POPPLER_MAJOR_VERSION = 0`n"
$env:NMAKE_LOCAL+="POPPLER_MINOR_VERSION = 30`n"
$env:NMAKE_LOCAL+="POPPLER_LIBS = `$(SDK_LIB)\poppler.lib `$(SDK_LIB)\freetype.lib `$(SDK_LIB)\harfbuzz.lib advapi32.lib gdi32.lib`n"
$env:NMAKE_LOCAL+="OPENJPEG_ENABLED = YES`n"
$env:NMAKE_LOCAL+="OPENJPEG_CFLAGS = -I`$(SDK_INC)\openjpeg-2.1`n"
$env:NMAKE_LOCAL+="OPENJPEG_LIB = `$(SDK_LIB)\openjp2.lib`n"
$env:NMAKE_LOCAL+="ECWDIR=bla`n"
$env:NMAKE_LOCAL+="ECWLIB=`$(SDK_LIB)\libecwj2.lib`n"
$env:NMAKE_LOCAL+="ECWFLAGS=-DECWSDK_VERSION=33 -I`$(SDK_INC) /D_MBCS /D_UNICODE /DUNICODE /D_WINDOWS /DLIBECWJ2 /DWIN32 /D_WINDLL -DNO_X86_MMI`n"
$env:NMAKE_LOCAL+="HDF5_DIR = `$(SDK_PREFIX)`n"
$env:NMAKE_LOCAL+="HDF5_LIB = `$(SDK_LIB)\hdf5.lib`n"
$env:NMAKE_LOCAL+="KEA_CFLAGS = -I`$(SDK_INC)`n"
$env:NMAKE_LOCAL+="KEA_LIB = `$(SDK_LIB)\libkea.lib `$(SDK_LIB)\hdf5_cpp.lib`n"
$env:NMAKE_LOCAL+="NETCDF_SETTING=yes`n"
$env:NMAKE_LOCAL+="NETCDF_LIB=`$(SDK_LIB)\netcdf.lib`n"
$env:NMAKE_LOCAL+="NETCDF_INC_DIR=`$(SDK_INC)`n"
$env:NMAKE_LOCAL+="NETCDF_HAS_NC4 = yes`n"
#$env:NMAKE_LOCAL+="NETCDF_HAS_NETCDF_MEM = yes`n"
$env:NMAKE_LOCAL+="PROJ_INCLUDE=-I$env:GITHUB_WORKSPACE\install-proj\include`n"
$env:NMAKE_LOCAL+="PROJ_LIBRARY=$env:GITHUB_WORKSPACE\install-proj\lib\proj.lib`n"
# For some reason libzstd.dll and libdeflate.dll conflicts at runtime
#$env:NMAKE_LOCAL+="ZSTD_CFLAGS = -I`$(SDK_PREFIX)\include`n"
#$env:NMAKE_LOCAL+="ZSTD_LIBS = `$(SDK_PREFIX)\dll\libzstd.dll.a`n"
$env:NMAKE_LOCAL+="WEBP_ENABLED=YES`n"
$env:NMAKE_LOCAL+="WEBP_CFLAGS = -I`$(SDK_PREFIX)\libwebp-1.0.3-windows-x86\include`n"
$env:NMAKE_LOCAL+="WEBP_LIBS = /NODEFAULTLIB:libcmt.lib `$(SDK_PREFIX)\libwebp-1.0.3-windows-x86\lib\libwebp.lib`n"
$env:NMAKE_LOCAL+="LIBDEFLATE_CFLAGS = -I`$(SDK_PREFIX)`n"
$env:NMAKE_LOCAL+="LIBDEFLATE_LIB = `$(SDK_PREFIX)\libdeflate.lib`n"
$env:NMAKE_LOCAL | Set-Content "$env:GITHUB_WORKSPACE\gdal\nmake.local"
#
cd $env:GITHUB_WORKSPACE
cd proj
mkdir build
cd build
$env:VCPKG_PLATFORM="$env:platform"+"-windows"
exec { vcpkg install sqlite3:$env:VCPKG_PLATFORM }
Invoke-WebRequest "https://sqlite.org/2018/sqlite-tools-win32-x86-3250100.zip" -OutFile "sqlite-tools-win32-x86-3250100.zip"
7z x sqlite-tools-win32-x86-3250100.zip
copy sqlite-tools-win32-x86-3250100/sqlite3.exe $env:GITHUB_WORKSPACE
$env:PATH="$env:GITHUB_WORKSPACE;$env:PATH"
$env:PROJ_INSTALL_DIR="$env:GITHUB_WORKSPACE"+"\install-proj"
$env:CMAKE_INSTALL_PREFIX="-DCMAKE_INSTALL_PREFIX=" + $env:PROJ_INSTALL_DIR
cmake -G $env:VS_VERSION -A $env:CMAKE_ARCHITECTURE .. $env:CMAKE_INSTALL_PREFIX -DPROJ_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_LIBPROJ_SHARED=ON -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -DBUILD_SHARED_LIBS=ON -DENABLE_CURL=OFF -DENABLE_TIFF=OFF -DBUILD_PROJSYNC=OFF
exec { cmake --build . --config Release --target install }
cd $env:GITHUB_WORKSPACE\install-proj\share\proj
Invoke-WebRequest "http://download.osgeo.org/proj/proj-datumgrid-1.8.zip" -OutFile "proj-datumgrid-1.8.zip"
7z x proj-datumgrid-1.8.zip -aoa
#
cd $env:GITHUB_WORKSPACE\gdal
copy $env:GITHUB_WORKSPACE\install-proj\bin\*.dll .
exec { nmake /f makefile.vc MSVC_VER=$env:MSVC_VER $env:WIN64_ARG USER_DEFS="/WX $env:ARCH_FLAGS" }
cd apps
exec { nmake /f makefile.vc test_ogrsf.exe MSVC_VER=$env:MSVC_VER $env:WIN64_ARG USER_DEFS=/WX }
$env:DISTUTILS_USE_SDK=1
$env:MSSdk=1
cd $env:GITHUB_WORKSPACE\gdal\swig\python
exec { python setup.py build }
exec { python setup.py install }
cd $env:GITHUB_WORKSPACE\gdal\swig\csharp
dotnet nuget locals all --clear
dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
dotnet restore
exec { nmake /f makefile.vc interface }
exec { nmake /f makefile.vc all $env:WIN64_ARG }
cd $env:GITHUB_WORKSPACE\autotest\cpp
exec { nmake /f makefile.vc MSVC_VER=$env:MSVC_VER $env:WIN64_ARG }
- name: Run tests
shell: pwsh
run: |
$ErrorActionPreference = 'continue'
function exec
{
param ( [ScriptBlock] $ScriptBlock )
& $ScriptBlock 2>&1 | ForEach-Object -Process { "$_" }
if ($LastExitCode -ne 0) { exit $LastExitCode }
}
$env:SDK_PREFIX="$env:GITHUB_WORKSPACE\sdk\$env:SDK"
$env:SDK_BIN="$env:SDK_PREFIX\bin"
# Set USE_PATH_FOR_GDAL_PYTHON=YES and include a fake path in the PATH
# to test robustness to nonexistent paths (only relevant for python>=3.8)
# See https://github.com/OSGeo/gdal/issues/3898
$env:USE_PATH_FOR_GDAL_PYTHON="YES"
$env:PATH="$env:GITHUB_WORKSPACE\gdal;$env:GITHUB_WORKSPACE\gdal\apps;$env:SDK_PREFIX\dll;$env:SDK_PREFIX;$env:SDK_BIN;$env:GITHUB_WORKSPACE\not_a_real_path;$env:PATH"
$env:GDAL_DATA="$env:GITHUB_WORKSPACE\gdal\data"
$env:DO_NOT_FAIL_ON_RECODE_ERRORS="YES"
$env:MDB_ODBC_DRIVER_INSTALLED="YES"
# The ca-bundle.crt file which we could point to is invalid in the current SDK
# See https://github.com/gisinternals/buildsystem/issues/104
$env:GDAL_HTTP_UNSAFESSL="YES"
cd $env:GITHUB_WORKSPACE\autotest\cpp
exec { nmake /f makefile.vc check MSVC_VER=$env:MSVC_VER $env:WIN64_ARG }
cd $env:GITHUB_WORKSPACE\autotest
pip install -Ur requirements.txt
exec { pytest -vv }
cd $env:GITHUB_WORKSPACE\gdal\swig\csharp
exec { nmake /f makefile.vc test }