%PDF- %PDF-
Direktori : /lib/dotnet/sdk/7.0.119/Sdks/Microsoft.DotNet.ILCompiler/build/ |
Current File : //lib/dotnet/sdk/7.0.119/Sdks/Microsoft.DotNet.ILCompiler/build/Microsoft.NETCore.Native.targets |
<!-- *********************************************************************************************** Microsoft.NETCore.Native.targets WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have created a backup copy. Incorrect changes to this file will make it impossible to load or build your projects from the command-line or the IDE. This file defines the steps in the build process for native AOT compilation. Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. *********************************************************************************************** --> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <!-- Set defaults for unspecified properties --> <PropertyGroup> <NativeLib Condition="'$(OutputType)' == 'Library' and '$(NativeLib)' == ''">Shared</NativeLib> <NativeIntermediateOutputPath Condition="'$(NativeIntermediateOutputPath)' == ''">$(IntermediateOutputPath)native\</NativeIntermediateOutputPath> <NativeOutputPath Condition="'$(NativeOutputPath)' == ''">$(OutputPath)native\</NativeOutputPath> <NativeCompilationDuringPublish Condition="'$(NativeCompilationDuringPublish)' == ''">true</NativeCompilationDuringPublish> <IlcBuildTasksPath Condition="'$(IlcBuildTasksPath)' == ''">$(MSBuildThisFileDirectory)..\tools\netstandard\ILCompiler.Build.Tasks.dll</IlcBuildTasksPath> <IlcToolsPath Condition="'$(IlcPath)' != '' and '$(IlcToolsPath)' == ''">$(IlcPath)\tools\</IlcToolsPath> <IlcSdkPath Condition="'$(IlcPath)' != '' and '$(IlcSdkPath)' == ''">$(IlcPath)\sdk\</IlcSdkPath> <IlcFrameworkPath Condition="'$(IlcPath)' != '' and '$(IlcFrameworkPath)' == ''">$(IlcPath)\framework\</IlcFrameworkPath> <IlcFrameworkNativePath Condition="'$(IlcPath)' != '' and '$(IlcFrameworkNativePath)' == ''">$(IlcPath)\framework\</IlcFrameworkNativePath> <IlcFrameworkNativePath Condition="'$(IlcFrameworkNativePath)' == '' and '$(IlcFrameworkPath)' != ''">$(IlcFrameworkPath)</IlcFrameworkNativePath> <IlcMibcPath Condition="'$(IlcPath)' != '' and '$(IlcMibcPath)' == ''">$(IlcPath)\mibc\</IlcMibcPath> <TargetOS Condition="'$([MSBuild]::IsOSPlatform(Windows))' == 'true'">windows</TargetOS> <TargetOS Condition="'$([MSBuild]::IsOSPlatform(OSX))' == 'true'">OSX</TargetOS> <TargetOS Condition="'$(TargetOS)' == ''">$(OS)</TargetOS> <NativeDebugSymbols Condition="$(DebugSymbols) == 'true' or ($(DebugType) != 'none' and $(DebugType) != '')">true</NativeDebugSymbols> <!-- Workaround for https://github.com/dotnet/runtimelab/issues/771 --> <ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles> <PublishTrimmed Condition="'$(PublishTrimmed)' == ''">true</PublishTrimmed> <RunILLink>false</RunILLink> </PropertyGroup> <!-- Set up the defaults for the compatibility mode --> <PropertyGroup> <IlcGenerateStackTraceData Condition="$(IlcGenerateStackTraceData) == ''">true</IlcGenerateStackTraceData> <IlcScanReflection Condition="$(IlcScanReflection) == ''">true</IlcScanReflection> </PropertyGroup> <!-- Set up default feature switches --> <PropertyGroup> <UseSystemResourceKeys Condition="$(IlcDisableReflection) == 'true'">true</UseSystemResourceKeys> <EventSourceSupport Condition="$(IlcDisableReflection) == 'true'">false</EventSourceSupport> <EventSourceSupport Condition="$(EventSourceSupport) == ''">false</EventSourceSupport> </PropertyGroup> <PropertyGroup Condition="'$(SuppressAotAnalysisWarnings)' == 'true'"> <EnableAotAnalyzer Condition="'$(EnableAotAnalyzer)' == ''">false</EnableAotAnalyzer> </PropertyGroup> <PropertyGroup> <NativeObjectExt Condition="'$(TargetOS)' == 'windows'">.obj</NativeObjectExt> <NativeObjectExt Condition="'$(TargetOS)' != 'windows'">.o</NativeObjectExt> <LibFileExt Condition="'$(TargetOS)' == 'windows'">.lib</LibFileExt> <LibFileExt Condition="'$(TargetOS)' != 'windows'">.a</LibFileExt> <IlcOutputFileExt Condition="$(IlcOutputFileExt) == ''">$(NativeObjectExt)</IlcOutputFileExt> <IsNativeExecutable Condition="'$(OutputType)' == 'Exe' or '$(OutputType)' == 'WinExe'">true</IsNativeExecutable> <NativeBinaryExt Condition="'$(IsNativeExecutable)' == 'true' and '$(TargetOS)' == 'windows'">.exe</NativeBinaryExt> <NativeBinaryExt Condition="'$(IsNativeExecutable)' == 'true' and '$(TargetOS)' != 'windows'"></NativeBinaryExt> <NativeBinaryExt Condition="'$(IsNativeExecutable)' != 'true' and '$(TargetOS)' == 'windows' and $(NativeLib) == 'Shared'">.dll</NativeBinaryExt> <NativeBinaryExt Condition="'$(IsNativeExecutable)' != 'true' and '$(TargetOS)' == 'OSX' and $(NativeLib) == 'Shared'">.dylib</NativeBinaryExt> <NativeBinaryExt Condition="'$(IsNativeExecutable)' != 'true' and '$(TargetOS)' != 'windows' and '$(TargetOS)' != 'OSX' and $(NativeLib) == 'Shared'">.so</NativeBinaryExt> <NativeBinaryExt Condition="'$(IsNativeExecutable)' != 'true' and '$(TargetOS)' == 'windows' and $(NativeLib) == 'Static'">.lib</NativeBinaryExt> <NativeBinaryExt Condition="'$(IsNativeExecutable)' != 'true' and '$(TargetOS)' != 'windows' and $(NativeLib) == 'Static'">.a</NativeBinaryExt> <NativeSymbolExt Condition="'$(TargetOS)' == 'OSX'">.dwarf</NativeSymbolExt> <NativeSymbolExt Condition="'$(TargetOS)' == 'windows'">.pdb</NativeSymbolExt> <NativeSymbolExt Condition="'$(TargetOS)' != 'OSX' and '$(TargetOS)' != 'windows'">.dbg</NativeSymbolExt> <ExportsFileExt Condition="'$(TargetOS)' == 'windows'">.def</ExportsFileExt> <ExportsFileExt Condition="'$(TargetOS)' != 'windows'">.exports</ExportsFileExt> <NativeObject>$(NativeIntermediateOutputPath)$(TargetName)$(NativeObjectExt)</NativeObject> <NativeBinary>$(NativeOutputPath)$(TargetName)$(NativeBinaryExt)</NativeBinary> <ExportsFile Condition="$(NativeLib) == 'Shared' and $(ExportsFile) == ''">$(NativeIntermediateOutputPath)$(TargetName)$(ExportsFileExt)</ExportsFile> <IlcCompileOutput>$(NativeObject)</IlcCompileOutput> <LinkNativeDependsOn>IlcCompile</LinkNativeDependsOn> <FrameworkLibPath Condition="'$(FrameworkLibPath)' == ''">$(NativeOutputPath)</FrameworkLibPath> <FrameworkObjPath Condition="'$(FrameworkObjPath)' == ''">$(NativeIntermediateOutputPath)</FrameworkObjPath> <SharedLibrary Condition="'$(TargetOS)' == 'windows'">$(FrameworkLibPath)\Framework$(LibFileExt)</SharedLibrary> <SharedLibrary Condition="'$(TargetOS)' != 'windows'">$(FrameworkLibPath)\libframework$(LibFileExt)</SharedLibrary> <IlcDynamicBuildPropertyDependencies Condition="'$(IlcCalledViaPackage)' == 'true'">SetupProperties</IlcDynamicBuildPropertyDependencies> </PropertyGroup> <PropertyGroup Condition="'$(IlcCompileDependsOn)'=='' and '$(NativeCompilationDuringPublish)' != 'false'"> <IlcCompileDependsOn Condition="'$(BuildingFrameworkLibrary)' != 'true'">Compile;ComputeIlcCompileInputs</IlcCompileDependsOn> <IlcCompileDependsOn Condition="'$(IlcMultiModule)' == 'true' and '$(BuildingFrameworkLibrary)' != 'true'">$(IlcCompileDependsOn);BuildFrameworkLib</IlcCompileDependsOn> <IlcCompileDependsOn>$(IlcCompileDependsOn);SetupOSSpecificProps</IlcCompileDependsOn> <IlcCompileDependsOn>$(IlcCompileDependsOn);PrepareForILLink</IlcCompileDependsOn> </PropertyGroup> <ItemGroup Condition="$(IlcSystemModule) == ''"> <AutoInitializedAssemblies Include="System.Private.CoreLib" /> <AutoInitializedAssemblies Include="System.Private.StackTraceMetadata" Condition="$(IlcDisableReflection) != 'true' or $(IlcGenerateStackTraceData) == 'true'" /> <AutoInitializedAssemblies Include="System.Private.TypeLoader" /> <AutoInitializedAssemblies Include="System.Private.Reflection.Execution" Condition="$(IlcDisableReflection) != 'true'" /> <AutoInitializedAssemblies Include="System.Private.DisabledReflection" Condition="$(IlcDisableReflection) == 'true'" /> </ItemGroup> <ItemGroup> <PrivateSdkAssemblies Include="$(IlcSdkPath)*.dll" /> <!-- Exclude unmanaged dlls --> <FrameworkAssemblies Include="$(IlcFrameworkPath)*.dll" Exclude="$(IlcFrameworkPath)*.Native.dll;$(IlcFrameworkPath)msquic.dll" /> <MibcFile Include="$(IlcMibcPath)*.mibc" Condition="'$(IlcPgoOptimize)' == 'true'" /> <DefaultFrameworkAssemblies Include="@(FrameworkAssemblies)" /> <DefaultFrameworkAssemblies Include="@(PrivateSdkAssemblies)" /> </ItemGroup> <ItemDefinitionGroup> <ManagedBinary> <IlcRspFile>$(NativeIntermediateOutputPath)\%(Filename).ilc.rsp</IlcRspFile> <IlcOutputFile>$(NativeIntermediateOutputPath)\%(Filename)$(IlcOutputFileExt)</IlcOutputFile> </ManagedBinary> </ItemDefinitionGroup> <Target Name="_ComputeManagedAssemblyForILLink" AfterTargets="_ComputeManagedAssemblyToLink" Condition="'$(NativeCompilationDuringPublish)' == 'true'"> <ItemGroup> <ManagedAssemblyToLink Remove="@(ManagedAssemblyToLink)" /> <ManagedAssemblyToLink Include="@(DefaultFrameworkAssemblies);@(_ManagedResolvedAssembliesToPublish);@(ManagedBinary)" /> </ItemGroup> </Target> <!-- The properties below need to be defined only after we've found the correct runtime package reference --> <Target Name="SetupProperties" DependsOnTargets="$(IlcSetupPropertiesDependsOn)" BeforeTargets="Publish"> <PropertyGroup> <!-- Define paths used in build targets to point to the runtime-specific ILCompiler implementation --> <IlcToolsPath Condition="'$(IlcToolsPath)' == ''">$(IlcHostPackagePath)\tools\</IlcToolsPath> <IlcSdkPath Condition="'$(IlcSdkPath)' == ''">$(RuntimePackagePath)\sdk\</IlcSdkPath> <IlcFrameworkPath Condition="'$(IlcFrameworkPath)' == ''">$(RuntimePackagePath)\framework\</IlcFrameworkPath> <IlcFrameworkNativePath Condition="'$(IlcFrameworkNativePath)' == ''">$(RuntimePackagePath)\framework\</IlcFrameworkNativePath> <IlcMibcPath Condition="'$(IlcMibcPath)' == ''">$(RuntimePackagePath)\mibc\</IlcMibcPath> </PropertyGroup> <!-- If running from a package these values need to be set again with the resolved IlcXYZPath --> <ItemGroup> <PrivateSdkAssemblies Include="$(IlcSdkPath)*.dll" /> <!-- Exclude unmanaged dlls --> <FrameworkAssemblies Include="$(IlcFrameworkPath)*.dll" Exclude="$(IlcFrameworkPath)*.Native.dll;$(IlcFrameworkPath)msquic.dll" /> <MibcFile Include="$(IlcMibcPath)*.mibc" Condition="'$(IlcPgoOptimize)' == 'true'" /> <DefaultFrameworkAssemblies Include="@(FrameworkAssemblies)" /> <DefaultFrameworkAssemblies Include="@(PrivateSdkAssemblies)" /> </ItemGroup> </Target> <Target Name="ComputeIlcCompileInputs" DependsOnTargets="$(IlcDynamicBuildPropertyDependencies)" BeforeTargets="Publish"> <ItemGroup> <ManagedBinary Condition="$(BuildingFrameworkLibrary) != 'true'" Include="$(IntermediateOutputPath)$(TargetName)$(TargetExt)" /> <IlcCompileInput Include="@(ManagedBinary)" /> <IlcReference Include="@(DefaultFrameworkAssemblies)" /> </ItemGroup> </Target> <!-- BuildFrameworkLib is invoked before IlcCompile in multi-module builds to produce the shared framework library on demand --> <Target Name="BuildFrameworkLib" Condition="'$(DisableFrameworkLibGeneration)' != 'true'" DependsOnTargets="$(IlcDynamicBuildPropertyDependencies)"> <ItemGroup> <!-- This builds the project with the ILC implementation in the identified runtime package to avoid resolving it again --> <ProjectToBuild Include="$(MSBuildThisFileDirectory)BuildFrameworkNativeObjects.proj"> <AdditionalProperties> IntermediateOutputPath=$(IntermediateOutputPath); FrameworkLibPath=$(FrameworkLibPath); FrameworkObjPath=$(FrameworkObjPath); RuntimePackagePath=$(RuntimePackagePath); IlcHostPackagePath=$(IlcHostPackagePath); TargetArchitecture=$(TargetArchitecture); </AdditionalProperties> </ProjectToBuild> </ItemGroup> <MSBuild Projects="@(ProjectToBuild)" BuildInParallel="true" /> </Target> <Target Name="WriteIlcRspFileForCompilation" Inputs="@(IlcCompileInput);@(RdXmlFile);@(TrimmerRootDescriptor)" Outputs="%(ManagedBinary.IlcRspFile)" DependsOnTargets="$(IlcCompileDependsOn)"> <ItemGroup> <_IlcRootedAssemblies Include="@(TrimmerRootAssembly)" /> <_IlcRootedAssemblies Include="@(ManagedAssemblyToLink)" Condition="%(ManagedAssemblyToLink.TrimMode) == 'copy'" /> <_IlcConditionallyRootedAssemblies Include="@(ManagedAssemblyToLink)" Condition="%(ManagedAssemblyToLink.TrimMode) == 'copyused'" /> <_IlcTrimmedAssemblies Include="@(ManagedAssemblyToLink)" Condition="%(ManagedAssemblyToLink.TrimMode) == 'link'" /> <_IlcNoSingleWarnAssemblies Include="@(ManagedAssemblyToLink)" Condition="%(ManagedAssemblyToLink.TrimmerSingleWarn) == 'false'" /> </ItemGroup> <ItemGroup> <IlcArg Include="@(IlcCompileInput)" /> <IlcArg Include="-o:$(NativeIntermediateOutputPath)%(ManagedBinary.Filename)$(IlcOutputFileExt)" /> <IlcArg Include="@(IlcReference->'-r:%(Identity)')" /> <IlcArg Include="@(MibcFile->'--mibc:%(Identity)')" /> <IlcArg Condition="$(IlcGenerateMetadataLog) == 'true'" Include="--metadatalog:$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).metadata.csv" /> <IlcArg Condition="$(TargetArchitecture) != ''" Include="--targetarch:$(TargetArchitecture)" /> <IlcArg Condition="$(IlcMultiModule) == 'true'" Include="--multifile" /> <IlcArg Condition="$(Optimize) == 'true'" Include="-O" /> <IlcArg Condition="$(NativeDebugSymbols) == 'true'" Include="-g" /> <IlcArg Condition="$(IlcDwarfVersion) == '5'" Include="--gdwarf-5" /> <IlcArg Condition="$(IlcGenerateMapFile) == 'true'" Include="--map:$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).map.xml" /> <IlcArg Condition="$(IlcGenerateMstatFile) == 'true'" Include="--mstat:$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).mstat" /> <IlcArg Condition="$(IlcGenerateDgmlFile) == 'true'" Include="--dgmllog:$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).codegen.dgml.xml" /> <IlcArg Condition="$(IlcGenerateDgmlFile) == 'true'" Include="--scandgmllog:$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).scan.dgml.xml" /> <IlcArg Include="@(RdXmlFile->'--rdxml:%(FullPath)')" /> <IlcArg Include="@(TrimmerRootDescriptor->'--descriptor:%(FullPath)')" /> <IlcArg Condition="$(NativeLib) != ''" Include="--nativelib" /> <IlcArg Condition="$(ExportsFile) != ''" Include="--exportsfile:$(ExportsFile)" /> <IlcArg Include="@(AutoInitializedAssemblies->'--initassembly:%(Identity)')" /> <IlcArg Include="@(RuntimeHostConfigurationOption->'--appcontextswitch:%(Identity)=%(Value)')" /> <IlcArg Include="--appcontextswitch:RUNTIME_IDENTIFIER=$(RuntimeIdentifier)" /> <IlcArg Include="@(DirectPInvoke->'--directpinvoke:%(Identity)')" /> <IlcArg Include="@(DirectPInvokeList->'--directpinvokelist:%(Identity)')" /> <IlcArg Include="@(_TrimmerFeatureSettings->'--feature:%(Identity)=%(Value)')" /> <IlcArg Condition="$(ServerGarbageCollection) == 'true'" Include="--runtimeopt:gcServer=1" /> <IlcArg Condition="$(IlcGenerateCompleteTypeMetadata) == 'true' and $(IlcDisableReflection) != 'true'" Include="--completetypemetadata" /> <IlcArg Condition="$(IlcGenerateStackTraceData) == 'true'" Include="--stacktracedata" /> <IlcArg Condition="$(IlcScanReflection) == 'true' and $(IlcDisableReflection) != 'true'" Include="--scanreflection" /> <IlcArg Condition="$(IlcFoldIdenticalMethodBodies) == 'true'" Include="--methodbodyfolding" /> <IlcArg Condition="$(Optimize) == 'true' and $(IlcOptimizationPreference) == 'Size'" Include="--Os" /> <IlcArg Condition="$(Optimize) == 'true' and $(IlcOptimizationPreference) == 'Speed'" Include="--Ot" /> <IlcArg Condition="$(IlcInstructionSet) != ''" Include="--instruction-set:$(IlcInstructionSet)" /> <IlcArg Condition="$(IlcDisableReflection) == 'true'" Include="--reflectiondata:none" /> <IlcArg Condition="$(IlcDisableReflection) == 'true'" Include="--feature:System.Collections.Generic.DefaultComparers=false" /> <IlcArg Condition="$(IlcSingleThreaded) == 'true'" Include="--parallelism:1" /> <IlcArg Condition="$(IlcSystemModule) != ''" Include="--systemmodule:$(IlcSystemModule)" /> <IlcArg Condition="$(IlcDumpIL) == 'true'" Include="--ildump:$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).il" /> <IlcArg Condition="$(NoWarn) != ''" Include='--nowarn:"$([MSBuild]::Escape($(NoWarn)))"' /> <IlcArg Condition="$(TrimmerSingleWarn) == 'true'" Include="--singlewarn" /> <IlcArg Condition="$(SuppressTrimAnalysisWarnings) == 'true'" Include="--notrimwarn" /> <IlcArg Condition="$(SuppressAotAnalysisWarnings) == 'true'" Include="--noaotwarn" /> <IlcArg Condition="$(IlcTrimMetadata) == 'false'" Include="--reflectiondata:all" /> <IlcArg Condition="'$(ControlFlowGuard)' == 'Guard' and '$(TargetOS)' == 'windows'" Include="--guard:cf" /> <IlcArg Include="@(_IlcRootedAssemblies->'--root:%(Identity)')" /> <IlcArg Include="@(_IlcConditionallyRootedAssemblies->'--conditionalroot:%(Identity)')" /> <IlcArg Include="@(_IlcTrimmedAssemblies->'--trim:%(Identity)')" /> <IlcArg Include="@(_IlcNoSingleWarnAssemblies->'--nosinglewarnassembly:%(Filename)')" /> <IlcArg Condition="'$(TrimmerDefaultAction)' == 'copyused' or '$(TrimmerDefaultAction)' == 'copy' or '$(TrimMode)' == 'partial'" Include="--defaultrooting" /> <IlcArg Include="--resilient" /> <IlcArg Condition="$(IlcDisableReflection) == 'true'" Include="--feature:System.Reflection.IsReflectionExecutionAvailable=false" /> <!-- Configure LINQ expressions - disable Emit everywhere --> <IlcArg Include="--feature:System.Linq.Expressions.CanCompileToIL=false" /> <IlcArg Include="--feature:System.Linq.Expressions.CanEmitObjectArrayDelegate=false" /> <IlcArg Include="--feature:System.Linq.Expressions.CanCreateArbitraryDelegates=false" /> </ItemGroup> <MakeDir Directories="$(NativeIntermediateOutputPath)" /> <WriteLinesToFile File="%(ManagedBinary.IlcRspFile)" Lines="@(IlcArg)" Overwrite="true" WriteOnlyWhenDifferent="true" /> </Target> <Target Name="IlcCompile" Inputs="@(IlcCompileInput);@(IlcReference);@(RdXmlFile);%(ManagedBinary.IlcRspFile)" Outputs="%(ManagedBinary.IlcOutputFile)" DependsOnTargets="WriteIlcRspFileForCompilation;$(IlcCompileDependsOn)"> <Message Text="Generating native code" Importance="high" /> <Exec Command=""$(IlcToolsPath)\ilc" @"$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).ilc.rsp"" /> <!-- Trick ILLinker into not actually running --> <MakeDir Condition="$([MSBuild]::VersionLessThan('$(NETCoreSdkVersion)', '7.0.0'))" Directories="$(IntermediateLinkDir)" /> <Touch Condition="$([MSBuild]::VersionLessThan('$(NETCoreSdkVersion)', '7.0.0'))" Files="$(_LinkSemaphore)" AlwaysCreate="true" /> </Target> <Import Project="$(MSBuildThisFileDirectory)Microsoft.NETCore.Native.Windows.targets" Condition="'$(TargetOS)' == 'windows'" /> <Import Project="$(MSBuildThisFileDirectory)Microsoft.NETCore.Native.Unix.targets" Condition="'$(TargetOS)' != 'windows'" /> <Target Name="MultiFileCopyNative" Inputs="@(NativeObjects)" Outputs="$(NativeOutputPath)" DependsOnTargets="GetNativeObjects"> <Copy SourceFiles="@(NativeObjects)" DestinationFolder="$(NativeOutputPath)" /> </Target> <PropertyGroup> <_Win32ResFile>$(NativeIntermediateOutputPath)$(TargetName).res</_Win32ResFile> </PropertyGroup> <UsingTask TaskName="DumpNativeResources" AssemblyFile="$(IlcBuildTasksPath)" /> <Target Name="GenerateResFile" Inputs="$(IntermediateOutputPath)$(TargetName)$(TargetExt)" Outputs="$(_Win32ResFile)" Condition="'$(TargetOS)' == 'windows'"> <DumpNativeResources MainAssembly="$(IntermediateOutputPath)$(TargetName)$(TargetExt)" ResourceFile="$(_Win32ResFile)" /> </Target> <Target Name="LinkNative" Inputs="$(NativeObject);@(NativeLibrary)" Outputs="$(NativeBinary)" DependsOnTargets="$(LinkNativeDependsOn);GenerateResFile"> <ItemGroup> <CustomLinkerArg Include=""$(NativeObject)"" /> <CustomLinkerArg Include="-o "$(NativeBinary)"" Condition="'$(TargetOS)' != 'windows'" /> <CustomLinkerArg Include="/OUT:"$(NativeBinary)"" Condition="'$(TargetOS)' == 'windows'" /> <CustomLinkerArg Include="/DEF:"$(ExportsFile)"" Condition="'$(TargetOS)' == 'windows' and $(ExportsFile) != ''" /> <CustomLinkerArg Include="/LIBPATH:"%(AdditionalNativeLibraryDirectories.Identity)"" Condition="'$(TargetOS)' == 'windows' and '@(AdditionalNativeLibraryDirectories->Count())' > 0" /> <CustomLinkerArg Include="-exported_symbols_list "$(ExportsFile)"" Condition="'$(TargetOS)' == 'OSX' and $(ExportsFile) != ''" /> <CustomLinkerArg Include="-Wl,--version-script=$(ExportsFile)" Condition="'$(TargetOS)' != 'windows' and '$(TargetOS)' != 'OSX' and $(ExportsFile) != ''" /> <CustomLinkerArg Condition="Exists('$(_Win32ResFile)')" Include=""$(_Win32ResFile)"" /> <CustomLinkerArg Include="@(LinkerArg)" /> </ItemGroup> <ItemGroup Condition="'$(TargetOS)' != 'windows' and '$(TargetOS)' != 'OSX'"> <CustomLinkerArg Include="-Wl,--discard-all" /> <CustomLinkerArg Include="-Wl,--gc-sections" /> </ItemGroup> <ItemGroup> <CustomLibArg Include="-crs "$(NativeBinary)"" Condition="'$(TargetOS)' != 'windows'" /> <CustomLibArg Include="/OUT:"$(NativeBinary)"" Condition="'$(TargetOS)' == 'windows'" /> <CustomLibArg Include=""$(NativeObject)"" /> </ItemGroup> <MakeDir Directories="$([System.IO.Path]::GetDirectoryName($(NativeBinary)))" /> <!-- https://github.com/dotnet/runtimelab/issues/956 - we IgnoreStandardErrorWarningFormat on macOS because there's a lot of warnings --> <PropertyGroup> <_IgnoreLinkerWarnings>false</_IgnoreLinkerWarnings> <_IgnoreLinkerWarnings Condition="'$(TargetOS)' == 'OSX'">true</_IgnoreLinkerWarnings> </PropertyGroup> <Exec Command=""$(CppLinker)" @(CustomLinkerArg, ' ')" Condition="'$(TargetOS)' != 'windows' and '$(NativeLib)' != 'Static'" IgnoreStandardErrorWarningFormat="$(_IgnoreLinkerWarnings)" /> <Exec Command=""$(CppLibCreator)" @(CustomLibArg, ' ')" Condition="'$(TargetOS)' != 'windows' and '$(NativeLib)' == 'Static'" /> <WriteLinesToFile File="$(NativeIntermediateOutputPath)link.rsp" Lines="@(CustomLinkerArg)" Overwrite="true" Encoding="utf-8" Condition="'$(TargetOS)' == 'windows' and '$(NativeLib)' != 'Static'" /> <Exec Command=""$(CppLinker)" @"$(NativeIntermediateOutputPath)link.rsp"" Condition="'$(TargetOS)' == 'windows' and '$(NativeLib)' != 'Static'" /> <WriteLinesToFile File="$(NativeIntermediateOutputPath)lib.rsp" Lines="@(CustomLibArg)" Overwrite="true" Encoding="utf-8" Condition="'$(TargetOS)' == 'windows' and '$(NativeLib)' == 'Static'" /> <Exec Command=""$(CppLibCreator)" @"$(NativeIntermediateOutputPath)lib.rsp"" Condition="'$(TargetOS)' == 'windows' and '$(NativeLib)' == 'Static'" /> <!-- remove executable flag --> <Exec Command="chmod 644 "$(NativeBinary)"" Condition="'$(TargetOS)' != 'windows' and '$(NativeLib)' == 'Shared'" /> <!-- strip symbols, see https://github.com/dotnet/runtime/blob/5d3288d/eng/native/functions.cmake#L374 --> <Exec Condition="'$(StripSymbols)' == 'true' and '$(TargetOS)' != 'windows' and '$(TargetOS)' != 'OSX'" Command=" "$(ObjCopyName)" --only-keep-debug "$(NativeBinary)" "$(NativeBinary)$(NativeSymbolExt)" && "$(ObjCopyName)" --strip-debug --strip-unneeded "$(NativeBinary)" && "$(ObjCopyName)" --add-gnu-debuglink="$(NativeBinary)$(NativeSymbolExt)" "$(NativeBinary)"" /> <Exec Condition="'$(StripSymbols)' == 'true' and '$(TargetOS)' == 'OSX'" Command=" dsymutil $(DsymUtilOptions) "$(NativeBinary)" && strip -no_code_signature_warning -S "$(NativeBinary)"" /> </Target> <Target Name="CreateLib" Inputs="@(LibInputs)" Outputs="$(SharedLibrary)" DependsOnTargets="$(CreateLibDependsOn);$(IlcDynamicBuildPropertyDependencies);SetupOSSpecificProps" > <ItemGroup> <CustomLibArg Include="/out:$(SharedLibrary)" Condition="'$(TargetOS)' == 'windows'" /> <CustomLibArg Include="-crs $(SharedLibrary)" Condition="'$(TargetOS)' != 'windows'" /> <CustomLibArg Include="@(LibInputs->'%(Identity)')" /> </ItemGroup> <MakeDir Directories="$(NativeIntermediateOutputPath)" /> <WriteLinesToFile File="$(NativeIntermediateOutputPath)lib.rsp" Lines="@(CustomLibArg)" Overwrite="true" Encoding="utf-8" Condition="'$(TargetOS)' == 'windows'" /> <MakeDir Directories="$([System.IO.Path]::GetDirectoryName($(SharedLibrary)))" /> <Exec Command=""$(CppLibCreator)" @"$(NativeIntermediateOutputPath)lib.rsp"" Condition="'$(TargetOS)' == 'windows'" /> <Exec Command=""$(CppLibCreator)" @(CustomLibArg, ' ')" Condition="'$(TargetOS)' != 'windows'" /> </Target> <Import Project="$(MSBuildThisFileDirectory)Microsoft.NETCore.Native.Publish.targets" Condition="'$(NativeCompilationDuringPublish)' != 'false'" /> </Project>