Skip to content

Commit ac8b7a5

Browse files
adrastogiAditya Rastogi
andauthored
Windows ML: Miscellaneous build fixes to support automated builds / tests (#556)
* Setting up intermediate / output directories and consolidating props files * Fix warnings in csproj file * Add fixes for debug builds and for hooking SqueezeNet targets file during command-line build * Revert "Fix warnings in csproj file" This reverts commit 5928575. * Using a more appropriate macro to cover cpp / cs scenarios * Using self-contained for C# desktop sample since test environments might not have the right runtime already installed --------- Co-authored-by: Aditya Rastogi <[email protected]>
1 parent 60052d5 commit ac8b7a5

File tree

5 files changed

+58
-90
lines changed

5 files changed

+58
-90
lines changed

Samples/WindowsML/Resources/SqueezeNetModel.targets

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
<SqueezeNetModelCatalogFile>$(MSBuildThisFileDirectory)SqueezeNetModelCatalog.json</SqueezeNetModelCatalogFile>
2525
</PropertyGroup>
2626

27+
<!-- Ensure copy target participates in Build for managed and native projects -->
28+
<PropertyGroup>
29+
<BuildDependsOn>CopySqueezeNetModelToOutput;$(BuildDependsOn)</BuildDependsOn>
30+
</PropertyGroup>
31+
2732
<!-- Create temp directory for downloaded model -->
2833
<Target Name="CreateSqueezeNetModelDirectory" BeforeTargets="Build">
2934
<MakeDir Directories="$(SqueezeNetModelTempDir)" Condition="!Exists('$(SqueezeNetModelTempDir)')" />
@@ -69,22 +74,23 @@
6974
<!-- Copy downloaded files to output directory -->
7075
<Target Name="CopySqueezeNetModelToOutput" BeforeTargets="Build" DependsOnTargets="DownloadSqueezeNetModel">
7176
<!-- Copy FP32 model to output directory with retry for antivirus interference -->
72-
<Copy SourceFiles="$(SqueezeNetModelFileFP32)" DestinationFiles="$(OutputPath)\SqueezeNet.fp32.onnx" SkipUnchangedFiles="true" Retries="5" RetryDelayMilliseconds="1000" />
77+
<Copy SourceFiles="$(SqueezeNetModelFileFP32)" DestinationFiles="$(TargetDir)SqueezeNet.fp32.onnx" SkipUnchangedFiles="true" Retries="5" RetryDelayMilliseconds="1000" />
7378

7479
<!-- Copy default quantized model from Resources folder -->
75-
<Copy SourceFiles="$(SqueezeNetModelFileDefault)" DestinationFiles="$(OutputPath)\SqueezeNet.onnx" SkipUnchangedFiles="true" Retries="5" RetryDelayMilliseconds="1000" />
80+
<Copy SourceFiles="$(SqueezeNetModelFileDefault)" DestinationFiles="$(TargetDir)SqueezeNet.onnx" SkipUnchangedFiles="true" Retries="5" RetryDelayMilliseconds="1000" />
7681

7782
<!-- Copy license file from Resources folder -->
78-
<Copy SourceFiles="$(SqueezeNetLicenseFile)" DestinationFiles="$(OutputPath)\SqueezeNet.LICENSE.txt" SkipUnchangedFiles="true" Retries="5" RetryDelayMilliseconds="1000" />
79-
83+
<Copy SourceFiles="$(SqueezeNetLicenseFile)" DestinationFiles="$(TargetDir)SqueezeNet.LICENSE.txt" SkipUnchangedFiles="true" Retries="5" RetryDelayMilliseconds="1000" />
84+
8085
<!-- Copy labels file -->
81-
<Copy SourceFiles="$(SqueezeNetLabelsFile)" DestinationFiles="$(OutputPath)\SqueezeNet.Labels.txt" SkipUnchangedFiles="true" Retries="5" RetryDelayMilliseconds="1000" />
82-
83-
<!-- Copy image file -->
84-
<Copy SourceFiles="$(SqueezeNetImageFile)" DestinationFiles="$(OutputPath)\image.png" SkipUnchangedFiles="true" Retries="5" RetryDelayMilliseconds="1000" />
86+
<Copy SourceFiles="$(SqueezeNetLabelsFile)" DestinationFiles="$(TargetDir)SqueezeNet.Labels.txt" SkipUnchangedFiles="true" Retries="5" RetryDelayMilliseconds="1000" />
8587

88+
<!-- Copy image file -->
89+
<Copy SourceFiles="$(SqueezeNetImageFile)" DestinationFiles="$(TargetDir)image.png" SkipUnchangedFiles="true" Retries="5" RetryDelayMilliseconds="1000" />
90+
8691
<!-- Copy sample catalog file from Resources folder -->
87-
<Copy SourceFiles="$(SqueezeNetModelCatalogFile)" DestinationFiles="$(OutputPath)\SqueezeNetModelCatalog.json" SkipUnchangedFiles="true" Retries="5" RetryDelayMilliseconds="1000" />
92+
<Copy SourceFiles="$(SqueezeNetModelCatalogFile)" DestinationFiles="$(TargetDir)SqueezeNetModelCatalog.json" SkipUnchangedFiles="true" Retries="5" RetryDelayMilliseconds="1000" />
93+
8894
</Target>
8995

90-
</Project>
96+
</Project>

Samples/WindowsML/cpp/CppConsoleDesktop.GenAI/Directory.Build.props

Lines changed: 0 additions & 40 deletions
This file was deleted.

Samples/WindowsML/cpp/CppConsoleDesktop/Directory.Build.props

Lines changed: 0 additions & 40 deletions
This file was deleted.

Samples/WindowsML/cpp/Directory.Build.props

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,46 @@
66

77
<!-- Disable central package management for C++ projects -->
88
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
9+
10+
<!-- Namespace output directories to prevent conflicts -->
11+
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\bin\</OutDir>
12+
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\obj\</IntDir>
913
</PropertyGroup>
14+
15+
<ItemDefinitionGroup>
16+
<ClCompile>
17+
<WarningLevel>Level3</WarningLevel>
18+
<SDLCheck>true</SDLCheck>
19+
<ConformanceMode>true</ConformanceMode>
20+
</ClCompile>
21+
<Link>
22+
<GenerateDebugInformation>true</GenerateDebugInformation>
23+
</Link>
24+
</ItemDefinitionGroup>
25+
26+
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
27+
<ClCompile>
28+
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
29+
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
30+
<Optimization>Disabled</Optimization>
31+
</ClCompile>
32+
</ItemDefinitionGroup>
33+
34+
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
35+
<ClCompile>
36+
<FunctionLevelLinking>true</FunctionLevelLinking>
37+
<IntrinsicFunctions>true</IntrinsicFunctions>
38+
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
39+
</ClCompile>
40+
<Link>
41+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
42+
<OptimizeReferences>true</OptimizeReferences>
43+
</Link>
44+
</ItemDefinitionGroup>
45+
46+
<ItemDefinitionGroup Condition="'$(Platform)'=='Win32'">
47+
<ClCompile>
48+
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
49+
</ClCompile>
50+
</ItemDefinitionGroup>
1051
</Project>

Samples/WindowsML/cs/CSharpConsoleDesktop/CSharpConsoleDesktop/CSharpConsoleDesktop.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<WindowsPackageType>None</WindowsPackageType>
6+
<SelfContained>True</SelfContained>
67
</PropertyGroup>
78

89
<ItemGroup>

0 commit comments

Comments
 (0)