1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-23 20:15:19 -07:00

[.NET Core] SUPPORT .NET FRAMEWORK >= 4.6 (#547)

Add MSBuild targets for net46 target framework which copy both x86 and
x64 libsodium binaries into corresponding folders. This allows AnyCPU
applications to load the appropriate binary at runtime via
`LoadLibraryEx`.
This commit is contained in:
Henrik Gaßmann 2017-05-19 16:44:44 +02:00 committed by Frank Denis
parent b3d1a638cf
commit e8795ff105
3 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,16 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x86\native\libsodium.dll">
<Link>x86\libsodium.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<Visible>false</Visible>
</None>
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win7-x64\native\libsodium.dll">
<Link>x64\libsodium.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<Visible>false</Visible>
</None>
</ItemGroup>
</Project>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<Project>
<PropertyGroup>
<TargetFramework>netstandard1.1</TargetFramework>
<TargetFrameworks>netstandard1.1;net46</TargetFrameworks>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<NoBuild>true</NoBuild>
<IncludeBuildOutput>false</IncludeBuildOutput>
@ -23,5 +23,6 @@
<Content Include="AUTHORS" PackagePath="" />
<Content Include="ChangeLog" PackagePath="" />
<Content Include="runtimes\**\*.*" PackagePath="runtimes\" />
<Content Include="build\**\*.*" PackagePath="build\" />
</ItemGroup>
</Project>

View File

@ -42,6 +42,7 @@ LINUX = [
EXTRAS = [ 'LICENSE', 'AUTHORS', 'ChangeLog' ]
PROPSFILE = 'libsodium.props'
DESKTOPTARGETSFILE = 'desktop.targets'
MAKEFILE = 'Makefile'
BUILDDIR = 'build'
CACHEDIR = 'cache'
@ -64,6 +65,7 @@ class Version:
self.projfile = os.path.join(self.builddir, '{0}.pkgproj'.format(PACKAGE))
self.propsfile = os.path.join(self.builddir, '{0}.props'.format(PACKAGE))
self.pkgfile = os.path.join(BUILDDIR, '{0}.{1}.nupkg'.format(PACKAGE, self.version))
self.desktoptargetsfile = os.path.join(self.builddir, 'build', 'net46', '{0}.targets'.format(PACKAGE))
class WindowsItem:
@ -202,6 +204,11 @@ def main(args):
for item in items:
item.make(f)
f.write('\n')
f.write('{0}: {1}\n'.format(version.desktoptargetsfile, DESKTOPTARGETSFILE))
f.write('\t@mkdir -p $(dir $@)\n')
f.write('\tcp -f $< $@\n')
f.write('\n')
f.write('{0}: {1}\n'.format(version.propsfile, PROPSFILE))
f.write('\t@mkdir -p $(dir $@)\n')
@ -222,6 +229,7 @@ def main(args):
f.write('{0}:'.format(version.pkgfile))
f.write(' \\\n\t\t{0}'.format(version.projfile))
f.write(' \\\n\t\t{0}'.format(version.propsfile))
f.write(' \\\n\t\t{0}'.format(version.desktoptargetsfile))
for item in items:
f.write(' \\\n\t\t{0}'.format(item.packfile))
f.write('\n')