194 lines
8.6 KiB
XML
194 lines
8.6 KiB
XML
<!--
|
|
|
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
The App.targets file is for assemblies that are "user" / process assemblies,
|
|
i.e. they are not part of the kernel. This is roughly equivalent to Makefile.app.
|
|
|
|
Projects that import App.targets inherit the following behaviors:
|
|
|
|
* If the project has not set a value for the OutputPath property, then this targets
|
|
file will provide one. If the project is an executable, then OutputPath is set
|
|
to $(APPSDIR); if the project is a library (DLL), then OutputPath is set to $(LIBSDIR).
|
|
This provides the right behavior for most user-mode projects.
|
|
|
|
* CompilerPlatformVersion is always set to "cli1".
|
|
|
|
* CompilerPlatformDir is always set to $(APPRUNTIMEDIR).
|
|
|
|
* Stdlib is always set to $(APPRUNTIMEDIR)\Corlib.dll.
|
|
|
|
* If the NoStandardLibraries property is not set to 'true', and if the language is Sing#,
|
|
then the following references will be added:
|
|
|
|
Corlib.Contracts.dll
|
|
System.Compiler.Runtime.dll
|
|
Microsoft.SingSharp.Runtime.dll
|
|
Corlibsg.dll
|
|
Directory.Contracts.dll
|
|
Io.Contracts.dll
|
|
|
|
|
|
-->
|
|
|
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
|
|
<Import Condition="'$(SingularityPathsIncluded)'==''" Project="..\Paths.targets"/>
|
|
|
|
<PropertyGroup>
|
|
<OutputPath Condition="'$(OutputPath)'=='' and '$(OutputType)'=='Exe'">$(APPSDIR)</OutputPath>
|
|
<OutputPath Condition="'$(OutputPath)'=='' and '$(OutputType)'=='Library'">$(LIBSDIR)</OutputPath>
|
|
</PropertyGroup>
|
|
|
|
<PropertyGroup>
|
|
<ExtraCompilerFlags>$(ExtraCompilerFlags) /d:SINGULARITY /d:SINGULARITY_PROCESS</ExtraCompilerFlags>
|
|
<CompilerPlatformVersion>cli1</CompilerPlatformVersion>
|
|
<CompilerPlatformDir>$(APPRUNTIMEDIR)</CompilerPlatformDir>
|
|
<Stdlib>$(APPRUNTIMEDIR)\Corlib.dll</Stdlib>
|
|
<Language Condition="'$(Language)'==''">Sing#</Language>
|
|
</PropertyGroup>
|
|
|
|
|
|
<PropertyGroup>
|
|
<DefaultNibOptionsFile>$(SINGULARITY_ROOT)\Options\$(Configuration).$(COLLECTOR_APP).$(Machine).options</DefaultNibOptionsFile>
|
|
<NibOptionsFile Condition="'$(NibOptionsFile)'==''">$(DefaultNibOptionsFile)</NibOptionsFile>
|
|
|
|
<!-- Build _NibArgs. $(NIBOPTS) is intended to allow people to bring in options from command shell environment. -->
|
|
<_NibArgs>/machine:$(MACHINE) /par $(NIBOPTS)</_NibArgs>
|
|
<_NibArgs>$(_NibArgs) /cache:$(SINGULARITY_OBJROOT)</_NibArgs>
|
|
<_NibArgs>$(_NibArgs) /native:$(APPS_NATIVE_IMAGE_DIR) </_NibArgs>
|
|
<_NibArgs>$(_NibArgs) /temp:$(DISTRO_TEMP_DIR)</_NibArgs>
|
|
<_NibArgs>$(_NibArgs) /libcache:$(DISTRO_LIB_DIR)</_NibArgs>
|
|
<_NibArgs>$(_NibArgs) /options:$(NibOptionsFile)</_NibArgs>
|
|
</PropertyGroup>
|
|
|
|
|
|
|
|
<ItemGroup Condition="'$(NoStdLib)'!='true'">
|
|
|
|
<!--
|
|
Use a single reference to the app runtime project.
|
|
This builds Corlib.dll, System.Compiler.Runtime.dll, Microsoft.SingSharp.Runtime.dll, and Corlibsg.dll.
|
|
-->
|
|
<DependentProject Include="$(SINGULARITY_ROOT)\Applications\Runtime\AppRuntime.proj"/>
|
|
|
|
<!-- The C# compiler does not support /stdlib:Corlib.dll, so we pass Corlib.dll as a reference. -->
|
|
<__il_refs Include="$(APPRUNTIMEDIR)\Corlib.dll" Condition="'$(Languge)'=='C#'"/>
|
|
<__native_refs Include="$(APPRUNTIMEDIR)\Corlib.dll"/>
|
|
|
|
<!--
|
|
The Sing# compiler will implicitly pick up Microsoft.SingSharp.Runtime.dll,
|
|
so there is no need to pass it as an IL reference, but we still need to add it to the native refs.
|
|
If the language is C#, then we don't add this assembly at all.
|
|
-->
|
|
<__native_refs Include="$(APPRUNTIMEDIR)\Microsoft.SingSharp.Runtime.dll" Condition="'$(Language)'=='Sing#'"/>
|
|
|
|
<__il_refs Include="$(APPRUNTIMEDIR)\Corlib.Contracts.dll" Condition="'$(Language)'=='Sing#'"/>
|
|
<__native_refs Include="$(APPRUNTIMEDIR)\ILHelpers.dll"/>
|
|
|
|
<!--
|
|
<ProjectReference Include="$(SINGULARITY_ROOT)\Applications\Runtime\ILHelpers.csproj">
|
|
<ExcludeFromILReferences>true</ExcludeFromILReferences>
|
|
</ProjectReference>
|
|
-->
|
|
|
|
</ItemGroup>
|
|
|
|
|
|
<ItemGroup Condition="'$(NoStandardLibraries)'!='true'">
|
|
<ProjectReference Include="$(SINGULARITY_ROOT)\Kernel\System.Compiler.Runtime\System.Compiler.Runtime.App.csproj"/>
|
|
|
|
|
|
<ProjectReference Include="$(SINGULARITY_ROOT)\Interfaces\Singularity.V1\Singularity.V1.csproj">
|
|
<!--
|
|
<ExcludeFromManifestReferences>false</ExcludeFromManifestReferences>
|
|
-->
|
|
<ExcludeFromNativeReferences>true</ExcludeFromNativeReferences>
|
|
</ProjectReference>
|
|
|
|
<ProjectReference Include="$(SINGULARITY_ROOT)\Libraries\Singularity.V1\Singularity.V1.csproj">
|
|
<ExcludeFromILReferences>true</ExcludeFromILReferences>
|
|
</ProjectReference>
|
|
|
|
|
|
<ProjectReference Condition="'$(Language)'=='Sing#'" Include="$(SINGULARITY_ROOT)\Applications\Runtime\Corlibsg.csproj"/>
|
|
<!--
|
|
<ProjectReference Condition="'$(Language)'=='Sing#'" Include="$(SINGULARITY_ROOT)\Kernel\SpecSharp.Contracts\Corlib.Contracts.csproj">
|
|
<ExcludeFromNativeReferences>true</ExcludeFromNativeReferences>
|
|
</ProjectReference>
|
|
-->
|
|
|
|
<ProjectReference Condition="'$(Language)'=='Sing#'" Include="$(SINGULARITY_ROOT)\Contracts\Io.Contracts\Io.Contracts.csproj"/>
|
|
<ProjectReference Condition="'$(Language)'=='Sing#'" Include="$(SINGULARITY_ROOT)\Contracts\Directory.Contracts\Directory.Contracts.csproj"/>
|
|
</ItemGroup>
|
|
|
|
|
|
<Choose>
|
|
<When Condition="'$(OutputType)'=='Exe' and '$(NoManifest)'!='true'">
|
|
<PropertyGroup>
|
|
<BuildDependsOn>$(BuildDependsOn);BuildManifest</BuildDependsOn>
|
|
<ManifestPath>$(OutputPath)\$(AssemblyName).manifest</ManifestPath>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup>
|
|
<FilesToClean Include="$(ManifestPath)"/>
|
|
<FilesToClean Include="$(NativeImagePath)"/>
|
|
<FilesToClean Include="$(NativeSymbolPath)"/>
|
|
<FilesToClean Include="$(NativeObjPath)"/>
|
|
<FilesToClean Include="$(NativeSuperObjPath)"/>
|
|
<FilesToClean Include="$(BartokLogPath)"/>
|
|
<FilesToClean Include="$(LinkLogPath)"/>
|
|
</ItemGroup>
|
|
</When>
|
|
</Choose>
|
|
|
|
<!-- This target creates the .manifest file for the executable. -->
|
|
<Target Name="BuildManifest"
|
|
DependsOnTargets="BuildAssembly;BuildNativeReferences"
|
|
Inputs="$(OutputAssemblyPath);$(MSBuildProjectFullPath)"
|
|
Outputs="$(ManifestPath)"
|
|
Condition="'$(OutputType)'=='Exe'">
|
|
<Message Text="Building manifest - $(AssemblyName).manifest"/>
|
|
<Message Text=" __native_refs: %(__native_refs.fullpath)"/>
|
|
<Message Text=" Reference: %(Reference.fullpath)"/>
|
|
<Exec Command="$(BUILDDIR)\mkmani /out:$(OutputPath)\$(AssemblyName).manifest /app:$(AssemblyName) /x86:$(OutputPath)\$(AssemblyName).x86 /cache:$(SINGULARITY_OBJROOT) $(OutputAssemblyPath) @(__native_refs->'/r:"%(fullpath)"',' ') @(Reference->'/r:"%(fullpath)"',' ')$(APP_CODEGEN) $(APP_LINKER)"/>
|
|
</Target>
|
|
|
|
<PropertyGroup>
|
|
<BuildDependsOn Condition="'$(EnableEarlyNib)'=='true' and '$(OutputType)'=='Exe'">$(BuildDependsOn);nib</BuildDependsOn>
|
|
</PropertyGroup>
|
|
|
|
<!--
|
|
This target allows you to build an executable, and then immediately run it through NIB,
|
|
to generate a native executable image. This is useful during development, in order to
|
|
recompile an app without re-buiding an entire Distro project.
|
|
|
|
This target does not use Inputs/Outputs for incremental builds; instead, NIB is always
|
|
invoked. This is done for several reasons. First, NIB may decide to replace libraries
|
|
with other libraries (e.g. replacing metadata-only interface assemblies with
|
|
implementation assemblies); the MSBuild environment therefore cannot know which files
|
|
are part of the input set. Second, NIB already examines file times, and will only
|
|
invoke the native code compiler if necessary.
|
|
|
|
We still declare the Outputs, though, to be the native image, just in case anyone wants
|
|
to build and access the native image.
|
|
-->
|
|
<Target Name="nib"
|
|
Condition="'$(OutputType)'=='Exe'"
|
|
Outputs="$(APPS_NATIVE_IMAGE_DIR)\$(AssemblyName).x86"
|
|
DependsOnTargets="BuildManifest;BuildAppRuntimeNative">
|
|
<MakeDir Directories="$(DISTRO_TEMP_DIR);$(APPS_NATIVE_IMAGE_DIR)"/>
|
|
<Message Text="Building Native Image - $(NativeImagePath)"/>
|
|
<Exec Command="$(NIB) $(_NibArgs) $(ManifestPath)"/>
|
|
</Target>
|
|
|
|
|
|
<Target Name="BuildAppRuntimeNative">
|
|
<MSBuild Projects="$(SINGULARITY_ROOT)\Applications\Runtime\Corlib.Native.proj"/>
|
|
</Target>
|
|
|
|
|
|
<Import Project="SingSharp.targets"/>
|
|
|
|
</Project>
|