mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
38f0d27901
* We also only use GIT_COMMIT_HASH where necessary to avoid rebuilding many files for no reason, including splitting version.cpp out into a separate project as we do with VS since otherwise changing its preprocessor defines rebuilds the whole renderdoc project. * At the same time, move the git hash to be internal only so we don't have to try to link version.cpp into other projects like renderdoccmd or qrenderdoc.
127 lines
5.6 KiB
XML
127 lines
5.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
<ItemGroup Label="ProjectConfigurations">
|
|
<ProjectConfiguration Include="Development|Win32">
|
|
<Configuration>Development</Configuration>
|
|
<Platform>Win32</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="Release|Win32">
|
|
<Configuration>Release</Configuration>
|
|
<Platform>Win32</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="Development|x64">
|
|
<Configuration>Development</Configuration>
|
|
<Platform>x64</Platform>
|
|
</ProjectConfiguration>
|
|
<ProjectConfiguration Include="Release|x64">
|
|
<Configuration>Release</Configuration>
|
|
<Platform>x64</Platform>
|
|
</ProjectConfiguration>
|
|
</ItemGroup>
|
|
<PropertyGroup Label="Globals">
|
|
<ProjectGuid>{257FD75C-4D17-4A23-A754-23BFD85887A0}</ProjectGuid>
|
|
<Keyword>Win32Proj</Keyword>
|
|
<RootNamespace>version</RootNamespace>
|
|
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
|
<ProjectName>version</ProjectName>
|
|
</PropertyGroup>
|
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
<PropertyGroup>
|
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
|
<UseDebugLibraries>false</UseDebugLibraries>
|
|
<PlatformToolset>v140</PlatformToolset>
|
|
<CharacterSet>Unicode</CharacterSet>
|
|
</PropertyGroup>
|
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
<ImportGroup Label="PropertySheets">
|
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
</ImportGroup>
|
|
<PropertyGroup>
|
|
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
|
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
|
|
<IncludePath>$(SolutionDir)\breakpad;$(IncludePath)</IncludePath>
|
|
<LibraryPath>$(LibraryPath)</LibraryPath>
|
|
<ExcludePath>$(ExcludePath)</ExcludePath>
|
|
</PropertyGroup>
|
|
<PropertyGroup>
|
|
<IntDir>$(SolutionDir)$(Platform)\$(Configuration)\obj\$(ProjectName)\</IntDir>
|
|
</PropertyGroup>
|
|
<ItemDefinitionGroup>
|
|
<ClCompile>
|
|
<WarningLevel>Level3</WarningLevel>
|
|
<Optimization>Disabled</Optimization>
|
|
</ClCompile>
|
|
<Link>
|
|
<SubSystem>Windows</SubSystem>
|
|
</Link>
|
|
</ItemDefinitionGroup>
|
|
<ItemDefinitionGroup Condition="'$(Platform)'=='x64'">
|
|
<ClCompile>
|
|
<PreprocessorDefinitions>WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
</ClCompile>
|
|
</ItemDefinitionGroup>
|
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
<!-- Thanks to https://stackoverflow.com/a/43815817/4070143 -->
|
|
<!-- fetch the path of the assembly, and unescape it so MSBuild doesn't choke on brackets in "Program Files (x86)" -->
|
|
<PropertyGroup>
|
|
<LibGit2SharpPath>$([MSBuild]::Unescape("$(DevEnvDir)\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\LibGit2Sharp.dll"))</LibGit2SharpPath>
|
|
<LibGit2SharpPath Condition="!exists('$(LibGit2SharpPath)')">$([MSBuild]::Unescape("$(VSInstallDir)\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\LibGit2Sharp.dll"))</LibGit2SharpPath>
|
|
</PropertyGroup>
|
|
<!-- Declare the task with some inline code -->
|
|
<UsingTask TaskName="GetGitCommit" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
|
|
<ParameterGroup>
|
|
<Sha1 ParameterType="System.String" Required="False" Output="True" />
|
|
<Repository ParameterType="System.String" Required="True" Output="False" />
|
|
<LibGit2SharpAssemblyPath ParameterType="System.String" Required="True" Output="False" />
|
|
</ParameterGroup>
|
|
<Task>
|
|
<Reference Include="$(LibGit2SharpPath)" />
|
|
<Code Type="Class" Language="cs">
|
|
using System;
|
|
using System.Linq;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace GitIntrospection {
|
|
public class GetGitCommit : Microsoft.Build.Utilities.Task {
|
|
public override bool Execute() {
|
|
System.AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => {
|
|
if (args.Name.Contains("LibGit2Sharp")) {
|
|
return System.Reflection.Assembly.LoadFrom(LibGit2SharpAssemblyPath);
|
|
}
|
|
return null;
|
|
};
|
|
GetCommit();
|
|
return !Log.HasLoggedErrors;
|
|
}
|
|
private void GetCommit() {
|
|
try {
|
|
Sha1 = (new LibGit2Sharp.Repository(Repository)).Commits.First().Id.Sha;
|
|
} catch(LibGit2Sharp.RepositoryNotFoundException) {
|
|
}
|
|
}
|
|
|
|
[Microsoft.Build.Framework.Required] public string Repository { get; set; }
|
|
[Microsoft.Build.Framework.Required] public string LibGit2SharpAssemblyPath { get; set; }
|
|
[Microsoft.Build.Framework.Output] public string Sha1 { get; set; }
|
|
}
|
|
}
|
|
</Code>
|
|
</Task>
|
|
</UsingTask>
|
|
<PropertyGroup><DisableFastUpToDateCheck>true</DisableFastUpToDateCheck></PropertyGroup>
|
|
<!-- Only actually run the task if we located the assembly for LibGit2Sharp. Otherwise silently skip this step. -->
|
|
<Target Name="RunTask" BeforeTargets="PrepareForBuild" Condition="exists('$(LibGit2SharpPath)')">
|
|
<GetGitCommit Repository="$(SolutionDir)" LibGit2SharpAssemblyPath="$(LibGit2SharpPath)" ContinueOnError="WarnAndContinue">
|
|
<Output TaskParameter="Sha1" PropertyName="CommitId" />
|
|
</GetGitCommit>
|
|
<Message Importance="high" Text="Building from Git commit $(CommitId)" />
|
|
<ItemGroup Condition="$(CommitId.Length) > 0">
|
|
<ClCompile>
|
|
<PreprocessorDefinitions>GIT_COMMIT_HASH="$(CommitId)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
</ClCompile>
|
|
</ItemGroup>
|
|
</Target>
|
|
<ItemGroup>
|
|
<ClCompile Include="replay\version.cpp" />
|
|
</ItemGroup>
|
|
</Project> |