Skip to content

Commit

Permalink
Merge pull request #58 from MedicalUltrasound/dotnet-nuget
Browse files Browse the repository at this point in the history
Make NuGet package compatible with .NET
  • Loading branch information
Jøger Hansegård authored Feb 6, 2018
2 parents 0e3c21e + 213c6eb commit fdd6974
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 25 deletions.
52 changes: 32 additions & 20 deletions Image3dAPI/Image3dAPI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,16 @@
<Midl>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>$(ProjectName).tlb</TypeLibraryName>
<TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>
</Midl>
<PostBuildEvent>
<Command>xcopy /Y /D "$(IntDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)"
TlbImp.exe /machine:x86 "$(IntDir)$(TargetName).tlb" /out:$(SolutionDir)$(Platform)\$(TargetName).dll
xcopy /Y /D "$(IntDir)*.h" "$(ProjectDir)"
xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)"</Command>
<Command>TlbImp.exe /machine:x86 "$(OutDir)$(TargetName).tlb" /out:$(OutDir)$(TargetName).dll
:: Copy interface definitions to shared project dir
xcopy /Y /D "$(IntDir)*.h" "$(ProjectDir)" || exit /b 1
xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" || exit /b 1
:: Copy type libraries to shared platform folder
xcopy /Y /D "$(OutDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)" || exit /b 1
xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" || exit /b 1</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
Expand All @@ -106,13 +109,16 @@ xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)"</Command>
<Midl>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>$(ProjectName).tlb</TypeLibraryName>
<TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>
</Midl>
<PostBuildEvent>
<Command>xcopy /Y /D "$(IntDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)"
TlbImp.exe /machine:x64 "$(IntDir)$(TargetName).tlb" /out:$(SolutionDir)$(Platform)\$(TargetName).dll
xcopy /Y /D "$(IntDir)*.h" "$(ProjectDir)"
xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)"</Command>
<Command>TlbImp.exe /machine:x64 "$(OutDir)$(TargetName).tlb" /out:$(OutDir)$(TargetName).dll
:: Copy interface definitions to shared project dir
xcopy /Y /D "$(IntDir)*.h" "$(ProjectDir)" || exit /b 1
xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" || exit /b 1
:: Copy type libraries to shared platform folder
xcopy /Y /D "$(OutDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)" || exit /b 1
xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" || exit /b 1</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand All @@ -131,13 +137,16 @@ xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)"</Command>
<Midl>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>$(ProjectName).tlb</TypeLibraryName>
<TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>
</Midl>
<PostBuildEvent>
<Command>xcopy /Y /D "$(IntDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)"
TlbImp.exe /machine:x86 "$(IntDir)$(TargetName).tlb" /out:$(SolutionDir)$(Platform)\$(TargetName).dll
xcopy /Y /D "$(IntDir)*.h" "$(ProjectDir)"
xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)"</Command>
<Command>TlbImp.exe /machine:x86 "$(OutDir)$(TargetName).tlb" /out:$(OutDir)$(TargetName).dll
:: Copy interface definitions to shared project dir
xcopy /Y /D "$(IntDir)*.h" "$(ProjectDir)" || exit /b 1
xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" || exit /b 1
:: Copy type libraries to shared platform folder
xcopy /Y /D "$(OutDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)" || exit /b 1
xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" || exit /b 1</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand All @@ -156,13 +165,16 @@ xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)"</Command>
<Midl>
<OutputDirectory>$(IntDir)</OutputDirectory>
<HeaderFileName>%(Filename).h</HeaderFileName>
<TypeLibraryName>$(ProjectName).tlb</TypeLibraryName>
<TypeLibraryName>$(OutDir)$(ProjectName).tlb</TypeLibraryName>
</Midl>
<PostBuildEvent>
<Command>xcopy /Y /D "$(IntDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)"
TlbImp.exe /machine:x64 "$(IntDir)$(TargetName).tlb" /out:$(SolutionDir)$(Platform)\$(TargetName).dll
xcopy /Y /D "$(IntDir)*.h" "$(ProjectDir)"
xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)"</Command>
<Command>TlbImp.exe /machine:x64 "$(OutDir)$(TargetName).tlb" /out:$(OutDir)$(TargetName).dll
:: Copy interface definitions to shared project dir
xcopy /Y /D "$(IntDir)*.h" "$(ProjectDir)" || exit /b 1
xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" || exit /b 1
:: Copy type libraries to shared platform folder
xcopy /Y /D "$(OutDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)" || exit /b 1
xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" || exit /b 1</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down
18 changes: 18 additions & 0 deletions PackagingGE/Image3dAPI.net.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- .NET/C# project config -->
<Target Name="InjectReference" BeforeTargets="ResolveAssemblyReferences">
<ItemGroup Condition="'$(Platform)' == 'Win32' or '$(Platform)' == 'x86'">
<Reference Include="Image3dAPI">
<HintPath>$(MSBuildThisFileDirectory)..\native\lib\Win32\Image3dAPI.dll</HintPath>
<EmbedInteropTypes>true</EmbedInteropTypes>
</Reference>
</ItemGroup>
<ItemGroup Condition="'$(Platform)' == 'x64'">
<Reference Include="Image3dAPI">
<HintPath>$(MSBuildThisFileDirectory)..\native\lib\x64\Image3dAPI.dll</HintPath>
<EmbedInteropTypes>true</EmbedInteropTypes>
</Reference>
</ItemGroup>
</Target>
</Project>
11 changes: 6 additions & 5 deletions PackagingGE/Image3dAPI.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
</metadata>

<files>
<file src="Image3dAPI.targets" target="build/native/" />
<file src="Image3dAPI.targets" target="build/native/" />
<file src="Image3dAPI.net.targets" target="build/net/Image3dAPI.targets" />

<!-- support headers -->
<file src="../Image3dAPI/ComSupport.hpp" target="build/native/include/Image3dAPI/" />
Expand All @@ -32,11 +33,11 @@
<file src="../Image3dAPI/IImage3d_p.c" target="build/native/include/Image3dAPI/" />

<!-- COM type libraries -->
<file src="../x64/Image3dAPI.tlb" target="build/native/lib/x64/" />
<file src="../Win32/Image3dAPI.tlb" target="build/native/lib/Win32/" />
<file src="../x64/Release/Image3dAPI.tlb" target="build/native/lib/x64/" />
<file src="../Win32/Release/Image3dAPI.tlb" target="build/native/lib/Win32/" />
<!-- .NET type libraries -->
<file src="../x64/Image3dAPI.dll" target="build/native/lib/x64/" />
<file src="../Win32/Image3dAPI.dll" target="build/native/lib/Win32/" />
<file src="../x64/Release/Image3dAPI.dll" target="build/native/lib/x64/" />
<file src="../Win32/Release/Image3dAPI.dll" target="build/native/lib/Win32/" />

<!-- documentation files -->
<file src="../changelog.txt" target="build/native/docs/" />
Expand Down

0 comments on commit fdd6974

Please sign in to comment.