Skip to content

Commit

Permalink
Enable building win/arm64 package using visual studio (#1130)
Browse files Browse the repository at this point in the history
* Retarget Visual studio tool chain to v142

* add ARM64 option to wintest.bat

* add windows/arm64 target to appveyor for CI

* add arm64 targets to visual studio solutions

* add cross compile option to wintest.bat

* Fix missing SET in wintest.bat

* update auto-generation scripts for msvc and update project files
  • Loading branch information
niyas-sait committed Nov 17, 2021
1 parent 85bdde2 commit 13144d1
Show file tree
Hide file tree
Showing 12 changed files with 333 additions and 87 deletions.
6 changes: 5 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 1.0.18.{build}

os: Visual Studio 2017
os: Visual Studio 2019

environment:
matrix:
Expand All @@ -12,6 +12,10 @@ environment:
configuration: Debug
- platform: x64
configuration: Release
- platform: ARM64
configuration: Debug
- platform: ARM64
configuration: Release

matrix:
fast_finish: false
Expand Down
1 change: 1 addition & 0 deletions builds/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ EXTRA_DIST = \
msvc/properties/ReleaseSEXE.props \
msvc/properties/Win32.props \
msvc/properties/x64.props \
msvc/properties/ARM64.props \
msvc/resource.h \
msvc/resource.rc \
msvc/version.h \
Expand Down
25 changes: 25 additions & 0 deletions builds/msvc/build/buildbase.bat
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,31 @@ ECHO Configuration=StaticRelease
msbuild /m /v:n /p:Configuration=StaticRelease /p:Platform=x64 %solution% >> %log%
IF errorlevel 1 GOTO error

@REM Build ARM64 packages only for Visual studio 19 and later
IF %version% == 16 (
CALL !environment! x86_arm64 > nul
ECHO Platform=ARM64

ECHO Configuration=DynDebug
msbuild /m /v:n /p:Configuration=DynDebug /p:Platform=ARM64 %solution% >> %log%
IF errorlevel 1 GOTO error
ECHO Configuration=DynRelease
msbuild /m /v:n /p:Configuration=DynRelease /p:Platform=ARM64 %solution% >> %log%
IF errorlevel 1 GOTO error
ECHO Configuration=LtcgDebug
msbuild /m /v:n /p:Configuration=LtcgDebug /p:Platform=ARM64 %solution% >> %log%
IF errorlevel 1 GOTO error
ECHO Configuration=LtcgRelease
msbuild /m /v:n /p:Configuration=LtcgRelease /p:Platform=ARM64 %solution% >> %log%
IF errorlevel 1 GOTO error
ECHO Configuration=StaticDebug
msbuild /m /v:n /p:Configuration=StaticDebug /p:Platform=ARM64 %solution% >> %log%
IF errorlevel 1 GOTO error
ECHO Configuration=StaticRelease
msbuild /m /v:n /p:Configuration=StaticRelease /p:Platform=ARM64 %solution% >> %log%
IF errorlevel 1 GOTO error
)

ECHO Complete: %solution%
GOTO end

Expand Down
18 changes: 18 additions & 0 deletions builds/msvc/properties/ARM64.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PropertySheetDisplayName>ARM64 Settings</_PropertySheetDisplayName>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>WIN32;_WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<TargetMachine>MachineARM64</TargetMachine>
</Link>
<Lib>
<AdditionalOptions>/MACHINE:ARM64 %(AdditionalOptions)</AdditionalOptions>
</Lib>
</ItemDefinitionGroup>

</Project>
18 changes: 18 additions & 0 deletions builds/msvc/vs2019/libsodium.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,60 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
DynDebug|Win32 = DynDebug|Win32
DynDebug|x64 = DynDebug|x64
DynDebug|ARM64 = DynDebug|ARM64
DynRelease|Win32 = DynRelease|Win32
DynRelease|x64 = DynRelease|x64
DynRelease|ARM64 = DynRelease|ARM64
LtcgDebug|Win32 = LtcgDebug|Win32
LtcgDebug|x64 = LtcgDebug|x64
LtcgDebug|ARM64 = LtcgDebug|ARM64
LtcgRelease|Win32 = LtcgRelease|Win32
LtcgRelease|x64 = LtcgRelease|x64
LtcgRelease|ARM64 = LtcgRelease|ARM64
StaticDebug|Win32 = StaticDebug|Win32
StaticDebug|x64 = StaticDebug|x64
StaticDebug|ARM64 = StaticDebug|ARM64
StaticRelease|Win32 = StaticRelease|Win32
StaticRelease|x64 = StaticRelease|x64
StaticRelease|ARM64 = StaticRelease|ARM64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynDebug|Win32.ActiveCfg = DebugDLL|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynDebug|Win32.Build.0 = DebugDLL|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynDebug|x64.ActiveCfg = DebugDLL|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynDebug|x64.Build.0 = DebugDLL|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynDebug|ARM64.ActiveCfg = DebugDLL|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynDebug|ARM64.Build.0 = DebugDLL|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynRelease|Win32.ActiveCfg = ReleaseDLL|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynRelease|Win32.Build.0 = ReleaseDLL|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynRelease|x64.ActiveCfg = ReleaseDLL|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynRelease|x64.Build.0 = ReleaseDLL|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynRelease|ARM64.ActiveCfg = ReleaseDLL|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DynRelease|ARM64.Build.0 = ReleaseDLL|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgDebug|Win32.ActiveCfg = DebugLTCG|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgDebug|Win32.Build.0 = DebugLTCG|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgDebug|x64.ActiveCfg = DebugLTCG|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgDebug|x64.Build.0 = DebugLTCG|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgDebug|ARM64.ActiveCfg = DebugLTCG|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgDebug|ARM64.Build.0 = DebugLTCG|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgRelease|Win32.ActiveCfg = ReleaseLTCG|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgRelease|Win32.Build.0 = ReleaseLTCG|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgRelease|x64.ActiveCfg = ReleaseLTCG|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgRelease|x64.Build.0 = ReleaseLTCG|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgRelease|ARM64.ActiveCfg = ReleaseLTCG|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.LtcgRelease|ARM64.Build.0 = ReleaseLTCG|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticDebug|Win32.ActiveCfg = DebugLIB|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticDebug|Win32.Build.0 = DebugLIB|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticDebug|x64.ActiveCfg = DebugLIB|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticDebug|x64.Build.0 = DebugLIB|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticDebug|ARM64.ActiveCfg = DebugLIB|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticDebug|ARM64.Build.0 = DebugLIB|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticRelease|Win32.ActiveCfg = ReleaseLIB|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticRelease|Win32.Build.0 = ReleaseLIB|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticRelease|x64.ActiveCfg = ReleaseLIB|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticRelease|x64.Build.0 = ReleaseLIB|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticRelease|ARM64.ActiveCfg = ReleaseLIB|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.StaticRelease|ARM64.Build.0 = ReleaseLIB|ARM64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
64 changes: 44 additions & 20 deletions builds/msvc/vs2019/libsodium/libsodium.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,74 @@
<Configuration>DebugDLL</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="ReleaseDLL|Win32">
<Configuration>ReleaseDLL</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="DebugDLL|x64">
<Configuration>DebugDLL</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="DebugDLL|ARM64">
<Configuration>DebugDLL</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="ReleaseDLL|Win32">
<Configuration>ReleaseDLL</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="ReleaseDLL|x64">
<Configuration>ReleaseDLL</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="DebugLTCG|Win32">
<Configuration>DebugLTCG</Configuration>
<Platform>Win32</Platform>
<ProjectConfiguration Include="ReleaseDLL|ARM64">
<Configuration>ReleaseDLL</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="ReleaseLTCG|Win32">
<Configuration>ReleaseLTCG</Configuration>
<ProjectConfiguration Include="DebugLIB|Win32">
<Configuration>DebugLIB</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="DebugLTCG|x64">
<Configuration>DebugLTCG</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="ReleaseLTCG|x64">
<Configuration>ReleaseLTCG</Configuration>
<ProjectConfiguration Include="DebugLIB|x64">
<Configuration>DebugLIB</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="DebugLIB|Win32">
<ProjectConfiguration Include="DebugLIB|ARM64">
<Configuration>DebugLIB</Configuration>
<Platform>Win32</Platform>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="ReleaseLIB|Win32">
<Configuration>ReleaseLIB</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="DebugLIB|x64">
<Configuration>DebugLIB</Configuration>
<ProjectConfiguration Include="ReleaseLIB|x64">
<Configuration>ReleaseLIB</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="ReleaseLIB|x64">
<ProjectConfiguration Include="ReleaseLIB|ARM64">
<Configuration>ReleaseLIB</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="DebugLTCG|Win32">
<Configuration>DebugLTCG</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="DebugLTCG|x64">
<Configuration>DebugLTCG</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="DebugLTCG|ARM64">
<Configuration>DebugLTCG</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="ReleaseLTCG|Win32">
<Configuration>ReleaseLTCG</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="ReleaseLTCG|x64">
<Configuration>ReleaseLTCG</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="ReleaseLTCG|ARM64">
<Configuration>ReleaseLTCG</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Configuration">
<ConfigurationType Condition="$(Configuration.IndexOf('DLL')) == -1">StaticLibrary</ConfigurationType>
Expand Down
19 changes: 17 additions & 2 deletions libsodium.sln
Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
# Visual Studio Version 16
VisualStudioVersion = 16.0.31424.327
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsodium", "libsodium.vcxproj", "{A185B162-6CB6-4502-B03F-B56F7699A8D9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
DebugDLL|ARM64 = DebugDLL|ARM64
DebugDLL|Win32 = DebugDLL|Win32
DebugDLL|x64 = DebugDLL|x64
Release|ARM64 = Release|ARM64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
ReleaseDLL|ARM64 = ReleaseDLL|ARM64
ReleaseDLL|Win32 = ReleaseDLL|Win32
ReleaseDLL|x64 = ReleaseDLL|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.Debug|ARM64.ActiveCfg = Debug|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.Debug|ARM64.Build.0 = Debug|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.Debug|Win32.ActiveCfg = Debug|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.Debug|Win32.Build.0 = Debug|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.Debug|x64.ActiveCfg = Debug|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.Debug|x64.Build.0 = Debug|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugDLL|ARM64.ActiveCfg = DebugDLL|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugDLL|ARM64.Build.0 = DebugDLL|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugDLL|Win32.ActiveCfg = DebugDLL|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugDLL|Win32.Build.0 = DebugDLL|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugDLL|x64.ActiveCfg = DebugDLL|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.DebugDLL|x64.Build.0 = DebugDLL|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.Release|ARM64.ActiveCfg = Release|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.Release|ARM64.Build.0 = Release|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.Release|Win32.ActiveCfg = Release|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.Release|Win32.Build.0 = Release|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.Release|x64.ActiveCfg = Release|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.Release|x64.Build.0 = Release|x64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.ReleaseDLL|ARM64.ActiveCfg = ReleaseDLL|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.ReleaseDLL|ARM64.Build.0 = ReleaseDLL|ARM64
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.ReleaseDLL|Win32.ActiveCfg = ReleaseDLL|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.ReleaseDLL|Win32.Build.0 = ReleaseDLL|Win32
{A185B162-6CB6-4502-B03F-B56F7699A8D9}.ReleaseDLL|x64.ActiveCfg = ReleaseDLL|x64
Expand All @@ -37,4 +49,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5A6485EC-81D2-4E84-80BE-2D82A65D901C}
EndGlobalSection
EndGlobal
Loading

0 comments on commit 13144d1

Please sign in to comment.