-
Notifications
You must be signed in to change notification settings - Fork 11
/
MultiFramework.targets
97 lines (81 loc) · 5.13 KB
/
MultiFramework.targets
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
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)Common.targets" Condition=" '$(ManagedOSVRCommon)' == '' "/>
<!-- Handle different framework versions, inspired by
http://stackoverflow.com/a/2928835/265522
and
http://stackoverflow.com/a/4457508/265522
-->
<!-- Default configuration and framework -->
<PropertyGroup>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<Configuration Condition=" '$(Configuration)' == '' and '$(TargetFrameworkVersion)' == '' ">Debug20</Configuration>
</PropertyGroup>
<!-- Framework version specified - populate props appropriately -->
<PropertyGroup Condition=" '$(TargetFrameworkVersion)' != '' ">
<TargetFrameworkBareVersion>$(TargetFrameworkVersion.Replace("v", "").Replace(".", ""))</TargetFrameworkBareVersion>
<!-- Appropriately re-construct the configuration -->
<BaseConfiguration Condition=" $(Configuration.Contains('Debug')) ">Debug</BaseConfiguration>
<BaseConfiguration Condition=" $(Configuration.Contains('Release')) ">Release</BaseConfiguration>
<BaseConfiguration Condition=" '$(Configuration)' == '' ">Debug</BaseConfiguration>
<Configuration>$(BaseConfiguration)(TargetFrameworkBareVersion)</Configuration>
</PropertyGroup>
<!-- OK, so by here, we should have the configuration set to some value, now let's parse it. -->
<PropertyGroup>
<!-- Parse out framework version -->
<TargetFrameworkVersion Condition=" $(Configuration.Contains('45')) ">v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion Condition=" $(Configuration.Contains('20')) ">v2.0</TargetFrameworkVersion>
<!-- Parse out base configurations -->
<BaseConfiguration Condition=" $(Configuration.Contains('Debug')) ">Debug</BaseConfiguration>
<BaseConfiguration Condition=" $(Configuration.Contains('Release')) ">Release</BaseConfiguration>
</PropertyGroup>
<PropertyGroup Condition=" '$(BaseConfiguration)' == 'Release' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(BaseConfiguration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants Condition=" '$(DefineConstants)' != '' ">$(DefineConstants);DEBUG;TRACE</DefineConstants>
<DefineConstants Condition=" '$(DefineConstants)' == '' ">DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<!--<TargetFrameworkBareVersion Condition=" '$(TargetFrameworkBareVersion)' == '' ">$(TargetFrameworkVersion.Replace("v", "").Replace(".", ""))</TargetFrameworkBareVersion>-->
<TargetFrameworkBareVersion>$(TargetFrameworkVersion.Replace("v", "").Replace(".", ""))</TargetFrameworkBareVersion>
<!-- Sets up a property FrameworkString with a value of something like net20 or net45 -->
<FrameworkString>net$(TargetFrameworkBareVersion)</FrameworkString>
<!-- Default root directory -->
<ManagedOSVRRoot Condition=" '$(ManagedOSVRRoot)' == '' ">$(MSBuildProjectDirectory)</ManagedOSVRRoot>
</PropertyGroup>
<!-- Sets up build product locations. If the BuildRoot property is not specified (such as a VS IDE build) it is assumed to be a directory named build in the root of the repository. -->
<Choose>
<When Condition=" '$(BuildRoot)' == '' ">
<PropertyGroup>
<BuildRoot>$(ManagedOSVRRoot)build</BuildRoot>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<BuildRoot>$(ManagedOSVRRoot)$(BuildRoot)</BuildRoot>
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup>
<OutputPath Condition=" '$(OutputPath)' == '' ">$(BuildRoot)\bin\$(FrameworkString)\$(BaseConfiguration)</OutputPath>
<IntermediateOutputPath Condition=" '$(IntermediateOutputPath)' == '' ">$(BuildRoot)\obj\$(FrameworkString)\$(BaseConfiguration)</IntermediateOutputPath>
<!-- Adds compile definitions that are the uppercased FrameworkString -->
<DefineConstants Condition=" !$(DefineConstants.Contains(';NET')) ">$(DefineConstants);NET$(TargetFrameworkBareVersion)</DefineConstants>
<DefineConstants Condition=" $(DefineConstants.Contains(';NET')) ">$(DefineConstants.Remove($(DefineConstants.LastIndexOf(";NET"))));NET$(TargetFrameworkBareVersion)</DefineConstants>
</PropertyGroup>
<!-- Explicitly list out configurations for the sake of Visual Studio, I hope. -->
<PropertyGroup Condition=" '$(Configuration)' == 'Debug45' "></PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug20' "></PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release45' "></PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release20' "></PropertyGroup>
<PropertyGroup Condition="'$(Platform)' == 'AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet Condition=" '$(CodeAnalysisRuleSet)' == '' ">MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
</Project>