Skip to content

Commit

Permalink
Merge branch 'release-0.17.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
belkiss committed Aug 23, 2021
2 parents 57c3b87 + a017c34 commit cc0ff32
Show file tree
Hide file tree
Showing 48 changed files with 910 additions and 314 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,15 @@ jobs:
dotnet "projects\helloworldmultiframeworks\output\anycpu\${{ matrix.configuration }}\netcoreapp3.1\HelloWorldMultiFrameworks.dll"
& "projects\helloworldmultiframeworks\output\anycpu\${{ matrix.configuration }}\net461\HelloWorldMultiFrameworks.exe"
- name: NetCore/DotNetOSMultiFrameworksHelloWorld ${{ matrix.configuration }}
if: runner.os == 'Windows'
working-directory: 'samples/NetCore/DotNetOSMultiFrameworksHelloWorld'
run: |
& $env:SHARPMAKE_EXE "/sources('HelloWorld.sharpmake.cs')"
& $env:COMPILE_BATCH codebase\temp\solutions\OSMultiFrameworksHelloWorldSolution.sln "${{ matrix.configuration }}" "Any CPU"
& "codebase\temp\bin\anycpu_${{ matrix.configuration }}\net5.0-windows\HelloWorldExe.exe"
& "codebase\temp\bin\anycpu_${{ matrix.configuration }}\net472\HelloWorldExe.exe"
- name: PackageReferences ${{ matrix.configuration }}
if: runner.os == 'Windows'
working-directory: 'samples/PackageReferences'
Expand All @@ -298,7 +307,7 @@ jobs:
- name: Install Qt
if: runner.os == 'Windows'
uses: jurplel/install-qt-action@v2.13.2
uses: jurplel/install-qt-action@v2.14.0

- name: QTFileCustomBuild ${{ matrix.configuration }}
if: runner.os == 'Windows'
Expand Down
19 changes: 4 additions & 15 deletions Sharpmake.Application/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,11 @@ public static void DebugWrite(string format, params object[] args)
DebugWrite(string.Format(format, args));
}

public static void DebugWrite(string message)
public static void DebugWrite(string msg)
{
if (DebugEnable)
{
TimeSpan span = DateTime.Now - s_startTime;

string prefix = string.Format("[{0:00}:{1:00}] ", span.Minutes, span.Seconds);
message = prefix + message;

Console.Write(message);
if (Debugger.IsAttached)
Trace.Write(message);
LogWrite(msg);
}
}

Expand All @@ -125,9 +118,7 @@ public static void WarningWrite(string format, params object[] args)
public static void WarningWrite(string msg)
{
Interlocked.Increment(ref s_warningCount);
Console.Write(msg);
if (Debugger.IsAttached)
Trace.Write(msg);
LogWrite("[WARNING]" + msg);
}

public static void WarningWriteLine(string format, params object[] args)
Expand All @@ -148,9 +139,7 @@ public static void ErrorWrite(string format, params object[] args)
public static void ErrorWrite(string msg)
{
Interlocked.Increment(ref s_errorCount);
Console.Write(msg);
if (Debugger.IsAttached)
Trace.Write(msg);
LogWrite("[ERROR]" + msg);
}

public static void ErrorWriteLine(string format, params object[] args)
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.17.1.0")]
[assembly: AssemblyVersion("0.17.2.0")]
2 changes: 1 addition & 1 deletion Sharpmake.Generators/Apple/XCodeProj.Template.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private static class Template
CODE_SIGN_IDENTITY = ""[item.Options.CodeSigningIdentity]"";
""CODE_SIGN_IDENTITY[sdk=iphoneos*]"" = ""[item.Options.CodeSigningIdentity]"";
CONFIGURATION_BUILD_DIR = ""[item.Options.BuildDirectory]"";
CONFIGURATION_TEMP_DIR = ""$(OBJROOT)"";
CONFIGURATION_TEMP_DIR = ""[item.Configuration.IntermediatePath]"";
COPY_PHASE_STRIP = [item.Options.StripDebugSymbolsDuringCopy];
DEAD_CODE_STRIPPING = [item.Options.DeadStripping];
DEBUG_INFORMATION_FORMAT = [item.Options.DebugInformationFormat];
Expand Down
30 changes: 4 additions & 26 deletions Sharpmake.Generators/FastBuild/Bff.Template.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System;

namespace Sharpmake.Generators.FastBuild
{
public partial class Bff
Expand Down Expand Up @@ -334,20 +332,14 @@ public static class ConfigurationFile

public static string MasmCompilerExtraOptions = @"
.CompilerExtraOptions = ''
// General options
// ---------------------------
+ ' /nologo'
+ ' /W3'
+ ' /errorReport:queue'
// Preprocessor options
// ---------------------------
+ ' [cmdLineOptions.PreprocessorDefinitions]'
";

public static string CPPCompilerExtraOptions = @"
.CompilerExtraOptions = ''
// General options
// ---------------------------
+ ' [cmdLineOptions.AdditionalIncludeDirectories]'
+ ' [cmdLineOptions.AdditionalUsingDirectories]'
+ ' [cmdLineOptions.DebugInformationFormat]'
Expand All @@ -356,22 +348,17 @@ public static class ConfigurationFile
+ ' [cmdLineOptions.SuppressStartupBanner]'
+ ' [cmdLineOptions.WarningLevel]'
+ ' [cmdLineOptions.TreatWarningAsError]'
+ ' [cmdLineOptions.ExternalWarningLevel]'
+ ' [cmdLineOptions.DiagnosticsFormat]'
+ ' [cmdLineOptions.EnableASAN]'
+ ' [fastBuildCompileAsC]'
// Multi-threaded build is already handled by FASTBuild
// + ' [cmdLineOptions.MultiProcessorCompilation]'
+ ' [cmdLineOptions.ConfigurationType]'
// Preprocessor options
// ---------------------------
+ ' [cmdLineOptions.PreprocessorDefinitions]'
+ ' [cmdLineOptions.UndefinePreprocessorDefinitions]'
+ ' [cmdLineOptions.UndefineAllPreprocessorDefinitions]'
+ ' [cmdLineOptions.IgnoreStandardIncludePath]'
+ ' [cmdLineOptions.GeneratePreprocessedFile]'
+ ' [cmdLineOptions.KeepComments]'
// Code Generation options
// ---------------------------
+ ' [cmdLineOptions.StringPooling]'
+ ' [cmdLineOptions.MinimalRebuild]'
+ ' [cmdLineOptions.ExceptionHandling]'
Expand All @@ -387,8 +374,6 @@ public static class ConfigurationFile
+ ' [cmdLineOptions.CompilerCreateHotpatchableImage]'
+ ' [cmdLineOptions.SupportJustMyCode]'
+ ' [cmdLineOptions.SpectreMitigation]'
// Language options
// ---------------------------
+ ' [cmdLineOptions.DisableLanguageExtensions]'
+ ' [cmdLineOptions.TreatWChar_tAsBuiltInType]'
+ ' [cmdLineOptions.ForceConformanceInForLoopScope]'
Expand All @@ -398,29 +383,22 @@ public static class ConfigurationFile
+ ' [cmdLineOptions.LanguageStandard_C]'
+ ' [cmdLineOptions.LanguageStandard]'
+ ' [cmdLineOptions.ConformanceMode]'
// Output Files options
// ---------------------------
+ ' [cmdLineOptions.CompilerProgramDatabaseFile]'
// Advanced options
// ---------------------------
+ ' [cmdLineOptions.CallingConvention]'
+ ' [cmdLineOptions.DisableSpecificWarnings]'
+ ' [cmdLineOptions.ForcedIncludeFiles]'
+ ' [fastBuildSourceFileType]'
+ ' [fastBuildAdditionalCompilerOptionsFromCode]'
+ ' /errorReport:queue'
// Character Set
// ---------------------------
+ ' [cmdLineOptions.TranslateIncludes]'
+ ' [cmdLineOptions.TreatAngleIncludeAsExternal]'
+ ' [cmdLineOptions.ExternalTemplatesDiagnostics]'
+ ' [cmdLineOptions.CharacterSet]'
// Additional compiler options
//--------------------------
+ ' [options.AdditionalCompilerOptions]'
+ ' [fastBuildCompilerForceUsing]'
";
public static string CPPCompilerOptimizationOptions =
@"
// Optimizations options
// ---------------------
.CompilerOptimizations = ''
+ ' [cmdLineOptions.Optimization]'
+ ' [cmdLineOptions.InlineFunctionExpansion]'
Expand Down
24 changes: 10 additions & 14 deletions Sharpmake.Generators/FastBuild/Bff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -726,8 +726,6 @@ List<string> skipFiles
case Options.Vc.General.PlatformToolset.LLVM:
case Options.Vc.General.PlatformToolset.ClangCL:
// <!-- Set the value of _MSC_VER to claim for compatibility -->
// TODO: figure out what version number to put there
// maybe use the DevEnv value
string mscVer = Options.GetString<Options.Clang.Compiler.MscVersion>(conf);
if (string.IsNullOrEmpty(mscVer))
{
Expand All @@ -745,6 +743,9 @@ List<string> skipFiles
case Options.Vc.General.PlatformToolset.v142:
mscVer = "1920";
break;
case Options.Vc.General.PlatformToolset.v143:
mscVer = "1930";
break;
default:
throw new Error("LLVMVcPlatformToolset! Platform toolset override '{0}' not supported", overridenPlatformToolset);
}
Expand All @@ -759,6 +760,9 @@ List<string> skipFiles
case DevEnv.vs2019:
mscVer = "1920";
break;
case DevEnv.vs2022:
mscVer = "1930";
break;
default:
throw new Error("Clang-cl used with unsupported DevEnv: " + context.DevelopmentEnvironment.ToString());
}
Expand Down Expand Up @@ -1451,18 +1455,10 @@ private static void FillIncludeDirectoriesOptions(BffGenerationContext context)
var resourceDirs = new List<string>();
resourceDirs.AddRange(resourceIncludePaths.Select(p => CmdLineConvertIncludePathsFunc(context, context.EnvironmentVariableResolver, p, defaultCmdLineIncludePrefix)));

if (Options.GetObject<Options.Vc.General.PlatformToolset>(context.Configuration).IsLLVMToolchain() &&
Options.GetObject<Options.Vc.LLVM.UseClangCl>(context.Configuration) == Options.Vc.LLVM.UseClangCl.Enable)
{
// with LLVM as toolchain, we are still using the default resource compiler, so we need the default include prefix
// TODO: this is not great, ideally we would need the prefix to be per "compiler", and a platform can have many
var platformIncludePathsDefaultPrefix = platformIncludePaths.Select(p => CmdLineConvertIncludePathsFunc(context, context.EnvironmentVariableResolver, p.Path, defaultCmdLineIncludePrefix));
resourceDirs.AddRange(platformIncludePathsDefaultPrefix);
}
else
{
resourceDirs.AddRange(platformIncludePathsPrefixed);
}
// with LLVM as toolchain, we are still using the default resource compiler, so we need the default include prefix
// TODO: this is not great, ideally we would need the prefix to be per "compiler", and a platform can have many
var platformIncludePathsDefaultPrefix = platformIncludePaths.Select(p => CmdLineConvertIncludePathsFunc(context, context.EnvironmentVariableResolver, p.Path, defaultCmdLineIncludePrefix));
resourceDirs.AddRange(platformIncludePathsDefaultPrefix);

if (resourceDirs.Any())
context.CommandLineOptions["AdditionalResourceIncludeDirectories"] = string.Join($"'{Environment.NewLine} + ' ", resourceDirs);
Expand Down
12 changes: 8 additions & 4 deletions Sharpmake.Generators/GeneratorManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ public void Generate(Builder builder,
}
else
{
switch (configurations[0].Target.GetFragment<DevEnv>())
DevEnv devEnv = configurations[0].Target.GetFragment<DevEnv>();
switch (devEnv)
{
case DevEnv.make:
{
Expand All @@ -101,6 +102,7 @@ public void Generate(Builder builder,
case DevEnv.vs2015:
case DevEnv.vs2017:
case DevEnv.vs2019:
case DevEnv.vs2022:
{
VcxprojGenerator.Generate(builder, project, configurations, projectFile, generatedFiles, skipFiles);
BffGenerator.Generate(builder, project, configurations, projectFile, generatedFiles, skipFiles);
Expand All @@ -114,7 +116,7 @@ public void Generate(Builder builder,
}
default:
{
throw new Error("Generate called with unknown DevEnv: " + configurations[0].Target.GetFragment<DevEnv>());
throw new Error("Generate called with unknown DevEnv: " + devEnv);
}
}
}
Expand All @@ -137,7 +139,8 @@ public void Generate(Builder builder,
}
else
{
switch (configurations[0].Target.GetFragment<DevEnv>())
DevEnv devEnv = configurations[0].Target.GetFragment<DevEnv>();
switch (devEnv)
{
case DevEnv.make:
{
Expand All @@ -150,6 +153,7 @@ public void Generate(Builder builder,
case DevEnv.vs2015:
case DevEnv.vs2017:
case DevEnv.vs2019:
case DevEnv.vs2022:
{
if (UtilityMethods.HasFastBuildConfig(configurations))
{
Expand All @@ -161,7 +165,7 @@ public void Generate(Builder builder,
}
default:
{
throw new Error("Generate called with unknown DevEnv: " + configurations[0].Target.GetFragment<DevEnv>());
throw new Error("Generate called with unknown DevEnv: " + devEnv);
}
}
}
Expand Down
21 changes: 19 additions & 2 deletions Sharpmake.Generators/Generic/Makefile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -562,14 +562,15 @@ private Options.ExplicitOptions GenerateOptions(Project.Configuration conf, File
options["OutputFile"] = conf.TargetFileFullNameWithExtension.Replace(" ", @"\ ");

// DependenciesLibraryFiles
OrderableStrings dependenciesLibraryFiles = new OrderableStrings(conf.DependenciesLibraryFiles);
PathMakeUnix(dependenciesLibraryFiles);
var dependenciesLibraryFiles = new OrderableStrings(conf.DependenciesLibraryFiles);
FixupLibraryNames(dependenciesLibraryFiles);
dependenciesLibraryFiles.InsertPrefix("-l:");
dependenciesLibraryFiles.Sort();
options["DependenciesLibraryFiles"] = dependenciesLibraryFiles.JoinStrings(" ");

// LibraryFiles
OrderableStrings libraryFiles = new OrderableStrings(conf.LibraryFiles);
FixupLibraryNames(libraryFiles);
libraryFiles.InsertPrefix("-l:");
libraryFiles.Sort();
options["LibraryFiles"] = libraryFiles.JoinStrings(" ");
Expand Down Expand Up @@ -696,6 +697,22 @@ private string GetOutputDirectory(Project.Configuration conf, FileInfo projectFi
return Util.PathGetRelative(projectFileInfo.DirectoryName, conf.TargetPath);
}

private static void FixupLibraryNames(IList<string> paths)
{
for (int i = 0; i < paths.Count; ++i)
{
string libraryName = PathMakeUnix(paths[i]);
// We've got two kinds of way of listing a library:
// - With a filename without extension we must add the potential prefix and potential extension.
// - With a filename with a static or shared lib extension (eg. .a/.so), we shouldn't touch it as it's already set by the script.
string extension = Path.GetExtension(libraryName).ToLowerInvariant();
if (extension != ".a" && extension != ".so")
paths[i] = "lib" + libraryName + ".a";
else
paths[i] = libraryName;
}
}

#endregion

#region Utils
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.17.1.0")]
[assembly: AssemblyVersion("0.17.2.0")]

[assembly: InternalsVisibleTo("Sharpmake")]
2 changes: 1 addition & 1 deletion Sharpmake.Generators/VisualStudio/Androidproj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ private void GenerateOptions(GenerationContext context)
if (appLibConf.Output != Project.Configuration.OutputType.Dll)
throw new Error("Cannot use configuration \"{0}\" as app lib for package configuration \"{1}\". Output type must be set to dynamic library.", appLibConf, conf);

options["AndroidAppLibName"] = appLibConf.TargetFileFullName;
options["AndroidAppLibName"] = appLibConf.TargetFilePrefix + appLibConf.TargetFileName + appLibConf.TargetFileSuffix;
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions Sharpmake.Generators/VisualStudio/Csproj.Template.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ public static class Project
<GenerateAssemblyInformationalVersionAttribute>[GeneratedAssemblyConfigTemplate.GenerateAssemblyInformationalVersionAttribute]</GenerateAssemblyInformationalVersionAttribute>
<RestoreProjectStyle>[NugetRestoreProjectStyleString]</RestoreProjectStyle>
<ProductVersion>[options.ProductVersion]</ProductVersion>
<UseWpf>[options.UseWpf]</UseWpf>
<UseWindowsForms>[options.UseWindowsForms]</UseWindowsForms>
</PropertyGroup>
";

Expand Down
Loading

0 comments on commit cc0ff32

Please sign in to comment.