singrdk/base/Targets/App.targets

192 lines
8.5 KiB
Plaintext
Raw Permalink Normal View History

2008-03-05 09:52:00 -05:00
<!--
2008-11-17 18:29:00 -05:00
###############################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
###############################################################################
-->
<!--
2008-03-05 09:52:00 -05:00
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.
2008-11-17 18:29:00 -05:00
2008-03-05 09:52:00 -05:00
* CompilerPlatformVersion is always set to "cli1".
2008-11-17 18:29:00 -05:00
2008-03-05 09:52:00 -05:00
* 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:
2008-11-17 18:29:00 -05:00
2008-03-05 09:52:00 -05:00
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"/>
2008-11-17 18:29:00 -05:00
<Import Condition="'$(RuntimePathsIncluded)'==''" Project="RuntimePaths.target"/>
2008-03-05 09:52:00 -05:00
<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>
2008-11-17 18:29:00 -05:00
<_NibArgs>$(_NibArgs) /cache:&quot;$(SINGULARITY_OBJROOT)&quot;</_NibArgs>
<_NibArgs>$(_NibArgs) /native:&quot;$(APPS_NATIVE_IMAGE_DIR)&quot; </_NibArgs>
<_NibArgs>$(_NibArgs) /temp:&quot;$(DISTRO_TEMP_DIR)&quot;</_NibArgs>
<_NibArgs>$(_NibArgs) /libcache:&quot;$(DISTRO_LIB_DIR)&quot;</_NibArgs>
<_NibArgs>$(_NibArgs) /options:&quot;$(NibOptionsFile)&quot;</_NibArgs>
<_NibArgs>$(_NibArgs) /bartok:&quot;$(BARTOK)&quot;</_NibArgs>
<_NibArgs>$(_NibArgs) /linker:&quot;$(LINK)&quot;</_NibArgs>
2008-03-05 09:52:00 -05:00
</PropertyGroup>
2008-11-17 18:29:00 -05:00
2008-03-05 09:52:00 -05:00
<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.
-->
2008-11-17 18:29:00 -05:00
<DependentProject Include="$(SINGULARITY_ROOT)\Applications\Runtime\$(Runtime)\AppRuntime.proj"/>
2008-03-05 09:52:00 -05:00
<!-- 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"/>
2008-11-17 18:29:00 -05:00
2008-03-05 09:52:00 -05:00
<!--
The Sing# compiler will implicitly pick up Microsoft.SingSharp.Runtime.dll,
2008-11-17 18:29:00 -05:00
so there is no need to pass it as an IL reference, but we still need to add it to the native refs.
2008-03-05 09:52:00 -05:00
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#'"/>
</ItemGroup>
2008-11-17 18:29:00 -05:00
2008-03-05 09:52:00 -05:00
<ItemGroup Condition="'$(NoStandardLibraries)'!='true'">
2008-11-17 18:29:00 -05:00
<ProjectReference Include="$(AppRuntimeSrcDir)\System.Compiler.Runtime.App.csproj"/>
<ProjectReference Include="$(SINGULARITY_ROOT)\Interfaces\Singularity.V1\Singularity.V1.App.csproj">
2008-03-05 09:52:00 -05:00
<!--
<ExcludeFromManifestReferences>false</ExcludeFromManifestReferences>
-->
<ExcludeFromNativeReferences>true</ExcludeFromNativeReferences>
</ProjectReference>
2008-11-17 18:29:00 -05:00
<ProjectReference Include="$(APPRUNTIMESRCDIR)\Singularity.V1.App.csproj">
2008-03-05 09:52:00 -05:00
<ExcludeFromILReferences>true</ExcludeFromILReferences>
</ProjectReference>
2008-11-17 18:29:00 -05:00
<ProjectReference Condition="'$(Language)'=='Sing#'" Include="$(APPRUNTIMESRCDIR)\Corlibsg.csproj"/>
2008-03-05 09:52:00 -05:00
<!--
2008-11-17 18:29:00 -05:00
<ProjectReference Condition="'$(Language)'=='Sing#'" Include="$(APPRUNTIMESRCDIR)\Corlib.Contracts.csproj">
2008-03-05 09:52:00 -05:00
<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>
2008-11-17 18:29:00 -05:00
<ManifestPath>$(OutputPath)\$(AssemblyName).$(Machine).manifest</ManifestPath>
2008-03-05 09:52:00 -05:00
</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'">
2008-11-17 18:29:00 -05:00
<Message Text="Building manifest - $(ManifestPath)"/>
<Exec Command="&quot;$(BUILDDIR)\mkmani&quot; /exec /out:&quot;$(ManifestPath)&quot; /app:$(AssemblyName) /cache:&quot;$(SINGULARITY_OBJROOT)&quot; &quot;$(OutputAssemblyPath)&quot; @(__native_refs->'/r:&quot;%(fullpath)&quot;',' ') @(Reference->'/r:&quot;%(fullpath)&quot;',' ')$(APP_CODEGEN) $(APP_LINKER) /runtime:$(Runtime)"/>
2008-03-05 09:52:00 -05:00
</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.
2008-11-17 18:29:00 -05:00
2008-03-05 09:52:00 -05:00
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.
2008-11-17 18:29:00 -05:00
2008-03-05 09:52:00 -05:00
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'"
2008-11-17 18:29:00 -05:00
Outputs="$(APPS_NATIVE_IMAGE_DIR)\$(AssemblyName).$(Machine)"
2008-03-05 09:52:00 -05:00
DependsOnTargets="BuildManifest;BuildAppRuntimeNative">
<MakeDir Directories="$(DISTRO_TEMP_DIR);$(APPS_NATIVE_IMAGE_DIR)"/>
<Message Text="Building Native Image - $(NativeImagePath)"/>
2008-11-17 18:29:00 -05:00
<Exec Command="$(NIB) $(_NibArgs) &quot;$(ManifestPath)&quot;"/>
2008-03-05 09:52:00 -05:00
</Target>
<Target Name="BuildAppRuntimeNative">
2008-11-17 18:29:00 -05:00
<MSBuild Projects="$(APPRUNTIMESRCDIR)\Corlib.Native.proj"/>
2008-03-05 09:52:00 -05:00
</Target>
2008-11-17 18:29:00 -05:00
2008-03-05 09:52:00 -05:00
<Import Project="SingSharp.targets"/>
</Project>