Skip to content

Commit

Permalink
Merge branch 'release-0.13.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
belkiss committed May 19, 2020
2 parents 91005c4 + b52a9a7 commit 22b37c8
Show file tree
Hide file tree
Showing 61 changed files with 1,726 additions and 710 deletions.
31 changes: 15 additions & 16 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Sharpmake AppVeyor CI configuration

image: Visual Studio 2017
image:
- Visual Studio 2017
- macOS

skip_commits:
files:
- docs/*

platform:
- Any CPU
Expand All @@ -11,22 +17,15 @@ configuration:

before_build:
- cmd: bootstrap.bat
- sh: ./bootstrap.sh

build_script:
- cmd: CompileSharpmake.bat Sharpmake.sln "%CONFIGURATION%" "%PLATFORM%"
- sh: ./CompileSharpmake.sh Sharpmake.sln "${CONFIGURATION}" "${PLATFORM}"

for:
-
matrix:
only:
- configuration: Debug
build_script:
- CompileSharpmake.bat Sharpmake.sln Debug "Any CPU"

-
matrix:
only:
- configuration: Release
build_script:
- CompileSharpmake.bat Sharpmake.sln Release "Any CPU"
test:
assemblies:
- 'Sharpmake.UnitTests\bin\*\Sharpmake.UnitTests.dll'

after_test:
- cmd: python regression_test.py

40 changes: 40 additions & 0 deletions CompileSharpmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/sh
# Script arguments:
# $1: Project/Solution to build
# $2: Target(Normally should be Debug or Release)
# $3: Platform(Normally should be "Any CPU" for sln and AnyCPU for a csproj)
# if none are passed, defaults to building Sharpmake.sln in Debug|Any CPU

function BuildSharpmake {
solutionPath=$1
configuration=$2
platform=$3
echo Compiling $solutionPath in "${configuration}|${platform}"...
MSBUILD_CMD="msbuild -t:build -restore \"${solutionPath}\" /nologo /v:m /p:Configuration=${configuration} /p:Platform=\"${platform}\""
echo $MSBUILD_CMD
eval $MSBUILD_CMD
if [ $? -ne 0 ]; then
echo ERROR: Failed to compile $solutionPath in "${configuration}|${platform}".
exit 1
fi
}

# fail immediately if anything goes wrong
set -e

pushd $(dirname $0) > /dev/null
CURRENT_DIR=$(pwd)
popd > /dev/null

which msbuild > /dev/null
MSBUILD_FOUND=$?
if [ $MSBUILD_FOUND -ne 0 ]; then
echo "MSBuild not found"
exit $MSBUILD_FOUND
fi

SOLUTION_PATH=${1:-"${CURRENT_DIR}/Sharpmake.sln"}
CONFIGURATION=${2:-"Debug"}
PLATFORM=${3:-"Any CPU"}

BuildSharpmake "$SOLUTION_PATH" "$CONFIGURATION" "$PLATFORM"
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ source code also comes with samples that you can study.


## Building Sharpmake
Building Sharpmake is quite straightforward. Clone the repo on GitHub, open the
Building Sharpmake is quite straightforward. Clone the repo on GitHub, run the
"bootstrap" script (".bat" for Windows, ".sh" for Unix platforms), open the
solution in Visual Studio and build the solution in *Release*. The binaries
will be found in the *Sharpmake.Application/bin/Release*. You can run the
*deploy_binaries.py* script to automatically fetch the binaries and copy them
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.11.2.*")]
[assembly: AssemblyVersion("0.13.2.0")]
2 changes: 1 addition & 1 deletion Sharpmake.Generators/Apple/XCodeProj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public partial class XCodeProj : IProjectGenerator
private const int ProjectArchiveVersion = 1;
private const int ProjectObjectVersion = 46;

public const string RemoveLineTag = "REMOVE_LINE_TAG";
public const string RemoveLineTag = FileGeneratorUtilities.RemoveLineTag;

public static readonly char FolderSeparator;

Expand Down
1 change: 1 addition & 0 deletions Sharpmake.Generators/FastBuild/Bff.Template.cs
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ public static class ConfigurationFile
[fastBuildUsingPlatformConfig]
.Intermediate = '[cmdLineOptions.IntermediateDirectory]\'
.Libraries = [fastBuildProjectDependencies]
.PreBuildDependencies = [fastBuildBuildOnlyDependencies]
.LinkerAssemblyResources = { [fastBuildObjectListEmbeddedResources] }
.LinkerOutput = '[fastBuildLinkerOutputFile]'
.LinkerLinkObjects = [fastBuildLinkerLinkObjects]
Expand Down
30 changes: 30 additions & 0 deletions Sharpmake.Generators/FastBuild/Bff.Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,36 @@ private static void GetOrderedFlattenedProjectDependenciesInternal(Project.Confi
}
}

internal static UniqueList<Project.Configuration> GetOrderedFlattenedBuildOnlyDependencies(Project.Configuration conf)
{
var dependencies = new UniqueList<Project.Configuration>();
GetOrderedFlattenedBuildOnlyDependenciesInternal(conf, dependencies);
return dependencies;
}

private static void GetOrderedFlattenedBuildOnlyDependenciesInternal(Project.Configuration conf, UniqueList<Project.Configuration> dependencies)
{
if (!conf.IsFastBuild)
return;

IEnumerable<Project.Configuration> confDependencies = conf.BuildOrderDependencies;

if (confDependencies.Contains(conf))
throw new Error("Cyclic dependency detected in project " + conf);

UniqueList<Project.Configuration> tmpDeps = new UniqueList<Project.Configuration>();
foreach (var dep in confDependencies)
{
GetOrderedFlattenedBuildOnlyDependenciesInternal(dep, tmpDeps);
tmpDeps.Add(dep);
}
foreach (var dep in tmpDeps)
{
if (dep.IsFastBuild && confDependencies.Contains(dep) && (conf != dep))
dependencies.Add(dep);
}
}

public static string FBuildCollectionFormat(Strings collection, int spaceLength, Strings includedExtensions = null)
{
// Select items.
Expand Down
31 changes: 25 additions & 6 deletions Sharpmake.Generators/FastBuild/Bff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ List<string> skipFiles

string fastBuildOutputFileShortName = GetShortProjectName(project, conf);
var fastBuildProjectDependencies = new List<string>();
var fastBuildBuildOnlyDependencies = new List<string>();
var fastBuildProjectExeUtilityDependencyList = new List<string>();

bool mustGenerateLibrary = confSubConfigs.Count > 1 && !useObjectLists && isLastSubConfig && isOutputTypeLib;
Expand Down Expand Up @@ -409,6 +410,23 @@ List<string> skipFiles
fastBuildProjectExeUtilityDependencyList.Add(GetShortProjectName(depProjConfig.Project, depProjConfig));
}
}

orderedProjectDeps = UtilityMethods.GetOrderedFlattenedBuildOnlyDependencies(conf);
foreach (var depProjConfig in orderedProjectDeps)
{
if (depProjConfig.Project == project)
throw new Error("Sharpmake-FastBuild : Project dependencies refers to itself.");

bool isExport = depProjConfig.Project.SharpmakeProjectType == Project.ProjectTypeAttribute.Export;
if (isExport)
continue;

if (depProjConfig.Output != Project.Configuration.OutputType.Exe &&
depProjConfig.Output != Project.Configuration.OutputType.Utility)
{
fastBuildBuildOnlyDependencies.Add(GetShortProjectName(depProjConfig.Project, depProjConfig));
}
}
}

string librarianAdditionalInputs = FileGeneratorUtilities.RemoveLineTag;
Expand Down Expand Up @@ -836,7 +854,7 @@ List<string> skipFiles
List<string> fastbuildEmbeddedResourceFilesList = new List<string>();

var sourceFiles = confSubConfigs[tuple];
foreach (Vcxproj.ProjectFile sourceFile in sourceFiles)
foreach (var sourceFile in sourceFiles)
{
string sourceFileName = CurrentBffPathKeyCombine(sourceFile.FileNameProjectRelative);

Expand Down Expand Up @@ -936,6 +954,7 @@ List<string> skipFiles
using (bffGenerator.Declare("fastBuildEmbeddedResources", fastBuildEmbeddedResources))
using (bffGenerator.Declare("fastBuildPrecompiledSourceFile", fastBuildPrecompiledSourceFile))
using (bffGenerator.Declare("fastBuildProjectDependencies", UtilityMethods.FBuildFormatList(fastBuildProjectDependencies, 30)))
using (bffGenerator.Declare("fastBuildBuildOnlyDependencies", UtilityMethods.FBuildFormatList(fastBuildBuildOnlyDependencies, 30)))
using (bffGenerator.Declare("fastBuildPreBuildTargets", UtilityMethods.FBuildFormatList(fastBuildPreBuildDependencies.ToList(), 28)))
using (bffGenerator.Declare("fastBuildObjectListEmbeddedResources", fastBuildObjectListEmbeddedResources))
using (bffGenerator.Declare("fastBuildCompilerPCHOptions", fastBuildCompilerPCHOptions))
Expand Down Expand Up @@ -1850,25 +1869,25 @@ out List<Vcxproj.ProjectFile> filesInNonDefaultSections
filesInNonDefaultSections = new List<Vcxproj.ProjectFile>();

// Add source files
List<Vcxproj.ProjectFile> allFiles = new List<Vcxproj.ProjectFile>();
var allFiles = new List<Vcxproj.ProjectFile>();
Strings projectFiles = context.Project.GetSourceFilesForConfigurations(configurations);
foreach (string file in projectFiles)
{
Vcxproj.ProjectFile projectFile = new Vcxproj.ProjectFile(context, file);
var projectFile = new Vcxproj.ProjectFile(context, file);
allFiles.Add(projectFile);
}
allFiles.Sort((l, r) => string.Compare(l.FileNameProjectRelative, r.FileNameProjectRelative, StringComparison.InvariantCulture));

List<Vcxproj.ProjectFile> sourceFiles = new List<Vcxproj.ProjectFile>();
foreach (Vcxproj.ProjectFile projectFile in allFiles)
var sourceFiles = new List<Vcxproj.ProjectFile>();
foreach (var projectFile in allFiles)
{
if (context.Project.SourceFilesCompileExtensions.Contains(projectFile.FileExtension) ||
(String.Compare(projectFile.FileExtension, ".rc", StringComparison.OrdinalIgnoreCase) == 0) ||
(String.Compare(projectFile.FileExtension, ".resx", StringComparison.OrdinalIgnoreCase) == 0))
sourceFiles.Add(projectFile);
}

foreach (Vcxproj.ProjectFile file in sourceFiles)
foreach (var file in sourceFiles)
{
foreach (Project.Configuration conf in configurations)
{
Expand Down
2 changes: 1 addition & 1 deletion Sharpmake.Generators/Generic/MakeProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Sharpmake.Generators.Generic
public partial class MakeProject : IProjectGenerator
{
private const string _makefileExtension = ".mk";
private const string RemoveLineTag = "REMOVE_LINE_TAG";
private const string RemoveLineTag = FileGeneratorUtilities.RemoveLineTag;

private Builder _builder;

Expand Down
5 changes: 2 additions & 3 deletions Sharpmake.Generators/IGenerationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ public interface IGenerationContext
string ProjectDirectory { get; }
DevEnv DevelopmentEnvironment { get; }

// The setter on those two should not be there.
Options.ExplicitOptions Options { get; set; }
IDictionary<string, string> CommandLineOptions { get; set; }
Options.ExplicitOptions Options { get; }
IDictionary<string, string> CommandLineOptions { get; }

string ProjectDirectoryCapitalized { get; }
string ProjectSourceCapitalized { get; }
Expand Down
2 changes: 1 addition & 1 deletion Sharpmake.Generators/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.11.2.*")]
[assembly: AssemblyVersion("0.13.2.0")]

[assembly: InternalsVisibleTo("Sharpmake")]
3 changes: 3 additions & 0 deletions Sharpmake.Generators/Sharpmake.Generators.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@
<Compile Include="VisualStudio\UserFile.cs" />
<Compile Include="VisualStudio\Vcxproj.Template.cs" />
<Compile Include="VisualStudio\Vcxproj.cs" />
<Compile Include="VisualStudio\VsProjCommon.Template.cs" />
<Compile Include="VisualStudio\VsProjCommon.cs" />
<Compile Include="VisualStudio\VsUtil.cs" />
<Compile Include="XmlFileGenerator.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
15 changes: 10 additions & 5 deletions Sharpmake.Generators/VisualStudio/Androidproj.Template.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ public static class Project
<MinimumVisualStudioVersion>[toolsVersion]</MinimumVisualStudioVersion>
<ProjectVersion>1.0</ProjectVersion>
<ProjectName>[projectName]</ProjectName>
</PropertyGroup>
<Import Project=""$(AndroidTargetsPath)\Android.Default.props"" />
<AndroidTargetsPath>[androidTargetsPath]</AndroidTargetsPath>
";

public const string ImportAndroidDefaultProps =
@" <Import Project=""$(AndroidTargetsPath)\Android.Default.props"" />
";

// The output directory is converted to a rooted path by prefixing it with $(ProjectDir) to work around
Expand All @@ -62,17 +65,19 @@ public static class Project
<OutDir>$(ProjectDir)[options.OutputDirectory]\</OutDir>
<IntDir>[options.IntermediateDirectory]\</IntDir>
<TargetName>[options.OutputFile]</TargetName>
<ShowAndroidPathsVerbosity>[options.ShowAndroidPathsVerbosity]</ShowAndroidPathsVerbosity>
</PropertyGroup>
";

public const string ProjectAfterConfigurationsGeneral =
@" <Import Project=""$(AndroidTargetsPath)\Android.props"" />
<ImportGroup Label=""ExtensionSettings"" />
<ImportGroup Label=""Shared"" />
<ImportGroup Label=""ExtensionSettings"">
";

public const string ProjectAfterImportedProps =
@" <PropertyGroup Label=""UserMacros"" />
@" </ImportGroup>
<ImportGroup Label=""Shared"" />
<PropertyGroup Label=""UserMacros"" />
";

public const string ProjectConfigurationBeginItemDefinition =
Expand Down
Loading

0 comments on commit 22b37c8

Please sign in to comment.