Skip to content

Commit 35402d0

Browse files
dschoGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
Merge pull request #2915 from dennisameling/windows-arm64-support
Windows arm64 support
2 parents fcab67a + c600d57 commit 35402d0

File tree

6 files changed

+87
-18
lines changed

6 files changed

+87
-18
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,11 @@ jobs:
169169
NO_PERL: 1
170170
GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'"
171171
runs-on: windows-latest
172+
strategy:
173+
matrix:
174+
arch: [x64, arm64]
172175
concurrency:
173-
group: vs-build-${{ github.ref }}
176+
group: vs-build-${{ github.ref }}-${{ matrix.arch }}
174177
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
175178
steps:
176179
- uses: actions/checkout@v4
@@ -193,14 +196,14 @@ jobs:
193196
uses: microsoft/setup-msbuild@v1
194197
- name: copy dlls to root
195198
shell: cmd
196-
run: compat\vcbuild\vcpkg_copy_dlls.bat release
199+
run: compat\vcbuild\vcpkg_copy_dlls.bat release ${{ matrix.arch }}-windows
197200
- name: generate Visual Studio solution
198201
shell: bash
199202
run: |
200-
cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/x64-windows \
201-
-DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON
203+
cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/${{ matrix.arch }}-windows \
204+
-DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON -DCMAKE_GENERATOR_PLATFORM=${{ matrix.arch }} -DVCPKG_ARCH=${{ matrix.arch }}-windows
202205
- name: MSBuild
203-
run: msbuild git.sln -property:Configuration=Release -property:Platform=x64 -maxCpuCount:4 -property:PlatformToolset=v142
206+
run: msbuild git.sln -property:Configuration=Release -property:Platform=${{ matrix.arch }} -maxCpuCount:4 -property:PlatformToolset=v142
204207
- name: bundle artifact tar
205208
shell: bash
206209
env:
@@ -214,7 +217,7 @@ jobs:
214217
- name: upload tracked files and build artifacts
215218
uses: actions/upload-artifact@v4
216219
with:
217-
name: vs-artifacts
220+
name: vs-artifacts-${{ matrix.arch }}
218221
path: artifacts
219222
vs-test:
220223
name: win+VS test
@@ -232,7 +235,7 @@ jobs:
232235
- name: download tracked files and build artifacts
233236
uses: actions/download-artifact@v4
234237
with:
235-
name: vs-artifacts
238+
name: vs-artifacts-x64
236239
path: ${{github.workspace}}
237240
- name: extract tracked files and build artifacts
238241
shell: bash

compat/vcbuild/README

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ The Steps to Build Git with VS2015 or VS2017 from the command line.
66
Prompt or from an SDK bash window:
77

88
$ cd <repo_root>
9-
$ ./compat/vcbuild/vcpkg_install.bat
9+
$ ./compat/vcbuild/vcpkg_install.bat x64-windows
10+
11+
or
12+
13+
$ ./compat/vcbuild/vcpkg_install.bat arm64-windows
1014

1115
The vcpkg tools and all of the third-party sources will be installed
1216
in this folder:

compat/vcbuild/vcpkg_copy_dlls.bat

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ REM ================================================================
1515
@FOR /F "delims=" %%D IN ("%~dp0") DO @SET cwd=%%~fD
1616
cd %cwd%
1717

18-
SET arch=x64-windows
18+
SET arch=%2
19+
IF NOT DEFINED arch (
20+
echo defaulting to 'x64-windows`. Invoke %0 with 'x86-windows', 'x64-windows', or 'arm64-windows'
21+
set arch=x64-windows
22+
)
23+
1924
SET inst=%cwd%vcpkg\installed\%arch%
2025

2126
IF [%1]==[release] (

compat/vcbuild/vcpkg_install.bat

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ REM ================================================================
3131

3232
SETLOCAL EnableDelayedExpansion
3333

34+
SET arch=%1
35+
IF NOT DEFINED arch (
36+
echo defaulting to 'x64-windows`. Invoke %0 with 'x86-windows', 'x64-windows', or 'arm64-windows'
37+
set arch=x64-windows
38+
)
39+
3440
@FOR /F "delims=" %%D IN ("%~dp0") DO @SET cwd=%%~fD
3541
cd %cwd%
3642

@@ -55,9 +61,8 @@ REM ================================================================
5561
echo Successfully installed %cwd%vcpkg\vcpkg.exe
5662

5763
:install_libraries
58-
SET arch=x64-windows
5964

60-
echo Installing third-party libraries...
65+
echo Installing third-party libraries(%arch%)...
6166
FOR %%i IN (zlib expat libiconv openssl libssh2 curl) DO (
6267
cd %cwd%vcpkg
6368
IF NOT EXIST "packages\%%i_%arch%" CALL :sub__install_one %%i
@@ -80,14 +85,47 @@ REM ================================================================
8085
:sub__install_one
8186
echo Installing package %1...
8287

88+
call :%1_features
89+
8390
REM vcpkg may not be reliable on slow, intermittent or proxy
8491
REM connections, see e.g.
8592
REM https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/4a8f7be5-5e15-4213-a7bb-ddf424a954e6/winhttpsendrequest-ends-with-12002-errorhttptimeout-after-21-seconds-no-matter-what-timeout?forum=windowssdk
8693
REM which explains the hidden 21 second timeout
8794
REM (last post by Dave : Microsoft - Windows Networking team)
8895

89-
.\vcpkg.exe install %1:%arch%
96+
.\vcpkg.exe install %1%features%:%arch%
9097
IF ERRORLEVEL 1 ( EXIT /B 1 )
9198

9299
echo Finished %1
93100
goto :EOF
101+
102+
::
103+
:: features for each vcpkg to install
104+
:: there should be an entry here for each package to install
105+
:: 'set features=' means use the default otherwise
106+
:: 'set features=[comma-delimited-feature-set]' is the syntax
107+
::
108+
109+
:zlib_features
110+
set features=
111+
goto :EOF
112+
113+
:expat_features
114+
set features=
115+
goto :EOF
116+
117+
:libiconv_features
118+
set features=
119+
goto :EOF
120+
121+
:openssl_features
122+
set features=
123+
goto :EOF
124+
125+
:libssh2_features
126+
set features=
127+
goto :EOF
128+
129+
:curl_features
130+
set features=[core,openssl,schannel]
131+
goto :EOF

contrib/buildsystems/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ if(USE_VCPKG)
6565
set(VCPKG_DIR "${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg")
6666
if(NOT EXISTS ${VCPKG_DIR})
6767
message("Initializing vcpkg and building the Git's dependencies (this will take a while...)")
68-
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg_install.bat)
68+
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg_install.bat ${VCPKG_ARCH})
6969
endif()
70-
list(APPEND CMAKE_PREFIX_PATH "${VCPKG_DIR}/installed/x64-windows")
70+
list(APPEND CMAKE_PREFIX_PATH "${VCPKG_DIR}/installed/${VCPKG_ARCH}")
7171

7272
# In the vcpkg edition, we need this to be able to link to libcurl
7373
set(CURL_NO_CURL_CMAKE ON)
@@ -1107,7 +1107,7 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PRE
11071107
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n")
11081108
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n")
11091109
if(USE_VCPKG)
1110-
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n")
1110+
file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/${VCPKG_ARCH}/bin\"\n")
11111111
endif()
11121112

11131113
#Make the tests work when building out of the source tree

contrib/buildsystems/Generators/Vcxproj.pm

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,21 @@ sub createProject {
126126
<Configuration>Release</Configuration>
127127
<Platform>x64</Platform>
128128
</ProjectConfiguration>
129+
<ProjectConfiguration Include="Debug|ARM64">
130+
<Configuration>Debug</Configuration>
131+
<Platform>ARM64</Platform>
132+
</ProjectConfiguration>
133+
<ProjectConfiguration Include="Release|ARM64">
134+
<Configuration>Release</Configuration>
135+
<Platform>ARM64</Platform>
136+
</ProjectConfiguration>
129137
</ItemGroup>
130138
<PropertyGroup Label="Globals">
131139
<ProjectGuid>$uuid</ProjectGuid>
132140
<Keyword>Win32Proj</Keyword>
133141
<VCPKGArch Condition="'\$(Platform)'=='Win32'">x86-windows</VCPKGArch>
134-
<VCPKGArch Condition="'\$(Platform)'!='Win32'">x64-windows</VCPKGArch>
142+
<VCPKGArch Condition="'\$(Platform)'=='x64'">x64-windows</VCPKGArch>
143+
<VCPKGArch Condition="'\$(Platform)'=='ARM64'">arm64-windows</VCPKGArch>
135144
<VCPKGArchDirectory>$cdup\\compat\\vcbuild\\vcpkg\\installed\\\$(VCPKGArch)</VCPKGArchDirectory>
136145
<VCPKGBinDirectory Condition="'\$(Configuration)'=='Debug'">\$(VCPKGArchDirectory)\\debug\\bin</VCPKGBinDirectory>
137146
<VCPKGLibDirectory Condition="'\$(Configuration)'=='Debug'">\$(VCPKGArchDirectory)\\debug\\lib</VCPKGLibDirectory>
@@ -152,7 +161,7 @@ sub createProject {
152161
</PropertyGroup>
153162
<PropertyGroup>
154163
<ConfigurationType>$config_type</ConfigurationType>
155-
<PlatformToolset>v140</PlatformToolset>
164+
<PlatformToolset>v142</PlatformToolset>
156165
<!-- <CharacterSet>UTF-8</CharacterSet> -->
157166
<OutDir>..\\</OutDir>
158167
<!-- <IntDir>\$(ProjectDir)\$(Configuration)\\</IntDir> -->
@@ -196,7 +205,7 @@ EOM
196205
<PreBuildEvent Condition="!Exists('$cdup\\compat\\vcbuild\\vcpkg\\installed\\\$(VCPKGArch)\\include\\openssl\\ssl.h')">
197206
<Message>Initialize VCPKG</Message>
198207
<Command>del "$cdup\\compat\\vcbuild\\vcpkg"</Command>
199-
<Command>call "$cdup\\compat\\vcbuild\\vcpkg_install.bat"</Command>
208+
<Command>call "$cdup\\compat\\vcbuild\\vcpkg_install.bat" \$(VCPKGArch)</Command>
200209
</PreBuildEvent>
201210
EOM
202211
}
@@ -379,8 +388,10 @@ sub createGlueProject {
379388
print F << "EOM";
380389
Global
381390
GlobalSection(SolutionConfigurationPlatforms) = preSolution
391+
Debug|ARM64 = Debug|ARM64
382392
Debug|x64 = Debug|x64
383393
Debug|x86 = Debug|x86
394+
Release|ARM64 = Release|ARM64
384395
Release|x64 = Release|x64
385396
Release|x86 = Release|x86
386397
EndGlobalSection
@@ -391,10 +402,14 @@ EOM
391402
foreach (@apps) {
392403
my $appname = $_;
393404
my $uuid = $build_structure{"APPS_${appname}_GUID"};
405+
print F "\t\t${uuid}.Debug|ARM64.ActiveCfg = Debug|ARM64\n";
406+
print F "\t\t${uuid}.Debug|ARM64.Build.0 = Debug|ARM64\n";
394407
print F "\t\t${uuid}.Debug|x64.ActiveCfg = Debug|x64\n";
395408
print F "\t\t${uuid}.Debug|x64.Build.0 = Debug|x64\n";
396409
print F "\t\t${uuid}.Debug|x86.ActiveCfg = Debug|Win32\n";
397410
print F "\t\t${uuid}.Debug|x86.Build.0 = Debug|Win32\n";
411+
print F "\t\t${uuid}.Release|ARM64.ActiveCfg = Release|ARM64\n";
412+
print F "\t\t${uuid}.Release|ARM64.Build.0 = Release|ARM64\n";
398413
print F "\t\t${uuid}.Release|x64.ActiveCfg = Release|x64\n";
399414
print F "\t\t${uuid}.Release|x64.Build.0 = Release|x64\n";
400415
print F "\t\t${uuid}.Release|x86.ActiveCfg = Release|Win32\n";
@@ -403,10 +418,14 @@ EOM
403418
foreach (@libs) {
404419
my $libname = $_;
405420
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
421+
print F "\t\t${uuid}.Debug|ARM64.ActiveCfg = Debug|ARM64\n";
422+
print F "\t\t${uuid}.Debug|ARM64.Build.0 = Debug|ARM64\n";
406423
print F "\t\t${uuid}.Debug|x64.ActiveCfg = Debug|x64\n";
407424
print F "\t\t${uuid}.Debug|x64.Build.0 = Debug|x64\n";
408425
print F "\t\t${uuid}.Debug|x86.ActiveCfg = Debug|Win32\n";
409426
print F "\t\t${uuid}.Debug|x86.Build.0 = Debug|Win32\n";
427+
print F "\t\t${uuid}.Release|ARM64.ActiveCfg = Release|ARM64\n";
428+
print F "\t\t${uuid}.Release|ARM64.Build.0 = Release|ARM64\n";
410429
print F "\t\t${uuid}.Release|x64.ActiveCfg = Release|x64\n";
411430
print F "\t\t${uuid}.Release|x64.Build.0 = Release|x64\n";
412431
print F "\t\t${uuid}.Release|x86.ActiveCfg = Release|Win32\n";

0 commit comments

Comments
 (0)