-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathnasm.targets
More file actions
198 lines (197 loc) · 9.8 KB
/
nasm.targets
File metadata and controls
198 lines (197 loc) · 9.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PropertyPageSchema
Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
<AvailableItemName Include="NASM">
<Targets>_NASM</Targets>
</AvailableItemName>
</ItemGroup>
<PropertyGroup>
<ComputeLinkInputsTargets>
$(ComputeLinkInputsTargets);
ComputeNASMOutput;
</ComputeLinkInputsTargets>
</PropertyGroup>
<PropertyGroup>
<ComputeLibInputsTargets>
$(ComputeLibInputsTargets);
ComputeNASMOutput;
</ComputeLibInputsTargets>
</PropertyGroup>
<PropertyGroup>
<ComputeImpLibInputsTargets>
$(ComputeImpLibInputsTargets);
ComputeNASMOutput;
</ComputeImpLibInputsTargets>
</PropertyGroup>
<UsingTask
TaskName="NASM"
TaskFactory="XamlTaskFactory"
AssemblyName="Microsoft.Build.Tasks.v4.0">
<Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
</UsingTask>
<!-- *******************************************************************************************
NASM
******************************************************************************************* -->
<PropertyGroup Condition="'$(NASMAfterTargets)'!='' or '$(NASMBeforeTargets)'!=''">
<NASMToolBeforeTargets>$(NASMBeforeTargets)</NASMToolBeforeTargets>
<NASMToolAfterTargets>$(NASMAfterTargets)</NASMToolAfterTargets>
</PropertyGroup>
<!--If no before/after targets are set, then set the default-->
<PropertyGroup Condition="'$(NASMAfterTargets)'=='' and '$(NASMBeforeTargets)'==''">
<NASMToolBeforeTargets>Midl</NASMToolBeforeTargets>
<NASMToolAfterTargets>PreBuildEvent</NASMToolAfterTargets>
<NASMBeforeTargets>PostBuildEvent</NASMBeforeTargets>
<NASMAfterTargets>BscMake</NASMAfterTargets>
</PropertyGroup>
<!-- If Selective File Build is enabled, then dont let custom interupt the build order-->
<PropertyGroup Condition="'$(SelectedFiles)'!=''">
<NASMToolBeforeTargets></NASMToolBeforeTargets>
<NASMToolAfterTargets></NASMToolAfterTargets>
<NASMBeforeTargets></NASMBeforeTargets>
<NASMAfterTargets></NASMAfterTargets>
</PropertyGroup>
<Target Name="_NASM"
BeforeTargets="$(NASMToolBeforeTargets)"
AfterTargets="$(NASMToolAfterTargets)"
DependsOnTargets="SelectNASM;ComputeNASMOutput">
<PropertyGroup>
<CustomBuildToolArchitecture Condition="'$(CustomBuildToolArchitecture)' == ''">Native32Bit</CustomBuildToolArchitecture>
</PropertyGroup>
<ItemGroup>
<NASM Update="@(NASM)">
<Inputs>%(NASM.FullPath);%(NASM.AdditionalDependencies);$(MSBuildProjectFile)</Inputs>
<AdditionalInputs>%(NASM.FullPath);%(NASM.AdditionalDependencies);$(MSBuildProjectFile)</AdditionalInputs>
<Message>%(NASM.ExecutionDescription)</Message>
<!-- Option fragments used for [AllOptions] -->
<_NasmOpt_Debug></_NasmOpt_Debug>
<_NasmOpt_Prefix></_NasmOpt_Prefix>
<_NasmOpt_Postfix></_NasmOpt_Postfix>
<_NasmOpt_IncludePaths></_NasmOpt_IncludePaths>
<_NasmOpt_PreIncludeFiles></_NasmOpt_PreIncludeFiles>
<_NasmOpt_Defines></_NasmOpt_Defines>
<_NasmOpt_Undefines></_NasmOpt_Undefines>
<_NasmOpt_Werror></_NasmOpt_Werror>
<_NasmOpt_Debug Condition="'%(NASM.GenerateDebugInformation)' == 'true'">-g</_NasmOpt_Debug>
<_NasmOpt_Prefix Condition="'%(NASM.SymbolsPrefix)' != ''">--prefix %(NASM.SymbolsPrefix)</_NasmOpt_Prefix>
<_NasmOpt_Postfix Condition="'%(NASM.SymbolsPostfix)' != ''">--postfix %(NASM.SymbolsPostfix)</_NasmOpt_Postfix>
<_NasmOpt_IncludePaths Condition="'%(NASM.IncludePaths)' != ''">-I"$([System.String]::Copy('%(NASM.IncludePaths)').Trim(';').Replace(';', '/" -I"'))/"</_NasmOpt_IncludePaths>
<_NasmOpt_PreIncludeFiles Condition="'%(NASM.PreIncludeFiles)' != ''">-P"$([System.String]::Copy('%(NASM.PreIncludeFiles)').Trim(';').Replace(';', '" -P"'))"</_NasmOpt_PreIncludeFiles>
<_NasmOpt_Defines Condition="'%(NASM.PreprocessorDefinitions)' != ''">-D$([System.String]::Copy('%(NASM.PreprocessorDefinitions)').Trim(';').Replace(';', ' -D'))</_NasmOpt_Defines>
<_NasmOpt_Undefines Condition="'%(NASM.UndefinePreprocessorDefinitions)' != ''">-U$([System.String]::Copy('%(NASM.UndefinePreprocessorDefinitions)').Trim(';').Replace(';', ' -U'))</_NasmOpt_Undefines>
<_NasmOpt_Werror Condition="'%(NASM.TreatWarningsAsErrors)' == 'true'">-Werror</_NasmOpt_Werror>
</NASM>
</ItemGroup>
<ItemGroup>
<NASM Update="@(NASM)">
<_NasmAllOptions>-o "%(NASM.Outputs)" %(NASM._NasmOpt_Debug) %(NASM._NasmOpt_Prefix) %(NASM._NasmOpt_Postfix) %(NASM._NasmOpt_IncludePaths) %(NASM._NasmOpt_PreIncludeFiles) %(NASM._NasmOpt_Defines) %(NASM._NasmOpt_Undefines) %(NASM._NasmOpt_Werror)</_NasmAllOptions>
</NASM>
</ItemGroup>
<ItemGroup>
<NASM Update="@(NASM)">
<Command>$([System.String]::Copy('%(NASM.CommandLineTemplate)').Replace('[AllOptions]', '%(NASM._NasmAllOptions)').Replace('[AdditionalOptions]', '%(NASM.AdditionalOptions)'))</Command>
</NASM>
</ItemGroup>
<!-- Delete old ParallelCustomBuild tlogs, same as CustomBuild -->
<GetOutOfDateItems
Sources ="@(_EmptyItemGroup)"
OutputsMetadataName ="Outputs"
DependenciesMetadataName ="AdditionalInputs"
CommandMetadataName ="Command"
TLogDirectory ="$(TLogLocation)"
TLogNamePrefix ="ParallelNasmBuild"
TrackFileAccess ="$(TrackFileAccess)"
/>
<!-- Get out of date items for NASM (full build case) -->
<GetOutOfDateItems
Condition ="'$(SelectedFiles)' == ''"
Sources ="@(NASM)"
OutputsMetadataName ="Outputs"
DependenciesMetadataName ="AdditionalInputs"
CommandMetadataName ="Command"
TLogDirectory ="$(TLogLocation)"
TLogNamePrefix ="NasmBuild"
TrackFileAccess ="$(TrackFileAccess)"
CheckForInterdependencies ="true">
<Output TaskParameter="OutOfDateSources" ItemName="_NasmBuild" />
</GetOutOfDateItems>
<!-- Selected-files build: just take all NASM items -->
<ItemGroup Condition ="'$(SelectedFiles)' != ''">
<_NasmBuild Include="@(NASM)" />
</ItemGroup>
<!-- Build items which can be built in parallel (ignored for selected-files build) -->
<ItemGroup Condition="'$(SelectedFiles)' == ''">
<_ParallelNasmBuild Include="@(_NasmBuild)"
Condition="'%(_NasmBuild.BuildInParallel)' == 'true' and '%(_NasmBuild.DependsOnAnotherItemOutput)' != 'true'" />
</ItemGroup>
<ParallelCustomBuild
Condition ="'@(_ParallelNasmBuild)' != ''"
Sources ="@(_ParallelNasmBuild)"
MaxProcesses ="%(_ParallelNasmBuild.MaxProcesses)"
MaxItemsInBatch ="%(_ParallelNasmBuild.MaxItemsInBatch)"
AcceptableNonZeroExitCodes ="%(_ParallelNasmBuild.AcceptableNonZeroExitCodes)"
StdOutEncoding ="%(_ParallelNasmBuild.StdOutEncoding)"
StdErrEncoding ="%(_ParallelNasmBuild.StdErrEncoding)"
UseMsbuildResourceManager ="$(UseMsbuildResourceManager)"
/>
<!-- Build the remaining items sequentially -->
<ItemGroup Condition="'@(_ParallelNasmBuild)' != ''">
<_NasmBuild Remove="@(_ParallelNasmBuild)" />
<_ParallelNasmBuild Remove="@(_ParallelNasmBuild)" />
</ItemGroup>
<CustomBuild Condition ="'@(_NasmBuild)' != ''"
Sources ="@(_NasmBuild)"
BuildSuffix ="$(_BuildSuffix)"
MinimalRebuildFromTracking ="false"
AcceptableNonZeroExitCodes ="%(_NasmBuild.AcceptableNonZeroExitCodes)"
StdOutEncoding ="%(_NasmBuild.StdOutEncoding)"
StdErrEncoding ="%(_NasmBuild.StdErrEncoding)">
</CustomBuild>
<ItemGroup Condition="'@(_NasmBuild)' != ''">
<_NasmBuild Remove="@(_NasmBuild)" />
</ItemGroup>
</Target>
<Target Name="SelectNASM" DependsOnTargets="_SelectedFiles">
<ItemGroup Condition="'@(SelectedFiles)'!=''">
<NASM Remove="@(NASM)" Condition="'%(Identity)'!='@(SelectedFiles)'"/>
<NASM>
<MinimalRebuildFromTracking>false</MinimalRebuildFromTracking>
</NASM>
</ItemGroup>
<ItemGroup>
<NASM Update="@(NASM)">
<Outputs Condition="'%(NASM.ObjectFileName)' != ''">%(NASM.ObjectFileName)</Outputs>
</NASM>
</ItemGroup>
</Target>
<Target Name="ComputeNASMOutput" DependsOnTargets="SelectNASM" >
<ItemGroup >
<NASMOutputs Include="@(NASM->Metadata('Outputs'))" Condition="'@(NASM)' != ''"/>
<NASMOutputs Condition="'%(NASMOutputs.ExcludedFromBuild)'!='true'
and '%(NASMOutputs.OutputItemType)'==''
and '%(NASMOutputs.LinkObjects)'=='true'
and ('%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib')">
<OutputItemType Condition="'$(ConfigurationType)'=='StaticLibrary'">Lib</OutputItemType>
<OutputItemType Condition="'$(ConfigurationType)'!='StaticLibrary'">Link</OutputItemType>
</NASMOutputs>
</ItemGroup>
<!-- Add NASM Outputs to lib, link or other tools -->
<CreateItem
Include="@(NASMOutputs)"
Condition="'%(NASMOutputs.OutputItemType)'!=''">
<Output
TaskParameter="Include"
ItemName="%(NASMOutputs.OutputItemType)"/>
<Output
TaskParameter="Include"
Condition="'%(NASMOutputs.OutputItemType)' == 'Link' and '$(GenerateImportLib)'=='true'"
ItemName="ImpLib"/>
</CreateItem>
<MakeDir Directories="@(NASMOutputs->'%(RootDir)%(Directory)')" />
<!-- Cleanup -->
<ItemGroup>
<NASMOutputs Remove="@(NASMOutputs)" />
</ItemGroup>
</Target>
</Project>