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

Initial arm64 #2507

Closed
wants to merge 6 commits into from
Closed
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 compat/bswap.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static inline uint64_t git_bswap64(uint64_t x)
}
#endif

#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM64))

#include <stdlib.h>

Expand Down
49 changes: 45 additions & 4 deletions compat/vcbuild/vcpkg_install.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@ECHO OFF
@IF NOT DEFINED _ECHO ECHO OFF
REM ================================================================
REM This script installs the "vcpkg" source package manager and uses
REM it to build the third-party libraries that git requires when it
Expand Down Expand Up @@ -31,6 +31,12 @@ REM ================================================================

SETLOCAL EnableDelayedExpansion

SET arch=%1
IF NOT DEFINED arch (
echo defaulting to 'x64-windows`. Invoke %0 with 'x86-windows', 'x64-windows', or 'arm64-windows'
set arch=x64-windows
)

@FOR /F "delims=" %%D IN ("%~dp0") DO @SET cwd=%%~fD
cd %cwd%

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

:install_libraries
SET arch=x64-windows

echo Installing third-party libraries...
echo Installing third-party libraries(%arch%)...
FOR %%i IN (zlib expat libiconv openssl libssh2 curl) DO (
cd %cwd%vcpkg
IF NOT EXIST "packages\%%i_%arch%" CALL :sub__install_one %%i
Expand All @@ -80,14 +85,50 @@ REM ================================================================
:sub__install_one
echo Installing package %1...

call :%1_features

REM vcpkg may not be reliable on slow, intermittent or proxy
REM connections, see e.g.
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
REM which explains the hidden 21 second timeout
REM (last post by Dave : Microsoft - Windows Networking team)

.\vcpkg.exe install %1:%arch%
.\vcpkg.exe install %1%features%:%arch%
IF ERRORLEVEL 1 ( EXIT /B 1 )

echo Finished %1
goto :EOF



::
:: features for each vcpkg to install
:: there should be an entry here for each package to install
:: 'set features=' means use the default otherwise
:: 'set features=[comma-delimited-feature-set]' is the syntax
::

:zlib_features
set features=
goto :EOF

:expat_features
set features=
goto :EOF

:libiconv_features
set features=
goto :EOF

:openssl_features
set features=
goto :EOF

:libssh2_features
set features=
goto :EOF

:curl_features
set features=[core,openssl]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it work if we used [core,openssl,schannel] here?

goto :EOF

25 changes: 22 additions & 3 deletions contrib/buildsystems/Generators/Vcxproj.pm
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,21 @@ sub createProject {
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>$uuid</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<VCPKGArch Condition="'\$(Platform)'=='Win32'">x86-windows</VCPKGArch>
<VCPKGArch Condition="'\$(Platform)'!='Win32'">x64-windows</VCPKGArch>
<VCPKGArch Condition="'\$(Platform)'=='x64'">x64-windows</VCPKGArch>
<VCPKGArch Condition="'\$(Platform)'=='ARM64'">arm64-windows</VCPKGArch>
<VCPKGArchDirectory>$cdup\\compat\\vcbuild\\vcpkg\\installed\\\$(VCPKGArch)</VCPKGArchDirectory>
<VCPKGBinDirectory Condition="'\$(Configuration)'=='Debug'">\$(VCPKGArchDirectory)\\debug\\bin</VCPKGBinDirectory>
<VCPKGLibDirectory Condition="'\$(Configuration)'=='Debug'">\$(VCPKGArchDirectory)\\debug\\lib</VCPKGLibDirectory>
Expand All @@ -139,7 +148,7 @@ sub createProject {
</PropertyGroup>
<PropertyGroup>
<ConfigurationType>$config_type</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we keep v140 here to keep things working with VS 2015? Upon loading the solution in Visual Studio, the user is asked whether they want to retarget anyway, and even MSBuild can override this via /p:PlatformToolset=v142.

<!-- <CharacterSet>UTF-8</CharacterSet> -->
<OutDir>..\\</OutDir>
<!-- <IntDir>\$(ProjectDir)\$(Configuration)\\</IntDir> -->
Expand Down Expand Up @@ -183,7 +192,7 @@ EOM
<PreBuildEvent Condition="!Exists('$cdup\\compat\\vcbuild\\vcpkg\\installed\\\$(VCPKGArch)\\include\\openssl\\ssl.h')">
<Message>Initialize VCPKG</Message>
<Command>del "$cdup\\compat\\vcbuild\\vcpkg"</Command>
<Command>call "$cdup\\compat\\vcbuild\\vcpkg_install.bat"</Command>
<Command>call "$cdup\\compat\\vcbuild\\vcpkg_install.bat" \$(VCPKGArch)</Command>
</PreBuildEvent>
EOM
}
Expand Down Expand Up @@ -345,8 +354,10 @@ sub createGlueProject {
print F << "EOM";
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
Expand All @@ -357,10 +368,14 @@ EOM
foreach (@apps) {
my $appname = $_;
my $uuid = $build_structure{"APPS_${appname}_GUID"};
print F "\t\t${uuid}.Debug|ARM64.ActiveCfg = Debug|ARM64\n";
print F "\t\t${uuid}.Debug|ARM64.Build.0 = Debug|ARM64\n";
print F "\t\t${uuid}.Debug|x64.ActiveCfg = Debug|x64\n";
print F "\t\t${uuid}.Debug|x64.Build.0 = Debug|x64\n";
print F "\t\t${uuid}.Debug|x86.ActiveCfg = Debug|Win32\n";
print F "\t\t${uuid}.Debug|x86.Build.0 = Debug|Win32\n";
print F "\t\t${uuid}.Release|ARM64.ActiveCfg = Release|ARM64\n";
print F "\t\t${uuid}.Release|ARM64.Build.0 = Release|ARM64\n";
print F "\t\t${uuid}.Release|x64.ActiveCfg = Release|x64\n";
print F "\t\t${uuid}.Release|x64.Build.0 = Release|x64\n";
print F "\t\t${uuid}.Release|x86.ActiveCfg = Release|Win32\n";
Expand All @@ -369,10 +384,14 @@ EOM
foreach (@libs) {
my $libname = $_;
my $uuid = $build_structure{"LIBS_${libname}_GUID"};
print F "\t\t${uuid}.Debug|ARM64.ActiveCfg = Debug|ARM64\n";
print F "\t\t${uuid}.Debug|ARM64.Build.0 = Debug|ARM64\n";
print F "\t\t${uuid}.Debug|x64.ActiveCfg = Debug|x64\n";
print F "\t\t${uuid}.Debug|x64.Build.0 = Debug|x64\n";
print F "\t\t${uuid}.Debug|x86.ActiveCfg = Debug|Win32\n";
print F "\t\t${uuid}.Debug|x86.Build.0 = Debug|Win32\n";
print F "\t\t${uuid}.Release|ARM64.ActiveCfg = Release|ARM64\n";
print F "\t\t${uuid}.Release|ARM64.Build.0 = Release|ARM64\n";
print F "\t\t${uuid}.Release|x64.ActiveCfg = Release|x64\n";
print F "\t\t${uuid}.Release|x64.Build.0 = Release|x64\n";
print F "\t\t${uuid}.Release|x86.ActiveCfg = Release|Win32\n";
Expand Down