Fix cross component builderror - CMakeLists.txt for PAL (#9819)
[platform/upstream/coreclr.git] / clr.props
1 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2   <!--*****************************************************-->
3   <!--This MSBuild project file was automatically generated-->
4   <!--from the original SOURCES/DIRS file by the KBC tool.-->
5   <!--*****************************************************-->
6   <!--Import the settings-->
7   <Import Project="$(_NTDRIVE)$(_NTROOT)\InternalAPIs\NDP_Common\inc\Microsoft.Ndp.Settings.targets" />
8
9   <!--Leaf project Properties-->
10   <PropertyGroup>
11     <Clrbase>$(_NTDRIVE)$(_NTROOT)\ndp\clr</Clrbase>
12     <ClrSrcDirectory>$(Clrbase)\src\</ClrSrcDirectory>
13
14     <ClrLibDest Condition="('$(BuildProjectName)' == '')">$(IntraPartitionAPIsPath)\$(LibSubPath)</ClrLibDest>
15     <ClrLibDest Condition="('$(BuildProjectName)' == 'CoreCLR' or '$(BuildProjectName)' == 'CoreSys')">$(IntraPartitionAPIsPath)\CORElib\$(InterApiType)\$(RealBuildArchitecture)</ClrLibDest>
16     <ClrLibPath>$(ClrLibDest)</ClrLibPath>
17     
18     <!-- Use IntermediateOutputDirectory as our Output, and also set BinplaceRoot to the BinariesDirectory.
19          This prevents us publishing a bunch of files we don't really need into the BinariesDirectory,
20          such as extra PDBs, .mt files, etc.  See clr.targets for the managed story which works differently.
21     -->
22     <BinariesDirectory Condition="'$(BinariesSubDirectory)' != ''">$(BinariesDirectory)\$(BinariesSubDirectory)</BinariesDirectory>
23     <OutputPath>$(IntermediateOutputDirectory)\</OutputPath>
24     <BinplaceRoot>$(BinariesDirectory)</BinplaceRoot>
25     <BinplaceSymbols>true</BinplaceSymbols>
26     <OutputLibPath>$(ClrLibPath)</OutputLibPath> 
27     <UsePdbToCompile>true</UsePdbToCompile>
28     <UseIncrementalCompiling>true</UseIncrementalCompiling>
29     <RootOutputPath>$(BinariesDirectory)</RootOutputPath>
30
31     <!-- Tags to detect illegal usage -->
32     <ObjectDirectory>**##ILLEGAL_ ObjectDirectory##**</ObjectDirectory>
33     <ObjectDirectoryPhase0>**##ILLEGAL_ ObjectDirectory0##**</ObjectDirectoryPhase0>
34     <ObjectDirectoryPhase1>**##ILLEGAL_ ObjectDirectory1##**</ObjectDirectoryPhase1>
35     <ObjectDirectoryPhase2>**##ILLEGAL_ ObjectDirectory2##**</ObjectDirectoryPhase2>
36
37
38     <!-- Enable this when we're ready to handle P2P -->
39     <BuildProjectReferences>true</BuildProjectReferences>
40
41     <!-- Use the CLR warning suppression instead of the devdiv one-->
42     <ClEnforceStandardScoping>true</ClEnforceStandardScoping>
43     <ForcedIncludeFiles>WarningControl.h</ForcedIncludeFiles>
44     
45     <ClForcedIncludeFiles>$(ForcedIncludeFiles)</ClForcedIncludeFiles>
46     <Fullcxxeh>Async</Fullcxxeh>
47     <Synccxxeh>Sync</Synccxxeh>
48     <Sehonly>Disabled</Sehonly>
49     <ClNativeExceptionHandling>$(Fullcxxeh)</ClNativeExceptionHandling>
50     <ClExternCNeverThrowsException>false</ClExternCNeverThrowsException>
51
52     <!-- Use iso volatile semantics for better performance -->
53     <ClIsoVolatile>true</ClIsoVolatile>
54
55     <!-- Originally, src\tools\I386mk.inc turned FPO off by default because it makes ETW stack crawling bad.  -->
56     <Fpo>0</Fpo>
57
58     <!-- Ensure that we're not setting /DNT_UP=1 which disables multiprocessor builds -->
59     <NtUp Condition="'$(NtUp)' == ''">0</NtUp>
60
61     <ClrBuildError>*** CLR Build Error:</ClrBuildError>
62     <ClrBuildTrace>*** CLR Trace:</ClrBuildTrace>
63
64     <ClAdditionalOptions Condition="'$(NoClMpFlag)'!='true'">$(ClAdditionalOptions) /MP</ClAdditionalOptions>
65     <ClAdditionalOptions>$(ClAdditionalOptions) /GS /d2Zi+</ClAdditionalOptions>
66     <ClBufferSecurityCheck>true</ClBufferSecurityCheck>
67     
68          
69     <!-- In Dbg and Chk builds, set /homeparams on x64 -->
70     <ClAdditionalOptions Condition="'$(BuildArchitecture)' == 'amd64' and ('$(BuildType)' == 'Checked' or '$(BuildType)' == 'Debug')">$(ClAdditionalOptions) /homeparams</ClAdditionalOptions>
71     
72     <!-- Warning Try not use _BuildArch if is not specific to build system. Cross-compilation requires to make distiction between build arhitecture
73         and target arhitecture.
74         Use _BuildArch only when you need to trigger, use the tools of some arhitecture.
75         Use TargetArch for anything else: feature selection, files selection, etc.
76     -->
77     <_BuildArch>$(_BUILDARCH)</_BuildArch>
78
79     <TargetArch Condition="'$(TargetArch)' == '' and '$(CrossTargetArchitecture)'!=''">$(CrossTargetArchitecture)</TargetArch>
80     <TargetArch Condition="'$(TargetArch)' == ''">$(BuildArchitecture)</TargetArch>
81
82     <TargetArch Condition="'$(TargetArch)'=='AMD64'">amd64</TargetArch>
83     
84     <!-- Enable X86-ARM cross-plat defines --> 
85     <CDefines Condition="'$(TargetArch)' == 'i386'">$(CDefines);_TARGET_X86_=1;</CDefines>
86     <CDefines Condition="'$(TargetArch)' == 'amd64'">$(CDefines);_TARGET_AMD64_=1;</CDefines>
87     <CDefines Condition="'$(TargetArch)' == 'arm'">$(CDefines);_TARGET_ARM_=1;</CDefines>
88     <CDefines Condition="'$(TargetArch)' == 'arm64'">$(CDefines);_TARGET_ARM64_=1;</CDefines>
89
90     <AsmSuffix Condition="'$(BuildArchitecture)' == 'i386' or '$(BuildArchitecture)' == 'amd64'">asm</AsmSuffix>
91
92     <CDefines Condition="'$(BuildArchitecture)' == 'amd64' or '$(BuildArchitecture)' == 'arm64'">$(CDefines);BIT64</CDefines>
93
94     <!-- Note: ClrProduct can be set prior to this file to 'Standalone'. -->
95     <ClrProduct Condition="(('$(BuildProjectName)' == 'CoreCLR' or '$(BuildProjectName)' == 'CoreSys')) and ('$(ClrProduct)' == '' or '$(CoreTarget)' == 'true')">core_clr</ClrProduct>
96
97     <ClAdditionalOptions>$(ClAdditionalOptions) /Zm200</ClAdditionalOptions>
98     <TargetDefines Condition="'$(BuildArchitecture)'=='i386'">$(BuildArchitecture);_X86_</TargetDefines>
99     <TargetDefines Condition="'$(BuildArchitecture)'=='amd64'">$(BuildArchitecture);_AMD64_</TargetDefines>
100     <TargetDefines Condition="'$(BuildArchitecture)'=='arm'">$(BuildArchitecture);_ARM_</TargetDefines>
101     <TargetDefines Condition="'$(BuildArchitecture)'=='arm64'">$(BuildArchitecture);_ARM64_</TargetDefines>
102
103     <TargetCpu Condition="('$(TargetArch)' == 'i386')">i386</TargetCpu>
104     <TargetCpu Condition="('$(TargetArch)' == 'amd64')">amd64</TargetCpu>
105     <TargetCpu Condition="('$(TargetArch)' == 'arm')">arm</TargetCpu>
106     <TargetCpu Condition="('$(TargetArch)' == 'arm64')">arm64</TargetCpu>
107     
108     <GeneratePlacefileFromFilelist>true</GeneratePlacefileFromFilelist>
109     
110   </PropertyGroup>
111
112
113   <PropertyGroup Condition="'$(DoPrefastBuild)' == 'true'">
114     <PrefastClToolPath>$(ToolsPath)\$(ToolsArchitecture)\prefast\scripts</PrefastClToolPath>
115     <PrefastClToolExe>prefast.exe $(ClToolPath)\$(ClToolExe)</PrefastClToolExe>
116   </PropertyGroup>
117
118
119   <!-- CLR Feature Settings.  We set the default values here, allow leaf projects to override, and then
120        set the CDefines based on these properties in clr.targets
121   -->
122   <Import Project="$(MSBuildThisFileDirectory)clr.coreclr.props" />
123
124   <PropertyGroup Condition="'$(CrossGenCompile)'=='true'">
125     <!-- Override settings of certain features to disable them for crossgen unconditionally -->
126     <!-- If you add new features to this list make sure that they are not affecting codegen or content of datastructures persisted in NGen image -->
127     <EnCSupported>false</EnCSupported>
128     <PerfcountersSupportedBuild>false</PerfcountersSupportedBuild>
129     <FeatureEventTrace>false</FeatureEventTrace>
130     <FeatureFusion>false</FeatureFusion>
131     <FeatureMdaSupported>false</FeatureMdaSupported>
132     <FeatureMergeJitAndEngine>true</FeatureMergeJitAndEngine>
133     <FeatureRandomizedStringHashing>false</FeatureRandomizedStringHashing>
134     <FeatureStackProbe>false</FeatureStackProbe>
135     <FeatureReJIT>false</FeatureReJIT>
136     <FeatureVersioningLog>false</FeatureVersioningLog>
137     <FeatureNativeImageGeneration>true</FeatureNativeImageGeneration>
138     <FeatureReadyToRunCompiler Condition="'$(FeatureReadyToRun)' == 'true'">true</FeatureReadyToRunCompiler>
139     <!-- Link crossgen with static CRT to make it standalone .exe -->
140     <LinkUseCMT>true</LinkUseCMT>
141     <UseMsvcrt>false</UseMsvcrt>
142   </PropertyGroup>
143
144   <PropertyGroup Condition="'$(ClrProduct)'=='Standalone'">
145     <!--
146         No features enabled by design - turn them on in your project file either:
147           - before including this file, or 
148           - after via <ClAdditionalOptions>$(ClAdditionalOptions) -DFEATURE_YourFeatureName</ClAdditionalOptions>.
149         Created primarily for standalone MetaData DLLs for WinRT - file:src\DLLs\StandaloneMD-RO and file:src\DLLs\StandaloneMD-RW
150         
151         By default uses statically linked CRT:
152             <UseMsvcrt>false</UseMsvcrt>
153             <LinkUseCMT>true</LinkUseCMT>
154     -->
155   </PropertyGroup>
156  
157   <PropertyGroup>
158     <DebugBuild Condition="'$(NTDEBUG)' == '' or '$(NTDEBUG)'=='ntsdnodbg'">false</DebugBuild>
159     <DebugBuild Condition="'$(NTDEBUG)' != '' and '$(NTDEBUG)'!='ntsdnodbg'">true</DebugBuild>
160   </PropertyGroup>
161   
162   <Choose>
163     <When Condition="$(DebugBuild)">
164       <PropertyGroup>
165         <CDefines>$(CDefines);NTMAKEENV;_DEBUG</CDefines>
166         <DebugCrts>true</DebugCrts>
167       </PropertyGroup>
168       
169       <PropertyGroup Condition="'$(_BUILDOPT)' == 'no opt'">
170         <Optimize>false</Optimize> 
171       </PropertyGroup>
172     </When>
173     <Otherwise>
174       <PropertyGroup>
175         <CDefines>$(CDefines);NTMAKEENV;NDEBUG;PERF_TRACKING</CDefines> 
176       </PropertyGroup>
177     </Otherwise>
178   </Choose>
179
180   <PropertyGroup>
181     <!--  "/Oi"  --> 
182     <ClIntrinsicFunctions>true</ClIntrinsicFunctions> 
183
184     <!-- "Disabled"=="/Od" "MinSpace"=="/O1" "MaxSpeed"=="/O2"  --> 
185     <ClOptimization Condition="'$(_BUILDOPT)' == 'full opt'">MinSpace</ClOptimization>
186     <ClOptimization Condition="'$(_BUILDOPT)' != 'full opt'">Disabled</ClOptimization>
187
188     <!-- Size == "/Os"  Speed == "/Ot" Disabled == "" --> 
189     <ClFavorSizeOrSpeed>Disabled</ClFavorSizeOrSpeed>
190   </PropertyGroup>
191   
192   <PropertyGroup>
193     <CDefines>$(CDefines);_BLD_CLR</CDefines> 
194
195     <ClAdditionalOptions>$(ExceptionHandling) $(ClAdditionalOptions) /we4640</ClAdditionalOptions> 
196
197     <!-- Desktop CLR, starting with version 4.5, supports Win2k8 R1 and higher on server, and Win7 and higher on client.
198          So across server & client, 0x0600 is the default minimum required WINVER -->
199     <Win32WinNt>0x0600</Win32WinNt>
200
201     <!-- CoreSys supports Win8 and higher -->
202     <Win32WinNt Condition="'$(BuildForCoreSystem)' == 'true' and '$(CrossTargetArchitecture)' == ''">0x0602</Win32WinNt>
203
204     <!-- 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
205          specified in tools\Microsoft.DevDiv.targets.
206     -->
207     <SubsystemVersion Condition="'$(BuildForCoreSystem)' == 'true' and '$(AllowCrossTargeting)' == 'true'">6.00</SubsystemVersion>
208     
209     <!-- Some special projects under CLR, like clr\src\DLLS\culture\mscorwks\culture.nativeproj and
210          clr\src\DLLS\normalization\mscorwks\normalization.nativeproj need to be compiled with 
211          a special WINVER, so respect their requests -->
212     <Win32WinNt Condition="'$(ClrOverriddenWin32WinNt)' != ''">$(ClrOverriddenWin32WinNt)</Win32WinNt>
213     
214     <!-- Now make sure WINVER matches Win32WinNt -->
215     <CDefines Condition="'$(Win32WinNt)' != ''">$(CDefines);WINVER=$(Win32WinNt)</CDefines>
216
217
218     <LinkLibIgnore Condition="'$(TargetArch)' == 'i386'">4013</LinkLibIgnore> 
219     <ClrBuildLeanAndMean>true</ClrBuildLeanAndMean>
220     <LinkLibIgnore Condition="!('$(TargetArch)' == 'i386')">4197,4013</LinkLibIgnore>  
221     <LinkLibIgnore>$(LinkLibIgnore);4254</LinkLibIgnore>
222     <UseVsVersion Condition="'$(UseVsVersion)' == ''">false</UseVsVersion>
223     <LibWarnAsError>true</LibWarnAsError>
224
225     <CoreSystemSdkPath Condition="'$(TargetArch)' != 'arm64'">$(ExternalAPIsPath)\Win8CoreSystem</CoreSystemSdkPath>
226     <CoreSystemSdkPath Condition="'$(TargetArch)' == 'arm64'">$(ExternalAPIsPath)\Win9CoreSystem</CoreSystemSdkPath>
227     
228     <UserIncludes>$(Clrbase)\src\inc; $(Clrbase)\src\strongname\inc; $(IntraPartitionAPIsPath)\inc; $(UserIncludes); $(ClrIncPath)</UserIncludes> 
229     <UserIncludes Condition="'$(BuildForCoreSystem)' != 'true' or  '$(CrossTargetArchitecture)' != ''">$(UserIncludes); $(VCToolsIncPath); $(VCPublicIncPath);</UserIncludes>
230     <UserIncludes Condition="'$(BuildForCoreSystem)' == 'true' and '$(CrossTargetArchitecture)' == ''">$(UserIncludes); $(CoreSystemSdkPath)\inc; $(CoreSystemSdkPath)\inc\crt;</UserIncludes>
231     <UserIncludes Condition="'$(UseVsVersion)' == 'false'">$(UserIncludes); $(NdpRootIncPath); $(NDP_CommonIncPath)</UserIncludes>
232     <UserIncludes Condition="'$(FeatureCominterop)' == 'true'">$(Clrbase)\src\inc\WinRT; $(UserIncludes)</UserIncludes>
233
234     <PogoInstrument>false</PogoInstrument> 
235     <PogoOptimize>false</PogoOptimize> 
236     <PogoUpdate>false</PogoUpdate> 
237     <PogoExePhase>1</PogoExePhase>
238     
239     <ResgenDefines Condition="'$(FeatureMacl)' == '1'">$(ResgenDefines) /define:FEATURE_MACL</ResgenDefines> 
240     <ResgenDefines Condition="'$(FeatureDisplayCultureInfo)' == '1'">$(ResgenDefines) /define:FEATURE_DISPLAY_CULTURE_INFO</ResgenDefines> 
241     <ResgenDefines Condition="'$(FeatureDisplayRegionInfo)' == '1'">$(ResgenDefines) /define:FEATURE_DISPLAY_REGION_INFO</ResgenDefines> 
242
243     <RootOutputPath>$(BinariesDirectory)</RootOutputPath>
244
245
246     <!-- Explicitly disable UninitializedVariableCheck and StackFrameCheck since the DevDiv targets sets them as default on and it
247     breaks the build when optimizations are enabled
248     -->
249     <NoRtc>true</NoRtc>
250     <NoBuildTypeDefines>true</NoBuildTypeDefines>
251
252     <!-- 
253         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 
254         of the CL.exe command line.   
255     -->
256     <OakIncPath >.</OakIncPath>
257     <ConfigIncPath >.</ConfigIncPath>
258     <VSCommonIncPath >.</VSCommonIncPath>
259     
260     <!-- Devdiv targets have a slightly different semantics for debug defines like DBG.  Defined as 
261          BuildType == Debug || BuildType == Checked && DebugBuild == True.  In CLR, Checked has DBG
262          defined so we override to preserve ntbuild behaviour
263     -->
264     <CDefines Condition="'$(BuildType)' == 'Checked' or '$(BuildType)' == 'Debug'">$(CDefines);DBG=1</CDefines>
265
266     <!-- Note: This defines only name of the lib 'ClrCrtLib'. Project has to use it explicitly like this: <LibCLib>$(ClrCrtLib)</LibCLib> -->
267     <ClrCrtLib Condition="'$(BuildForCoreSystem)' != 'true'">$(CrtLibPath)\msvcrt$(BuildSuffix)_clr.lib</ClrCrtLib>
268
269     <RefAsmOutputDirectory>$(BinariesDirectory)\ref\</RefAsmOutputDirectory>
270
271   </PropertyGroup>
272
273   <PropertyGroup Condition="'$(BuildForCoreSystem)' == 'true' and ('$(HostMachineOS)'=='' or '$(HostMachineOS)' == 'OneCore' or '$(HostMachineOS)'=='OneCoreWin7Compat')">
274     <!--
275         For the most part we build against CoreSystem in the same way as we do against full Windows. But
276         linking is very different. There are a different set of import libraries (in sdk\lib\CoreSystem) and
277         we pick up the system CRT (from sdk rather than vc).
278
279         There are 3 different variations of linking we might use:
280         CoreSystem forwarder libraries - This links against mincore_fw.lib, which causes the binaries to reference
281            a bunch of small forwarder dlls at runtime. These forwarders redirect CoreSystem api-set imports back
282            to standard win32 API exports. Binaries linked this way can run on any CoreSystem OS + Win7, however
283            all the forwarder dlls must be present on the LoadLibrary search path.
284         CoreSystem stand alone libraries - This links against mincore.lib (and maybe others like mincore_legacy.lib).
285            These binaries can run on OneCore OS or Win8+ and don't have any dependency on forwarders.
286         Win32 APIs - This links against the traditional win32 libraries such as kernel32 and the VC CRT. These
287            binaries run on Win7+ but don't work on pure OneCore SKUs. 
288
289         Most of the binaries we build in the CoreSystem build get linked using the forwarder libraries. To do
290         that we need to set $(BuildForCoreSystem)=true and $(BuildForWindows7)=true. All the binaries in this
291         group have never set the $(HostMachineOS) property. On ARM we don't support win7, so in that case we
292         use the stand alone library linkage, $(BuildForWindows7)=false.
293         
294         Some of the binaries we build are cross compiled, such as some debugging related binaries. In this scenario
295         we are debugging a CoreSystem coreclr, but the debugger may be running on a different machine. Because
296         these libraries can be loaded via LoadLibrary and won't have forwarder libraries available, we use some of
297         the alternate linkages. All binaries in this set have set the $(HostMachineOS) to something...
298         $(HostMachineOS)=='windows' => we want Win32 API and won't enter this conditional
299         $(HostMachineOS)=='OneCore' => we want the stand alone libraries
300         $(HostMachineOS)=='OneCoreWin7Compat' => we want the forwarders
301     -->
302     <BuildForWindows7 Condition="'$(BuildForWindows7)'==''">true</BuildForWindows7>
303     <BuildForWindows7 Condition="'$(HostMachineOS)'=='OneCore'">false</BuildForWindows7>
304     <BuildForWindows7 Condition="'$(TargetArch)'=='arm' or '$(TargetArch)'=='arm64'">false</BuildForWindows7>
305
306     <SdkLibPath>$(CoreSystemSdkPath)\sdk\lib\mincore\$(BuildArchitecture)</SdkLibPath>
307     <SdkLibPath Condition="'$(BuildForWindows7)' == 'true'">$(ExternalAPIsPath)\Windows\Win7\$(BuildArchitecture)</SdkLibPath>
308
309     <CoreSystemCrt>$(SdkLibPath)\msvcrt.lib</CoreSystemCrt>
310     <CrtSecureDeprecate>true</CrtSecureDeprecate>
311     <LinkNoLibraries>true</LinkNoLibraries>
312     <LinkNoWin32Libraries>true</LinkNoWin32Libraries>
313     <NoWinXPSP3NXCompat>true</NoWinXPSP3NXCompat>
314   </PropertyGroup>
315 </Project>