forked from OSGeo/gdal
-
Notifications
You must be signed in to change notification settings - Fork 0
205 lines (189 loc) · 10.2 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
name: Windows builds
on:
push:
paths-ignore:
- 'doc/**'
branches-ignore:
- 'backport**'
- 'dependabot**'
pull_request:
paths-ignore:
- 'doc/**'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
windows_build:
runs-on: windows-2022
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
include:
- VS_VERSION: Visual Studio 17
VS_VER: 2022
SDK: release-1930
platform: x86
PROJ_BRANCH: "9.3"
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"
SWIG_URL: "https://freefr.dl.sourceforge.net/project/swig/swigwin/swigwin-4.1.1/swigwin-4.1.1.zip"
env:
VS_VERSION: ${{ matrix.VS_VERSION }}
VS_VER: ${{ matrix.VS_VER }}
SDK: ${{ matrix.SDK }}
platform: ${{ matrix.platform }}
PROJ_BRANCH: "${{ matrix.PROJ_BRANCH }}"
LIBZSTD_URL: "${{ matrix.LIBZSTD_URL }}"
LIBDEFLATE_URL: "${{ matrix.LIBDEFLATE_URL }}"
SWIG_URL: "${{ matrix.SWIG_URL }}"
APPVEYOR: true # to skip some tests
PYTHON_VERSION: "3.10.5"
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@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
- 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%" == "2022" CALL "C:\Program Files\Microsoft Visual Studio\2022\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: Remove conflicting libraries
shell: bash -l {0}
run: |
rm -rf C:/Strawberry || /bin/true
- 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
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:SWIG_ZIP="swigwin-4.1.1.zip"
if(-Not (Test-Path -Path $env:SWIG_ZIP -PathType Leaf)) { Invoke-WebRequest "$env:SWIG_URL" -OutFile "$env:SWIG_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:SWIG_ZIP }
# exec { 7z x -y ..\..\downloads\$env:LIBDEFLATE_ZIP }
cd ..
$env:SDK_PREFIX="$env:GITHUB_WORKSPACE\sdk\$env:SDK"
$env:SDK_LIB="$env:SDK_PREFIX\lib"
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
mkdir build
cd build
$env:SDK_BIN="$env:SDK_PREFIX\bin"
$env:PATH="$env:SDK_BIN;$env:SDK\swigwin-4.1.1;$env:PATH"
$env:GDAL_INSTALL_DIR="$env:GITHUB_WORKSPACE"+"\install-gdal"
$env:CMAKE_INSTALL_PREFIX="-DCMAKE_INSTALL_PREFIX=" + $env:GDAL_INSTALL_DIR
$env:PROJ_ROOT="-DPROJ_ROOT=" + $env:PROJ_INSTALL_DIR
$env:CMAKE_PREFIX_PATH="-DCMAKE_PREFIX_PATH=" + $env:SDK_PREFIX
$env:MYSQL_LIBRARY="-DMYSQL_LIBRARY=" + $env:SDK_LIB + "\libmysql.lib"
$env:POPPLER_EXTRA_LIBRARIES="-DPOPPLER_EXTRA_LIBRARIES=" + $env:SDK_LIB + "\freetype.lib;" + $env:SDK_LIB + "\harfbuzz.lib"
# We disable Spatialite and external geotiff as they link to gisinternals proj9 and we have the following linking error
# referring to a file from the gisinternals build machine...
# LINK : fatal error LNK1181: cannot open input file 'E:\buildsystem\release-1930\lib\proj9.lib' [D:\a\gdal\gdal\build\GDAL.vcxproj]
# Disabling HDF4 (and netCDF) for similar reason: LINK : fatal error LNK1181: cannot open input file 'E:\buildsystem\release-1930\lib\mfhdf.lib'
# Disabling KEA because of "keadataset.obj : error LNK2019: unresolved external symbol "public: static class H5::FileAccPropList const & const H5::FileAccPropList::DEFAULT"
cmake -G $env:VS_VERSION -A $env:CMAKE_ARCHITECTURE .. $env:CMAKE_INSTALL_PREFIX -DCMAKE_BUILD_TYPE=Release $env:CMAKE_PREFIX_PATH -DCMAKE_C_FLAGS=" /WX $env:ARCH_FLAGS" -DCMAKE_CXX_FLAGS=" /WX $env:ARCH_FLAGS" -DGDAL_USE_DEFLATE=OFF $env:PROJ_ROOT $env:MYSQL_LIBRARY $env:POPPLER_EXTRA_LIBRARIES -DGDAL_USE_ZLIB_INTERNAL=ON -DECW_INTERFACE_COMPILE_DEFINITIONS="_MBCS;_UNICODE;UNICODE;_WINDOWS;LIBECWJ2;WIN32;_WINDLL;NO_X86_MMI" -DBUILD_CSHARP_BINDINGS=OFF -DBUILD_JAVA_BINDINGS=OFF -DOGR_ENABLE_DRIVER_LIBKML=OFF -DGDAL_USE_SPATIALITE=OFF -DGDAL_USE_GEOTIFF_INTERNAL=ON -DGDAL_USE_HDF4=OFF -DGDAL_USE_NETCDF=OFF -DGDAL_USE_WEBP=OFF -DGDAL_USE_KEA=OFF
exec { cmake --build . --config Release --target install }
- 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"
$env:PATH="$env:GITHUB_WORKSPACE\build\Release;$env:GITHUB_WORKSPACE\build\apps\Release;$env:GITHUB_WORKSPACE\install-proj\bin;$env:SDK_BIN;$env:PATH"
$env:GDAL_DATA="$env:GITHUB_WORKSPACE\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
python3 -m pip install -Ur requirements.txt
# For some reason I can't debug remotely, gdal.dll can'be loaded. Probably something missing in the path
# exec { ctest --test-dir $env:GITHUB_WORKSPACE\build -C Release -V -j 3 -R autotest }