From 7756b2e4706b67790378e4091baa8d4e277771a2 Mon Sep 17 00:00:00 2001 From: Fredrik Orderud Date: Sun, 4 Feb 2018 22:44:22 +0100 Subject: [PATCH 1/4] Generate type libraries directly in $(OutDir) and run tlbimp directly in that folder. Postpone copying of file to $(SolutionDir)$(Platform) to the end. Done to make it possible to separate debug- from release-builds of the type libraries. --- Image3dAPI/Image3dAPI.vcxproj | 44 ++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/Image3dAPI/Image3dAPI.vcxproj b/Image3dAPI/Image3dAPI.vcxproj index ee1ecac..bba0bbf 100644 --- a/Image3dAPI/Image3dAPI.vcxproj +++ b/Image3dAPI/Image3dAPI.vcxproj @@ -85,13 +85,16 @@ $(IntDir) %(Filename).h - $(ProjectName).tlb + $(OutDir)$(ProjectName).tlb - xcopy /Y /D "$(IntDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)" -TlbImp.exe /machine:x86 "$(IntDir)$(TargetName).tlb" /out:$(SolutionDir)$(Platform)\$(TargetName).dll + TlbImp.exe /machine:x86 "$(OutDir)$(TargetName).tlb" /out:$(OutDir)$(TargetName).dll +:: Copy interface definitions to shared project dir xcopy /Y /D "$(IntDir)*.h" "$(ProjectDir)" -xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" +xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" +:: Copy type libraries to shared platform folder +xcopy /Y /D "$(OutDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)" +xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" @@ -106,13 +109,16 @@ xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" $(IntDir) %(Filename).h - $(ProjectName).tlb + $(OutDir)$(ProjectName).tlb - xcopy /Y /D "$(IntDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)" -TlbImp.exe /machine:x64 "$(IntDir)$(TargetName).tlb" /out:$(SolutionDir)$(Platform)\$(TargetName).dll + TlbImp.exe /machine:x64 "$(OutDir)$(TargetName).tlb" /out:$(OutDir)$(TargetName).dll +:: Copy interface definitions to shared project dir xcopy /Y /D "$(IntDir)*.h" "$(ProjectDir)" -xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" +xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" +:: Copy type libraries to shared platform folder +xcopy /Y /D "$(OutDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)" +xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" @@ -131,13 +137,16 @@ xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" $(IntDir) %(Filename).h - $(ProjectName).tlb + $(OutDir)$(ProjectName).tlb - xcopy /Y /D "$(IntDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)" -TlbImp.exe /machine:x86 "$(IntDir)$(TargetName).tlb" /out:$(SolutionDir)$(Platform)\$(TargetName).dll + TlbImp.exe /machine:x86 "$(OutDir)$(TargetName).tlb" /out:$(OutDir)$(TargetName).dll +:: Copy interface definitions to shared project dir xcopy /Y /D "$(IntDir)*.h" "$(ProjectDir)" -xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" +xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" +:: Copy type libraries to shared platform folder +xcopy /Y /D "$(OutDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)" +xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" @@ -156,13 +165,16 @@ xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" $(IntDir) %(Filename).h - $(ProjectName).tlb + $(OutDir)$(ProjectName).tlb - xcopy /Y /D "$(IntDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)" -TlbImp.exe /machine:x64 "$(IntDir)$(TargetName).tlb" /out:$(SolutionDir)$(Platform)\$(TargetName).dll + TlbImp.exe /machine:x64 "$(OutDir)$(TargetName).tlb" /out:$(OutDir)$(TargetName).dll +:: Copy interface definitions to shared project dir xcopy /Y /D "$(IntDir)*.h" "$(ProjectDir)" -xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" +xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" +:: Copy type libraries to shared platform folder +xcopy /Y /D "$(OutDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)" +xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" From d8722958ab5d4714d8c9cac4ec92db2f1735fcd0 Mon Sep 17 00:00:00 2001 From: Fredrik Orderud Date: Sun, 4 Feb 2018 23:04:16 +0100 Subject: [PATCH 2/4] Explicitly use release-builds of type libraries in nuget package. --- PackagingGE/Image3dAPI.nuspec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PackagingGE/Image3dAPI.nuspec b/PackagingGE/Image3dAPI.nuspec index 3319107..1afd101 100644 --- a/PackagingGE/Image3dAPI.nuspec +++ b/PackagingGE/Image3dAPI.nuspec @@ -32,11 +32,11 @@ - - + + - - + + From 5d744d3c73118ec90d771e555da0ff8a2c3c13db Mon Sep 17 00:00:00 2001 From: Fredrik Orderud Date: Sun, 4 Feb 2018 23:08:23 +0100 Subject: [PATCH 3/4] Add separate .targets file for .NET projects. Done to make it easier to use Image3dAPI from .NET/C# projects. --- PackagingGE/Image3dAPI.net.targets | 18 ++++++++++++++++++ PackagingGE/Image3dAPI.nuspec | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 PackagingGE/Image3dAPI.net.targets diff --git a/PackagingGE/Image3dAPI.net.targets b/PackagingGE/Image3dAPI.net.targets new file mode 100644 index 0000000..cf3062f --- /dev/null +++ b/PackagingGE/Image3dAPI.net.targets @@ -0,0 +1,18 @@ + + + + + + + $(MSBuildThisFileDirectory)..\native\lib\Win32\Image3dAPI.dll + true + + + + + $(MSBuildThisFileDirectory)..\native\lib\x64\Image3dAPI.dll + true + + + + \ No newline at end of file diff --git a/PackagingGE/Image3dAPI.nuspec b/PackagingGE/Image3dAPI.nuspec index 1afd101..adde8a3 100644 --- a/PackagingGE/Image3dAPI.nuspec +++ b/PackagingGE/Image3dAPI.nuspec @@ -20,7 +20,8 @@ - + + From 213c6eb6e417584449899d7c1c15b951b0553ae2 Mon Sep 17 00:00:00 2001 From: Fredrik Orderud Date: Tue, 6 Feb 2018 10:50:59 +0100 Subject: [PATCH 4/4] Make the build fail if any of the xcopy calls fail. --- Image3dAPI/Image3dAPI.vcxproj | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Image3dAPI/Image3dAPI.vcxproj b/Image3dAPI/Image3dAPI.vcxproj index bba0bbf..c42dc1f 100644 --- a/Image3dAPI/Image3dAPI.vcxproj +++ b/Image3dAPI/Image3dAPI.vcxproj @@ -90,11 +90,11 @@ TlbImp.exe /machine:x86 "$(OutDir)$(TargetName).tlb" /out:$(OutDir)$(TargetName).dll :: Copy interface definitions to shared project dir -xcopy /Y /D "$(IntDir)*.h" "$(ProjectDir)" -xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" +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)" -xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" +xcopy /Y /D "$(OutDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)" || exit /b 1 +xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" || exit /b 1 @@ -114,11 +114,11 @@ xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" TlbImp.exe /machine:x64 "$(OutDir)$(TargetName).tlb" /out:$(OutDir)$(TargetName).dll :: Copy interface definitions to shared project dir -xcopy /Y /D "$(IntDir)*.h" "$(ProjectDir)" -xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" +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)" -xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" +xcopy /Y /D "$(OutDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)" || exit /b 1 +xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" || exit /b 1 @@ -142,11 +142,11 @@ xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" TlbImp.exe /machine:x86 "$(OutDir)$(TargetName).tlb" /out:$(OutDir)$(TargetName).dll :: Copy interface definitions to shared project dir -xcopy /Y /D "$(IntDir)*.h" "$(ProjectDir)" -xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" +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)" -xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" +xcopy /Y /D "$(OutDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)" || exit /b 1 +xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" || exit /b 1 @@ -170,11 +170,11 @@ xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" TlbImp.exe /machine:x64 "$(OutDir)$(TargetName).tlb" /out:$(OutDir)$(TargetName).dll :: Copy interface definitions to shared project dir -xcopy /Y /D "$(IntDir)*.h" "$(ProjectDir)" -xcopy /Y /D "$(IntDir)*.c" "$(ProjectDir)" +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)" -xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" +xcopy /Y /D "$(OutDir)$(TargetName).tlb" "$(SolutionDir)$(Platform)" || exit /b 1 +xcopy /Y /D "$(OutDir)$(TargetName).dll" "$(SolutionDir)$(Platform)" || exit /b 1