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

View File

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