summaryrefslogtreecommitdiff
path: root/clr.props
blob: b1d3618609aa1c706e6af8d8d440339871f29e17 (plain)
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--*****************************************************-->
  <!--This MSBuild project file was automatically generated-->
  <!--from the original SOURCES/DIRS file by the KBC tool.-->
  <!--*****************************************************-->
  <!--Import the settings-->
  <Import Project="$(_NTDRIVE)$(_NTROOT)\InternalAPIs\NDP_Common\inc\Microsoft.Ndp.Settings.targets" />

  <!--Leaf project Properties-->
  <PropertyGroup>
    <Clrbase>$(_NTDRIVE)$(_NTROOT)\ndp\clr</Clrbase>
    <ClrSrcDirectory>$(Clrbase)\src\</ClrSrcDirectory>

    <ClrLibDest Condition="('$(BuildProjectName)' == '')">$(IntraPartitionAPIsPath)\$(LibSubPath)</ClrLibDest>
    <ClrLibDest Condition="('$(BuildProjectName)' == 'CoreCLR' or '$(BuildProjectName)' == 'CoreSys')">$(IntraPartitionAPIsPath)\CORElib\$(InterApiType)\$(RealBuildArchitecture)</ClrLibDest>
    <ClrLibPath>$(ClrLibDest)</ClrLibPath>
    
    <!-- Use IntermediateOutputDirectory as our Output, and also set BinplaceRoot to the BinariesDirectory.
         This prevents us publishing a bunch of files we don't really need into the BinariesDirectory,
         such as extra PDBs, .mt files, etc.  See clr.targets for the managed story which works differently.
    -->
    <BinariesDirectory Condition="'$(BinariesSubDirectory)' != ''">$(BinariesDirectory)\$(BinariesSubDirectory)</BinariesDirectory>
    <OutputPath>$(IntermediateOutputDirectory)\</OutputPath>
    <BinplaceRoot>$(BinariesDirectory)</BinplaceRoot>
    <BinplaceSymbols>true</BinplaceSymbols>
    <OutputLibPath>$(ClrLibPath)</OutputLibPath> 
    <UsePdbToCompile>true</UsePdbToCompile>
    <UseIncrementalCompiling>true</UseIncrementalCompiling>
    <RootOutputPath>$(BinariesDirectory)</RootOutputPath>

    <!-- Tags to detect illegal usage -->
    <ObjectDirectory>**##ILLEGAL_ ObjectDirectory##**</ObjectDirectory>
    <ObjectDirectoryPhase0>**##ILLEGAL_ ObjectDirectory0##**</ObjectDirectoryPhase0>
    <ObjectDirectoryPhase1>**##ILLEGAL_ ObjectDirectory1##**</ObjectDirectoryPhase1>
    <ObjectDirectoryPhase2>**##ILLEGAL_ ObjectDirectory2##**</ObjectDirectoryPhase2>


    <!-- Enable this when we're ready to handle P2P -->
    <BuildProjectReferences>true</BuildProjectReferences>

    <!-- Use the CLR warning suppression instead of the devdiv one-->
    <ClEnforceStandardScoping>true</ClEnforceStandardScoping>
    <ForcedIncludeFiles>WarningControl.h</ForcedIncludeFiles>
    
    <ClForcedIncludeFiles>$(ForcedIncludeFiles)</ClForcedIncludeFiles>
    <Fullcxxeh>Async</Fullcxxeh>
    <Synccxxeh>Sync</Synccxxeh>
    <Sehonly>Disabled</Sehonly>
    <ClNativeExceptionHandling>$(Fullcxxeh)</ClNativeExceptionHandling>
    <ClExternCNeverThrowsException>false</ClExternCNeverThrowsException>

    <!-- Use iso volatile semantics for better performance -->
    <ClIsoVolatile>true</ClIsoVolatile>

    <!-- Originally, src\tools\I386mk.inc turned FPO off by default because it makes ETW stack crawling bad.  -->
    <Fpo>0</Fpo>

    <!-- Ensure that we're not setting /DNT_UP=1 which disables multiprocessor builds -->
    <NtUp Condition="'$(NtUp)' == ''">0</NtUp>

    <ClrBuildError>*** CLR Build Error:</ClrBuildError>
    <ClrBuildTrace>*** CLR Trace:</ClrBuildTrace>

    <ClAdditionalOptions Condition="'$(NoClMpFlag)'!='true'">$(ClAdditionalOptions) /MP</ClAdditionalOptions>
    <ClAdditionalOptions>$(ClAdditionalOptions) /GS /d2Zi+</ClAdditionalOptions>
    <ClBufferSecurityCheck>true</ClBufferSecurityCheck>
    
         
    <!-- In Dbg and Chk builds, set /homeparams on x64 -->
    <ClAdditionalOptions Condition="'$(BuildArchitecture)' == 'amd64' and ('$(BuildType)' == 'Checked' or '$(BuildType)' == 'Debug')">$(ClAdditionalOptions) /homeparams</ClAdditionalOptions>
    
    <!-- Warning Try not use _BuildArch if is not specific to build system. Cross-compilation requires to make distiction between build arhitecture
        and target arhitecture.
        Use _BuildArch only when you need to trigger, use the tools of some arhitecture.
        Use TargetArch for anything else: feature selection, files selection, etc.
    -->
    <_BuildArch>$(_BUILDARCH)</_BuildArch>

    <TargetArch Condition="'$(TargetArch)' == '' and '$(CrossTargetArchitecture)'!=''">$(CrossTargetArchitecture)</TargetArch>
    <TargetArch Condition="'$(TargetArch)' == ''">$(BuildArchitecture)</TargetArch>

    <TargetArch Condition="'$(TargetArch)'=='AMD64'">amd64</TargetArch>
    
    <!-- Enable X86-ARM cross-plat defines --> 
    <CDefines Condition="'$(TargetArch)' == 'i386'">$(CDefines);_TARGET_X86_=1;</CDefines>
    <CDefines Condition="'$(TargetArch)' == 'amd64'">$(CDefines);_TARGET_AMD64_=1;</CDefines>
    <CDefines Condition="'$(TargetArch)' == 'arm'">$(CDefines);_TARGET_ARM_=1;</CDefines>
    <CDefines Condition="'$(TargetArch)' == 'arm64'">$(CDefines);_TARGET_ARM64_=1;</CDefines>

    <AsmSuffix Condition="'$(BuildArchitecture)' == 'i386' or '$(BuildArchitecture)' == 'amd64'">asm</AsmSuffix>

    <CDefines Condition="'$(BuildArchitecture)' == 'amd64' or '$(BuildArchitecture)' == 'arm64'">$(CDefines);BIT64</CDefines>

    <!-- Note: ClrProduct can be set prior to this file to 'Standalone'. -->
    <ClrProduct Condition="(('$(BuildProjectName)' == 'CoreCLR' or '$(BuildProjectName)' == 'CoreSys')) and ('$(ClrProduct)' == '' or '$(CoreTarget)' == 'true')">core_clr</ClrProduct>

    <ClAdditionalOptions>$(ClAdditionalOptions) /Zm200</ClAdditionalOptions>
    <TargetDefines Condition="'$(BuildArchitecture)'=='i386'">$(BuildArchitecture);_X86_</TargetDefines>
    <TargetDefines Condition="'$(BuildArchitecture)'=='amd64'">$(BuildArchitecture);_AMD64_</TargetDefines>
    <TargetDefines Condition="'$(BuildArchitecture)'=='arm'">$(BuildArchitecture);_ARM_</TargetDefines>
    <TargetDefines Condition="'$(BuildArchitecture)'=='arm64'">$(BuildArchitecture);_ARM64_</TargetDefines>

    <TargetCpu Condition="('$(TargetArch)' == 'i386')">i386</TargetCpu>
    <TargetCpu Condition="('$(TargetArch)' == 'amd64')">amd64</TargetCpu>
    <TargetCpu Condition="('$(TargetArch)' == 'arm')">arm</TargetCpu>
    <TargetCpu Condition="('$(TargetArch)' == 'arm64')">arm64</TargetCpu>
    
    <GeneratePlacefileFromFilelist>true</GeneratePlacefileFromFilelist>
    
  </PropertyGroup>


  <PropertyGroup Condition="'$(DoPrefastBuild)' == 'true'">
    <PrefastClToolPath>$(ToolsPath)\$(ToolsArchitecture)\prefast\scripts</PrefastClToolPath>
    <PrefastClToolExe>prefast.exe $(ClToolPath)\$(ClToolExe)</PrefastClToolExe>
  </PropertyGroup>


  <!-- CLR Feature Settings.  We set the default values here, allow leaf projects to override, and then
       set the CDefines based on these properties in clr.targets
  -->
  <Import Project="$(MSBuildThisFileDirectory)clr.coreclr.props" />

  <PropertyGroup Condition="'$(CrossGenCompile)'=='true'">
    <!-- Override settings of certain features to disable them for crossgen unconditionally -->
    <!-- If you add new features to this list make sure that they are not affecting codegen or content of datastructures persisted in NGen image -->
    <EnCSupported>false</EnCSupported>
    <PerfcountersSupportedBuild>false</PerfcountersSupportedBuild>
    <FeatureEventTrace>false</FeatureEventTrace>
    <FeatureFusion>false</FeatureFusion>
    <FeatureIncludeAllInterfaces>false</FeatureIncludeAllInterfaces>
    <FeatureMdaSupported>false</FeatureMdaSupported>
    <FeatureMergeJitAndEngine>true</FeatureMergeJitAndEngine>
    <FeatureRandomizedStringHashing>false</FeatureRandomizedStringHashing>
    <FeatureReflectionOnlyLoad>false</FeatureReflectionOnlyLoad>
    <FeatureStackProbe>false</FeatureStackProbe>
    <FeatureReJIT>false</FeatureReJIT>
    <FeatureVersioningLog>false</FeatureVersioningLog>
    <FeatureNativeImageGeneration>true</FeatureNativeImageGeneration>
    <FeatureReadyToRunCompiler Condition="'$(FeatureReadyToRun)' == 'true'">true</FeatureReadyToRunCompiler>
    <!-- Link crossgen with static CRT to make it standalone .exe -->
    <LinkUseCMT>true</LinkUseCMT>
    <UseMsvcrt>false</UseMsvcrt>
  </PropertyGroup>

  <PropertyGroup Condition="'$(ClrProduct)'=='Standalone'">
    <!--
        No features enabled by design - turn them on in your project file either:
          - before including this file, or 
          - after via <ClAdditionalOptions>$(ClAdditionalOptions) -DFEATURE_YourFeatureName</ClAdditionalOptions>.
        Created primarily for standalone MetaData DLLs for WinRT - file:src\DLLs\StandaloneMD-RO and file:src\DLLs\StandaloneMD-RW
        
        By default uses statically linked CRT:
            <UseMsvcrt>false</UseMsvcrt>
            <LinkUseCMT>true</LinkUseCMT>
    -->
  </PropertyGroup>
 
  <PropertyGroup>
    <DebugBuild Condition="'$(NTDEBUG)' == '' or '$(NTDEBUG)'=='ntsdnodbg'">false</DebugBuild>
    <DebugBuild Condition="'$(NTDEBUG)' != '' and '$(NTDEBUG)'!='ntsdnodbg'">true</DebugBuild>
  </PropertyGroup>
  
  <Choose>
    <When Condition="$(DebugBuild)">
      <PropertyGroup>
        <CDefines>$(CDefines);NTMAKEENV;_DEBUG</CDefines>
        <DebugCrts>true</DebugCrts>
      </PropertyGroup>
      
      <PropertyGroup Condition="'$(_BUILDOPT)' == 'no opt'">
        <Optimize>false</Optimize> 
      </PropertyGroup>
    </When>
    <Otherwise>
      <PropertyGroup>
        <CDefines>$(CDefines);NTMAKEENV;NDEBUG;PERF_TRACKING</CDefines> 
      </PropertyGroup>
    </Otherwise>
  </Choose>

  <PropertyGroup>
    <!--  "/Oi"  --> 
    <ClIntrinsicFunctions>true</ClIntrinsicFunctions> 

    <!-- "Disabled"=="/Od" "MinSpace"=="/O1" "MaxSpeed"=="/O2"  --> 
    <ClOptimization Condition="'$(_BUILDOPT)' == 'full opt'">MinSpace</ClOptimization>
    <ClOptimization Condition="'$(_BUILDOPT)' != 'full opt'">Disabled</ClOptimization>

    <!-- Size == "/Os"  Speed == "/Ot" Disabled == "" --> 
    <ClFavorSizeOrSpeed>Disabled</ClFavorSizeOrSpeed>
  </PropertyGroup>
  
  <PropertyGroup>
    <CDefines>$(CDefines);_BLD_CLR</CDefines> 

    <ClAdditionalOptions>$(ExceptionHandling) $(ClAdditionalOptions) /we4640</ClAdditionalOptions> 

    <!-- Desktop CLR, starting with version 4.5, supports Win2k8 R1 and higher on server, and Win7 and higher on client.
         So across server & client, 0x0600 is the default minimum required WINVER -->
    <Win32WinNt>0x0600</Win32WinNt>

    <!-- CoreSys supports Win8 and higher -->
    <Win32WinNt Condition="'$(BuildForCoreSystem)' == 'true' and '$(CrossTargetArchitecture)' == ''">0x0602</Win32WinNt>

    <!-- When building cross-target binaries, they must be able to run on pre-Win8 OS and thus, should have subsystem version 6.00. so, override the Subsystem setting
         specified in tools\Microsoft.DevDiv.targets.
    -->
    <SubsystemVersion Condition="'$(BuildForCoreSystem)' == 'true' and '$(AllowCrossTargeting)' == 'true'">6.00</SubsystemVersion>
    
    <!-- Some special projects under CLR, like clr\src\DLLS\culture\mscorwks\culture.nativeproj and
         clr\src\DLLS\normalization\mscorwks\normalization.nativeproj need to be compiled with 
         a special WINVER, so respect their requests -->
    <Win32WinNt Condition="'$(ClrOverriddenWin32WinNt)' != ''">$(ClrOverriddenWin32WinNt)</Win32WinNt>
    
    <!-- Now make sure WINVER matches Win32WinNt -->
    <CDefines Condition="'$(Win32WinNt)' != ''">$(CDefines);WINVER=$(Win32WinNt)</CDefines>


    <LinkLibIgnore Condition="'$(TargetArch)' == 'i386'">4013</LinkLibIgnore> 
    <ClrBuildLeanAndMean>true</ClrBuildLeanAndMean>
    <LinkLibIgnore Condition="!('$(TargetArch)' == 'i386')">4197,4013</LinkLibIgnore>  
    <LinkLibIgnore>$(LinkLibIgnore);4254</LinkLibIgnore>
    <UseVsVersion Condition="'$(UseVsVersion)' == ''">false</UseVsVersion>
    <LibWarnAsError>true</LibWarnAsError>

    <CoreSystemSdkPath Condition="'$(TargetArch)' != 'arm64'">$(ExternalAPIsPath)\Win8CoreSystem</CoreSystemSdkPath>
    <CoreSystemSdkPath Condition="'$(TargetArch)' == 'arm64'">$(ExternalAPIsPath)\Win9CoreSystem</CoreSystemSdkPath>
    
    <UserIncludes>$(Clrbase)\src\inc; $(Clrbase)\src\strongname\inc; $(IntraPartitionAPIsPath)\inc; $(UserIncludes); $(ClrIncPath)</UserIncludes> 
    <UserIncludes Condition="'$(BuildForCoreSystem)' != 'true' or  '$(CrossTargetArchitecture)' != ''">$(UserIncludes); $(VCToolsIncPath); $(VCPublicIncPath);</UserIncludes>
    <UserIncludes Condition="'$(BuildForCoreSystem)' == 'true' and '$(CrossTargetArchitecture)' == ''">$(UserIncludes); $(CoreSystemSdkPath)\inc; $(CoreSystemSdkPath)\inc\crt;</UserIncludes>
    <UserIncludes Condition="'$(UseVsVersion)' == 'false'">$(UserIncludes); $(NdpRootIncPath); $(NDP_CommonIncPath)</UserIncludes>
    <UserIncludes Condition="'$(FeatureCominterop)' == 'true'">$(Clrbase)\src\inc\WinRT; $(UserIncludes)</UserIncludes>

    <PogoInstrument>false</PogoInstrument> 
    <PogoOptimize>false</PogoOptimize> 
    <PogoUpdate>false</PogoUpdate> 
    <PogoExePhase>1</PogoExePhase>
    
    <ResgenDefines Condition="'$(FeatureImpersonation)' == '1'">$(ResgenDefines) /define:FEATURE_IMPERSONATION</ResgenDefines> 
    <ResgenDefines Condition="'$(FeatureIsostore)' == '1'">$(ResgenDefines) /define:FEATURE_ISOSTORE</ResgenDefines> 
    <ResgenDefines Condition="'$(FeatureMacl)' == '1'">$(ResgenDefines) /define:FEATURE_MACL</ResgenDefines> 
    <ResgenDefines Condition="'$(FeatureRemoting)' == '1'">$(ResgenDefines) /define:FEATURE_REMOTING</ResgenDefines> 
    <ResgenDefines Condition="'$(FeatureIdentityReference)' == '1'">$(ResgenDefines) /define:FEATURE_IDENTITY_REFERENCE</ResgenDefines> 
    <ResgenDefines Condition="'$(FeatureDisplayCultureInfo)' == '1'">$(ResgenDefines) /define:FEATURE_DISPLAY_CULTURE_INFO</ResgenDefines> 
    <ResgenDefines Condition="'$(FeatureDisplayRegionInfo)' == '1'">$(ResgenDefines) /define:FEATURE_DISPLAY_REGION_INFO</ResgenDefines> 

    <RootOutputPath>$(BinariesDirectory)</RootOutputPath>


    <!-- Explicitly disable UninitializedVariableCheck and StackFrameCheck since the DevDiv targets sets them as default on and it
    breaks the build when optimizations are enabled
    -->
    <NoRtc>true</NoRtc>
    <NoBuildTypeDefines>true</NoBuildTypeDefines>

    <!-- 
        The DevDiv targets define these to stuff we don't use if they're left blank and there's no easy way to keep them off 
        of the CL.exe command line.   
    -->
    <OakIncPath >.</OakIncPath>
    <ConfigIncPath >.</ConfigIncPath>
    <VSCommonIncPath >.</VSCommonIncPath>
    
    <!-- Devdiv targets have a slightly different semantics for debug defines like DBG.  Defined as 
         BuildType == Debug || BuildType == Checked && DebugBuild == True.  In CLR, Checked has DBG
         defined so we override to preserve ntbuild behaviour
    -->
    <CDefines Condition="'$(BuildType)' == 'Checked' or '$(BuildType)' == 'Debug'">$(CDefines);DBG=1</CDefines>

    <!-- Note: This defines only name of the lib 'ClrCrtLib'. Project has to use it explicitly like this: <LibCLib>$(ClrCrtLib)</LibCLib> -->
    <ClrCrtLib Condition="'$(BuildForCoreSystem)' != 'true'">$(CrtLibPath)\msvcrt$(BuildSuffix)_clr.lib</ClrCrtLib>

    <RefAsmOutputDirectory>$(BinariesDirectory)\ref\</RefAsmOutputDirectory>

  </PropertyGroup>

  <PropertyGroup Condition="'$(BuildForCoreSystem)' == 'true' and ('$(HostMachineOS)'=='' or '$(HostMachineOS)' == 'OneCore' or '$(HostMachineOS)'=='OneCoreWin7Compat')">
    <!--
        For the most part we build against CoreSystem in the same way as we do against full Windows. But
        linking is very different. There are a different set of import libraries (in sdk\lib\CoreSystem) and
        we pick up the system CRT (from sdk rather than vc).

        There are 3 different variations of linking we might use:
        CoreSystem forwarder libraries - This links against mincore_fw.lib, which causes the binaries to reference
           a bunch of small forwarder dlls at runtime. These forwarders redirect CoreSystem api-set imports back
           to standard win32 API exports. Binaries linked this way can run on any CoreSystem OS + Win7, however
           all the forwarder dlls must be present on the LoadLibrary search path.
        CoreSystem stand alone libraries - This links against mincore.lib (and maybe others like mincore_legacy.lib).
           These binaries can run on OneCore OS or Win8+ and don't have any dependency on forwarders.
        Win32 APIs - This links against the traditional win32 libraries such as kernel32 and the VC CRT. These
           binaries run on Win7+ but don't work on pure OneCore SKUs. 

        Most of the binaries we build in the CoreSystem build get linked using the forwarder libraries. To do
        that we need to set $(BuildForCoreSystem)=true and $(BuildForWindows7)=true. All the binaries in this
        group have never set the $(HostMachineOS) property. On ARM we don't support win7, so in that case we
        use the stand alone library linkage, $(BuildForWindows7)=false.
        
        Some of the binaries we build are cross compiled, such as some debugging related binaries. In this scenario
        we are debugging a CoreSystem coreclr, but the debugger may be running on a different machine. Because
        these libraries can be loaded via LoadLibrary and won't have forwarder libraries available, we use some of
        the alternate linkages. All binaries in this set have set the $(HostMachineOS) to something...
        $(HostMachineOS)=='windows' => we want Win32 API and won't enter this conditional
        $(HostMachineOS)=='OneCore' => we want the stand alone libraries
        $(HostMachineOS)=='OneCoreWin7Compat' => we want the forwarders
    -->
    <BuildForWindows7 Condition="'$(BuildForWindows7)'==''">true</BuildForWindows7>
    <BuildForWindows7 Condition="'$(HostMachineOS)'=='OneCore'">false</BuildForWindows7>
    <BuildForWindows7 Condition="'$(TargetArch)'=='arm' or '$(TargetArch)'=='arm64'">false</BuildForWindows7>

    <SdkLibPath>$(CoreSystemSdkPath)\sdk\lib\mincore\$(BuildArchitecture)</SdkLibPath>
    <SdkLibPath Condition="'$(BuildForWindows7)' == 'true'">$(ExternalAPIsPath)\Windows\Win7\$(BuildArchitecture)</SdkLibPath>

    <CoreSystemCrt>$(SdkLibPath)\msvcrt.lib</CoreSystemCrt>
    <CrtSecureDeprecate>true</CrtSecureDeprecate>
    <LinkNoLibraries>true</LinkNoLibraries>
    <LinkNoWin32Libraries>true</LinkNoWin32Libraries>
    <NoWinXPSP3NXCompat>true</NoWinXPSP3NXCompat>
  </PropertyGroup>
</Project>