Skip to content

Commit

Permalink
Merge branch 'release-0.14.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
belkiss committed Oct 12, 2020
2 parents e3886d2 + b66b765 commit de84348
Show file tree
Hide file tree
Showing 74 changed files with 2,685 additions and 467 deletions.
1 change: 1 addition & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
image:
- Visual Studio 2017
- macOS
- Ubuntu

skip_commits:
files:
Expand Down
2 changes: 1 addition & 1 deletion Sharpmake.Application/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.14.4.0")]
[assembly: AssemblyVersion("0.14.5.0")]
5 changes: 2 additions & 3 deletions Sharpmake.Application/Sharpmake.Application.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand All @@ -24,7 +23,7 @@
<Optimize>false</Optimize>
<OutputPath>..\bin\debug</OutputPath>
<IntermediateOutputPath>..\tmp\obj\debug\sharpmake.application</IntermediateOutputPath>
<BaseIntermediateOutputPath>..\tmp\obj\Debug\Sharpmake.Application</BaseIntermediateOutputPath>
<BaseIntermediateOutputPath>..\tmp\obj\debug\sharpmake.application</BaseIntermediateOutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand All @@ -39,7 +38,7 @@
<Optimize>true</Optimize>
<OutputPath>..\bin\release</OutputPath>
<IntermediateOutputPath>..\tmp\obj\release\sharpmake.application</IntermediateOutputPath>
<BaseIntermediateOutputPath>..\tmp\obj\Release\Sharpmake.Application</BaseIntermediateOutputPath>
<BaseIntermediateOutputPath>..\tmp\obj\release\sharpmake.application</BaseIntermediateOutputPath>
<DefineConstants>TRACE</DefineConstants>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,27 @@ public static ITarget[] GetDefaultTargets()
}
}

public class SortableBuildStepCopy : Sharpmake.Project.Configuration.BuildStepCopy
{
public int Order;

public SortableBuildStepCopy(string sourcePath, string destinationPath, bool isNameSpecific = false, string copyPattern = "*", bool fileCopy = true) :
base(sourcePath, destinationPath, isNameSpecific, copyPattern, fileCopy)
{
}

public override int CompareTo(object obj)
{
if (obj == null)
return 1;

if (obj is SortableBuildStepCopy)
return Order.CompareTo((obj as SortableBuildStepCopy).Order);

return 0;
}
}

public abstract class CommonProject : Project
{
public CommonProject()
Expand Down Expand Up @@ -318,19 +339,21 @@ public override void ConfigureAll(Configuration conf, Target target)
{
base.ConfigureAll(conf, target);

string tempGeneratedPath = @"[project.SharpmakeCsPath]\projects\generated";
string generatedHeaderFile = Path.Combine(tempGeneratedPath, "header_generated_by_prebuild_step.h");
string generatedHeaderFilename = "header_generated_by_prebuild_step.h";
string relativeGeneratedHeaderFilePath = Path.Combine("generated", generatedHeaderFilename);
string absoluteGeneratedHeaderPath = Path.Combine("[conf.ProjectPath]", "generated");
string absoluteGeneratedHeaderFilePath = Path.Combine(absoluteGeneratedHeaderPath, generatedHeaderFilename);

// Create a PreBuild step that creates a header file that is required for compilation
var preBuildStep = new Configuration.BuildStepExecutable(
@"[project.SourceRootPath]\execute.bat",
@"[project.SourceRootPath]\main.cpp",
generatedHeaderFile,
"echo #define PREBUILD_GENERATED_DEFINE() 0 > " + generatedHeaderFile);
absoluteGeneratedHeaderFilePath,
"echo #define PREBUILD_GENERATED_DEFINE() 0 > " + relativeGeneratedHeaderFilePath);

conf.EventCustomPrebuildExecute.Add("GenerateHeader", preBuildStep);

conf.IncludePrivatePaths.Add(tempGeneratedPath);
conf.IncludePrivatePaths.Add(absoluteGeneratedHeaderPath);
}
}

Expand Down Expand Up @@ -381,6 +404,45 @@ public override void ConfigureAll(Configuration conf, Target target)
}
}

[Generate]
public class ExplicitlyOrderedPostBuildTest : CommonExeProject
{
public ExplicitlyOrderedPostBuildTest()
{
}

public override void ConfigureAll(Configuration conf, Target target)
{
base.ConfigureAll(conf, target);

// Copy executable (build output) to another folder. This does not need explicit prebuild dependencies
// in FastBuild, since the source path is a file node that is defined by the Executable() function (the linker step).
// Therefore linking the executable is implicitly a prebuild dependency of this copy step.
var copyExeFileBuildStep = new SortableBuildStepCopy(
@"[conf.TargetPath]\[conf.TargetFileName].exe",
@"[conf.TargetPath]\explicitly_ordered_postbuild_test\temp_copy\[conf.TargetFileName].exe");
conf.EventCustomPostBuildExe.Add(copyExeFileBuildStep);

// Copy the PDB to another folder. FastBuild has no knowledge about the source of this pdb file.
// Since we add the BuildStepCopy object to the PostBuildExe list, Sharpmake should create a PreBuildDependency
// for the linker step automatically, to make sure the copy is executed only after the linking, which creates the pdb.
var copyPdbFileBuildStep = new SortableBuildStepCopy(
@"[conf.TargetPath]\[conf.TargetFileName].pdb",
@"[conf.TargetPath]\explicitly_ordered_postbuild_test\temp_copy\[conf.TargetFileName].pdb");
conf.EventCustomPostBuildExe.Add(copyPdbFileBuildStep);

// Copy both .exe & .pdb to another location. This needs explicit ordering to ensure that the folder is only copied
// after the folder is filled with the two previous copy steps.
var copyDirBuildStep = new SortableBuildStepCopy(
@"[conf.TargetPath]\explicitly_ordered_postbuild_test\temp_copy",
@"[conf.TargetPath]\file_copy_destination");
copyDirBuildStep.IsFileCopy = false;
copyDirBuildStep.CopyPattern = "*.*";
copyDirBuildStep.Order = 1;
conf.EventCustomPostBuildExe.Add(copyDirBuildStep);
}
}

[Generate]
public class PostBuildExecuteTest : CommonExeProject
{
Expand Down Expand Up @@ -454,6 +516,7 @@ public void ConfigureAll(Configuration conf, Target target)
conf.AddProject<PostBuildCopyDirTest>(target);
conf.AddProject<PostBuildExecuteTest>(target);
conf.AddProject<PostBuildTestExecution>(target);
conf.AddProject<ExplicitlyOrderedPostBuildTest>(target);

if (target.Blob == Blob.FastBuildUnitys)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

int main(int, char**)
{
return 0;
}
Loading

0 comments on commit de84348

Please sign in to comment.