From dc63ae9aabca280484c37718abdbc35cb28527cf Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 11 Sep 2023 00:30:40 +0200 Subject: [PATCH] Visual Studio: add Windows/ARM64 support --- builds/msvc/properties/ARM64.props | 23 ++++++ .../msvc/vs2010/libsodium/libsodium.vcxproj | 51 ++++++------- .../msvc/vs2012/libsodium/libsodium.vcxproj | 51 ++++++------- .../msvc/vs2013/libsodium/libsodium.vcxproj | 51 ++++++------- .../msvc/vs2015/libsodium/libsodium.vcxproj | 51 ++++++------- .../msvc/vs2017/libsodium/libsodium.vcxproj | 51 ++++++------- .../msvc/vs2019/libsodium/libsodium.vcxproj | 73 +++++++++++++------ .../msvc/vs2022/libsodium/libsodium.vcxproj | 73 +++++++++++++------ libsodium.vcxproj | 43 +++++++---- regen-msvc/libsodium.vcxproj.tpl | 52 +------------ regen-msvc/regen-msvc.py | 41 +++++++++++ regen-msvc/tl_libsodium.vcxproj.tpl | 36 +-------- 12 files changed, 328 insertions(+), 268 deletions(-) create mode 100644 builds/msvc/properties/ARM64.props diff --git a/builds/msvc/properties/ARM64.props b/builds/msvc/properties/ARM64.props new file mode 100644 index 00000000..a5b8f546 --- /dev/null +++ b/builds/msvc/properties/ARM64.props @@ -0,0 +1,23 @@ + + + + + <_PropertySheetDisplayName>ARM64 Settings + + + + + WIN32;_WIN32;WIN64;_WIN64;%(PreprocessorDefinitions) + + + ARM64;%(PreprocessorDefinitions) + + + MachineARM64 + + + /MACHINE:ARM64 %(AdditionalOptions) + + + + diff --git a/builds/msvc/vs2010/libsodium/libsodium.vcxproj b/builds/msvc/vs2010/libsodium/libsodium.vcxproj index 5d1bcf46..9efcd557 100644 --- a/builds/msvc/vs2010/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2010/libsodium/libsodium.vcxproj @@ -1,5 +1,6 @@  - + {A185B162-6CB6-4502-B03F-B56F7699A8D9} libsodium @@ -10,50 +11,50 @@ DebugDLL Win32 - - ReleaseDLL - Win32 - DebugDLL x64 + + ReleaseDLL + Win32 + ReleaseDLL x64 - - DebugLTCG - Win32 - - - ReleaseLTCG - Win32 - - - DebugLTCG - x64 - - - ReleaseLTCG - x64 - DebugLIB Win32 - - ReleaseLIB - Win32 - DebugLIB x64 + + ReleaseLIB + Win32 + ReleaseLIB x64 + + DebugLTCG + Win32 + + + DebugLTCG + x64 + + + ReleaseLTCG + Win32 + + + ReleaseLTCG + x64 + StaticLibrary diff --git a/builds/msvc/vs2012/libsodium/libsodium.vcxproj b/builds/msvc/vs2012/libsodium/libsodium.vcxproj index 0f13fa25..327999fb 100644 --- a/builds/msvc/vs2012/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2012/libsodium/libsodium.vcxproj @@ -1,5 +1,6 @@  - + {A185B162-6CB6-4502-B03F-B56F7699A8D9} libsodium @@ -10,50 +11,50 @@ DebugDLL Win32 - - ReleaseDLL - Win32 - DebugDLL x64 + + ReleaseDLL + Win32 + ReleaseDLL x64 - - DebugLTCG - Win32 - - - ReleaseLTCG - Win32 - - - DebugLTCG - x64 - - - ReleaseLTCG - x64 - DebugLIB Win32 - - ReleaseLIB - Win32 - DebugLIB x64 + + ReleaseLIB + Win32 + ReleaseLIB x64 + + DebugLTCG + Win32 + + + DebugLTCG + x64 + + + ReleaseLTCG + Win32 + + + ReleaseLTCG + x64 + StaticLibrary diff --git a/builds/msvc/vs2013/libsodium/libsodium.vcxproj b/builds/msvc/vs2013/libsodium/libsodium.vcxproj index d66a33e2..d464f5f5 100644 --- a/builds/msvc/vs2013/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2013/libsodium/libsodium.vcxproj @@ -1,5 +1,6 @@  - + {A185B162-6CB6-4502-B03F-B56F7699A8D9} libsodium @@ -10,50 +11,50 @@ DebugDLL Win32 - - ReleaseDLL - Win32 - DebugDLL x64 + + ReleaseDLL + Win32 + ReleaseDLL x64 - - DebugLTCG - Win32 - - - ReleaseLTCG - Win32 - - - DebugLTCG - x64 - - - ReleaseLTCG - x64 - DebugLIB Win32 - - ReleaseLIB - Win32 - DebugLIB x64 + + ReleaseLIB + Win32 + ReleaseLIB x64 + + DebugLTCG + Win32 + + + DebugLTCG + x64 + + + ReleaseLTCG + Win32 + + + ReleaseLTCG + x64 + StaticLibrary diff --git a/builds/msvc/vs2015/libsodium/libsodium.vcxproj b/builds/msvc/vs2015/libsodium/libsodium.vcxproj index a1ff0447..2bb704dd 100644 --- a/builds/msvc/vs2015/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2015/libsodium/libsodium.vcxproj @@ -1,5 +1,6 @@  - + {A185B162-6CB6-4502-B03F-B56F7699A8D9} libsodium @@ -10,50 +11,50 @@ DebugDLL Win32 - - ReleaseDLL - Win32 - DebugDLL x64 + + ReleaseDLL + Win32 + ReleaseDLL x64 - - DebugLTCG - Win32 - - - ReleaseLTCG - Win32 - - - DebugLTCG - x64 - - - ReleaseLTCG - x64 - DebugLIB Win32 - - ReleaseLIB - Win32 - DebugLIB x64 + + ReleaseLIB + Win32 + ReleaseLIB x64 + + DebugLTCG + Win32 + + + DebugLTCG + x64 + + + ReleaseLTCG + Win32 + + + ReleaseLTCG + x64 + StaticLibrary diff --git a/builds/msvc/vs2017/libsodium/libsodium.vcxproj b/builds/msvc/vs2017/libsodium/libsodium.vcxproj index 8ef2c996..99df4cfc 100644 --- a/builds/msvc/vs2017/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2017/libsodium/libsodium.vcxproj @@ -1,5 +1,6 @@  - + {A185B162-6CB6-4502-B03F-B56F7699A8D9} libsodium @@ -10,50 +11,50 @@ DebugDLL Win32 - - ReleaseDLL - Win32 - DebugDLL x64 + + ReleaseDLL + Win32 + ReleaseDLL x64 - - DebugLTCG - Win32 - - - ReleaseLTCG - Win32 - - - DebugLTCG - x64 - - - ReleaseLTCG - x64 - DebugLIB Win32 - - ReleaseLIB - Win32 - DebugLIB x64 + + ReleaseLIB + Win32 + ReleaseLIB x64 + + DebugLTCG + Win32 + + + DebugLTCG + x64 + + + ReleaseLTCG + Win32 + + + ReleaseLTCG + x64 + StaticLibrary diff --git a/builds/msvc/vs2019/libsodium/libsodium.vcxproj b/builds/msvc/vs2019/libsodium/libsodium.vcxproj index d7090a7e..950508c0 100644 --- a/builds/msvc/vs2019/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2019/libsodium/libsodium.vcxproj @@ -1,5 +1,6 @@  - + {A185B162-6CB6-4502-B03F-B56F7699A8D9} libsodium @@ -10,50 +11,74 @@ DebugDLL Win32 - - ReleaseDLL - Win32 - DebugDLL x64 + + DebugDLL + ARM64 + + + ReleaseDLL + Win32 + ReleaseDLL x64 - - DebugLTCG - Win32 - - - ReleaseLTCG - Win32 - - - DebugLTCG - x64 - - - ReleaseLTCG - x64 + + ReleaseDLL + ARM64 DebugLIB Win32 - - ReleaseLIB - Win32 - DebugLIB x64 + + DebugLIB + ARM64 + + + ReleaseLIB + Win32 + ReleaseLIB x64 + + ReleaseLIB + ARM64 + + + DebugLTCG + Win32 + + + DebugLTCG + x64 + + + DebugLTCG + ARM64 + + + ReleaseLTCG + Win32 + + + ReleaseLTCG + x64 + + + ReleaseLTCG + ARM64 + StaticLibrary diff --git a/builds/msvc/vs2022/libsodium/libsodium.vcxproj b/builds/msvc/vs2022/libsodium/libsodium.vcxproj index 272984f5..d3fbfa75 100644 --- a/builds/msvc/vs2022/libsodium/libsodium.vcxproj +++ b/builds/msvc/vs2022/libsodium/libsodium.vcxproj @@ -1,5 +1,6 @@  - + {A185B162-6CB6-4502-B03F-B56F7699A8D9} libsodium @@ -10,50 +11,74 @@ DebugDLL Win32 - - ReleaseDLL - Win32 - DebugDLL x64 + + DebugDLL + ARM64 + + + ReleaseDLL + Win32 + ReleaseDLL x64 - - DebugLTCG - Win32 - - - ReleaseLTCG - Win32 - - - DebugLTCG - x64 - - - ReleaseLTCG - x64 + + ReleaseDLL + ARM64 DebugLIB Win32 - - ReleaseLIB - Win32 - DebugLIB x64 + + DebugLIB + ARM64 + + + ReleaseLIB + Win32 + ReleaseLIB x64 + + ReleaseLIB + ARM64 + + + DebugLTCG + Win32 + + + DebugLTCG + x64 + + + DebugLTCG + ARM64 + + + ReleaseLTCG + Win32 + + + ReleaseLTCG + x64 + + + ReleaseLTCG + ARM64 + StaticLibrary diff --git a/libsodium.vcxproj b/libsodium.vcxproj index 3217a25d..a7b358d4 100644 --- a/libsodium.vcxproj +++ b/libsodium.vcxproj @@ -1,5 +1,6 @@  - + DebugDLL @@ -9,14 +10,6 @@ DebugDLL x64 - - Debug - Win32 - - - Debug - x64 - ReleaseDLL Win32 @@ -25,12 +18,36 @@ ReleaseDLL x64 - - Release + + DebugLIB Win32 - - Release + + DebugLIB + x64 + + + ReleaseLIB + Win32 + + + ReleaseLIB + x64 + + + DebugLTCG + Win32 + + + DebugLTCG + x64 + + + ReleaseLTCG + Win32 + + + ReleaseLTCG x64 diff --git a/regen-msvc/libsodium.vcxproj.tpl b/regen-msvc/libsodium.vcxproj.tpl index e8d326c8..79132f90 100644 --- a/regen-msvc/libsodium.vcxproj.tpl +++ b/regen-msvc/libsodium.vcxproj.tpl @@ -1,59 +1,13 @@  - + {A185B162-6CB6-4502-B03F-B56F7699A8D9} libsodium {{platform}} - - DebugDLL - Win32 - - - ReleaseDLL - Win32 - - - DebugDLL - x64 - - - ReleaseDLL - x64 - - - DebugLTCG - Win32 - - - ReleaseLTCG - Win32 - - - DebugLTCG - x64 - - - ReleaseLTCG - x64 - - - DebugLIB - Win32 - - - ReleaseLIB - Win32 - - - DebugLIB - x64 - - - ReleaseLIB - x64 - + {{configurations}} StaticLibrary diff --git a/regen-msvc/regen-msvc.py b/regen-msvc/regen-msvc.py index 8b479d82..6f6de0c7 100755 --- a/regen-msvc/regen-msvc.py +++ b/regen-msvc/regen-msvc.py @@ -77,6 +77,39 @@ for dir in dirs: fd = fd + " \r\n" +def get_project_configurations(vs_version): + projconfig = "" + configs = [ + "DebugDLL", + "ReleaseDLL", + "DebugLIB", + "ReleaseLIB", + "DebugLTCG", + "ReleaseLTCG", + ] + platforms = ["Win32", "x64"] + # add arm64 platform only for v142+ toolchain + if vs_version >= 142: + platforms.append("ARM64") + for config in configs: + for platform in platforms: + projconfig = ( + projconfig + + ' \r\n'.format( + config, platform + ) + ) + projconfig = ( + projconfig + + " {}\r\n".format(config) + ) + projconfig = projconfig + " {}\r\n".format( + platform + ) + projconfig = projconfig + " \r\n" + return projconfig + + def apply_template(tplfile, outfile, sbox): tpl = "" with open(tplfile, "rb") as fd: @@ -109,6 +142,7 @@ apply_template( ) sbox.update({"platform": "v140"}) +sbox.update({"configurations": get_project_configurations(140)}) apply_template(sd + "/tl_libsodium.vcxproj.tpl", "libsodium.vcxproj", sbox) apply_template( @@ -148,6 +182,7 @@ apply_template( ) sbox.update({"platform": "v143"}) +sbox.update({"configurations": get_project_configurations(143)}) apply_template( sd + "/libsodium.vcxproj.tpl", "builds/msvc/vs2022/libsodium/libsodium.vcxproj", @@ -155,6 +190,7 @@ apply_template( ) sbox.update({"platform": "v142"}) +sbox.update({"configurations": get_project_configurations(142)}) apply_template( sd + "/libsodium.vcxproj.tpl", "builds/msvc/vs2019/libsodium/libsodium.vcxproj", @@ -162,6 +198,7 @@ apply_template( ) sbox.update({"platform": "v141"}) +sbox.update({"configurations": get_project_configurations(141)}) apply_template( sd + "/libsodium.vcxproj.tpl", "builds/msvc/vs2017/libsodium/libsodium.vcxproj", @@ -169,6 +206,7 @@ apply_template( ) sbox.update({"platform": "v140"}) +sbox.update({"configurations": get_project_configurations(140)}) apply_template( sd + "/libsodium.vcxproj.tpl", "builds/msvc/vs2015/libsodium/libsodium.vcxproj", @@ -176,6 +214,7 @@ apply_template( ) sbox.update({"platform": "v120"}) +sbox.update({"configurations": get_project_configurations(120)}) apply_template( sd + "/libsodium.vcxproj.tpl", "builds/msvc/vs2013/libsodium/libsodium.vcxproj", @@ -183,6 +222,7 @@ apply_template( ) sbox.update({"platform": "v110"}) +sbox.update({"configurations": get_project_configurations(110)}) apply_template( sd + "/libsodium.vcxproj.tpl", "builds/msvc/vs2012/libsodium/libsodium.vcxproj", @@ -190,6 +230,7 @@ apply_template( ) sbox.update({"platform": "v100"}) +sbox.update({"configurations": get_project_configurations(100)}) apply_template( sd + "/libsodium.vcxproj.tpl", "builds/msvc/vs2010/libsodium/libsodium.vcxproj", diff --git a/regen-msvc/tl_libsodium.vcxproj.tpl b/regen-msvc/tl_libsodium.vcxproj.tpl index 72bb16a8..c741a031 100644 --- a/regen-msvc/tl_libsodium.vcxproj.tpl +++ b/regen-msvc/tl_libsodium.vcxproj.tpl @@ -1,38 +1,8 @@  - + - - DebugDLL - Win32 - - - DebugDLL - x64 - - - Debug - Win32 - - - Debug - x64 - - - ReleaseDLL - Win32 - - - ReleaseDLL - x64 - - - Release - Win32 - - - Release - x64 - + {{configurations}} {A185B162-6CB6-4502-B03F-B56F7699A8D9}