From c5c14697de0d2b9da233066ed2d02aef92f8686f Mon Sep 17 00:00:00 2001 From: Lambert Clara Date: Wed, 15 Jul 2020 16:12:36 +0200 Subject: [PATCH 1/6] Make the version unofficial. --- Sharpmake.Application/Properties/AssemblyInfo.cs | 2 +- Sharpmake.Generators/Properties/AssemblyInfo.cs | 2 +- .../Sharpmake.CommonPlatforms/Properties/AssemblyInfo.cs | 2 +- .../Sharpmake.NvShield/Properties/AssemblyInfo.cs | 2 +- Sharpmake.Platforms/Sharpmake.X360/Properties/AssemblyInfo.cs | 2 +- Sharpmake/Properties/AssemblyInfo.cs | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Sharpmake.Application/Properties/AssemblyInfo.cs b/Sharpmake.Application/Properties/AssemblyInfo.cs index e4a3c4074..2467ffcc2 100644 --- a/Sharpmake.Application/Properties/AssemblyInfo.cs +++ b/Sharpmake.Application/Properties/AssemblyInfo.cs @@ -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.1.0")] +[assembly: AssemblyVersion("0.14.1.*")] diff --git a/Sharpmake.Generators/Properties/AssemblyInfo.cs b/Sharpmake.Generators/Properties/AssemblyInfo.cs index 5927a79df..74e93e2b4 100644 --- a/Sharpmake.Generators/Properties/AssemblyInfo.cs +++ b/Sharpmake.Generators/Properties/AssemblyInfo.cs @@ -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.14.1.0")] +[assembly: AssemblyVersion("0.14.1.*")] [assembly: InternalsVisibleTo("Sharpmake")] diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Properties/AssemblyInfo.cs b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Properties/AssemblyInfo.cs index 0bb5d5e10..48e92b040 100644 --- a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Properties/AssemblyInfo.cs +++ b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Properties/AssemblyInfo.cs @@ -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.14.1.0")] +[assembly: AssemblyVersion("0.14.1.*")] [assembly: SharpmakeExtension] diff --git a/Sharpmake.Platforms/Sharpmake.NvShield/Properties/AssemblyInfo.cs b/Sharpmake.Platforms/Sharpmake.NvShield/Properties/AssemblyInfo.cs index 5eebb875f..a4f87c540 100644 --- a/Sharpmake.Platforms/Sharpmake.NvShield/Properties/AssemblyInfo.cs +++ b/Sharpmake.Platforms/Sharpmake.NvShield/Properties/AssemblyInfo.cs @@ -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.14.1.0")] +[assembly: AssemblyVersion("0.14.1.*")] [assembly: SharpmakeExtension] diff --git a/Sharpmake.Platforms/Sharpmake.X360/Properties/AssemblyInfo.cs b/Sharpmake.Platforms/Sharpmake.X360/Properties/AssemblyInfo.cs index cc0bead5a..c1246cc83 100644 --- a/Sharpmake.Platforms/Sharpmake.X360/Properties/AssemblyInfo.cs +++ b/Sharpmake.Platforms/Sharpmake.X360/Properties/AssemblyInfo.cs @@ -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.14.1.0")] +[assembly: AssemblyVersion("0.14.1.*")] [assembly: SharpmakeExtension] diff --git a/Sharpmake/Properties/AssemblyInfo.cs b/Sharpmake/Properties/AssemblyInfo.cs index f31dd231f..e0375e6d8 100644 --- a/Sharpmake/Properties/AssemblyInfo.cs +++ b/Sharpmake/Properties/AssemblyInfo.cs @@ -44,9 +44,9 @@ // // 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.1.0")] +[assembly: AssemblyVersion("0.14.1.*")] #pragma warning disable CS7035 -[assembly: AssemblyFileVersion("0.14.1.0 (LocalBuild)")] +[assembly: AssemblyFileVersion("0.14.1.* (LocalBuild)")] #pragma warning restore [assembly: InternalsVisibleTo("Sharpmake.Application")] From bf10fb6cc4e7ca06e2f6fd2b44d4e431dd0ccaf6 Mon Sep 17 00:00:00 2001 From: Lambert Clara Date: Thu, 16 Jul 2020 15:38:06 +0200 Subject: [PATCH 2/6] [XCode] Harmonize use of tabs in xcodeproj files --- .../Apple/XCodeProj.Template.cs | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Sharpmake.Generators/Apple/XCodeProj.Template.cs b/Sharpmake.Generators/Apple/XCodeProj.Template.cs index d0c94d947..96e9c3c01 100644 --- a/Sharpmake.Generators/Apple/XCodeProj.Template.cs +++ b/Sharpmake.Generators/Apple/XCodeProj.Template.cs @@ -339,37 +339,37 @@ private static class Template buildSettings = { ALWAYS_SEARCH_USER_PATHS = [item.Options.AlwaysSearchUserPaths]; ARCHS = [item.Options.Archs]; - ASSETCATALOG_COMPILER_APPICON_NAME = [item.Options.AssetCatalogCompilerAppIconName]; - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = [item.Options.ClangAnalyzerLocalizabilityNonlocalized]; + ASSETCATALOG_COMPILER_APPICON_NAME = [item.Options.AssetCatalogCompilerAppIconName]; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = [item.Options.ClangAnalyzerLocalizabilityNonlocalized]; CLANG_CXX_LANGUAGE_STANDARD = ""[item.Options.CppStandard]""; CLANG_CXX_LIBRARY = ""[item.Options.LibraryStandard]""; CLANG_ENABLE_OBJC_ARC = [item.Options.AutomaticReferenceCounting]; - CLANG_ENABLE_OBJC_WEAK = [item.Options.ObjCWeakReferences]; - CLANG_ENABLE_MODULES = [item.Options.ClangEnableModules]; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = [item.Options.WarningBlockCaptureAutoReleasing]; + CLANG_ENABLE_OBJC_WEAK = [item.Options.ObjCWeakReferences]; + CLANG_ENABLE_MODULES = [item.Options.ClangEnableModules]; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = [item.Options.WarningBlockCaptureAutoReleasing]; CLANG_WARN_BOOL_CONVERSION = [item.Options.WarningBooleanConversion]; - CLANG_WARN_COMMA = [item.Options.WarningComma]; + CLANG_WARN_COMMA = [item.Options.WarningComma]; CLANG_WARN_CONSTANT_CONVERSION = [item.Options.WarningConstantConversion]; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = [item.Options.WarningDeprecatedObjCImplementations]; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = [item.Options.WarningDeprecatedObjCImplementations]; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = [item.Options.WarningDirectIsaUsage]; CLANG_WARN_EMPTY_BODY = [item.Options.WarningEmptyBody]; CLANG_WARN_ENUM_CONVERSION = [item.Options.WarningEnumConversion]; - CLANG_WARN_INFINITE_RECURSION = [item.Options.WarningInfiniteRecursion]; + CLANG_WARN_INFINITE_RECURSION = [item.Options.WarningInfiniteRecursion]; CLANG_WARN_INT_CONVERSION = [item.Options.WarningIntConversion]; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = [item.Options.WarningNonLiteralNullConversion]; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = [item.Options.WarningObjCImplicitRetainSelf]; - CLANG_WARN_OBJC_LITERAL_CONVERSION = [item.Options.WarningObjCLiteralConversion]; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = [item.Options.WarningNonLiteralNullConversion]; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = [item.Options.WarningObjCImplicitRetainSelf]; + CLANG_WARN_OBJC_LITERAL_CONVERSION = [item.Options.WarningObjCLiteralConversion]; CLANG_WARN_OBJC_ROOT_CLASS = [item.Options.WarningRootClass]; CLANG_WARN__DUPLICATE_METHOD_MATCH = [item.Options.WarningDuplicateMethodMatch]; - CLANG_WARN_RANGE_LOOP_ANALYSIS = [item.Options.WarningRangeLoopAnalysis]; - CLANG_WARN_STRICT_PROTOTYPES = [item.Options.WarningStrictPrototypes]; - CLANG_WARN_SUSPICIOUS_MOVE = [item.Options.WarningSuspiciousMove]; - CLANG_WARN_UNREACHABLE_CODE = [item.Options.WarningUnreachableCode]; - ENABLE_STRICT_OBJC_MSGSEND = [item.Options.StrictObjCMsgSend]; - ENABLE_TESTABILITY = [item.Options.Testability]; + CLANG_WARN_RANGE_LOOP_ANALYSIS = [item.Options.WarningRangeLoopAnalysis]; + CLANG_WARN_STRICT_PROTOTYPES = [item.Options.WarningStrictPrototypes]; + CLANG_WARN_SUSPICIOUS_MOVE = [item.Options.WarningSuspiciousMove]; + CLANG_WARN_UNREACHABLE_CODE = [item.Options.WarningUnreachableCode]; + ENABLE_STRICT_OBJC_MSGSEND = [item.Options.StrictObjCMsgSend]; + ENABLE_TESTABILITY = [item.Options.Testability]; EXECUTABLE_PREFIX = [item.Options.ExecutablePrefix]; GCC_C_LANGUAGE_STANDARD = ""[item.Options.CStandard]""; - GCC_NO_COMMON_BLOCKS = [item.Options.GccNoCommonBlocks]; + GCC_NO_COMMON_BLOCKS = [item.Options.GccNoCommonBlocks]; GCC_PRECOMPILE_PREFIX_HEADER = [item.Options.UsePrecompiledHeader]; GCC_PREFIX_HEADER = ""[item.Options.PrecompiledHeader]""; GCC_OPTIMIZATION_LEVEL = [item.Options.OptimizationLevel]; @@ -383,7 +383,7 @@ private static class Template GCC_TREAT_WARNINGS_AS_ERRORS = [item.Options.TreatWarningsAsErrors]; SDKROOT = ""[item.Options.SDKRoot]""; TARGETED_DEVICE_FAMILY = ""[item.Options.TargetedDeviceFamily]""; - ONLY_ACTIVE_ARCH = [item.Options.OnlyActiveArch]; + ONLY_ACTIVE_ARCH = [item.Options.OnlyActiveArch]; OTHER_CPLUSPLUSFLAGS = [item.Options.CompilerOptions]; OTHER_LDFLAGS = [item.Options.LinkerOptions]; }; From b6be763e0ac58142801686c7c370664ce483c713 Mon Sep 17 00:00:00 2001 From: Lambert Clara Date: Thu, 16 Jul 2020 15:47:02 +0200 Subject: [PATCH 3/6] [FastBuild] Fix preprocessor definitions taking a string argument Note that the behavior is different when running on mac or on windows, the latter requires the whole /D to be wrapped with double quotes and double quotes need to be escaped, whereas on mac none of those are required. - Create a new IBffGenerationContext to enable the platforms to set options differently for vcxproj and bff --- .../FastBuildFunctionalTest.sharpmake.cs | 2 + .../codebase/UsePrecompExe/util.cpp | 2 +- .../projects/mixcppandcexe_vs2017_win64.bff | 48 ++++++++-------- .../postbuildcopydirtest_vs2017_win64.bff | 24 ++++---- ...stbuildcopysinglefiletest_vs2017_win64.bff | 24 ++++---- .../postbuildexecutetest_vs2017_win64.bff | 24 ++++---- .../postbuildtestexecution_vs2017_win64.bff | 24 ++++---- .../requireprebuildstep_vs2017_win64.bff | 24 ++++---- ...plesrcdirsfbnoblobexclude_vs2017_win64.bff | 12 ++-- ...plesrcdirsfbnoblobinclude_vs2017_win64.bff | 12 ++-- ...iplesrcdirsfbunityexclude_vs2017_win64.bff | 12 ++-- ...iplesrcdirsfbunityinclude_vs2017_win64.bff | 12 ++-- .../projects/useprecompexe_vs2017_win64.bff | 56 +++++++++++-------- .../useprecompexe_vs2017_win64.vcxproj | 12 ++-- Sharpmake.Generators/FastBuild/Bff.cs | 40 ++++--------- .../FastBuild/IBffGenerationContext.cs | 26 +++++++++ .../FastBuild/IPlatformBff.cs | 2 + .../Sharpmake.Generators.csproj | 1 + .../VisualStudio/IPlatformVcxproj.cs | 2 + .../VisualStudio/ProjectOptionsGenerator.cs | 23 -------- Sharpmake.Generators/VisualStudio/Vcxproj.cs | 1 + .../Apple/BaseApplePlatform.cs | 49 ++++++++++++++++ .../Sharpmake.CommonPlatforms/BasePlatform.cs | 53 ++++++++++++++++++ ...fastbuildsimpleexecutable_vs2017_win64.bff | 12 ++-- 24 files changed, 301 insertions(+), 196 deletions(-) create mode 100644 Sharpmake.Generators/FastBuild/IBffGenerationContext.cs diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/FastBuildFunctionalTest.sharpmake.cs b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/FastBuildFunctionalTest.sharpmake.cs index 517b8f84f..1df71379f 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/FastBuildFunctionalTest.sharpmake.cs +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/FastBuildFunctionalTest.sharpmake.cs @@ -302,6 +302,8 @@ public override void ConfigureAll(Configuration conf, Target target) conf.PrecompSourceExclude.Add("noprecomp_util.cpp"); conf.PrecompSourceExcludeExtension.Add(".ceepeepee"); + + conf.Defines.Add("SOME_UTILITY_STRING=\"UTIL FUNC\""); } } diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/codebase/UsePrecompExe/util.cpp b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/codebase/UsePrecompExe/util.cpp index 9669c393e..473a38f84 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/codebase/UsePrecompExe/util.cpp +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/codebase/UsePrecompExe/util.cpp @@ -9,5 +9,5 @@ void Util::StaticUtilityMethod() { - printf("%s\n", __func__); + printf(SOME_UTILITY_STRING " => %s\n", __func__); } diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/mixcppandcexe_vs2017_win64.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/mixcppandcexe_vs2017_win64.bff index bd3f59f85..0f1d311cd 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/mixcppandcexe_vs2017_win64.bff +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/mixcppandcexe_vs2017_win64.bff @@ -42,9 +42,9 @@ ObjectList( 'MixCppAndCExe_Debug_FastBuild_NoBlob_vs2017_win64_0_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -119,9 +119,9 @@ ObjectList( 'MixCppAndCExe_Debug_FastBuild_NoBlob_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -273,9 +273,9 @@ ObjectList( 'MixCppAndCExe_Release_FastBuild_NoBlob_vs2017_win64_0_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -351,9 +351,9 @@ ObjectList( 'MixCppAndCExe_Release_FastBuild_NoBlob_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -506,9 +506,9 @@ ObjectList( 'MixCppAndCExe_Debug_FastBuild_vs2017_win64_0_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -583,9 +583,9 @@ ObjectList( 'MixCppAndCExe_Debug_FastBuild_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -737,9 +737,9 @@ ObjectList( 'MixCppAndCExe_Release_FastBuild_vs2017_win64_0_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -815,9 +815,9 @@ ObjectList( 'MixCppAndCExe_Release_FastBuild_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildcopydirtest_vs2017_win64.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildcopydirtest_vs2017_win64.bff index f5620f729..59a686e81 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildcopydirtest_vs2017_win64.bff +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildcopydirtest_vs2017_win64.bff @@ -42,9 +42,9 @@ ObjectList( 'PostBuildCopyDirTest_Debug_FastBuild_NoBlob_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -204,9 +204,9 @@ ObjectList( 'PostBuildCopyDirTest_Release_FastBuild_NoBlob_vs2017_win64_objects' // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -367,9 +367,9 @@ ObjectList( 'PostBuildCopyDirTest_Debug_FastBuild_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -529,9 +529,9 @@ ObjectList( 'PostBuildCopyDirTest_Release_FastBuild_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildcopysinglefiletest_vs2017_win64.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildcopysinglefiletest_vs2017_win64.bff index 8df7411a3..2f28bc48b 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildcopysinglefiletest_vs2017_win64.bff +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildcopysinglefiletest_vs2017_win64.bff @@ -42,9 +42,9 @@ ObjectList( 'PostBuildCopySingleFileTest_Debug_FastBuild_NoBlob_vs2017_win64_obj // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -204,9 +204,9 @@ ObjectList( 'PostBuildCopySingleFileTest_Release_FastBuild_NoBlob_vs2017_win64_o // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -367,9 +367,9 @@ ObjectList( 'PostBuildCopySingleFileTest_Debug_FastBuild_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -529,9 +529,9 @@ ObjectList( 'PostBuildCopySingleFileTest_Release_FastBuild_vs2017_win64_objects' // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildexecutetest_vs2017_win64.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildexecutetest_vs2017_win64.bff index e18965a93..3a8591512 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildexecutetest_vs2017_win64.bff +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildexecutetest_vs2017_win64.bff @@ -42,9 +42,9 @@ ObjectList( 'PostBuildExecuteTest_Debug_FastBuild_NoBlob_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -205,9 +205,9 @@ ObjectList( 'PostBuildExecuteTest_Release_FastBuild_NoBlob_vs2017_win64_objects' // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -369,9 +369,9 @@ ObjectList( 'PostBuildExecuteTest_Debug_FastBuild_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -532,9 +532,9 @@ ObjectList( 'PostBuildExecuteTest_Release_FastBuild_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildtestexecution_vs2017_win64.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildtestexecution_vs2017_win64.bff index ff8d5c296..c4e7eef83 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildtestexecution_vs2017_win64.bff +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildtestexecution_vs2017_win64.bff @@ -42,9 +42,9 @@ ObjectList( 'PostBuildTestExecution_Debug_FastBuild_NoBlob_vs2017_win64_objects' // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -205,9 +205,9 @@ ObjectList( 'PostBuildTestExecution_Release_FastBuild_NoBlob_vs2017_win64_object // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -369,9 +369,9 @@ ObjectList( 'PostBuildTestExecution_Debug_FastBuild_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -532,9 +532,9 @@ ObjectList( 'PostBuildTestExecution_Release_FastBuild_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/requireprebuildstep_vs2017_win64.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/requireprebuildstep_vs2017_win64.bff index 37d0c0188..deff157de 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/requireprebuildstep_vs2017_win64.bff +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/requireprebuildstep_vs2017_win64.bff @@ -43,9 +43,9 @@ ObjectList( 'RequirePreBuildStep_Debug_FastBuild_NoBlob_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -197,9 +197,9 @@ ObjectList( 'RequirePreBuildStep_Release_FastBuild_NoBlob_vs2017_win64_objects' // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -352,9 +352,9 @@ ObjectList( 'RequirePreBuildStep_Debug_FastBuild_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -506,9 +506,9 @@ ObjectList( 'RequirePreBuildStep_Release_FastBuild_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/spanmultiplesrcdirsfbnoblobexclude_vs2017_win64.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/spanmultiplesrcdirsfbnoblobexclude_vs2017_win64.bff index 4f99c4d50..a601c230b 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/spanmultiplesrcdirsfbnoblobexclude_vs2017_win64.bff +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/spanmultiplesrcdirsfbnoblobexclude_vs2017_win64.bff @@ -34,9 +34,9 @@ ObjectList( 'SpanMultipleSrcDirsFBNoBlobExclude_Debug_FastBuild_NoBlob_vs2017_wi // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -198,9 +198,9 @@ ObjectList( 'SpanMultipleSrcDirsFBNoBlobExclude_Release_FastBuild_NoBlob_vs2017_ // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/spanmultiplesrcdirsfbnoblobinclude_vs2017_win64.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/spanmultiplesrcdirsfbnoblobinclude_vs2017_win64.bff index 8cc207b96..9b453ecae 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/spanmultiplesrcdirsfbnoblobinclude_vs2017_win64.bff +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/spanmultiplesrcdirsfbnoblobinclude_vs2017_win64.bff @@ -34,9 +34,9 @@ ObjectList( 'SpanMultipleSrcDirsFBNoBlobInclude_Debug_FastBuild_NoBlob_vs2017_wi // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -195,9 +195,9 @@ ObjectList( 'SpanMultipleSrcDirsFBNoBlobInclude_Release_FastBuild_NoBlob_vs2017_ // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/spanmultiplesrcdirsfbunityexclude_vs2017_win64.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/spanmultiplesrcdirsfbunityexclude_vs2017_win64.bff index 76bddfe57..3c9af70ae 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/spanmultiplesrcdirsfbunityexclude_vs2017_win64.bff +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/spanmultiplesrcdirsfbunityexclude_vs2017_win64.bff @@ -51,9 +51,9 @@ ObjectList( 'SpanMultipleSrcDirsFBUnityExclude_Debug_FastBuild_vs2017_win64_obje // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -204,9 +204,9 @@ ObjectList( 'SpanMultipleSrcDirsFBUnityExclude_Release_FastBuild_vs2017_win64_ob // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/spanmultiplesrcdirsfbunityinclude_vs2017_win64.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/spanmultiplesrcdirsfbunityinclude_vs2017_win64.bff index f20aba08f..149353241 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/spanmultiplesrcdirsfbunityinclude_vs2017_win64.bff +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/spanmultiplesrcdirsfbunityinclude_vs2017_win64.bff @@ -52,9 +52,9 @@ ObjectList( 'SpanMultipleSrcDirsFBUnityInclude_Debug_FastBuild_vs2017_win64_obje // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -205,9 +205,9 @@ ObjectList( 'SpanMultipleSrcDirsFBUnityInclude_Release_FastBuild_vs2017_win64_ob // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/useprecompexe_vs2017_win64.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/useprecompexe_vs2017_win64.bff index edc342728..0fe59278d 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/useprecompexe_vs2017_win64.bff +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/useprecompexe_vs2017_win64.bff @@ -44,9 +44,10 @@ ObjectList( 'UsePrecompExe_Debug_FastBuild_NoBlob_vs2017_win64_0_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' + + ' "/DSOME_UTILITY_STRING=\"UTIL FUNC\""' // Code Generation options // --------------------------- + ' /GF' @@ -136,9 +137,10 @@ ObjectList( 'UsePrecompExe_Debug_FastBuild_NoBlob_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' + + ' "/DSOME_UTILITY_STRING=\"UTIL FUNC\""' // Code Generation options // --------------------------- + ' /GF' @@ -293,9 +295,10 @@ ObjectList( 'UsePrecompExe_Release_FastBuild_NoBlob_vs2017_win64_0_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' + + ' "/DSOME_UTILITY_STRING=\"UTIL FUNC\""' // Code Generation options // --------------------------- + ' /GF' @@ -386,9 +389,10 @@ ObjectList( 'UsePrecompExe_Release_FastBuild_NoBlob_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' + + ' "/DSOME_UTILITY_STRING=\"UTIL FUNC\""' // Code Generation options // --------------------------- + ' /GF' @@ -544,9 +548,10 @@ ObjectList( 'UsePrecompExe_Debug_FastBuild_vs2017_win64_0_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' + + ' "/DSOME_UTILITY_STRING=\"UTIL FUNC\""' // Code Generation options // --------------------------- + ' /GF' @@ -633,9 +638,10 @@ ObjectList( 'UsePrecompExe_Debug_FastBuild_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' + + ' "/DSOME_UTILITY_STRING=\"UTIL FUNC\""' // Code Generation options // --------------------------- + ' /GF' @@ -790,9 +796,10 @@ ObjectList( 'UsePrecompExe_Release_FastBuild_vs2017_win64_0_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' + + ' "/DSOME_UTILITY_STRING=\"UTIL FUNC\""' // Code Generation options // --------------------------- + ' /GF' @@ -880,9 +887,10 @@ ObjectList( 'UsePrecompExe_Release_FastBuild_vs2017_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' + + ' "/DSOME_UTILITY_STRING=\"UTIL FUNC\""' // Code Generation options // --------------------------- + ' /GF' diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/useprecompexe_vs2017_win64.vcxproj b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/useprecompexe_vs2017_win64.vcxproj index 9f0e5b8bc..13f9b7fe0 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/useprecompexe_vs2017_win64.vcxproj +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/useprecompexe_vs2017_win64.vcxproj @@ -103,7 +103,7 @@ del "output\debug_fastbuild_noblob_vs2017\useprecompexe.ilk" >NUL 2>NUL del "output\debug_fastbuild_noblob_vs2017\useprecompexe.lib" >NUL 2>NUL del "output\debug_fastbuild_noblob_vs2017\useprecompexe.pdb" >NUL 2>NUL output\debug_fastbuild_noblob_vs2017\useprecompexe.exe - WIN64;_CONSOLE;_DEBUG + SOME_UTILITY_STRING="UTIL FUNC";WIN64;_CONSOLE;_DEBUG useprecompexe.exe @@ -124,7 +124,7 @@ del "output\debug_fastbuild_vs2017\useprecompexe.ilk" >NUL 2>NUL del "output\debug_fastbuild_vs2017\useprecompexe.lib" >NUL 2>NUL del "output\debug_fastbuild_vs2017\useprecompexe.pdb" >NUL 2>NUL output\debug_fastbuild_vs2017\useprecompexe.exe - WIN64;_CONSOLE;_DEBUG + SOME_UTILITY_STRING="UTIL FUNC";WIN64;_CONSOLE;_DEBUG useprecompexe.exe @@ -156,7 +156,7 @@ del "output\release_fastbuild_noblob_vs2017\useprecompexe.ilk" >NUL 2>NUL del "output\release_fastbuild_noblob_vs2017\useprecompexe.lib" >NUL 2>NUL del "output\release_fastbuild_noblob_vs2017\useprecompexe.pdb" >NUL 2>NUL output\release_fastbuild_noblob_vs2017\useprecompexe.exe - NDEBUG;WIN64;_CONSOLE + NDEBUG;SOME_UTILITY_STRING="UTIL FUNC";WIN64;_CONSOLE useprecompexe.exe @@ -177,7 +177,7 @@ del "output\release_fastbuild_vs2017\useprecompexe.ilk" >NUL 2>NUL del "output\release_fastbuild_vs2017\useprecompexe.lib" >NUL 2>NUL del "output\release_fastbuild_vs2017\useprecompexe.pdb" >NUL 2>NUL output\release_fastbuild_vs2017\useprecompexe.exe - NDEBUG;WIN64;_CONSOLE + NDEBUG;SOME_UTILITY_STRING="UTIL FUNC";WIN64;_CONSOLE useprecompexe.exe @@ -196,7 +196,7 @@ del "output\release_fastbuild_vs2017\useprecompexe.pdb" >NUL 2>NULUse Level4 Disabled - WIN64;_CONSOLE;_DEBUG;%(PreprocessorDefinitions);$(PreprocessorDefinitions) + SOME_UTILITY_STRING="UTIL FUNC";WIN64;_CONSOLE;_DEBUG;%(PreprocessorDefinitions);$(PreprocessorDefinitions) ProgramDatabase true false @@ -281,7 +281,7 @@ del "output\release_fastbuild_vs2017\useprecompexe.pdb" >NUL 2>NULUse Level4 Full - NDEBUG;WIN64;_CONSOLE;%(PreprocessorDefinitions);$(PreprocessorDefinitions) + NDEBUG;SOME_UTILITY_STRING="UTIL FUNC";WIN64;_CONSOLE;%(PreprocessorDefinitions);$(PreprocessorDefinitions) ProgramDatabase true false diff --git a/Sharpmake.Generators/FastBuild/Bff.cs b/Sharpmake.Generators/FastBuild/Bff.cs index 61cc5c250..af35840b5 100644 --- a/Sharpmake.Generators/FastBuild/Bff.cs +++ b/Sharpmake.Generators/FastBuild/Bff.cs @@ -25,7 +25,7 @@ namespace Sharpmake.Generators.FastBuild { public partial class Bff : IProjectGenerator { - private class BffGenerationContext : IGenerationContext + private class BffGenerationContext : IBffGenerationContext { private Resolver _envVarResolver; @@ -35,6 +35,8 @@ private class BffGenerationContext : IGenerationContext public Project.Configuration Configuration { get; set; } + public IReadOnlyList ProjectConfigurations { get; } + public string ProjectDirectory { get; } public Options.ExplicitOptions Options { get; set; } = new Options.ExplicitOptions(); @@ -62,13 +64,17 @@ public Resolver EnvironmentVariableResolver } } - public BffGenerationContext(Builder builder, Project project, string projectDir) + public IReadOnlyDictionary PresentPlatforms { get; } + + public BffGenerationContext(Builder builder, Project project, string projectDir, IEnumerable projectConfigurations) { Builder = builder; Project = project; ProjectDirectory = projectDir; ProjectDirectoryCapitalized = Util.GetCapitalizedPath(projectDir); ProjectSourceCapitalized = Util.GetCapitalizedPath(project.SourceRootPath); + ProjectConfigurations = projectConfigurations as IReadOnlyList; + PresentPlatforms = ProjectConfigurations.Select(conf => conf.Platform).Distinct().ToDictionary(p => p, PlatformRegistry.Get); } public void SelectOption(params Options.OptionAction[] options) @@ -196,7 +202,7 @@ List skipFiles Project.Configuration firstConf = configurations.First(); string projectName = firstConf.ProjectName; string projectPath = new FileInfo(projectFile).Directory.FullName; - var context = new BffGenerationContext(builder, project, projectPath); + var context = new BffGenerationContext(builder, project, projectPath, configurations); string projectBffFile = Bff.GetBffFileName(projectPath, firstConf.BffFileName); // TODO: bff file name could be different per conf, hence we would generate more than one file string fastBuildClrSupport = Util.IsDotNet(firstConf) ? "/clr" : FileGeneratorUtilities.RemoveLineTag; List filesInNonDefaultSection; @@ -1344,6 +1350,8 @@ private static void GenerateBffOptions( targetPlatformVersionString = GetLatestTargetPlatformVersion(context.Configuration.Compiler); } + var platformBff = context.PresentPlatforms[context.Configuration.Platform]; + var resolverParams = new[] { new VariableAssignment("project", context.Project), new VariableAssignment("target", context.Configuration.Target), @@ -1353,8 +1361,7 @@ private static void GenerateBffOptions( var platformDescriptor = PlatformRegistry.Get(context.Configuration.Platform); context.EnvironmentVariableResolver = platformDescriptor.GetPlatformEnvironmentResolver(resolverParams); projectOptionsGen.GenerateOptions(context); - - GenerateResourceCompilerOptions(context, platformDescriptor); + platformBff.SelectPreprocessorDefinitionsBff(context); FillIncludeDirectoriesOptions(context); @@ -1364,29 +1371,6 @@ private static void GenerateBffOptions( additionalDependenciesPerConf.Add(context.Configuration, additionalDependencies); } - private static void GenerateResourceCompilerOptions(BffGenerationContext context, IPlatformDescriptor platformDescriptor) - { - Strings resourceDefines = Options.GetStrings(context.Configuration); - if (resourceDefines.Any()) - { - var fastBuildDefines = new List(); - string platformDefineSwitch = platformDescriptor.IsUsingClang ? "-D" : "/D"; - - foreach (string resourceDefine in resourceDefines) - { - if (string.IsNullOrWhiteSpace(resourceDefine)) - continue; - - fastBuildDefines.Add(string.Concat(platformDefineSwitch, resourceDefine)); - } - context.CommandLineOptions["ResourcePreprocessorDefinitions"] = string.Join($"'{Environment.NewLine} + ' ", fastBuildDefines); - } - else - { - context.CommandLineOptions["ResourcePreprocessorDefinitions"] = FileGeneratorUtilities.RemoveLineTag; - } - } - private static void FillIncludeDirectoriesOptions(BffGenerationContext context) { // TODO: really not ideal, refactor and move the properties we need from it someplace else diff --git a/Sharpmake.Generators/FastBuild/IBffGenerationContext.cs b/Sharpmake.Generators/FastBuild/IBffGenerationContext.cs new file mode 100644 index 000000000..0b6aff8d3 --- /dev/null +++ b/Sharpmake.Generators/FastBuild/IBffGenerationContext.cs @@ -0,0 +1,26 @@ +// Copyright (c) 2017 Ubisoft Entertainment +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Sharpmake.Generators.FastBuild +{ + public interface IBffGenerationContext : IGenerationContext + { + IReadOnlyList ProjectConfigurations { get; } + } +} diff --git a/Sharpmake.Generators/FastBuild/IPlatformBff.cs b/Sharpmake.Generators/FastBuild/IPlatformBff.cs index a5591c7e6..9d30a19db 100644 --- a/Sharpmake.Generators/FastBuild/IPlatformBff.cs +++ b/Sharpmake.Generators/FastBuild/IPlatformBff.cs @@ -60,6 +60,8 @@ public interface IPlatformBff /// `true` if a prefix is required, `false` otherwise. bool AddLibPrefix(Configuration conf); + void SelectPreprocessorDefinitionsBff(IBffGenerationContext context); + /// /// Setups extra linker settings for linking with that platform. /// diff --git a/Sharpmake.Generators/Sharpmake.Generators.csproj b/Sharpmake.Generators/Sharpmake.Generators.csproj index d90321539..cc09870e8 100644 --- a/Sharpmake.Generators/Sharpmake.Generators.csproj +++ b/Sharpmake.Generators/Sharpmake.Generators.csproj @@ -68,6 +68,7 @@ + diff --git a/Sharpmake.Generators/VisualStudio/IPlatformVcxproj.cs b/Sharpmake.Generators/VisualStudio/IPlatformVcxproj.cs index 2d66fd6a9..11ba20137 100644 --- a/Sharpmake.Generators/VisualStudio/IPlatformVcxproj.cs +++ b/Sharpmake.Generators/VisualStudio/IPlatformVcxproj.cs @@ -71,6 +71,8 @@ public interface IPlatformVcxproj void SelectApplicationFormatOptions(IGenerationContext context); void SelectBuildType(IGenerationContext context); + void SelectPreprocessorDefinitionsVcxproj(IVcxprojGenerationContext context); + bool HasPrecomp(IGenerationContext context); void GenerateSdkVcxproj(IVcxprojGenerationContext context, IFileGenerator generator); diff --git a/Sharpmake.Generators/VisualStudio/ProjectOptionsGenerator.cs b/Sharpmake.Generators/VisualStudio/ProjectOptionsGenerator.cs index 25ba9cd62..c5970bab5 100644 --- a/Sharpmake.Generators/VisualStudio/ProjectOptionsGenerator.cs +++ b/Sharpmake.Generators/VisualStudio/ProjectOptionsGenerator.cs @@ -976,29 +976,6 @@ private void GenerateCompilerOptions(IGenerationContext context, ProjectOptionsG context.CommandLineOptions["UndefinePreprocessorDefinitions"] = FileGeneratorUtilities.RemoveLineTag; } - // concat defines, don't add options.Defines since they are automatically added by VS - Strings defines = new Strings(); - defines.AddRange(context.Options.ExplicitDefines); - defines.AddRange(context.Configuration.Defines); - - context.Options["PreprocessorDefinitions"] = defines.JoinStrings(";"); - - context.CommandLineOptions["PreprocessorDefinitions"] = FileGeneratorUtilities.RemoveLineTag; - if (defines.Count > 0) - { - var fastBuildDefines = new List(); - string platformDefineSwitch = optionsContext.PlatformDescriptor.IsUsingClang ? "-D" : "/D"; - - foreach (string define in defines) - { - if (string.IsNullOrWhiteSpace(define)) - continue; - - fastBuildDefines.Add(string.Concat(platformDefineSwitch, define)); - } - context.CommandLineOptions["PreprocessorDefinitions"] = string.Join($"'{Environment.NewLine} + ' ", fastBuildDefines); - } - // UndefineAllPreprocessorDefinitions context.CommandLineOptions["UndefineAllPreprocessorDefinitions"] = FileGeneratorUtilities.RemoveLineTag; diff --git a/Sharpmake.Generators/VisualStudio/Vcxproj.cs b/Sharpmake.Generators/VisualStudio/Vcxproj.cs index 3be2912d2..c4e5ec022 100644 --- a/Sharpmake.Generators/VisualStudio/Vcxproj.cs +++ b/Sharpmake.Generators/VisualStudio/Vcxproj.cs @@ -327,6 +327,7 @@ private void GenerateConfOptions(GenerationContext context) context.CommandLineOptions = new ProjectOptionsGenerator.VcxprojCmdLineOptions(); projectOptionsGen.GenerateOptions(context); + platformVcxproj.SelectPreprocessorDefinitionsVcxproj(context); FillIncludeDirectoriesOptions(context); FillLibrariesOptions(context); diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/BaseApplePlatform.cs b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/BaseApplePlatform.cs index 339408857..76f4bb19f 100644 --- a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/BaseApplePlatform.cs +++ b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Apple/BaseApplePlatform.cs @@ -81,6 +81,50 @@ protected virtual void WriteCompilerExtraOptionsGeneral(IFileGenerator generator public bool AddLibPrefix(Configuration conf) => true; + public virtual void SelectPreprocessorDefinitionsBff(IBffGenerationContext context) + { + var platformDescriptor = PlatformRegistry.Get(context.Configuration.Platform); + string platformDefineSwitch = platformDescriptor.IsUsingClang ? "-D" : "/D"; + + // concat defines, don't add options.Defines since they are automatically added by VS + var defines = new Strings(); + defines.AddRange(context.Options.ExplicitDefines); + defines.AddRange(context.Configuration.Defines); + + if (defines.Count > 0) + { + var fastBuildDefines = new List(); + + foreach (string define in defines) + { + if (!string.IsNullOrWhiteSpace(define)) + fastBuildDefines.Add(string.Concat(platformDefineSwitch, define)); + } + context.CommandLineOptions["PreprocessorDefinitions"] = string.Join($"'{Environment.NewLine} + ' ", fastBuildDefines); + } + else + { + context.CommandLineOptions["PreprocessorDefinitions"] = FileGeneratorUtilities.RemoveLineTag; + } + + Strings resourceDefines = Options.GetStrings(context.Configuration); + if (resourceDefines.Any()) + { + var fastBuildDefines = new List(); + + foreach (string resourceDefine in resourceDefines) + { + if (!string.IsNullOrWhiteSpace(resourceDefine)) + fastBuildDefines.Add(string.Concat(platformDefineSwitch, resourceDefine)); + } + context.CommandLineOptions["ResourcePreprocessorDefinitions"] = string.Join($"'{Environment.NewLine} + ' ", fastBuildDefines); + } + else + { + context.CommandLineOptions["ResourcePreprocessorDefinitions"] = FileGeneratorUtilities.RemoveLineTag; + } + } + [Obsolete("Use " + nameof(SetupExtraLinkerSettings) + " and pass the conf", error: true)] public void SetupExtraLinkerSettings(IFileGenerator fileGenerator, Project.Configuration.OutputType outputType, string fastBuildOutputFile) { @@ -885,6 +929,11 @@ public void SelectBuildType(IGenerationContext context) { } + public virtual void SelectPreprocessorDefinitionsVcxproj(IVcxprojGenerationContext context) + { + throw new NotImplementedException(SimplePlatformString + " should not be called by a Vcxproj generator"); + } + public bool HasPrecomp(IGenerationContext context) { return !string.IsNullOrEmpty(context.Configuration.PrecompHeader); diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/BasePlatform.cs b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/BasePlatform.cs index d097d742d..7d321bfec 100644 --- a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/BasePlatform.cs +++ b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/BasePlatform.cs @@ -66,6 +66,49 @@ public virtual bool AddLibPrefix(Configuration conf) return false; } + public virtual void SelectPreprocessorDefinitionsBff(IBffGenerationContext context) + { + var platformDescriptor = PlatformRegistry.Get(context.Configuration.Platform); + string platformDefineSwitch = platformDescriptor.IsUsingClang ? "-D" : "/D"; + + var defines = new Strings(); + defines.AddRange(context.Options.ExplicitDefines); + defines.AddRange(context.Configuration.Defines); + + if (defines.Count > 0) + { + var fastBuildDefines = new List(); + + foreach (string define in defines) + { + if (!string.IsNullOrWhiteSpace(define)) + fastBuildDefines.Add(string.Format(@"""{0}{1}""", platformDefineSwitch, define.Replace(Util.DoubleQuotes, Util.EscapedDoubleQuotes))); + } + context.CommandLineOptions["PreprocessorDefinitions"] = string.Join($"'{Environment.NewLine} + ' ", fastBuildDefines); + } + else + { + context.CommandLineOptions["PreprocessorDefinitions"] = FileGeneratorUtilities.RemoveLineTag; + } + + Strings resourceDefines = Options.GetStrings(context.Configuration); + if (resourceDefines.Any()) + { + var fastBuildDefines = new List(); + + foreach (string resourceDefine in resourceDefines) + { + if (!string.IsNullOrWhiteSpace(resourceDefine)) + fastBuildDefines.Add(string.Format(@"""{0}{1}""", platformDefineSwitch, resourceDefine.Replace(Util.DoubleQuotes, Util.EscapedDoubleQuotes))); + } + context.CommandLineOptions["ResourcePreprocessorDefinitions"] = string.Join($"'{Environment.NewLine} + ' ", fastBuildDefines); + } + else + { + context.CommandLineOptions["ResourcePreprocessorDefinitions"] = FileGeneratorUtilities.RemoveLineTag; + } + } + [Obsolete("Use " + nameof(SetupExtraLinkerSettings) + " and pass the conf")] public virtual void SetupExtraLinkerSettings(IFileGenerator fileGenerator, Project.Configuration.OutputType outputType, string fastBuildOutputFile) { @@ -201,6 +244,16 @@ public virtual void SelectBuildType(IGenerationContext context) { } + public virtual void SelectPreprocessorDefinitionsVcxproj(IVcxprojGenerationContext context) + { + // concat defines, don't add options.Defines since they are automatically added by VS + var defines = new Strings(); + defines.AddRange(context.Options.ExplicitDefines); + defines.AddRange(context.Configuration.Defines); + + context.Options["PreprocessorDefinitions"] = defines.JoinStrings(";"); + } + public virtual bool HasPrecomp(IGenerationContext context) { Project.Configuration conf = context.Configuration; diff --git a/samples/FastBuildSimpleExecutable/reference/projects/fastbuildsimpleexecutable_vs2017_win64.bff b/samples/FastBuildSimpleExecutable/reference/projects/fastbuildsimpleexecutable_vs2017_win64.bff index 77f3bb5d1..3ad564952 100644 --- a/samples/FastBuildSimpleExecutable/reference/projects/fastbuildsimpleexecutable_vs2017_win64.bff +++ b/samples/FastBuildSimpleExecutable/reference/projects/fastbuildsimpleexecutable_vs2017_win64.bff @@ -32,9 +32,9 @@ ObjectList( 'FastBuildSimpleExecutable_Debug_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DWIN64' - + ' /D_CONSOLE' - + ' /D_DEBUG' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/D_DEBUG"' // Code Generation options // --------------------------- + ' /GF' @@ -183,9 +183,9 @@ ObjectList( 'FastBuildSimpleExecutable_Release_win64_objects' ) // + ' /MP' // Preprocessor options // --------------------------- - + ' /DNDEBUG' - + ' /DWIN64' - + ' /D_CONSOLE' + + ' "/D_CONSOLE"' + + ' "/DWIN64"' + + ' "/DNDEBUG"' // Code Generation options // --------------------------- + ' /GF' From ac30f23011d655bd8cdfacb64f681d79609b30cd Mon Sep 17 00:00:00 2001 From: Lambert Clara Date: Thu, 16 Jul 2020 16:38:50 +0200 Subject: [PATCH 4/6] Fix functional_test base class so it uses the new style --- functional_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functional_test.py b/functional_test.py index 611ef1926..00d6eac2f 100644 --- a/functional_test.py +++ b/functional_test.py @@ -11,7 +11,7 @@ import select -class FunctionalTest: +class FunctionalTest(object): def __init__(self, directory, script_name, project_root = ""): self.directory = directory self.script_name = script_name From 1a76a6d10efdd75579539eefe54cc1ae5a664081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christophe=20PLOURDE-DE-LA-CHEVROTI=C3=88RE?= Date: Thu, 16 Jul 2020 14:52:42 +0000 Subject: [PATCH 5/6] New fix to IncludeSystemPaths for MSBuild + MSVC IncludeSystemPaths were overwriting the default IncludeDirectories. Now, they are properly added after them. --- .../Sharpmake.CommonPlatforms/Windows/BaseWindowsPlatform.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Windows/BaseWindowsPlatform.cs b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Windows/BaseWindowsPlatform.cs index 8df1b6c44..0ac5eb9be 100644 --- a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Windows/BaseWindowsPlatform.cs +++ b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Windows/BaseWindowsPlatform.cs @@ -124,7 +124,7 @@ public override void SetupSdkOptions(IGenerationContext context) { systemIncludes.Sort(); if (context.Options["IncludePath"] == FileGeneratorUtilities.RemoveLineTag) - context.Options["IncludePath"] = systemIncludes.JoinStrings(";"); + context.Options["IncludePath"] = "$(VC_IncludePath);$(WindowsSDK_IncludePath);" + systemIncludes.JoinStrings(";"); else context.Options["IncludePath"] += ";" + systemIncludes.JoinStrings(";"); } From 0b606a850b6bdf838cf64b8d5c782bd4135b909b Mon Sep 17 00:00:00 2001 From: Lambert Clara Date: Thu, 16 Jul 2020 17:40:39 +0200 Subject: [PATCH 6/6] Bump version number to 0.14.2 --- Sharpmake.Application/Properties/AssemblyInfo.cs | 2 +- Sharpmake.Generators/Properties/AssemblyInfo.cs | 2 +- .../Sharpmake.CommonPlatforms/Properties/AssemblyInfo.cs | 2 +- .../Sharpmake.NvShield/Properties/AssemblyInfo.cs | 2 +- Sharpmake.Platforms/Sharpmake.X360/Properties/AssemblyInfo.cs | 2 +- Sharpmake/Properties/AssemblyInfo.cs | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Sharpmake.Application/Properties/AssemblyInfo.cs b/Sharpmake.Application/Properties/AssemblyInfo.cs index 2467ffcc2..d7f064cdd 100644 --- a/Sharpmake.Application/Properties/AssemblyInfo.cs +++ b/Sharpmake.Application/Properties/AssemblyInfo.cs @@ -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.1.*")] +[assembly: AssemblyVersion("0.14.2.0")] diff --git a/Sharpmake.Generators/Properties/AssemblyInfo.cs b/Sharpmake.Generators/Properties/AssemblyInfo.cs index 74e93e2b4..9f0318a89 100644 --- a/Sharpmake.Generators/Properties/AssemblyInfo.cs +++ b/Sharpmake.Generators/Properties/AssemblyInfo.cs @@ -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.14.1.*")] +[assembly: AssemblyVersion("0.14.2.0")] [assembly: InternalsVisibleTo("Sharpmake")] diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Properties/AssemblyInfo.cs b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Properties/AssemblyInfo.cs index 48e92b040..fbdbfc300 100644 --- a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Properties/AssemblyInfo.cs +++ b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Properties/AssemblyInfo.cs @@ -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.14.1.*")] +[assembly: AssemblyVersion("0.14.2.0")] [assembly: SharpmakeExtension] diff --git a/Sharpmake.Platforms/Sharpmake.NvShield/Properties/AssemblyInfo.cs b/Sharpmake.Platforms/Sharpmake.NvShield/Properties/AssemblyInfo.cs index a4f87c540..98ea66df3 100644 --- a/Sharpmake.Platforms/Sharpmake.NvShield/Properties/AssemblyInfo.cs +++ b/Sharpmake.Platforms/Sharpmake.NvShield/Properties/AssemblyInfo.cs @@ -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.14.1.*")] +[assembly: AssemblyVersion("0.14.2.0")] [assembly: SharpmakeExtension] diff --git a/Sharpmake.Platforms/Sharpmake.X360/Properties/AssemblyInfo.cs b/Sharpmake.Platforms/Sharpmake.X360/Properties/AssemblyInfo.cs index c1246cc83..8438bba78 100644 --- a/Sharpmake.Platforms/Sharpmake.X360/Properties/AssemblyInfo.cs +++ b/Sharpmake.Platforms/Sharpmake.X360/Properties/AssemblyInfo.cs @@ -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.14.1.*")] +[assembly: AssemblyVersion("0.14.2.0")] [assembly: SharpmakeExtension] diff --git a/Sharpmake/Properties/AssemblyInfo.cs b/Sharpmake/Properties/AssemblyInfo.cs index e0375e6d8..45021237f 100644 --- a/Sharpmake/Properties/AssemblyInfo.cs +++ b/Sharpmake/Properties/AssemblyInfo.cs @@ -44,9 +44,9 @@ // // 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.1.*")] +[assembly: AssemblyVersion("0.14.2.0")] #pragma warning disable CS7035 -[assembly: AssemblyFileVersion("0.14.1.* (LocalBuild)")] +[assembly: AssemblyFileVersion("0.14.2.0 (LocalBuild)")] #pragma warning restore [assembly: InternalsVisibleTo("Sharpmake.Application")]