diff --git a/.appveyor.yml b/.appveyor.yml index 7574a455f..23e7349fb 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -3,6 +3,7 @@ image: - Visual Studio 2017 - macOS +- Ubuntu skip_commits: files: diff --git a/Sharpmake.Application/Properties/AssemblyInfo.cs b/Sharpmake.Application/Properties/AssemblyInfo.cs index 95a9cc0be..f6b96b822 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.4.0")] +[assembly: AssemblyVersion("0.14.5.0")] diff --git a/Sharpmake.Application/Sharpmake.Application.csproj b/Sharpmake.Application/Sharpmake.Application.csproj index e79745954..47895a7e6 100644 --- a/Sharpmake.Application/Sharpmake.Application.csproj +++ b/Sharpmake.Application/Sharpmake.Application.csproj @@ -1,6 +1,5 @@  - Debug AnyCPU @@ -24,7 +23,7 @@ false ..\bin\debug ..\tmp\obj\debug\sharpmake.application - ..\tmp\obj\Debug\Sharpmake.Application + ..\tmp\obj\debug\sharpmake.application DEBUG;TRACE 4 true @@ -39,7 +38,7 @@ true ..\bin\release ..\tmp\obj\release\sharpmake.application - ..\tmp\obj\Release\Sharpmake.Application + ..\tmp\obj\release\sharpmake.application TRACE 4 true diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/FastBuildFunctionalTest.sharpmake.cs b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/FastBuildFunctionalTest.sharpmake.cs index 1df71379f..2aaee657c 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/FastBuildFunctionalTest.sharpmake.cs +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/FastBuildFunctionalTest.sharpmake.cs @@ -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() @@ -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); } } @@ -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 { @@ -454,6 +516,7 @@ public void ConfigureAll(Configuration conf, Target target) conf.AddProject(target); conf.AddProject(target); conf.AddProject(target); + conf.AddProject(target); if (target.Blob == Blob.FastBuildUnitys) { diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/codebase/ExplicitlyOrderedPostBuildTest/main.cpp b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/codebase/ExplicitlyOrderedPostBuildTest/main.cpp new file mode 100644 index 000000000..d454a9082 --- /dev/null +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/codebase/ExplicitlyOrderedPostBuildTest/main.cpp @@ -0,0 +1,5 @@ + +int main(int, char**) +{ + return 0; +} diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/explicitlyorderedpostbuildtest_vs2017_win64.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/explicitlyorderedpostbuildtest_vs2017_win64.bff new file mode 100644 index 000000000..14267fea2 --- /dev/null +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/explicitlyorderedpostbuildtest_vs2017_win64.bff @@ -0,0 +1,777 @@ + +//================================================================================================================= +// ExplicitlyOrderedPostBuildTest FASTBuild config file +//================================================================================================================= +#once + + +Unity( 'ExplicitlyOrderedPostBuildTest_FastBuildUnitys_unity' ) +{ + .UnityInputPath = '.\$_CURRENT_BFF_DIR_$\..\codebase\ExplicitlyOrderedPostBuildTest' + .UnityInputIsolateWritableFiles = true + .UnityInputIsolateWritableFilesLimit = 10 + .UnityOutputPath = '.\$_CURRENT_BFF_DIR_$\unity\ExplicitlyOrderedPostBuildTest' + .UnityOutputPattern = 'explicitlyorderedpostbuildtest_fastbuildunitys_unity*.cpp' + .UnityNumFiles = 1 +} + +//////////////////////////////////////////////////////////////////////////////// +// PLATFORM SPECIFIC SECTION +#if WIN64 + +//================================================================================================================= +ObjectList( 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_NoBlob_vs2017_win64_objects' ) +{ + Using( .win64Config ) + .Intermediate = '.\$_CURRENT_BFF_DIR_$\build\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\' + + .CompilerExtraOptions = '' + // General options + // --------------------------- + + ' /I"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include"' + + ' /I"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\atlmfc\include"' + + ' /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\um"' + + ' /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\shared"' + + ' /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\winrt"' + + ' /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt"' + + ' /Zi' + + ' /nologo' + + ' /W4' + + ' /WX-' + // Multi-threaded build is already handled by FASTBuild + // + ' /MP' + // Preprocessor options + // --------------------------- + + ' /D"WIN64"' + + ' /D"_CONSOLE"' + + ' /D"_DEBUG"' + // Code Generation options + // --------------------------- + + ' /GF' + + ' /Gm' + + ' /MTd' + + ' /GS' + + ' /Gy-' + + ' /fp:fast' + + ' /fp:except-' + // Language options + // --------------------------- + + ' /Zc:wchar_t' + + ' /Zc:forScope' + + ' /Zc:inline' + + ' /GR-' + + ' /openmp-' + // Output Files options + // --------------------------- + + ' /Fd".\$_CURRENT_BFF_DIR_$\build\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\explicitlyorderedpostbuildtest_compiler.pdb"' + // Advanced options + // --------------------------- + + ' /Gd' + + ' /TP' + + ' /errorReport:queue' + // Character Set + // --------------------------- + + ' /D"_MBCS"' + // Additional compiler options + //-------------------------- + + ' /FS /Zc:__cplusplus' + + // Optimizations options + // --------------------- + .CompilerOptimizations = '' + + ' /Od' + + ' /Ob1' + + ' /Oi' + + ' /Oy-' + + // Compiler options + // ---------------- + .CompilerOptions = '"%1" /Fo"%2" /c' + + ' $CompilerExtraOptions$' + + ' $CompilerOptimizations$' + + .CompilerOutputPath = '$Intermediate$' + .CompilerInputFiles = '.\$_CURRENT_BFF_DIR_$\..\codebase\ExplicitlyOrderedPostBuildTest\main.cpp' + +} + + +//================================================================================================================= +Executable( 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_NoBlob_vs2017_win64_Executable' ) +{ + Using( .win64Config ) + .Intermediate = '.\$_CURRENT_BFF_DIR_$\build\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\' + .Libraries = 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_NoBlob_vs2017_win64_objects' + .LinkerOutput = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.exe' + .LinkerLinkObjects = false + + .LinkerOptions = '/OUT:"%2"' + // General + // --------------------------- + + ' /INCREMENTAL:NO' + + ' /NOLOGO' + + ' /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\lib\x64"' + + ' /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\atlmfc\lib\x64"' + + ' /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\ucrt\x64"' + + ' /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\um\x64"' + // Input + // --------------------------- + + ' "kernel32.lib"' + + ' "user32.lib"' + + ' "gdi32.lib"' + + ' "winspool.lib"' + + ' "comdlg32.lib"' + + ' "advapi32.lib"' + + ' "shell32.lib"' + + ' "ole32.lib"' + + ' "oleaut32.lib"' + + ' "uuid.lib"' + + ' "odbc32.lib"' + + ' "odbccp32.lib"' + // Input files + // --------------------------- + + ' "%1"' + // Manifest + // --------------------------- + + ' /MANIFEST /MANIFESTUAC:"level=^'asInvoker^' uiAccess=^'false^'"' + + ' /ManifestFile:".\$_CURRENT_BFF_DIR_$\build\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\explicitlyorderedpostbuildtest.intermediate.manifest"' + // Debugging + // --------------------------- + + ' /DEBUG' + + ' /PDB:".\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.pdb"' + + ' /MAP":.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.map"' + // System + // --------------------------- + + ' /SUBSYSTEM:CONSOLE' + + ' /LARGEADDRESSAWARE' + // Optimization + // --------------------------- + + ' /OPT:NOREF' + + ' /OPT:NOICF' + // Embedded IDL + // --------------------------- + + ' /TLBID:1' + // Windows Metadata + // --------------------------- + // Advanced + // --------------------------- + + ' /DYNAMICBASE' + + ' /MACHINE:X64' + + ' /errorReport:queue' + // Additional linker options + //-------------------------- +} + + +//================================================================================================================= +Copy( 'Copy_21E34A2D' ) +{ + .Source = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.exe' + .Dest = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_noblob_vs2017\explicitly_ordered_postbuild_test\temp_copy\explicitlyorderedpostbuildtest.exe' + .PreBuildDependencies = 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_NoBlob_vs2017_win64_Executable' +} + + +//================================================================================================================= +Copy( 'Copy_BC977AE9' ) +{ + .Source = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.pdb' + .Dest = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_noblob_vs2017\explicitly_ordered_postbuild_test\temp_copy\explicitlyorderedpostbuildtest.pdb' + .PreBuildDependencies = 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_NoBlob_vs2017_win64_Executable' +} + + +//================================================================================================================= +CopyDir( 'Copy_2784F0C2' ) +{ + .SourcePaths = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_noblob_vs2017\explicitly_ordered_postbuild_test\temp_copy\' + .SourcePathsPattern = '*.*' + .SourcePathsRecurse = true + .Dest = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_noblob_vs2017\file_copy_destination\' + .PreBuildDependencies = { + 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_NoBlob_vs2017_win64_Executable', + 'Copy_21E34A2D', + 'Copy_BC977AE9' + } +} + +//================================================================================================================= +Alias( 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_NoBlob_vs2017_win64' ) +{ + .Targets = { + 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_NoBlob_vs2017_win64_Executable', + 'Copy_21E34A2D', + 'Copy_BC977AE9', + 'Copy_2784F0C2' + } +} + + +//================================================================================================================= +ObjectList( 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_NoBlob_vs2017_win64_objects' ) +{ + Using( .win64Config ) + .Intermediate = '.\$_CURRENT_BFF_DIR_$\build\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\' + + .CompilerExtraOptions = '' + // General options + // --------------------------- + + ' /I"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include"' + + ' /I"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\atlmfc\include"' + + ' /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\um"' + + ' /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\shared"' + + ' /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\winrt"' + + ' /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt"' + + ' /Zi' + + ' /nologo' + + ' /W4' + + ' /WX-' + // Multi-threaded build is already handled by FASTBuild + // + ' /MP' + // Preprocessor options + // --------------------------- + + ' /D"NDEBUG"' + + ' /D"WIN64"' + + ' /D"_CONSOLE"' + // Code Generation options + // --------------------------- + + ' /GF' + + ' /Gm-' + + ' /MT' + + ' /GS-' + + ' /Gy' + + ' /fp:fast' + + ' /fp:except-' + // Language options + // --------------------------- + + ' /Zc:wchar_t' + + ' /Zc:forScope' + + ' /Zc:inline' + + ' /GR-' + + ' /openmp-' + // Output Files options + // --------------------------- + + ' /Fd".\$_CURRENT_BFF_DIR_$\build\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\explicitlyorderedpostbuildtest_compiler.pdb"' + // Advanced options + // --------------------------- + + ' /Gd' + + ' /TP' + + ' /errorReport:queue' + // Character Set + // --------------------------- + + ' /D"_MBCS"' + // Additional compiler options + //-------------------------- + + ' /FS /Zc:__cplusplus' + + // Optimizations options + // --------------------- + .CompilerOptimizations = '' + + ' /Ox' + + ' /Ob2' + + ' /Oi' + + ' /Ot' + + ' /Oy-' + + // Compiler options + // ---------------- + .CompilerOptions = '"%1" /Fo"%2" /c' + + ' $CompilerExtraOptions$' + + ' $CompilerOptimizations$' + + .CompilerOutputPath = '$Intermediate$' + .CompilerInputFiles = '.\$_CURRENT_BFF_DIR_$\..\codebase\ExplicitlyOrderedPostBuildTest\main.cpp' + +} + + +//================================================================================================================= +Executable( 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_NoBlob_vs2017_win64_Executable' ) +{ + Using( .win64Config ) + .Intermediate = '.\$_CURRENT_BFF_DIR_$\build\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\' + .Libraries = 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_NoBlob_vs2017_win64_objects' + .LinkerOutput = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.exe' + .LinkerLinkObjects = false + + .LinkerOptions = '/OUT:"%2"' + // General + // --------------------------- + + ' /INCREMENTAL:NO' + + ' /NOLOGO' + + ' /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\lib\x64"' + + ' /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\atlmfc\lib\x64"' + + ' /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\ucrt\x64"' + + ' /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\um\x64"' + // Input + // --------------------------- + + ' "kernel32.lib"' + + ' "user32.lib"' + + ' "gdi32.lib"' + + ' "winspool.lib"' + + ' "comdlg32.lib"' + + ' "advapi32.lib"' + + ' "shell32.lib"' + + ' "ole32.lib"' + + ' "oleaut32.lib"' + + ' "uuid.lib"' + + ' "odbc32.lib"' + + ' "odbccp32.lib"' + // Input files + // --------------------------- + + ' "%1"' + // Manifest + // --------------------------- + + ' /MANIFEST /MANIFESTUAC:"level=^'asInvoker^' uiAccess=^'false^'"' + + ' /ManifestFile:".\$_CURRENT_BFF_DIR_$\build\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\explicitlyorderedpostbuildtest.intermediate.manifest"' + // Debugging + // --------------------------- + + ' /DEBUG' + + ' /PDB:".\$_CURRENT_BFF_DIR_$\output\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.pdb"' + + ' /MAP":.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.map"' + // System + // --------------------------- + + ' /SUBSYSTEM:CONSOLE' + + ' /LARGEADDRESSAWARE' + // Optimization + // --------------------------- + + ' /OPT:REF' + + ' /OPT:ICF' + // Embedded IDL + // --------------------------- + + ' /TLBID:1' + // Windows Metadata + // --------------------------- + // Advanced + // --------------------------- + + ' /DYNAMICBASE' + + ' /MACHINE:X64' + + ' /errorReport:queue' + // Additional linker options + //-------------------------- +} + + +//================================================================================================================= +Copy( 'Copy_2DCB92CD' ) +{ + .Source = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.exe' + .Dest = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_noblob_vs2017\explicitly_ordered_postbuild_test\temp_copy\explicitlyorderedpostbuildtest.exe' + .PreBuildDependencies = 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_NoBlob_vs2017_win64_Executable' +} + + +//================================================================================================================= +Copy( 'Copy_3BAA3409' ) +{ + .Source = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.pdb' + .Dest = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_noblob_vs2017\explicitly_ordered_postbuild_test\temp_copy\explicitlyorderedpostbuildtest.pdb' + .PreBuildDependencies = 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_NoBlob_vs2017_win64_Executable' +} + + +//================================================================================================================= +CopyDir( 'Copy_6007A422' ) +{ + .SourcePaths = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_noblob_vs2017\explicitly_ordered_postbuild_test\temp_copy\' + .SourcePathsPattern = '*.*' + .SourcePathsRecurse = true + .Dest = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_noblob_vs2017\file_copy_destination\' + .PreBuildDependencies = { + 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_NoBlob_vs2017_win64_Executable', + 'Copy_2DCB92CD', + 'Copy_3BAA3409' + } +} + +//================================================================================================================= +Alias( 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_NoBlob_vs2017_win64' ) +{ + .Targets = { + 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_NoBlob_vs2017_win64_Executable', + 'Copy_2DCB92CD', + 'Copy_3BAA3409', + 'Copy_6007A422' + } +} + + +//================================================================================================================= +ObjectList( 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_vs2017_win64_objects' ) +{ + Using( .win64Config ) + .Intermediate = '.\$_CURRENT_BFF_DIR_$\build\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest\' + + .CompilerExtraOptions = '' + // General options + // --------------------------- + + ' /I"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include"' + + ' /I"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\atlmfc\include"' + + ' /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\um"' + + ' /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\shared"' + + ' /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\winrt"' + + ' /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt"' + + ' /Zi' + + ' /nologo' + + ' /W4' + + ' /WX-' + // Multi-threaded build is already handled by FASTBuild + // + ' /MP' + // Preprocessor options + // --------------------------- + + ' /D"WIN64"' + + ' /D"_CONSOLE"' + + ' /D"_DEBUG"' + // Code Generation options + // --------------------------- + + ' /GF' + + ' /Gm' + + ' /MTd' + + ' /GS' + + ' /Gy-' + + ' /fp:fast' + + ' /fp:except-' + // Language options + // --------------------------- + + ' /Zc:wchar_t' + + ' /Zc:forScope' + + ' /Zc:inline' + + ' /GR-' + + ' /openmp-' + // Output Files options + // --------------------------- + + ' /Fd".\$_CURRENT_BFF_DIR_$\build\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest\explicitlyorderedpostbuildtest_compiler.pdb"' + // Advanced options + // --------------------------- + + ' /Gd' + + ' /TP' + + ' /errorReport:queue' + // Character Set + // --------------------------- + + ' /D"_MBCS"' + // Additional compiler options + //-------------------------- + + ' /FS /Zc:__cplusplus' + + // Optimizations options + // --------------------- + .CompilerOptimizations = '' + + ' /Od' + + ' /Ob1' + + ' /Oi' + + ' /Oy-' + + // Compiler options + // ---------------- + .CompilerOptions = '"%1" /Fo"%2" /c' + + ' $CompilerExtraOptions$' + + ' $CompilerOptimizations$' + + .CompilerInputUnity = 'ExplicitlyOrderedPostBuildTest_FastBuildUnitys_unity' + .CompilerOutputPath = '$Intermediate$' + +} + + +//================================================================================================================= +Executable( 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_vs2017_win64_Executable' ) +{ + Using( .win64Config ) + .Intermediate = '.\$_CURRENT_BFF_DIR_$\build\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest\' + .Libraries = 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_vs2017_win64_objects' + .LinkerOutput = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest.exe' + .LinkerLinkObjects = false + + .LinkerOptions = '/OUT:"%2"' + // General + // --------------------------- + + ' /INCREMENTAL:NO' + + ' /NOLOGO' + + ' /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\lib\x64"' + + ' /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\atlmfc\lib\x64"' + + ' /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\ucrt\x64"' + + ' /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\um\x64"' + // Input + // --------------------------- + + ' "kernel32.lib"' + + ' "user32.lib"' + + ' "gdi32.lib"' + + ' "winspool.lib"' + + ' "comdlg32.lib"' + + ' "advapi32.lib"' + + ' "shell32.lib"' + + ' "ole32.lib"' + + ' "oleaut32.lib"' + + ' "uuid.lib"' + + ' "odbc32.lib"' + + ' "odbccp32.lib"' + // Input files + // --------------------------- + + ' "%1"' + // Manifest + // --------------------------- + + ' /MANIFEST /MANIFESTUAC:"level=^'asInvoker^' uiAccess=^'false^'"' + + ' /ManifestFile:".\$_CURRENT_BFF_DIR_$\build\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest\explicitlyorderedpostbuildtest.intermediate.manifest"' + // Debugging + // --------------------------- + + ' /DEBUG' + + ' /PDB:".\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest.pdb"' + + ' /MAP":.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest.map"' + // System + // --------------------------- + + ' /SUBSYSTEM:CONSOLE' + + ' /LARGEADDRESSAWARE' + // Optimization + // --------------------------- + + ' /OPT:NOREF' + + ' /OPT:NOICF' + // Embedded IDL + // --------------------------- + + ' /TLBID:1' + // Windows Metadata + // --------------------------- + // Advanced + // --------------------------- + + ' /DYNAMICBASE' + + ' /MACHINE:X64' + + ' /errorReport:queue' + // Additional linker options + //-------------------------- +} + + +//================================================================================================================= +Copy( 'Copy_82284415' ) +{ + .Source = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest.exe' + .Dest = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_vs2017\explicitly_ordered_postbuild_test\temp_copy\explicitlyorderedpostbuildtest.exe' + .PreBuildDependencies = 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_vs2017_win64_Executable' +} + + +//================================================================================================================= +Copy( 'Copy_60A01E55' ) +{ + .Source = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest.pdb' + .Dest = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_vs2017\explicitly_ordered_postbuild_test\temp_copy\explicitlyorderedpostbuildtest.pdb' + .PreBuildDependencies = 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_vs2017_win64_Executable' +} + + +//================================================================================================================= +CopyDir( 'Copy_4F4A088A' ) +{ + .SourcePaths = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_vs2017\explicitly_ordered_postbuild_test\temp_copy\' + .SourcePathsPattern = '*.*' + .SourcePathsRecurse = true + .Dest = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_vs2017\file_copy_destination\' + .PreBuildDependencies = { + 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_vs2017_win64_Executable', + 'Copy_82284415', + 'Copy_60A01E55' + } +} + +//================================================================================================================= +Alias( 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_vs2017_win64' ) +{ + .Targets = { + 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_vs2017_win64_Executable', + 'Copy_82284415', + 'Copy_60A01E55', + 'Copy_4F4A088A' + } +} + + +//================================================================================================================= +ObjectList( 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_vs2017_win64_objects' ) +{ + Using( .win64Config ) + .Intermediate = '.\$_CURRENT_BFF_DIR_$\build\release_fastbuild_vs2017\explicitlyorderedpostbuildtest\' + + .CompilerExtraOptions = '' + // General options + // --------------------------- + + ' /I"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\include"' + + ' /I"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\atlmfc\include"' + + ' /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\um"' + + ' /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\shared"' + + ' /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\winrt"' + + ' /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\ucrt"' + + ' /Zi' + + ' /nologo' + + ' /W4' + + ' /WX-' + // Multi-threaded build is already handled by FASTBuild + // + ' /MP' + // Preprocessor options + // --------------------------- + + ' /D"NDEBUG"' + + ' /D"WIN64"' + + ' /D"_CONSOLE"' + // Code Generation options + // --------------------------- + + ' /GF' + + ' /Gm-' + + ' /MT' + + ' /GS-' + + ' /Gy' + + ' /fp:fast' + + ' /fp:except-' + // Language options + // --------------------------- + + ' /Zc:wchar_t' + + ' /Zc:forScope' + + ' /Zc:inline' + + ' /GR-' + + ' /openmp-' + // Output Files options + // --------------------------- + + ' /Fd".\$_CURRENT_BFF_DIR_$\build\release_fastbuild_vs2017\explicitlyorderedpostbuildtest\explicitlyorderedpostbuildtest_compiler.pdb"' + // Advanced options + // --------------------------- + + ' /Gd' + + ' /TP' + + ' /errorReport:queue' + // Character Set + // --------------------------- + + ' /D"_MBCS"' + // Additional compiler options + //-------------------------- + + ' /FS /Zc:__cplusplus' + + // Optimizations options + // --------------------- + .CompilerOptimizations = '' + + ' /Ox' + + ' /Ob2' + + ' /Oi' + + ' /Ot' + + ' /Oy-' + + // Compiler options + // ---------------- + .CompilerOptions = '"%1" /Fo"%2" /c' + + ' $CompilerExtraOptions$' + + ' $CompilerOptimizations$' + + .CompilerInputUnity = 'ExplicitlyOrderedPostBuildTest_FastBuildUnitys_unity' + .CompilerOutputPath = '$Intermediate$' + +} + + +//================================================================================================================= +Executable( 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_vs2017_win64_Executable' ) +{ + Using( .win64Config ) + .Intermediate = '.\$_CURRENT_BFF_DIR_$\build\release_fastbuild_vs2017\explicitlyorderedpostbuildtest\' + .Libraries = 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_vs2017_win64_objects' + .LinkerOutput = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_vs2017\explicitlyorderedpostbuildtest.exe' + .LinkerLinkObjects = false + + .LinkerOptions = '/OUT:"%2"' + // General + // --------------------------- + + ' /INCREMENTAL:NO' + + ' /NOLOGO' + + ' /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\lib\x64"' + + ' /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\atlmfc\lib\x64"' + + ' /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\ucrt\x64"' + + ' /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\um\x64"' + // Input + // --------------------------- + + ' "kernel32.lib"' + + ' "user32.lib"' + + ' "gdi32.lib"' + + ' "winspool.lib"' + + ' "comdlg32.lib"' + + ' "advapi32.lib"' + + ' "shell32.lib"' + + ' "ole32.lib"' + + ' "oleaut32.lib"' + + ' "uuid.lib"' + + ' "odbc32.lib"' + + ' "odbccp32.lib"' + // Input files + // --------------------------- + + ' "%1"' + // Manifest + // --------------------------- + + ' /MANIFEST /MANIFESTUAC:"level=^'asInvoker^' uiAccess=^'false^'"' + + ' /ManifestFile:".\$_CURRENT_BFF_DIR_$\build\release_fastbuild_vs2017\explicitlyorderedpostbuildtest\explicitlyorderedpostbuildtest.intermediate.manifest"' + // Debugging + // --------------------------- + + ' /DEBUG' + + ' /PDB:".\$_CURRENT_BFF_DIR_$\output\release_fastbuild_vs2017\explicitlyorderedpostbuildtest.pdb"' + + ' /MAP":.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_vs2017\explicitlyorderedpostbuildtest.map"' + // System + // --------------------------- + + ' /SUBSYSTEM:CONSOLE' + + ' /LARGEADDRESSAWARE' + // Optimization + // --------------------------- + + ' /OPT:REF' + + ' /OPT:ICF' + // Embedded IDL + // --------------------------- + + ' /TLBID:1' + // Windows Metadata + // --------------------------- + // Advanced + // --------------------------- + + ' /DYNAMICBASE' + + ' /MACHINE:X64' + + ' /errorReport:queue' + // Additional linker options + //-------------------------- +} + + +//================================================================================================================= +Copy( 'Copy_B2476EF5' ) +{ + .Source = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_vs2017\explicitlyorderedpostbuildtest.exe' + .Dest = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_vs2017\explicitly_ordered_postbuild_test\temp_copy\explicitlyorderedpostbuildtest.exe' + .PreBuildDependencies = 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_vs2017_win64_Executable' +} + + +//================================================================================================================= +Copy( 'Copy_FE930175' ) +{ + .Source = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_vs2017\explicitlyorderedpostbuildtest.pdb' + .Dest = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_vs2017\explicitly_ordered_postbuild_test\temp_copy\explicitlyorderedpostbuildtest.pdb' + .PreBuildDependencies = 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_vs2017_win64_Executable' +} + + +//================================================================================================================= +CopyDir( 'Copy_4AFE99AA' ) +{ + .SourcePaths = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_vs2017\explicitly_ordered_postbuild_test\temp_copy\' + .SourcePathsPattern = '*.*' + .SourcePathsRecurse = true + .Dest = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_vs2017\file_copy_destination\' + .PreBuildDependencies = { + 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_vs2017_win64_Executable', + 'Copy_B2476EF5', + 'Copy_FE930175' + } +} + +//================================================================================================================= +Alias( 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_vs2017_win64' ) +{ + .Targets = { + 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_vs2017_win64_Executable', + 'Copy_B2476EF5', + 'Copy_FE930175', + 'Copy_4AFE99AA' + } +} + + +#endif // WIN64 +//////////////////////////////////////////////////////////////////////////////// diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/explicitlyorderedpostbuildtest_vs2017_win64.vcxproj b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/explicitlyorderedpostbuildtest_vs2017_win64.vcxproj new file mode 100644 index 000000000..61f6501e7 --- /dev/null +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/explicitlyorderedpostbuildtest_vs2017_win64.vcxproj @@ -0,0 +1,372 @@ + + + + + Debug_FastBuild_NoBlob_vs2017 + x64 + + + Debug_FastBuild_vs2017 + x64 + + + Debug_MSBuild_vs2017 + x64 + + + Release_FastBuild_NoBlob_vs2017 + x64 + + + Release_FastBuild_vs2017 + x64 + + + Release_MSBuild_vs2017 + x64 + + + + {77AE9D0E-D7D9-039E-9DB9-180932FD4AE9} + en-US + ExplicitlyOrderedPostBuildTest + ExplicitlyOrderedPostBuildTest + + + 10.0.10586.0 + + + + Makefile + true + MultiByte + false + v141 + + + Makefile + true + MultiByte + false + v141 + + + Application + true + MultiByte + false + v141 + + + Makefile + false + MultiByte + false + v141 + + + Makefile + false + MultiByte + false + v141 + + + Application + false + MultiByte + false + v141 + + + + + + + + + + output\debug_fastbuild_noblob_vs2017\ + build\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\ + cd $(SolutionDir) +$(ProjectDir)..\..\..\tools\FastBuild\FBuild.exe ExplicitlyOrderedPostBuildTest_Debug_FastBuild_NoBlob_vs2017_win64 -ide -summary -wait -config $(SolutionName).bff + cd $(SolutionDir) +$(ProjectDir)..\..\..\tools\FastBuild\FBuild.exe -clean ExplicitlyOrderedPostBuildTest_Debug_FastBuild_NoBlob_vs2017_win64 -ide -summary -wait -config $(SolutionName).bff + del "build\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\*unity*.cpp" >NUL 2>NUL +del "build\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\*.obj" >NUL 2>NUL +del "build\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\*.a" >NUL 2>NUL +del "build\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\*.lib" >NUL 2>NUL +del "output\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.exe" >NUL 2>NUL +del "output\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.elf" >NUL 2>NUL +del "output\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.exp" >NUL 2>NUL +del "output\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.ilk" >NUL 2>NUL +del "output\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.lib" >NUL 2>NUL +del "output\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.pdb" >NUL 2>NUL + output\debug_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.exe + WIN64;_CONSOLE;_DEBUG + explicitlyorderedpostbuildtest.exe + + + output\debug_fastbuild_vs2017\ + build\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest\ + cd $(SolutionDir) +$(ProjectDir)..\..\..\tools\FastBuild\FBuild.exe ExplicitlyOrderedPostBuildTest_Debug_FastBuild_vs2017_win64 -ide -summary -wait -config $(SolutionName).bff + cd $(SolutionDir) +$(ProjectDir)..\..\..\tools\FastBuild\FBuild.exe -clean ExplicitlyOrderedPostBuildTest_Debug_FastBuild_vs2017_win64 -ide -summary -wait -config $(SolutionName).bff + del "build\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest\*unity*.cpp" >NUL 2>NUL +del "build\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest\*.obj" >NUL 2>NUL +del "build\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest\*.a" >NUL 2>NUL +del "build\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest\*.lib" >NUL 2>NUL +del "output\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest.exe" >NUL 2>NUL +del "output\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest.elf" >NUL 2>NUL +del "output\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest.exp" >NUL 2>NUL +del "output\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest.ilk" >NUL 2>NUL +del "output\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest.lib" >NUL 2>NUL +del "output\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest.pdb" >NUL 2>NUL + output\debug_fastbuild_vs2017\explicitlyorderedpostbuildtest.exe + WIN64;_CONSOLE;_DEBUG + explicitlyorderedpostbuildtest.exe + + + explicitlyorderedpostbuildtest + output\debug_msbuild_vs2017\ + build\debug_msbuild_vs2017\explicitlyorderedpostbuildtest\ + .exe + true + false + output\debug_msbuild_vs2017\explicitlyorderedpostbuildtest.exe + false + false + + + output\release_fastbuild_noblob_vs2017\ + build\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\ + cd $(SolutionDir) +$(ProjectDir)..\..\..\tools\FastBuild\FBuild.exe ExplicitlyOrderedPostBuildTest_Release_FastBuild_NoBlob_vs2017_win64 -ide -summary -wait -config $(SolutionName).bff + cd $(SolutionDir) +$(ProjectDir)..\..\..\tools\FastBuild\FBuild.exe -clean ExplicitlyOrderedPostBuildTest_Release_FastBuild_NoBlob_vs2017_win64 -ide -summary -wait -config $(SolutionName).bff + del "build\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\*unity*.cpp" >NUL 2>NUL +del "build\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\*.obj" >NUL 2>NUL +del "build\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\*.a" >NUL 2>NUL +del "build\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest\*.lib" >NUL 2>NUL +del "output\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.exe" >NUL 2>NUL +del "output\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.elf" >NUL 2>NUL +del "output\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.exp" >NUL 2>NUL +del "output\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.ilk" >NUL 2>NUL +del "output\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.lib" >NUL 2>NUL +del "output\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.pdb" >NUL 2>NUL + output\release_fastbuild_noblob_vs2017\explicitlyorderedpostbuildtest.exe + NDEBUG;WIN64;_CONSOLE + explicitlyorderedpostbuildtest.exe + + + output\release_fastbuild_vs2017\ + build\release_fastbuild_vs2017\explicitlyorderedpostbuildtest\ + cd $(SolutionDir) +$(ProjectDir)..\..\..\tools\FastBuild\FBuild.exe ExplicitlyOrderedPostBuildTest_Release_FastBuild_vs2017_win64 -ide -summary -wait -config $(SolutionName).bff + cd $(SolutionDir) +$(ProjectDir)..\..\..\tools\FastBuild\FBuild.exe -clean ExplicitlyOrderedPostBuildTest_Release_FastBuild_vs2017_win64 -ide -summary -wait -config $(SolutionName).bff + del "build\release_fastbuild_vs2017\explicitlyorderedpostbuildtest\*unity*.cpp" >NUL 2>NUL +del "build\release_fastbuild_vs2017\explicitlyorderedpostbuildtest\*.obj" >NUL 2>NUL +del "build\release_fastbuild_vs2017\explicitlyorderedpostbuildtest\*.a" >NUL 2>NUL +del "build\release_fastbuild_vs2017\explicitlyorderedpostbuildtest\*.lib" >NUL 2>NUL +del "output\release_fastbuild_vs2017\explicitlyorderedpostbuildtest.exe" >NUL 2>NUL +del "output\release_fastbuild_vs2017\explicitlyorderedpostbuildtest.elf" >NUL 2>NUL +del "output\release_fastbuild_vs2017\explicitlyorderedpostbuildtest.exp" >NUL 2>NUL +del "output\release_fastbuild_vs2017\explicitlyorderedpostbuildtest.ilk" >NUL 2>NUL +del "output\release_fastbuild_vs2017\explicitlyorderedpostbuildtest.lib" >NUL 2>NUL +del "output\release_fastbuild_vs2017\explicitlyorderedpostbuildtest.pdb" >NUL 2>NUL + output\release_fastbuild_vs2017\explicitlyorderedpostbuildtest.exe + NDEBUG;WIN64;_CONSOLE + explicitlyorderedpostbuildtest.exe + + + explicitlyorderedpostbuildtest + output\release_msbuild_vs2017\ + build\release_msbuild_vs2017\explicitlyorderedpostbuildtest\ + .exe + true + false + output\release_msbuild_vs2017\explicitlyorderedpostbuildtest.exe + false + false + + + + NotUsing + Level4 + Disabled + WIN64;_CONSOLE;_DEBUG;%(PreprocessorDefinitions);$(PreprocessorDefinitions) + ProgramDatabase + true + false + true + false + OnlyExplicitInline + true + Neither + false + false + false + false + false + false + false + false + true + false + false + Default + MultiThreadedDebug + Default + true + false + NotSet + Fast + false + false + false + true + true + false + false + false + NoListing + false + false + Cdecl + Default + /Zc:__cplusplus + build\debug_msbuild_vs2017\explicitlyorderedpostbuildtest\explicitlyorderedpostbuildtest_compiler.pdb + MultiThreadedDebug + + + Console + true + output\debug_msbuild_vs2017\explicitlyorderedpostbuildtest.exe + NotSet + build\debug_msbuild_vs2017\explicitlyorderedpostbuildtest\explicitlyorderedpostbuildtest.intermediate.manifest + output\debug_msbuild_vs2017\explicitlyorderedpostbuildtest.pdb + true + false + false + false + NotSet + false + false + + + Default + false + 1 + false + false + false + MachineX64 + false + Default + PromptImmediately + ;%(AdditionalDependencies) + true + false + + true + output\debug_msbuild_vs2017\explicitlyorderedpostbuildtest.map + + + + + NotUsing + Level4 + Full + NDEBUG;WIN64;_CONSOLE;%(PreprocessorDefinitions);$(PreprocessorDefinitions) + ProgramDatabase + true + false + true + false + AnySuitable + true + Speed + false + false + false + false + false + false + false + false + true + false + false + false + Default + MultiThreaded + Default + false + true + NotSet + Fast + false + false + false + true + true + false + false + false + NoListing + false + false + Cdecl + Default + /Zc:__cplusplus + build\release_msbuild_vs2017\explicitlyorderedpostbuildtest\explicitlyorderedpostbuildtest_compiler.pdb + MultiThreaded + + + Console + true + output\release_msbuild_vs2017\explicitlyorderedpostbuildtest.exe + NotSet + build\release_msbuild_vs2017\explicitlyorderedpostbuildtest\explicitlyorderedpostbuildtest.intermediate.manifest + output\release_msbuild_vs2017\explicitlyorderedpostbuildtest.pdb + true + false + false + false + NotSet + true + true + + + Default + false + 1 + false + false + false + MachineX64 + false + Default + PromptImmediately + ;%(AdditionalDependencies) + true + false + + true + output\release_msbuild_vs2017\explicitlyorderedpostbuildtest.map + + + + + + + + + + + + + + diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/explicitlyorderedpostbuildtest_vs2017_win64.vcxproj.filters b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/explicitlyorderedpostbuildtest_vs2017_win64.vcxproj.filters new file mode 100644 index 000000000..70c6b5070 --- /dev/null +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/explicitlyorderedpostbuildtest_vs2017_win64.vcxproj.filters @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/fastbuildfunctionaltest.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/fastbuildfunctionaltest.bff index 81c6e86b9..b6e86209e 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/fastbuildfunctionaltest.bff +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/fastbuildfunctionaltest.bff @@ -21,13 +21,14 @@ Exec( 'GenerateHeader' ) .ExecExecutable = '.\$_CURRENT_BFF_DIR_$\..\codebase\requireprebuildstep\execute.bat' .ExecInput = '.\$_CURRENT_BFF_DIR_$\..\codebase\requireprebuildstep\main.cpp' .ExecOutput = '.\$_CURRENT_BFF_DIR_$\generated\header_generated_by_prebuild_step.h' - .ExecArguments = 'echo #define PREBUILD_GENERATED_DEFINE() 0 > e:\rd\sharpmakes\sharpmake.packageci\sharpmake\sharpmake.functionaltests\fastbuildfunctionaltest\projects\generated\header_generated_by_prebuild_step.h' + .ExecArguments = 'echo #define PREBUILD_GENERATED_DEFINE() 0 > generated\header_generated_by_prebuild_step.h' } //================================================================================================================= // fastbuildfunctionaltest.bff .bff includes //================================================================================================================= +#include ".\explicitlyorderedpostbuildtest_vs2017_win64.bff" #include ".\mixcppandcexe_vs2017_win64.bff" #include ".\postbuildcopydirtest_vs2017_win64.bff" #include ".\postbuildcopysinglefiletest_vs2017_win64.bff" diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/fastbuildfunctionaltest.sln b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/fastbuildfunctionaltest.sln index 83a32f5a0..a5adc765f 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/fastbuildfunctionaltest.sln +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/fastbuildfunctionaltest.sln @@ -8,10 +8,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FastBuild", "FastBuild", "{ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MixCppAndCExe", "mixcppandcexe_vs2017_win64.vcxproj", "{5A047CB1-D2C4-4765-6F6F-EDD60899737F}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExplicitlyOrderedPostBuildTest", "explicitlyorderedpostbuildtest_vs2017_win64.vcxproj", "{77AE9D0E-D7D9-039E-9DB9-180932FD4AE9}" +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FastBuildFunctionalTest_All", "fastbuildfunctionaltest_all.vcxproj", "{6AE06EC2-B2C7-52F6-C657-FE1FFFA43666}" ProjectSection(ProjectDependencies) = postProject {7D8A189A-C043-D9EA-2CD4-C5DA529D56F9} = {7D8A189A-C043-D9EA-2CD4-C5DA529D56F9} {4CB12B72-2C37-A067-2236-AC7AA2926DE3} = {4CB12B72-2C37-A067-2236-AC7AA2926DE3} + {77AE9D0E-D7D9-039E-9DB9-180932FD4AE9} = {77AE9D0E-D7D9-039E-9DB9-180932FD4AE9} {311CFA15-731D-A99E-EDE1-41AB713BBE48} = {311CFA15-731D-A99E-EDE1-41AB713BBE48} {0E8AC270-BB93-42F0-4487-E85F2785FCF0} = {0E8AC270-BB93-42F0-4487-E85F2785FCF0} {B0087514-0636-5209-BC43-4E8096928555} = {B0087514-0636-5209-BC43-4E8096928555} @@ -61,6 +64,14 @@ Global {5A047CB1-D2C4-4765-6F6F-EDD60899737F}.Release|FastBuild_NoBlob.ActiveCfg = Release_FastBuild_NoBlob_vs2017|x64 {5A047CB1-D2C4-4765-6F6F-EDD60899737F}.Release|MSBuild.ActiveCfg = Release_MSBuild_vs2017|x64 {5A047CB1-D2C4-4765-6F6F-EDD60899737F}.Release|MSBuild.Build.0 = Release_MSBuild_vs2017|x64 + {77AE9D0E-D7D9-039E-9DB9-180932FD4AE9}.Debug|FastBuild.ActiveCfg = Debug_FastBuild_vs2017|x64 + {77AE9D0E-D7D9-039E-9DB9-180932FD4AE9}.Debug|FastBuild_NoBlob.ActiveCfg = Debug_FastBuild_NoBlob_vs2017|x64 + {77AE9D0E-D7D9-039E-9DB9-180932FD4AE9}.Debug|MSBuild.ActiveCfg = Debug_MSBuild_vs2017|x64 + {77AE9D0E-D7D9-039E-9DB9-180932FD4AE9}.Debug|MSBuild.Build.0 = Debug_MSBuild_vs2017|x64 + {77AE9D0E-D7D9-039E-9DB9-180932FD4AE9}.Release|FastBuild.ActiveCfg = Release_FastBuild_vs2017|x64 + {77AE9D0E-D7D9-039E-9DB9-180932FD4AE9}.Release|FastBuild_NoBlob.ActiveCfg = Release_FastBuild_NoBlob_vs2017|x64 + {77AE9D0E-D7D9-039E-9DB9-180932FD4AE9}.Release|MSBuild.ActiveCfg = Release_MSBuild_vs2017|x64 + {77AE9D0E-D7D9-039E-9DB9-180932FD4AE9}.Release|MSBuild.Build.0 = Release_MSBuild_vs2017|x64 {6AE06EC2-B2C7-52F6-C657-FE1FFFA43666}.Debug|FastBuild.ActiveCfg = Debug_FastBuild_vs2017|x64 {6AE06EC2-B2C7-52F6-C657-FE1FFFA43666}.Debug|FastBuild.Build.0 = Debug_FastBuild_vs2017|x64 {6AE06EC2-B2C7-52F6-C657-FE1FFFA43666}.Debug|FastBuild_NoBlob.ActiveCfg = Debug_FastBuild_NoBlob_vs2017|x64 diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/fastbuildfunctionaltest_all.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/fastbuildfunctionaltest_all.bff index 7ca8c73e6..b17a0bfe6 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/fastbuildfunctionaltest_all.bff +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/fastbuildfunctionaltest_all.bff @@ -13,6 +13,7 @@ Alias( 'FastBuildFunctionalTest_All_Debug_FastBuild_NoBlob_vs2017_win64' ) { .Targets = { + 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_NoBlob_vs2017_win64', 'MixCppAndCExe_Debug_FastBuild_NoBlob_vs2017_win64', 'PostBuildCopyDirTest_Debug_FastBuild_NoBlob_vs2017_win64', 'PostBuildCopySingleFileTest_Debug_FastBuild_NoBlob_vs2017_win64', @@ -30,6 +31,7 @@ Alias( 'FastBuildFunctionalTest_All_Debug_FastBuild_NoBlob_vs2017_win64' ) Alias( 'FastBuildFunctionalTest_All_Release_FastBuild_NoBlob_vs2017_win64' ) { .Targets = { + 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_NoBlob_vs2017_win64', 'MixCppAndCExe_Release_FastBuild_NoBlob_vs2017_win64', 'PostBuildCopyDirTest_Release_FastBuild_NoBlob_vs2017_win64', 'PostBuildCopySingleFileTest_Release_FastBuild_NoBlob_vs2017_win64', @@ -47,6 +49,7 @@ Alias( 'FastBuildFunctionalTest_All_Release_FastBuild_NoBlob_vs2017_win64' ) Alias( 'FastBuildFunctionalTest_All_Debug_FastBuild_vs2017_win64' ) { .Targets = { + 'ExplicitlyOrderedPostBuildTest_Debug_FastBuild_vs2017_win64', 'MixCppAndCExe_Debug_FastBuild_vs2017_win64', 'PostBuildCopyDirTest_Debug_FastBuild_vs2017_win64', 'PostBuildCopySingleFileTest_Debug_FastBuild_vs2017_win64', @@ -64,6 +67,7 @@ Alias( 'FastBuildFunctionalTest_All_Debug_FastBuild_vs2017_win64' ) Alias( 'FastBuildFunctionalTest_All_Release_FastBuild_vs2017_win64' ) { .Targets = { + 'ExplicitlyOrderedPostBuildTest_Release_FastBuild_vs2017_win64', 'MixCppAndCExe_Release_FastBuild_vs2017_win64', 'PostBuildCopyDirTest_Release_FastBuild_vs2017_win64', 'PostBuildCopySingleFileTest_Release_FastBuild_vs2017_win64', diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/fastbuildfunctionaltest_all.vcxproj b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/fastbuildfunctionaltest_all.vcxproj index 64c82217d..270dc64ca 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/fastbuildfunctionaltest_all.vcxproj +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/fastbuildfunctionaltest_all.vcxproj @@ -89,7 +89,7 @@ $(ProjectDir)..\..\..\tools\FastBuild\FBuild.exe -clean FastBuildFunctionalTest_ NDEBUG;WIN64 - + diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildcopydirtest_vs2017_win64.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildcopydirtest_vs2017_win64.bff index 1ebee2ecf..042f319d0 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildcopydirtest_vs2017_win64.bff +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildcopydirtest_vs2017_win64.bff @@ -163,12 +163,14 @@ Executable( 'PostBuildCopyDirTest_Debug_FastBuild_NoBlob_vs2017_win64_Executable } -CopyDir( 'Copy_D5B44AD5' ) +//================================================================================================================= +CopyDir( 'Copy_95F387B3' ) { .SourcePaths = '.\$_CURRENT_BFF_DIR_$\..\codebase\postbuildcopydirtest\' .SourcePathsPattern = { '*.cpp', '*.txt' } .SourcePathsRecurse = true .Dest = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_noblob_vs2017\file_copy_destination\' + .PreBuildDependencies = 'PostBuildCopyDirTest_Debug_FastBuild_NoBlob_vs2017_win64_Executable' } //================================================================================================================= @@ -176,7 +178,7 @@ Alias( 'PostBuildCopyDirTest_Debug_FastBuild_NoBlob_vs2017_win64' ) { .Targets = { 'PostBuildCopyDirTest_Debug_FastBuild_NoBlob_vs2017_win64_Executable', - 'Copy_D5B44AD5' + 'Copy_95F387B3' } } @@ -326,12 +328,14 @@ Executable( 'PostBuildCopyDirTest_Release_FastBuild_NoBlob_vs2017_win64_Executab } -CopyDir( 'Copy_94F215BD' ) +//================================================================================================================= +CopyDir( 'Copy_54B15627' ) { .SourcePaths = '.\$_CURRENT_BFF_DIR_$\..\codebase\postbuildcopydirtest\' .SourcePathsPattern = { '*.cpp', '*.txt' } .SourcePathsRecurse = true .Dest = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_noblob_vs2017\file_copy_destination\' + .PreBuildDependencies = 'PostBuildCopyDirTest_Release_FastBuild_NoBlob_vs2017_win64_Executable' } //================================================================================================================= @@ -339,7 +343,7 @@ Alias( 'PostBuildCopyDirTest_Release_FastBuild_NoBlob_vs2017_win64' ) { .Targets = { 'PostBuildCopyDirTest_Release_FastBuild_NoBlob_vs2017_win64_Executable', - 'Copy_94F215BD' + 'Copy_54B15627' } } @@ -488,12 +492,14 @@ Executable( 'PostBuildCopyDirTest_Debug_FastBuild_vs2017_win64_Executable' ) } -CopyDir( 'Copy_9E4F9E84' ) +//================================================================================================================= +CopyDir( 'Copy_CF70E156' ) { .SourcePaths = '.\$_CURRENT_BFF_DIR_$\..\codebase\postbuildcopydirtest\' .SourcePathsPattern = { '*.cpp', '*.txt' } .SourcePathsRecurse = true .Dest = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_vs2017\file_copy_destination\' + .PreBuildDependencies = 'PostBuildCopyDirTest_Debug_FastBuild_vs2017_win64_Executable' } //================================================================================================================= @@ -501,7 +507,7 @@ Alias( 'PostBuildCopyDirTest_Debug_FastBuild_vs2017_win64' ) { .Targets = { 'PostBuildCopyDirTest_Debug_FastBuild_vs2017_win64_Executable', - 'Copy_9E4F9E84' + 'Copy_CF70E156' } } @@ -651,12 +657,14 @@ Executable( 'PostBuildCopyDirTest_Release_FastBuild_vs2017_win64_Executable' ) } -CopyDir( 'Copy_1F243046' ) +//================================================================================================================= +CopyDir( 'Copy_C20D120C' ) { .SourcePaths = '.\$_CURRENT_BFF_DIR_$\..\codebase\postbuildcopydirtest\' .SourcePathsPattern = { '*.cpp', '*.txt' } .SourcePathsRecurse = true .Dest = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_vs2017\file_copy_destination\' + .PreBuildDependencies = 'PostBuildCopyDirTest_Release_FastBuild_vs2017_win64_Executable' } //================================================================================================================= @@ -664,7 +672,7 @@ Alias( 'PostBuildCopyDirTest_Release_FastBuild_vs2017_win64' ) { .Targets = { 'PostBuildCopyDirTest_Release_FastBuild_vs2017_win64_Executable', - 'Copy_1F243046' + 'Copy_C20D120C' } } diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildcopysinglefiletest_vs2017_win64.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildcopysinglefiletest_vs2017_win64.bff index 455c27532..acb28ccba 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildcopysinglefiletest_vs2017_win64.bff +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildcopysinglefiletest_vs2017_win64.bff @@ -164,10 +164,11 @@ Executable( 'PostBuildCopySingleFileTest_Debug_FastBuild_NoBlob_vs2017_win64_Exe //================================================================================================================= -Copy( 'Copy_C42D7E42' ) +Copy( 'Copy_1D5DF622' ) { .Source = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_noblob_vs2017\postbuildcopysinglefiletest.exe' .Dest = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_noblob_vs2017\file_copy_destination\postbuildcopysinglefiletest.exe' + .PreBuildDependencies = 'PostBuildCopySingleFileTest_Debug_FastBuild_NoBlob_vs2017_win64_Executable' } @@ -176,7 +177,7 @@ Alias( 'PostBuildCopySingleFileTest_Debug_FastBuild_NoBlob_vs2017_win64' ) { .Targets = { 'PostBuildCopySingleFileTest_Debug_FastBuild_NoBlob_vs2017_win64_Executable', - 'Copy_C42D7E42' + 'Copy_1D5DF622' } } @@ -327,10 +328,11 @@ Executable( 'PostBuildCopySingleFileTest_Release_FastBuild_NoBlob_vs2017_win64_E //================================================================================================================= -Copy( 'Copy_BC80BD82' ) +Copy( 'Copy_8BC3E0C2' ) { .Source = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_noblob_vs2017\postbuildcopysinglefiletest.exe' .Dest = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_noblob_vs2017\file_copy_destination\postbuildcopysinglefiletest.exe' + .PreBuildDependencies = 'PostBuildCopySingleFileTest_Release_FastBuild_NoBlob_vs2017_win64_Executable' } @@ -339,7 +341,7 @@ Alias( 'PostBuildCopySingleFileTest_Release_FastBuild_NoBlob_vs2017_win64' ) { .Targets = { 'PostBuildCopySingleFileTest_Release_FastBuild_NoBlob_vs2017_win64_Executable', - 'Copy_BC80BD82' + 'Copy_8BC3E0C2' } } @@ -489,10 +491,11 @@ Executable( 'PostBuildCopySingleFileTest_Debug_FastBuild_vs2017_win64_Executable //================================================================================================================= -Copy( 'Copy_7FAB9568' ) +Copy( 'Copy_6E7A0E5A' ) { .Source = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_vs2017\postbuildcopysinglefiletest.exe' .Dest = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_vs2017\file_copy_destination\postbuildcopysinglefiletest.exe' + .PreBuildDependencies = 'PostBuildCopySingleFileTest_Debug_FastBuild_vs2017_win64_Executable' } @@ -501,7 +504,7 @@ Alias( 'PostBuildCopySingleFileTest_Debug_FastBuild_vs2017_win64' ) { .Targets = { 'PostBuildCopySingleFileTest_Debug_FastBuild_vs2017_win64_Executable', - 'Copy_7FAB9568' + 'Copy_6E7A0E5A' } } @@ -652,10 +655,11 @@ Executable( 'PostBuildCopySingleFileTest_Release_FastBuild_vs2017_win64_Executab //================================================================================================================= -Copy( 'Copy_803944F8' ) +Copy( 'Copy_0E72E88A' ) { .Source = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_vs2017\postbuildcopysinglefiletest.exe' .Dest = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_vs2017\file_copy_destination\postbuildcopysinglefiletest.exe' + .PreBuildDependencies = 'PostBuildCopySingleFileTest_Release_FastBuild_vs2017_win64_Executable' } @@ -664,7 +668,7 @@ Alias( 'PostBuildCopySingleFileTest_Release_FastBuild_vs2017_win64' ) { .Targets = { 'PostBuildCopySingleFileTest_Release_FastBuild_vs2017_win64_Executable', - 'Copy_803944F8' + 'Copy_0E72E88A' } } diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildexecutetest_vs2017_win64.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildexecutetest_vs2017_win64.bff index 14700c45c..b368c10a7 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildexecutetest_vs2017_win64.bff +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildexecutetest_vs2017_win64.bff @@ -164,11 +164,12 @@ Executable( 'PostBuildExecuteTest_Debug_FastBuild_NoBlob_vs2017_win64_Executable //================================================================================================================= -Exec( 'Exec_postbuildexecutetest_exe_32D9274C' ) +Exec( 'Exec_postbuildexecutetest_exe_6F670091' ) { .ExecExecutable = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_noblob_vs2017\postbuildexecutetest.exe' .ExecOutput = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_noblob_vs2017\postbuild_exec_sentinel.txt' .ExecUseStdOutAsOutput = true + .PreBuildDependencies = 'PostBuildExecuteTest_Debug_FastBuild_NoBlob_vs2017_win64_Executable' } @@ -177,7 +178,7 @@ Alias( 'PostBuildExecuteTest_Debug_FastBuild_NoBlob_vs2017_win64' ) { .Targets = { 'PostBuildExecuteTest_Debug_FastBuild_NoBlob_vs2017_win64_Executable', - 'Exec_postbuildexecutetest_exe_32D9274C' + 'Exec_postbuildexecutetest_exe_6F670091' } } @@ -328,11 +329,12 @@ Executable( 'PostBuildExecuteTest_Release_FastBuild_NoBlob_vs2017_win64_Executab //================================================================================================================= -Exec( 'Exec_postbuildexecutetest_exe_B1C1EB06' ) +Exec( 'Exec_postbuildexecutetest_exe_CAF85FE1' ) { .ExecExecutable = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_noblob_vs2017\postbuildexecutetest.exe' .ExecOutput = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_noblob_vs2017\postbuild_exec_sentinel.txt' .ExecUseStdOutAsOutput = true + .PreBuildDependencies = 'PostBuildExecuteTest_Release_FastBuild_NoBlob_vs2017_win64_Executable' } @@ -341,7 +343,7 @@ Alias( 'PostBuildExecuteTest_Release_FastBuild_NoBlob_vs2017_win64' ) { .Targets = { 'PostBuildExecuteTest_Release_FastBuild_NoBlob_vs2017_win64_Executable', - 'Exec_postbuildexecutetest_exe_B1C1EB06' + 'Exec_postbuildexecutetest_exe_CAF85FE1' } } @@ -491,11 +493,12 @@ Executable( 'PostBuildExecuteTest_Debug_FastBuild_vs2017_win64_Executable' ) //================================================================================================================= -Exec( 'Exec_postbuildexecutetest_exe_F8EDE0EF' ) +Exec( 'Exec_postbuildexecutetest_exe_980FD418' ) { .ExecExecutable = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_vs2017\postbuildexecutetest.exe' .ExecOutput = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_vs2017\postbuild_exec_sentinel.txt' .ExecUseStdOutAsOutput = true + .PreBuildDependencies = 'PostBuildExecuteTest_Debug_FastBuild_vs2017_win64_Executable' } @@ -504,7 +507,7 @@ Alias( 'PostBuildExecuteTest_Debug_FastBuild_vs2017_win64' ) { .Targets = { 'PostBuildExecuteTest_Debug_FastBuild_vs2017_win64_Executable', - 'Exec_postbuildexecutetest_exe_F8EDE0EF' + 'Exec_postbuildexecutetest_exe_980FD418' } } @@ -655,11 +658,12 @@ Executable( 'PostBuildExecuteTest_Release_FastBuild_vs2017_win64_Executable' ) //================================================================================================================= -Exec( 'Exec_postbuildexecutetest_exe_6EEA7B0B' ) +Exec( 'Exec_postbuildexecutetest_exe_205BA032' ) { .ExecExecutable = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_vs2017\postbuildexecutetest.exe' .ExecOutput = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_vs2017\postbuild_exec_sentinel.txt' .ExecUseStdOutAsOutput = true + .PreBuildDependencies = 'PostBuildExecuteTest_Release_FastBuild_vs2017_win64_Executable' } @@ -668,7 +672,7 @@ Alias( 'PostBuildExecuteTest_Release_FastBuild_vs2017_win64' ) { .Targets = { 'PostBuildExecuteTest_Release_FastBuild_vs2017_win64_Executable', - 'Exec_postbuildexecutetest_exe_6EEA7B0B' + 'Exec_postbuildexecutetest_exe_205BA032' } } diff --git a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildtestexecution_vs2017_win64.bff b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildtestexecution_vs2017_win64.bff index 7c3cef59d..b938f33be 100644 --- a/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildtestexecution_vs2017_win64.bff +++ b/Sharpmake.FunctionalTests/FastBuildFunctionalTest/reference/projects/postbuildtestexecution_vs2017_win64.bff @@ -164,11 +164,12 @@ Executable( 'PostBuildTestExecution_Debug_FastBuild_NoBlob_vs2017_win64_Executab //================================================================================================================= -Test( 'Test_postbuildtestexecution_exe_107D34DF' ) +Test( 'Test_postbuildtestexecution_exe_07EEB88C' ) { .TestExecutable = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_noblob_vs2017\postbuildtestexecution.exe' .TestOutput = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_noblob_vs2017\test_execution_output.txt' .TestAlwaysShowOutput = true + .PreBuildDependencies = 'PostBuildTestExecution_Debug_FastBuild_NoBlob_vs2017_win64_Executable' } @@ -177,7 +178,7 @@ Alias( 'PostBuildTestExecution_Debug_FastBuild_NoBlob_vs2017_win64' ) { .Targets = { 'PostBuildTestExecution_Debug_FastBuild_NoBlob_vs2017_win64_Executable', - 'Test_postbuildtestexecution_exe_107D34DF' + 'Test_postbuildtestexecution_exe_07EEB88C' } } @@ -328,11 +329,12 @@ Executable( 'PostBuildTestExecution_Release_FastBuild_NoBlob_vs2017_win64_Execut //================================================================================================================= -Test( 'Test_postbuildtestexecution_exe_1AB2D9BB' ) +Test( 'Test_postbuildtestexecution_exe_739E48FE' ) { .TestExecutable = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_noblob_vs2017\postbuildtestexecution.exe' .TestOutput = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_noblob_vs2017\test_execution_output.txt' .TestAlwaysShowOutput = true + .PreBuildDependencies = 'PostBuildTestExecution_Release_FastBuild_NoBlob_vs2017_win64_Executable' } @@ -341,7 +343,7 @@ Alias( 'PostBuildTestExecution_Release_FastBuild_NoBlob_vs2017_win64' ) { .Targets = { 'PostBuildTestExecution_Release_FastBuild_NoBlob_vs2017_win64_Executable', - 'Test_postbuildtestexecution_exe_1AB2D9BB' + 'Test_postbuildtestexecution_exe_739E48FE' } } @@ -491,11 +493,12 @@ Executable( 'PostBuildTestExecution_Debug_FastBuild_vs2017_win64_Executable' ) //================================================================================================================= -Test( 'Test_postbuildtestexecution_exe_7CC5FB7E' ) +Test( 'Test_postbuildtestexecution_exe_384F0979' ) { .TestExecutable = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_vs2017\postbuildtestexecution.exe' .TestOutput = '.\$_CURRENT_BFF_DIR_$\output\debug_fastbuild_vs2017\test_execution_output.txt' .TestAlwaysShowOutput = true + .PreBuildDependencies = 'PostBuildTestExecution_Debug_FastBuild_vs2017_win64_Executable' } @@ -504,7 +507,7 @@ Alias( 'PostBuildTestExecution_Debug_FastBuild_vs2017_win64' ) { .Targets = { 'PostBuildTestExecution_Debug_FastBuild_vs2017_win64_Executable', - 'Test_postbuildtestexecution_exe_7CC5FB7E' + 'Test_postbuildtestexecution_exe_384F0979' } } @@ -655,11 +658,12 @@ Executable( 'PostBuildTestExecution_Release_FastBuild_vs2017_win64_Executable' ) //================================================================================================================= -Test( 'Test_postbuildtestexecution_exe_276F8194' ) +Test( 'Test_postbuildtestexecution_exe_C07CFCF9' ) { .TestExecutable = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_vs2017\postbuildtestexecution.exe' .TestOutput = '.\$_CURRENT_BFF_DIR_$\output\release_fastbuild_vs2017\test_execution_output.txt' .TestAlwaysShowOutput = true + .PreBuildDependencies = 'PostBuildTestExecution_Release_FastBuild_vs2017_win64_Executable' } @@ -668,7 +672,7 @@ Alias( 'PostBuildTestExecution_Release_FastBuild_vs2017_win64' ) { .Targets = { 'PostBuildTestExecution_Release_FastBuild_vs2017_win64_Executable', - 'Test_postbuildtestexecution_exe_276F8194' + 'Test_postbuildtestexecution_exe_C07CFCF9' } } diff --git a/Sharpmake.Generators/Apple/XCodeProj.cs b/Sharpmake.Generators/Apple/XCodeProj.cs index 0018db285..c4a539b1b 100644 --- a/Sharpmake.Generators/Apple/XCodeProj.cs +++ b/Sharpmake.Generators/Apple/XCodeProj.cs @@ -75,8 +75,6 @@ public XCodeGenerationContext(Builder builder, string projectPath, Project proje private readonly HashSet _projectItems = new HashSet(); - //Source files that are potentially removable. Need to check if they are excluded from build in all configs. - private HashSet _removableItems = new HashSet(); private ProjectFolder _mainGroup = null; private ProjectFolder _productsGroup = null; private ProjectFolder _frameworksFolder = null; @@ -485,15 +483,6 @@ private void PrepareSections(XCodeGenerationContext context, List configurationsForProject = new HashSet(); ProjectConfigurationList configurationListForProject = new ProjectConfigurationList(configurationsForProject, "configurationListForProject"); _projectItems.Add(configurationListForProject); @@ -627,10 +616,6 @@ private void PrepareSourceFiles(string xCodeTargetName, IEnumerable sour _projectItems.Add(buildFileItem); _sourcesBuildPhases[xCodeTargetName].Files.Add(buildFileItem); } - else - { - _removableItems.Add(item); - } } else { @@ -1289,7 +1274,7 @@ public ProjectOutputFile(Project.Configuration conf, string name = null) private static string GetFilePrefix(Project.Configuration.OutputType outputType) { - return outputType.HasAnyFlag(Project.Configuration.OutputType.Lib | Project.Configuration.OutputType.Dll) ? "lib" : ""; + return (outputType == Project.Configuration.OutputType.Lib || outputType == Project.Configuration.OutputType.Dll) ? "lib" : ""; } public static string GetFileExtension(Project.Configuration conf) @@ -1445,7 +1430,7 @@ private abstract class ProjectBuildPhase : ProjectItem public ProjectBuildPhase(ItemSection section, string phaseName, uint buildActionMask) : base(section, phaseName) { - Files = new List(); + Files = new UniqueList(); BuildActionMask = buildActionMask; RunOnlyForDeploymentPostprocessing = 0; } @@ -1454,7 +1439,7 @@ public override void GetAdditionalResolverParameters(ProjectItem item, Resolver { ProjectBuildPhase folderItem = (ProjectBuildPhase)item; string childrenList = ""; - foreach (ProjectBuildFile childItem in folderItem.Files) + foreach (ProjectBuildFile childItem in folderItem.Files.SortedValues) { using (resolver.NewScopedParameter("item", childItem)) { @@ -1465,7 +1450,7 @@ public override void GetAdditionalResolverParameters(ProjectItem item, Resolver resolverParameters.Add("itemChildren", childrenList); } - public List Files { get; } + public UniqueList Files { get; } public uint BuildActionMask { get; } = 0; public int RunOnlyForDeploymentPostprocessing { get; } } diff --git a/Sharpmake.Generators/FastBuild/Bff.Template.cs b/Sharpmake.Generators/FastBuild/Bff.Template.cs index 5e548567e..90e7edb26 100644 --- a/Sharpmake.Generators/FastBuild/Bff.Template.cs +++ b/Sharpmake.Generators/FastBuild/Bff.Template.cs @@ -463,6 +463,7 @@ public static class ConfigurationFile { .Source = '[fastBuildCopySource]' .Dest = '[fastBuildCopyDest]' + .PreBuildDependencies = [fastBuildCopyDependencies] } "; @@ -517,6 +518,7 @@ public static class ConfigurationFile .ExecWorkingDir = '[fastBuildPrebuildWorkingPath]' .ExecUseStdOutAsOutput = [fastBuildPrebuildUseStdOutAsOutput] .ExecAlwaysShowOutput = [fastBuildPrebuildAlwaysShowOutput] + .PreBuildDependencies = [fastBuildExecPreBuildDependencies] } "; @@ -533,6 +535,7 @@ public static class ConfigurationFile .TestWorkingDir = '[fastBuildTestWorkingDir]' .TestTimeOut = [fastBuildTestTimeOut] .TestAlwaysShowOutput = [fastBuildTestAlwaysShowOutput] + .PreBuildDependencies = [fastBuildTestPreBuildDependencies] } "; @@ -563,12 +566,14 @@ public static class ConfigurationFile "; public static string CopyDirSection = @" +//================================================================================================================= CopyDir( '[fastBuildCopyDirName]' ) { .SourcePaths = '[fastBuildCopyDirSourcePath]' .SourcePathsPattern = [fastBuildCopyDirPattern] .SourcePathsRecurse = [fastBuildCopyDirRecurse] .Dest = '[fastBuildCopyDirDestinationPath]' + .PreBuildDependencies = [fastBuildCopyDirDependencies] } "; // All config sections. For now this section is used for submit assistant(when there is a source file filter) diff --git a/Sharpmake.Generators/FastBuild/Bff.Util.cs b/Sharpmake.Generators/FastBuild/Bff.Util.cs index f7ba072ce..7bd35e3fc 100644 --- a/Sharpmake.Generators/FastBuild/Bff.Util.cs +++ b/Sharpmake.Generators/FastBuild/Bff.Util.cs @@ -102,9 +102,20 @@ internal interface IResolvable string Resolve(string rootPath, string bffFilePath, Resolver resolver); } - internal class ExecNode : IResolvable + internal abstract class BffNodeBase : IResolvable + { + public string Identifier; + + public abstract string Resolve(string rootPath, string bffFilePath, Resolver resolver); + } + + internal abstract class BffDependentNode : BffNodeBase + { + public Strings Dependencies = new Strings(); + } + + internal class ExecNode : BffDependentNode { - public string BuildStepKey; public string ExecutableFile; public Strings InputFiles; public string OutputFile; @@ -115,7 +126,7 @@ internal class ExecNode : IResolvable public ExecNode(string buildStepKey, Project.Configuration.BuildStepExecutable buildStep) { - BuildStepKey = buildStepKey; + Identifier = buildStepKey; ExecutableFile = buildStep.ExecutableFile; IEnumerable inputFiles = buildStep.FastBuildExecutableInputFiles.Count > 0 ? buildStep.FastBuildExecutableInputFiles : Enumerable.Repeat(buildStep.ExecutableInputFileArgumentOption, 1); @@ -128,11 +139,11 @@ public ExecNode(string buildStepKey, Project.Configuration.BuildStepExecutable b AlwaysShowOutput = buildStep.FastBuildAlwaysShowOutput; } - public string Resolve(string rootPath, string bffFilePath, Resolver resolver) + public override string Resolve(string rootPath, string bffFilePath, Resolver resolver) { var inputFiles = InputFiles.Select(f => UtilityMethods.GetNormalizedPathForBuildStep(rootPath, bffFilePath, f)); - using (resolver.NewScopedParameter("fastBuildPreBuildName", BuildStepKey)) + using (resolver.NewScopedParameter("fastBuildPreBuildName", Identifier)) using (resolver.NewScopedParameter("fastBuildPrebuildExeFile", UtilityMethods.GetNormalizedPathForBuildStep(rootPath, bffFilePath, ExecutableFile))) using (resolver.NewScopedParameter("fastBuildPreBuildInputFiles", UtilityMethods.FBuildFormatList(inputFiles.ToList(), 26))) using (resolver.NewScopedParameter("fastBuildPreBuildOutputFile", UtilityMethods.GetNormalizedPathForBuildStep(rootPath, bffFilePath, OutputFile))) @@ -140,42 +151,42 @@ public string Resolve(string rootPath, string bffFilePath, Resolver resolver) using (resolver.NewScopedParameter("fastBuildPrebuildWorkingPath", UtilityMethods.GetNormalizedPathForBuildStep(rootPath, bffFilePath, WorkingPath))) using (resolver.NewScopedParameter("fastBuildPrebuildUseStdOutAsOutput", UseStdOutAsOutput ? "true" : FileGeneratorUtilities.RemoveLineTag)) using (resolver.NewScopedParameter("fastBuildPrebuildAlwaysShowOutput", AlwaysShowOutput ? "true" : FileGeneratorUtilities.RemoveLineTag)) + using (resolver.NewScopedParameter("fastBuildExecPreBuildDependencies", Dependencies.Count > 0 ? UtilityMethods.FBuildFormatList(Dependencies.ToList(), 26) : FileGeneratorUtilities.RemoveLineTag)) { return resolver.Resolve(Bff.Template.ConfigurationFile.GenericExecutableSection); } } } - internal class CopyNode : IResolvable + internal class CopyNode : BffDependentNode { - public string BuildStepKey; public string Source; public string Destination; public CopyNode(string buildStepKey, Project.Configuration.BuildStepCopy buildStep) { - BuildStepKey = buildStepKey; + Identifier = buildStepKey; Source = buildStep.SourcePath; Destination = buildStep.DestinationPath; } - public string Resolve(string rootPath, string bffFilePath, Resolver resolver) + public override string Resolve(string rootPath, string bffFilePath, Resolver resolver) { var normalizedSource = UtilityMethods.GetNormalizedPathForBuildStep(rootPath, bffFilePath, Source); var normalizedDestination = UtilityMethods.GetNormalizedPathForBuildStep(rootPath, bffFilePath, Destination); - using (resolver.NewScopedParameter("fastBuildCopyAlias", BuildStepKey)) + using (resolver.NewScopedParameter("fastBuildCopyAlias", Identifier)) using (resolver.NewScopedParameter("fastBuildCopySource", normalizedSource)) using (resolver.NewScopedParameter("fastBuildCopyDest", normalizedDestination)) + using (resolver.NewScopedParameter("fastBuildCopyDependencies", Dependencies.Count > 0 ? UtilityMethods.FBuildFormatList(Dependencies.ToList(), 28) : FileGeneratorUtilities.RemoveLineTag)) { return resolver.Resolve(Bff.Template.ConfigurationFile.CopyFileSection); } } } - internal class CopyDirNode : IResolvable + internal class CopyDirNode : BffDependentNode { - public string BuildStepKey; public string Source; public string Destination; public bool Recurse; @@ -183,32 +194,32 @@ internal class CopyDirNode : IResolvable public CopyDirNode(string buildStepKey, Project.Configuration.BuildStepCopy buildStep) { - BuildStepKey = buildStepKey; + Identifier = buildStepKey; Source = buildStep.SourcePath; Destination = buildStep.DestinationPath; Recurse = buildStep.IsRecurse; FilePattern = buildStep.CopyPattern; } - public string Resolve(string rootPath, string bffFilePath, Resolver resolver) + public override string Resolve(string rootPath, string bffFilePath, Resolver resolver) { var normalizedSource = UtilityMethods.GetNormalizedPathForBuildStep(rootPath, bffFilePath, Source); var normalizedDestination = UtilityMethods.GetNormalizedPathForBuildStep(rootPath, bffFilePath, Destination); - using (resolver.NewScopedParameter("fastBuildCopyDirName", BuildStepKey)) + using (resolver.NewScopedParameter("fastBuildCopyDirName", Identifier)) using (resolver.NewScopedParameter("fastBuildCopyDirSourcePath", Util.EnsureTrailingSeparator(normalizedSource))) using (resolver.NewScopedParameter("fastBuildCopyDirDestinationPath", Util.EnsureTrailingSeparator(normalizedDestination))) using (resolver.NewScopedParameter("fastBuildCopyDirRecurse", Recurse.ToString().ToLower())) using (resolver.NewScopedParameter("fastBuildCopyDirPattern", UtilityMethods.GetBffFileCopyPattern(FilePattern))) + using (resolver.NewScopedParameter("fastBuildCopyDirDependencies", Dependencies.Count > 0 ? UtilityMethods.FBuildFormatList(Dependencies.ToList(), 42) : FileGeneratorUtilities.RemoveLineTag)) { return resolver.Resolve(Bff.Template.ConfigurationFile.CopyDirSection); } } } - internal class TestNode : IResolvable + internal class TestNode : BffDependentNode { - public string BuildStepKey; public string Executable; public string WorkingDir; public string Output; @@ -218,7 +229,7 @@ internal class TestNode : IResolvable public TestNode(string buildStepKey, Project.Configuration.BuildStepTest buildStep) { - BuildStepKey = buildStepKey; + Identifier = buildStepKey; Executable = buildStep.TestExecutable; WorkingDir = buildStep.TestWorkingDir; Output = buildStep.TestOutput; @@ -227,19 +238,20 @@ public TestNode(string buildStepKey, Project.Configuration.BuildStepTest buildSt AlwaysShowOutput = buildStep.TestAlwaysShowOutput; } - public string Resolve(string rootPath, string bffFilePath, Resolver resolver) + public override string Resolve(string rootPath, string bffFilePath, Resolver resolver) { var normalizedExecutable = UtilityMethods.GetNormalizedPathForBuildStep(rootPath, bffFilePath, Executable); var normalizedWorkingDir = UtilityMethods.GetNormalizedPathForBuildStep(rootPath, bffFilePath, WorkingDir); var normalizedOutput = UtilityMethods.GetNormalizedPathForBuildStep(rootPath, bffFilePath, Output); - using (resolver.NewScopedParameter("fastBuildTest", BuildStepKey)) + using (resolver.NewScopedParameter("fastBuildTest", Identifier)) using (resolver.NewScopedParameter("fastBuildTestExecutable", normalizedExecutable)) using (resolver.NewScopedParameter("fastBuildTestWorkingDir", normalizedWorkingDir)) using (resolver.NewScopedParameter("fastBuildTestOutput", normalizedOutput)) using (resolver.NewScopedParameter("fastBuildTestArguments", string.IsNullOrWhiteSpace(Arguments) ? FileGeneratorUtilities.RemoveLineTag : Arguments)) using (resolver.NewScopedParameter("fastBuildTestTimeOut", TimeOutInSeconds == 0 ? FileGeneratorUtilities.RemoveLineTag : TimeOutInSeconds.ToString())) using (resolver.NewScopedParameter("fastBuildTestAlwaysShowOutput", AlwaysShowOutput.ToString().ToLower())) + using (resolver.NewScopedParameter("fastBuildTestPreBuildDependencies", Dependencies.Count > 0 ? UtilityMethods.FBuildFormatList(Dependencies.ToList(), 27) : FileGeneratorUtilities.RemoveLineTag)) { return resolver.Resolve(Bff.Template.ConfigurationFile.TestSection); } @@ -687,11 +699,13 @@ public static string GetNormalizedPathForBuildStep(string projectRootPath, strin return path; } - public static Bff.IResolvable GetResolveableFromBuildStep(string buildStepKey, Project.Configuration.BuildStepBase buildStep) + private static Bff.BffNodeBase GetBffNodesFromBuildStep(string buildStepKey, Project.Configuration.BuildStepBase buildStep, Strings dependencies) { + Bff.BffDependentNode node = null; + if (buildStep is Project.Configuration.BuildStepExecutable) { - return new Bff.ExecNode(buildStepKey, buildStep as Project.Configuration.BuildStepExecutable); + node = new Bff.ExecNode(buildStepKey, buildStep as Project.Configuration.BuildStepExecutable); } if (buildStep is Project.Configuration.BuildStepCopy) @@ -700,23 +714,45 @@ public static Bff.IResolvable GetResolveableFromBuildStep(string buildStepKey, P if (copyStep.IsFileCopy) { - return new Bff.CopyNode(buildStepKey, copyStep); + node = new Bff.CopyNode(buildStepKey, copyStep); + } + else + { + node = new Bff.CopyDirNode(buildStepKey, copyStep); } - - return new Bff.CopyDirNode(buildStepKey, copyStep); } if (buildStep is Project.Configuration.BuildStepTest) { - return new Bff.TestNode(buildStepKey, buildStep as Project.Configuration.BuildStepTest); + node = new Bff.TestNode(buildStepKey, buildStep as Project.Configuration.BuildStepTest); + } + + if (node == null) + { + throw new Error("BuildStep not supported: {0}", buildStep.GetType().FullName); } - throw new Error("error, BuildStep not supported: {0}", buildStep.GetType().FullName); + node.Dependencies.AddRange(dependencies); + + return node; } - public static List GetResolvablesFromBuildSteps(Dictionary buildSteps) + public static List GetBffNodesFromBuildSteps(Dictionary buildSteps, Strings preBuildDependencies) { - return buildSteps.Select(e => GetResolveableFromBuildStep(e.Key, e.Value)).ToList(); + var result = new List(); + + foreach (var buildStep in buildSteps.OrderBy(kvp => kvp.Value)) + { + // If CompareTo between two BuildSteps does not return 0, we create an explicit dependency to enforce execution order. + var dependencySteps = buildSteps.Where(kvp => kvp.Value.CompareTo(buildStep.Value) < 0).Select(kvp => kvp.Key); + + Strings nodePreBuildDependencies = new Strings(preBuildDependencies); + nodePreBuildDependencies.AddRange(dependencySteps); + + result.Add(GetBffNodesFromBuildStep(buildStep.Key, buildStep.Value, nodePreBuildDependencies)); + } + + return result; } } } diff --git a/Sharpmake.Generators/FastBuild/Bff.cs b/Sharpmake.Generators/FastBuild/Bff.cs index b5e8ec1e1..adb6bd791 100644 --- a/Sharpmake.Generators/FastBuild/Bff.cs +++ b/Sharpmake.Generators/FastBuild/Bff.cs @@ -522,10 +522,10 @@ List skipFiles { // the pre-steps are written in the master bff, we only need to refer their aliases preBuildTargets.AddRange(conf.EventPreBuildExecute.Select(e => e.Key)); - preBuildTargets.AddRange(conf.ResolvedEventPreBuildExe.Select(e => ProjectOptionsGenerator.MakeBuildStepName(conf, e, Vcxproj.BuildStep.PreBuild))); + preBuildTargets.AddRange(conf.ResolvedEventPreBuildExe.Select(e => ProjectOptionsGenerator.MakeBuildStepName(conf, e, Vcxproj.BuildStep.PreBuild, project.RootPath, projectPath))); preBuildTargets.AddRange(conf.EventCustomPrebuildExecute.Select(e => e.Key)); - preBuildTargets.AddRange(conf.ResolvedEventCustomPreBuildExe.Select(e => ProjectOptionsGenerator.MakeBuildStepName(conf, e, Vcxproj.BuildStep.PreBuildCustomAction))); + preBuildTargets.AddRange(conf.ResolvedEventCustomPreBuildExe.Select(e => ProjectOptionsGenerator.MakeBuildStepName(conf, e, Vcxproj.BuildStep.PreBuildCustomAction, project.RootPath, projectPath))); } fastBuildTargetSubTargets.AddRange(fastBuildProjectExeUtilityDependencyList); @@ -557,7 +557,7 @@ List skipFiles var extraPlatformEvents = platformBff.GetExtraPostBuildEvents(conf, fastBuildOutputFile).Select(step => { step.Resolve(resolver); return step; }); foreach (var buildEvent in extraPlatformEvents.Concat(conf.ResolvedEventPostBuildExe)) { - string eventKey = ProjectOptionsGenerator.MakeBuildStepName(conf, buildEvent, Vcxproj.BuildStep.PostBuild); + string eventKey = ProjectOptionsGenerator.MakeBuildStepName(conf, buildEvent, Vcxproj.BuildStep.PostBuild, project.RootPath, projectPath); fastBuildTargetSubTargets.Add(eventKey); postBuildEvents.Add(eventKey, buildEvent); } @@ -570,14 +570,14 @@ List skipFiles foreach (var buildEvent in conf.ResolvedEventCustomPostBuildExe) { - string eventKey = ProjectOptionsGenerator.MakeBuildStepName(conf, buildEvent, Vcxproj.BuildStep.PostBuildCustomAction); + string eventKey = ProjectOptionsGenerator.MakeBuildStepName(conf, buildEvent, Vcxproj.BuildStep.PostBuildCustomAction, project.RootPath, projectPath); fastBuildTargetSubTargets.Add(eventKey); postBuildEvents.Add(eventKey, buildEvent); } if (conf.PostBuildStepTest != null) { - string eventKey = ProjectOptionsGenerator.MakeBuildStepName(conf, conf.PostBuildStepTest, Vcxproj.BuildStep.PostBuildCustomAction); + string eventKey = ProjectOptionsGenerator.MakeBuildStepName(conf, conf.PostBuildStepTest, Vcxproj.BuildStep.PostBuildCustomAction, project.RootPath, projectPath); fastBuildTargetSubTargets.Add(eventKey); postBuildEvents.Add(eventKey, conf.PostBuildStepTest); } @@ -612,7 +612,7 @@ List skipFiles if (isCompileAsCFile) { fastBuildUsingPlatformConfig = platformBff.CConfigName(conf); - // Do not take cpp Language conformance into account while compiling in C + // Do not take Cpp Language conformance into account while compiling in C scopedOptions.Add(new Options.ScopedOption(confCmdLineOptions, "CppLanguageStd", FileGeneratorUtilities.RemoveLineTag)); scopedOptions.Add(new Options.ScopedOption(confOptions, "ClangCppLanguageStandard", FileGeneratorUtilities.RemoveLineTag)); if (clangPlatformBff != null) @@ -621,6 +621,10 @@ List skipFiles } else { + // Do not take C Language conformance into account while compiling in Cpp + scopedOptions.Add(new Options.ScopedOption(confCmdLineOptions, "CLanguageStd", FileGeneratorUtilities.RemoveLineTag)); + scopedOptions.Add(new Options.ScopedOption(confOptions, "ClangCLanguageStandard", FileGeneratorUtilities.RemoveLineTag)); + fastBuildSourceFileType = "/TP"; fastBuildUsingPlatformConfig = platformBff.CppConfigName(conf); } @@ -704,6 +708,7 @@ List skipFiles fastBuildPCHForceInclude = @"/FI""[cmdLineOptions.PrecompiledHeaderThrough]"""; break; case Options.Vc.General.PlatformToolset.LLVM: + case Options.Vc.General.PlatformToolset.ClangCL: // // TODO: figure out what version number to put there // maybe use the DevEnv value @@ -1242,8 +1247,19 @@ List skipFiles // These are all pre-build steps, at least in principle, so insert them before the other build steps. fastBuildTargetSubTargets.InsertRange(0, fileCustomBuildKeys); + // Resolve node name of the prebuild dependency for PostBuildEvents. + string resolvedSectionNodeIdentifier; + if (beginSectionType == Template.ConfigurationFile.ObjectListBeginSection) + { + resolvedSectionNodeIdentifier = resolver.Resolve("[fastBuildOutputFileShortName]_objects"); + } + else + { + resolvedSectionNodeIdentifier = resolver.Resolve("[fastBuildOutputFileShortName]_[fastBuildOutputType]"); + } + // Convert build steps to Bff resolvable objects - var resolvableBuildSteps = UtilityMethods.GetResolvablesFromBuildSteps(postBuildEvents); + var resolvableBuildSteps = UtilityMethods.GetBffNodesFromBuildSteps(postBuildEvents, new Strings(resolvedSectionNodeIdentifier)); // Resolve objects using the current project path var resolvedBuildSteps = resolvableBuildSteps.Select(b => b.Resolve(project.RootPath, projectPath, resolver)); @@ -1434,11 +1450,43 @@ private static void FillLinkerOptions(BffGenerationContext context) FillEmbeddedNatvisOptions(context); } + private static Strings CollectNatvisFiles(BffGenerationContext context) + { + Project.Configuration projectConfig = context.Configuration; + if (projectConfig.Output == Project.Configuration.OutputType.Dll || projectConfig.Output == Project.Configuration.OutputType.Exe) + { + Strings natvisFiles = new Strings(projectConfig.Project.NatvisFiles); + HashSet visitedProjects = new HashSet(); + foreach (Project.Configuration resolvedDepConfig in projectConfig.ResolvedDependencies) + { + if (resolvedDepConfig.Output != Project.Configuration.OutputType.Dll && resolvedDepConfig.Output != Project.Configuration.OutputType.Exe) + { + if (!visitedProjects.Contains(resolvedDepConfig.Project)) + { + visitedProjects.Add(resolvedDepConfig.Project); + foreach (string natvisFile in resolvedDepConfig.Project.NatvisFiles) + { + natvisFiles.Add(natvisFile); + } + } + } + } + + return natvisFiles; + } + else + { + return projectConfig.Project.NatvisFiles; + } + } + private static void FillEmbeddedNatvisOptions(BffGenerationContext context) { - if (context.Configuration.Project.NatvisFiles.Count > 0) + Strings natvisFiles = CollectNatvisFiles(context); + + if (natvisFiles.Count > 0) { - var cmdNatvisFiles = context.Configuration.Project.NatvisFiles.Select(n => Bff.CmdLineConvertIncludePathsFunc(context, context.EnvironmentVariableResolver, n, "/NATVIS:")); + var cmdNatvisFiles = natvisFiles.SortedValues.Select(n => Bff.CmdLineConvertIncludePathsFunc(context, context.EnvironmentVariableResolver, n, "/NATVIS:")); string linkerNatvis = string.Join($"'{Environment.NewLine} + ' ", cmdNatvisFiles); context.CommandLineOptions["LinkerNatvisFiles"] = linkerNatvis; @@ -1645,15 +1693,18 @@ private string GetUnityName(Project.Configuration conf) private void ConfigureUnities(IGenerationContext context, Dictionary>, List>> confSourceFiles) { var conf = context.Configuration; - var unityTuple = GetDefaultTupleConfig(); - var confSubConfigs = confSourceFiles[conf]; - var sourceFiles = confSubConfigs[unityTuple]; - var project = context.Project; - // Only add unity build to non blobbed projects -> which they will be blobbed by FBuild if (!conf.FastBuildBlobbed) return; + if (!confSourceFiles.ContainsKey(conf)) // no source files, so no unity section + return; + + var confSubConfigs = confSourceFiles[conf]; + var unityTuple = GetDefaultTupleConfig(); + var sourceFiles = confSubConfigs[unityTuple]; + var project = context.Project; + const int spaceLength = 42; string fastBuildUnityInputFiles = FileGeneratorUtilities.RemoveLineTag; diff --git a/Sharpmake.Generators/FastBuild/MasterBff.cs b/Sharpmake.Generators/FastBuild/MasterBff.cs index 9ddfa222e..d568ad5c8 100644 --- a/Sharpmake.Generators/FastBuild/MasterBff.cs +++ b/Sharpmake.Generators/FastBuild/MasterBff.cs @@ -345,7 +345,7 @@ private static bool GenerateMasterBffFile(Builder builder, ConfigurationsPerBff string previous; if (verificationPostBuildCopies.TryGetValue(key, out previous)) { - if (previous != currentSourceFullPath) + if (FileSystemStringComparer.StaticCompare(previous, currentSourceFullPath) != 0) builder.LogErrorLine("A post-build copy to the destination '{0}' already exist but from different sources: '{1}' and '{2}'!", Util.PathGetAbsolute(masterBffDirectory, destinationFolder), previous, currentSourceFullPath); } else @@ -359,6 +359,7 @@ private static bool GenerateMasterBffFile(Builder builder, ConfigurationsPerBff using (fileGenerator.Declare("fastBuildCopyAlias", fastBuildCopyAlias)) using (fileGenerator.Declare("fastBuildCopySource", Bff.CurrentBffPathKeyCombine(sourceFile))) using (fileGenerator.Declare("fastBuildCopyDest", Bff.CurrentBffPathKeyCombine(destinationFile))) + using (fileGenerator.Declare("fastBuildCopyDependencies", FileGeneratorUtilities.RemoveLineTag)) { if (!bffMasterSection.ContainsKey(fastBuildCopyAlias)) bffMasterSection.Add(fastBuildCopyAlias, fileGenerator.Resolver.Resolve(Bff.Template.ConfigurationFile.CopyFileSection)); @@ -374,7 +375,7 @@ private static bool GenerateMasterBffFile(Builder builder, ConfigurationsPerBff foreach (var buildEvent in conf.ResolvedEventPreBuildExe) { - string eventKey = ProjectOptionsGenerator.MakeBuildStepName(conf, buildEvent, Vcxproj.BuildStep.PreBuild); + string eventKey = ProjectOptionsGenerator.MakeBuildStepName(conf, buildEvent, Vcxproj.BuildStep.PreBuild, project.RootPath, masterBffDirectory); preBuildEvents.Add(eventKey, buildEvent); } @@ -386,7 +387,7 @@ private static bool GenerateMasterBffFile(Builder builder, ConfigurationsPerBff foreach (var buildEvent in conf.ResolvedEventCustomPreBuildExe) { - string eventKey = ProjectOptionsGenerator.MakeBuildStepName(conf, buildEvent, Vcxproj.BuildStep.PreBuildCustomAction); + string eventKey = ProjectOptionsGenerator.MakeBuildStepName(conf, buildEvent, Vcxproj.BuildStep.PreBuildCustomAction, project.RootPath, masterBffDirectory); customPreBuildEvents.Add(eventKey, buildEvent); } @@ -472,17 +473,16 @@ private static void WriteEvents( string relativeTo ) { - foreach (var buildEvent in buildEvents) + List bffNodes = UtilityMethods.GetBffNodesFromBuildSteps(buildEvents, new Strings()); + + foreach (var bffNode in bffNodes) { - string eventKey = resolver.Resolve(buildEvent.Key); + string nodeIdentifier = resolver.Resolve(bffNode.Identifier); - if (bffSection.ContainsKey(eventKey)) + if (bffSection.ContainsKey(nodeIdentifier)) continue; - var resolveableBuildStep = UtilityMethods.GetResolveableFromBuildStep(buildEvent.Key, buildEvent.Value); - var resolvedBuildStep = resolveableBuildStep.Resolve(projectRoot, relativeTo, resolver); - - bffSection.Add(eventKey, resolvedBuildStep); + bffSection.Add(nodeIdentifier, bffNode.Resolve(projectRoot, relativeTo, resolver)); } } diff --git a/Sharpmake.Generators/Generic/Makefile.cs b/Sharpmake.Generators/Generic/Makefile.cs index 21b7be5f2..b94b1716f 100644 --- a/Sharpmake.Generators/Generic/Makefile.cs +++ b/Sharpmake.Generators/Generic/Makefile.cs @@ -407,7 +407,12 @@ private Options.ExplicitOptions GenerateOptions(Project.Configuration conf, File #region Compiler // Defines - Strings defines = new Strings(); + var defines = new Strings(); + if (conf.DefaultOption == Options.DefaultTarget.Debug) + defines.Add("_DEBUG"); + else // Release + defines.Add("NDEBUG"); + defines.AddRange(conf.Defines); defines.InsertPrefix("-D"); options["Defines"] = defines.JoinStrings(" "); @@ -639,7 +644,7 @@ private string GetOutputDirectory(Project.Configuration conf, FileInfo projectFi private static string FormatOutputFileName(Project.Configuration conf) { string outputExtension = !string.IsNullOrEmpty(conf.OutputExtension) ? "." + conf.OutputExtension : ""; - string targetNamePrefix = (conf.Output == Project.Configuration.OutputType.Lib) ? "lib" : ""; + string targetNamePrefix = (conf.Output == Project.Configuration.OutputType.Lib || conf.Output == Project.Configuration.OutputType.Dll) ? "lib" : ""; return (targetNamePrefix + conf.TargetFileFullName + outputExtension); } diff --git a/Sharpmake.Generators/Properties/AssemblyInfo.cs b/Sharpmake.Generators/Properties/AssemblyInfo.cs index 2a68fe1cb..44aea2322 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.4.0")] +[assembly: AssemblyVersion("0.14.5.0")] [assembly: InternalsVisibleTo("Sharpmake")] diff --git a/Sharpmake.Generators/Sharpmake.Generators.csproj b/Sharpmake.Generators/Sharpmake.Generators.csproj index cc09870e8..150ca9da4 100644 --- a/Sharpmake.Generators/Sharpmake.Generators.csproj +++ b/Sharpmake.Generators/Sharpmake.Generators.csproj @@ -1,6 +1,5 @@  - Debug AnyCPU @@ -20,8 +19,8 @@ false ..\bin\debug ..\tmp\obj\debug\sharpmake.generators - ..\tmp\obj\Debug\Sharpmake.Generators - ..\bin\Debug\Sharpmake.Generators.xml + ..\tmp\obj\debug\sharpmake.generators + ..\bin\debug\sharpmake.generators.xml DEBUG;TRACE 4 true @@ -37,8 +36,8 @@ true ..\bin\release ..\tmp\obj\release\sharpmake.generators - ..\tmp\obj\Release\Sharpmake.Generators - ..\bin\Release\Sharpmake.Generators.xml + ..\tmp\obj\release\sharpmake.generators + ..\bin\release\sharpmake.generators.xml TRACE 4 true diff --git a/Sharpmake.Generators/VisualStudio/Csproj.Template.cs b/Sharpmake.Generators/VisualStudio/Csproj.Template.cs index 68e11e783..e1cea7516 100644 --- a/Sharpmake.Generators/VisualStudio/Csproj.Template.cs +++ b/Sharpmake.Generators/VisualStudio/Csproj.Template.cs @@ -371,6 +371,12 @@ public static class ItemGroups @" "; + public static string ItemGroupConditionalBegin = +@" +"; + + public static string ItemGroupTargetFrameworkCondition = "'$(TargetFramework)'=='[targetFramework]'"; + public static string ItemGroupEnd = @" "; diff --git a/Sharpmake.Generators/VisualStudio/Csproj.cs b/Sharpmake.Generators/VisualStudio/Csproj.cs index 0e6813bab..41db85546 100644 --- a/Sharpmake.Generators/VisualStudio/Csproj.cs +++ b/Sharpmake.Generators/VisualStudio/Csproj.cs @@ -33,9 +33,14 @@ internal interface IResolvable string Resolve(Resolver resolver); } + internal interface IResolvableCondition : IResolvable + { + string ResolveCondition(Resolver resolver); + } + internal class ItemGroups { - internal ItemGroup References = new ItemGroup(); + internal ItemGroupConditional> References = new ItemGroupConditional>(); internal ItemGroup Services = new ItemGroup(); internal ItemGroup Compiles = new ItemGroup(); internal ItemGroup ProjectReferences = new ItemGroup(); @@ -55,7 +60,7 @@ internal class ItemGroups internal ItemGroup EntityDeploys = new ItemGroup(); internal ItemGroup WCFMetadataStorages = new ItemGroup(); internal ItemGroup AppSplashScreen = new ItemGroup(); - internal ItemGroup PackageReferences = new ItemGroup(); + internal ItemGroupConditional> PackageReferences = new ItemGroupConditional>(); internal ItemGroup Analyzers = new ItemGroup(); internal ItemGroup VSIXSourceItems = new ItemGroup(); internal ItemGroup FolderIncludes = new ItemGroup(); @@ -97,6 +102,7 @@ public string Resolve(Resolver resolver) { if (Count <= 0) return string.Empty; + var writer = new StringWriter(); writer.Write(Template.ItemGroups.ItemGroupBegin); var sortedValues = SortedValues; @@ -109,6 +115,83 @@ public string Resolve(Resolver resolver) } } + internal class ItemGroupConditional : UniqueList, IResolvable where T : IResolvableCondition + { + public T AlwaysTrueElement; + + public string Resolve(Resolver resolver) + { + if (Count <= 0) + return string.Empty; + + var conditionalItemGroups = new Dictionary>(); + foreach (T elem in Values) + { + var resolvedElemCondition = elem.ResolveCondition(resolver); + var resolvedElem = elem.Resolve(resolver); + if (conditionalItemGroups.ContainsKey(resolvedElemCondition)) + conditionalItemGroups[resolvedElemCondition].Add(resolvedElem); + else + conditionalItemGroups.Add(resolvedElemCondition, new List { resolvedElem }); + } + + // No ItemGroup, skip + if (!conditionalItemGroups.Any()) + return string.Empty; + + var writer = new StringWriter(); + var resolvedAlwaysTrueCondition = AlwaysTrueElement?.ResolveCondition(resolver); + foreach (var conditionalItemGroup in conditionalItemGroups.OrderBy(k => k.Key, StringComparer.InvariantCultureIgnoreCase)) + { + // No element for this ItemGroup, skip + if (!conditionalItemGroup.Value.Any()) + continue; + + if (resolvedAlwaysTrueCondition != null && resolvedAlwaysTrueCondition == conditionalItemGroup.Key) + { + writer.Write(Template.ItemGroups.ItemGroupBegin); + } + else + { + using (resolver.NewScopedParameter("itemGroupCondition", conditionalItemGroup.Key)) + writer.Write(resolver.Resolve(Template.ItemGroups.ItemGroupConditionalBegin)); + } + + foreach (var elem in conditionalItemGroup.Value.OrderBy(v => v, StringComparer.InvariantCultureIgnoreCase)) + writer.Write(elem); + + writer.Write(Template.ItemGroups.ItemGroupEnd); + } + return writer.ToString(); + } + } + + internal class TargetFrameworksCondition : UniqueList, IResolvableCondition where T : IResolvable + { + public List TargetFrameworks; + + public string ResolveCondition(Resolver resolver) + { + using (resolver.NewScopedParameter("targetFramework", string.Join(";", TargetFrameworks.Select(conf => conf.ToFolderName())))) + { + return resolver.Resolve(Template.ItemGroups.ItemGroupTargetFrameworkCondition); + } + } + + public string Resolve(Resolver resolver) + { + if (Count <= 0) + return string.Empty; + var writer = new StringWriter(); + var sortedValues = SortedValues; + foreach (T elem in sortedValues) + { + writer.Write(elem.Resolve(resolver)); + } + return writer.ToString(); + } + } + internal class ItemGroupItem : IComparable, IEquatable { public string Include; @@ -810,6 +893,48 @@ public string Resolve(Resolver resolver) return resolver.Resolve(Template.ItemGroups.VSIXSourceItem); } } + + private static void AddTargetFrameworksCondition(ItemGroupConditional> itemGroupConditional, DotNetFramework dotNetFramework, T elem) where T : IResolvable + { + if (itemGroupConditional.Any(it => it.Contains(elem))) + { + foreach (var itemGroup in itemGroupConditional.Where(it => it.Contains(elem) && !it.TargetFrameworks.Contains(dotNetFramework))) + { + itemGroup.TargetFrameworks.Add(dotNetFramework); + } + } + else + { + var newItemGroup = new TargetFrameworksCondition + { + TargetFrameworks = new List { dotNetFramework }, + }; + newItemGroup.Add(elem); + itemGroupConditional.Add(newItemGroup); + } + } + + public void SetTargetFrameworks(List projectFrameworks) + { + References.AlwaysTrueElement = new TargetFrameworksCondition + { + TargetFrameworks = projectFrameworks + }; + PackageReferences.AlwaysTrueElement = new TargetFrameworksCondition + { + TargetFrameworks = projectFrameworks + }; + } + + public void AddReference(DotNetFramework dotNetFramework, Reference reference) + { + AddTargetFrameworksCondition(References, dotNetFramework, reference); + } + + public void AddPackageReference(DotNetFramework dotNetFramework, ItemTemplate itemTemplate) + { + AddTargetFrameworksCondition(PackageReferences, dotNetFramework, itemTemplate); + } } internal class Choose : IResolvable @@ -909,6 +1034,10 @@ List skipFiles // Need to sort by name and platform List configurations = unsortedConfigurations.OrderBy(conf => conf.Name + conf.Platform).ToList(); + List projectFrameworks = configurations.Select( + conf => conf.Target.GetFragment()).Distinct().ToList(); + itemGroups.SetTargetFrameworks(projectFrameworks); + // valid that 2 conf name in the same project don't have the same name var configurationNameMapping = new Dictionary(); string assemblyName = null; @@ -982,13 +1111,11 @@ List skipFiles string targetFrameworkString; DevEnv devenv = configurations.Select( - conf => ((ITarget)conf.Target).GetFragment()).Distinct().Single(); - List projectFrameworks = configurations.Select( - conf => ((ITarget)conf.Target).GetFragment()).Distinct().ToList(); + conf => conf.Target.GetFragment()).Distinct().Single(); bool isNetCoreProjectSchema = project.ProjectSchema == CSharpProjectSchema.NetCore || (project.ProjectSchema == CSharpProjectSchema.Default && - (projectFrameworks.Any(x => x.IsDotNetCore()) || projectFrameworks.Count > 1) + (projectFrameworks.Any(x => x.IsDotNetCore() || x.IsDotNetStandard()) || projectFrameworks.Count > 1) ); if (isNetCoreProjectSchema) { @@ -1032,11 +1159,6 @@ List skipFiles WriteCustomProperties(preImportCustomProperties, project, writer, resolver); var preImportProjects = new List(project.PreImportProjects); - if (!isNetCoreProjectSchema) - { - CSharpProject.AddCSharpSpecificPreImportProjects(preImportProjects, devenv); - } - WriteImportProjects(preImportProjects.Distinct(EqualityComparer.Default), project, configurations.First(), writer, resolver); // generate all configuration options onces... @@ -2059,72 +2181,76 @@ List skipFiles #region References - List projectFrameworks = configurations.Select( - conf => ((ITarget)conf.Target).GetFragment()).Distinct().ToList(); - - bool netCoreProject = project.ProjectSchema == CSharpProjectSchema.NetCore || - (project.ProjectSchema == CSharpProjectSchema.Default && - projectFrameworks.Any(x => x.IsDotNetCore()) - ); - if (!netCoreProject) - { - var referencesByName = new List(); - configurations.ForEach( - conf => referencesByName.AddRange( - conf.ReferencesByName.Select( - str => new ItemGroups.Reference + foreach (var conf in configurations) + { + var dotNetFramework = conf.Target.GetFragment(); + if (dotNetFramework.IsDotNetFramework()) + { + foreach (var str in conf.ReferencesByName) + { + var referencesByName = new ItemGroups.Reference { Include = str, Private = project.DependenciesCopyLocal.HasFlag(Project.DependenciesCopyLocalTypes.DotNetReferences) ? default(bool?) : false, - }))); - itemGroups.References.AddRange(referencesByName); + }; + itemGroups.AddReference(dotNetFramework, referencesByName); + } + } } - var referencesByNameExternal = new List(); - configurations.ForEach( - conf => referencesByNameExternal.AddRange( - conf.ReferencesByNameExternal.Select( - str => new ItemGroups.Reference + foreach (var conf in configurations) + { + var dotNetFramework = conf.Target.GetFragment(); + foreach (var str in conf.ReferencesByNameExternal) + { + var referencesByNameExternal = new ItemGroups.Reference { Include = str, Private = project.DependenciesCopyLocal.HasFlag(Project.DependenciesCopyLocalTypes.DotNetExtensions), - }))); - itemGroups.References.AddRange(referencesByNameExternal); - - var referencesByPath = new List(); + }; + itemGroups.AddReference(dotNetFramework, referencesByNameExternal); + } + } foreach (var conf in configurations) { - referencesByPath.AddRange( - conf.ReferencesByPath.Select(Util.GetCapitalizedPath) - .Select(str => new ItemGroups.Reference + var dotNetFramework = conf.Target.GetFragment(); + foreach (var str in conf.ReferencesByPath.Select(Util.GetCapitalizedPath)) + { + var referencesByPath = new ItemGroups.Reference { Include = Path.GetFileNameWithoutExtension(str), SpecificVersion = false, HintPath = Util.PathGetRelative(_projectPathCapitalized, str), Private = project.DependenciesCopyLocal.HasFlag(Project.DependenciesCopyLocalTypes.ExternalReferences), - })); + }; + itemGroups.AddReference(dotNetFramework, referencesByPath); + } - referencesByPath.AddRange( - project.AdditionalEmbeddedAssemblies.Select(Util.GetCapitalizedPath) - .Select(str => new ItemGroups.Reference + foreach (var str in project.AdditionalEmbeddedAssemblies.Select(Util.GetCapitalizedPath)) + { + var referencesByPath = new ItemGroups.Reference { Include = Path.GetFileNameWithoutExtension(str), SpecificVersion = false, HintPath = Util.PathGetRelative(_projectPathCapitalized, str), Private = false - })); + }; + itemGroups.AddReference(dotNetFramework, referencesByPath); + } } - itemGroups.References.AddRange(referencesByPath); - - if (!netCoreProject) + foreach (var conf in configurations) { - var references = configurations.SelectMany( - conf => conf.DotNetReferences.Select( - r => GetItemGroupsReference(r, project.DependenciesCopyLocal))); - - itemGroups.References.AddRange(references); + var dotNetFramework = conf.Target.GetFragment(); + if (dotNetFramework.IsDotNetFramework()) + { + foreach (var r in conf.DotNetReferences) + { + var references = GetItemGroupsReference(r, project.DependenciesCopyLocal); + itemGroups.AddReference(dotNetFramework, references); + } + } } if (Util.DirectoryExists(Path.Combine(project.SourceRootPath, "Web References"))) @@ -2256,58 +2382,61 @@ private void GeneratePackageReferences( List skipFiles ) { - Project.Configuration configuration = configurations[0]; - var devenv = configuration.Target.GetFragment(); - // package reference: Default in vs2017+ - if (project.NuGetReferenceType == Project.NuGetPackageMode.PackageReference - || (project.NuGetReferenceType == Project.NuGetPackageMode.VersionDefault && devenv >= DevEnv.vs2017)) + foreach (var configuration in configurations) { - if (devenv < DevEnv.vs2017) - throw new Error("Package references are not supported on Visual Studio versions below vs2017"); - - var resolver = new Resolver(); - foreach (var packageReference in configuration.ReferencesByNuGetPackage) + var devenv = configuration.Target.GetFragment(); + var dotNetFramework = configuration.Target.GetFragment(); + // package reference: Default in vs2017+ + if (project.NuGetReferenceType == Project.NuGetPackageMode.PackageReference + || (project.NuGetReferenceType == Project.NuGetPackageMode.VersionDefault && devenv >= DevEnv.vs2017)) { - itemGroups.PackageReferences.Add(new ItemGroups.ItemTemplate(packageReference.Resolve(resolver))); - } - } - // project.json: Default in vs2015 - else if (project.NuGetReferenceType == Project.NuGetPackageMode.ProjectJson - || (project.NuGetReferenceType == Project.NuGetPackageMode.VersionDefault && devenv == DevEnv.vs2015)) - { - if (devenv < DevEnv.vs2015) - throw new Error("Project.json files are not supported on Visual Studio versions below vs2015"); + if (devenv < DevEnv.vs2017) + throw new Error("Package references are not supported on Visual Studio versions below vs2017"); - var projectJson = new ProjectJson(); - projectJson.Generate(_builder, project, configurations, _projectPath, generatedFiles, skipFiles); - if (projectJson.IsGenerated) - { - string include = Util.PathGetRelative(_projectPathCapitalized, Util.SimplifyPath(projectJson.ProjectJsonPath)); - itemGroups.Nones.Add(new ItemGroups.None { Include = include }); + var resolver = new Resolver(); + foreach (var packageReference in configuration.ReferencesByNuGetPackage) + { + itemGroups.AddPackageReference(dotNetFramework, new ItemGroups.ItemTemplate(packageReference.Resolve(resolver))); + } } - } - // packages.config: Default in vs2013, vs2012, and vs2010 - else if (project.NuGetReferenceType == Project.NuGetPackageMode.PackageConfig - || (project.NuGetReferenceType == Project.NuGetPackageMode.VersionDefault && devenv <= DevEnv.vs2013)) - { - var packagesConfig = new PackagesConfig(); - packagesConfig.Generate(_builder, project, configurations, _projectPath, generatedFiles, skipFiles); - if (packagesConfig.IsGenerated) + // project.json: Default in vs2015 + else if (project.NuGetReferenceType == Project.NuGetPackageMode.ProjectJson + || (project.NuGetReferenceType == Project.NuGetPackageMode.VersionDefault && devenv == DevEnv.vs2015)) { - string include = Util.PathGetRelative(_projectPathCapitalized, Util.SimplifyPath(packagesConfig.PackagesConfigPath)); - itemGroups.Nones.Add(new ItemGroups.None { Include = include }); + if (devenv < DevEnv.vs2015) + throw new Error("Project.json files are not supported on Visual Studio versions below vs2015"); + + var projectJson = new ProjectJson(); + projectJson.Generate(_builder, project, configurations, _projectPath, generatedFiles, skipFiles); + if (projectJson.IsGenerated) + { + string include = Util.PathGetRelative(_projectPathCapitalized, Util.SimplifyPath(projectJson.ProjectJsonPath)); + itemGroups.Nones.Add(new ItemGroups.None { Include = include }); + } } - foreach (var references in configuration.ReferencesByNuGetPackage) + // packages.config: Default in vs2013, vs2012, and vs2010 + else if (project.NuGetReferenceType == Project.NuGetPackageMode.PackageConfig + || (project.NuGetReferenceType == Project.NuGetPackageMode.VersionDefault && devenv <= DevEnv.vs2013)) { - string dotNetHint = references.DotNetHint; - if (string.IsNullOrWhiteSpace(dotNetHint)) + var packagesConfig = new PackagesConfig(); + packagesConfig.Generate(_builder, project, configurations, _projectPath, generatedFiles, skipFiles); + if (packagesConfig.IsGenerated) { - var frameworkFlags = project.Targets.TargetPossibilities.Select(f => f.GetFragment()).Aggregate((x, y) => x | y); - DotNetFramework dnfs = ((DotNetFramework[])Enum.GetValues(typeof(DotNetFramework))).First(f => frameworkFlags.HasFlag(f)); - dotNetHint = dnfs.ToFolderName(); + string include = Util.PathGetRelative(_projectPathCapitalized, Util.SimplifyPath(packagesConfig.PackagesConfigPath)); + itemGroups.Nones.Add(new ItemGroups.None { Include = include }); + } + foreach (var references in configuration.ReferencesByNuGetPackage) + { + string dotNetHint = references.DotNetHint; + if (string.IsNullOrWhiteSpace(dotNetHint)) + { + var frameworkFlags = project.Targets.TargetPossibilities.Select(f => f.GetFragment()).Aggregate((x, y) => x | y); + DotNetFramework dnfs = ((DotNetFramework[])Enum.GetValues(typeof(DotNetFramework))).First(f => frameworkFlags.HasFlag(f)); + dotNetHint = dnfs.ToFolderName(); + } + string hintPath = Path.Combine("$(SolutionDir)packages", references.Name + "." + references.Version, "lib", dotNetHint, references.Name + ".dll"); + itemGroups.AddReference(dotNetFramework, new ItemGroups.Reference { Include = references.Name, HintPath = hintPath }); } - string hintPath = Path.Combine("$(SolutionDir)packages", references.Name + "." + references.Version, "lib", dotNetHint, references.Name + ".dll"); - itemGroups.References.Add(new ItemGroups.Reference { Include = references.Name, HintPath = hintPath }); } } } diff --git a/Sharpmake.Generators/VisualStudio/ProjectOptionsGenerator.cs b/Sharpmake.Generators/VisualStudio/ProjectOptionsGenerator.cs index c5970bab5..0d6280e41 100644 --- a/Sharpmake.Generators/VisualStudio/ProjectOptionsGenerator.cs +++ b/Sharpmake.Generators/VisualStudio/ProjectOptionsGenerator.cs @@ -92,6 +92,8 @@ internal void GenerateOptions(IGenerationContext context, ProjectOptionGeneratio GenerateGeneralOptions(context, optionsContext); + GenerateAdvancedOptions(context, optionsContext); + if (level >= ProjectOptionGenerationLevel.Compiler) GenerateCompilerOptions(context, optionsContext); @@ -221,15 +223,45 @@ private static void SelectConfigurationTypeOption(IGenerationContext context) } } + private void GenerateAdvancedOptions(IGenerationContext context, ProjectOptionsGenerationContext optionsContext) + { + context.SelectOption + ( + Options.Option(Options.Vc.Advanced.CopyLocalDeploymentContent.Enable, () => { context.Options["CopyLocalDeploymentContent"] = "true"; }), + Options.Option(Options.Vc.Advanced.CopyLocalDeploymentContent.Disable, () => { context.Options["CopyLocalDeploymentContent"] = FileGeneratorUtilities.RemoveLineTag; }) + ); + + context.SelectOption + ( + Options.Option(Options.Vc.Advanced.CopyLocalProjectReference.Enable, () => { context.Options["CopyLocalProjectReference"] = "true"; }), + Options.Option(Options.Vc.Advanced.CopyLocalProjectReference.Disable, () => { context.Options["CopyLocalProjectReference"] = FileGeneratorUtilities.RemoveLineTag; }) + ); + + context.SelectOption + ( + Options.Option(Options.Vc.Advanced.CopyLocalDebugSymbols.Enable, () => { context.Options["CopyLocalDebugSymbols"] = "true"; }), + Options.Option(Options.Vc.Advanced.CopyLocalDebugSymbols.Disable, () => { context.Options["CopyLocalDebugSymbols"] = FileGeneratorUtilities.RemoveLineTag; }) + ); + + context.SelectOption + ( + Options.Option(Options.Vc.Advanced.CopyCppRuntimeToOutputDir.Enable, () => { context.Options["CopyCppRuntimeToOutputDir"] = "true"; }), + Options.Option(Options.Vc.Advanced.CopyCppRuntimeToOutputDir.Disable, () => { context.Options["CopyCppRuntimeToOutputDir"] = FileGeneratorUtilities.RemoveLineTag; }) + ); + } + private void GenerateCompilerOptions(IGenerationContext context, ProjectOptionsGenerationContext optionsContext) { var forcedIncludes = new Strings(); + bool useClangCl = Options.GetObject(context.Configuration).IsLLVMToolchain() && + Options.GetObject(context.Configuration) == Options.Vc.LLVM.UseClangCl.Enable; + + if (!context.Configuration.IsFastBuild) { // support of PCH requires them to be set as ForceIncludes with ClangCl - if (Options.GetObject(context.Configuration).IsLLVMToolchain() && - Options.GetObject(context.Configuration) == Options.Vc.LLVM.UseClangCl.Enable) + if (useClangCl) { forcedIncludes.Add(context.Configuration.PrecompHeader); } @@ -265,6 +297,7 @@ private void GenerateCompilerOptions(IGenerationContext context, ProjectOptionsG context.Options["LanguageStandard"] = FileGeneratorUtilities.RemoveLineTag; context.CommandLineOptions["LanguageStandard"] = FileGeneratorUtilities.RemoveLineTag; + //https://clang.llvm.org/docs/CommandGuide/clang.html context.SelectOption ( Options.Option(Options.Clang.Compiler.CppLanguageStandard.Default, () => { context.Options["ClangCppLanguageStandard"] = FileGeneratorUtilities.RemoveLineTag; }), @@ -272,10 +305,31 @@ private void GenerateCompilerOptions(IGenerationContext context, ProjectOptionsG Options.Option(Options.Clang.Compiler.CppLanguageStandard.Cpp11, () => { context.Options["ClangCppLanguageStandard"] = "-std=c++11"; }), Options.Option(Options.Clang.Compiler.CppLanguageStandard.Cpp14, () => { context.Options["ClangCppLanguageStandard"] = "-std=c++14"; }), Options.Option(Options.Clang.Compiler.CppLanguageStandard.Cpp17, () => { context.Options["ClangCppLanguageStandard"] = "-std=c++17"; }), + Options.Option(Options.Clang.Compiler.CppLanguageStandard.Cpp2a, () => { context.Options["ClangCppLanguageStandard"] = "-std=c++2a"; }), Options.Option(Options.Clang.Compiler.CppLanguageStandard.GnuCpp98, () => { context.Options["ClangCppLanguageStandard"] = "-std=gnu++98"; }), Options.Option(Options.Clang.Compiler.CppLanguageStandard.GnuCpp11, () => { context.Options["ClangCppLanguageStandard"] = "-std=gnu++11"; }), - Options.Option(Options.Clang.Compiler.CppLanguageStandard.GnuCpp14, () => { context.Options["ClangCppLanguageStandard"] = "-std=gnu++14"; }) + Options.Option(Options.Clang.Compiler.CppLanguageStandard.GnuCpp14, () => { context.Options["ClangCppLanguageStandard"] = "-std=gnu++14"; }), + Options.Option(Options.Clang.Compiler.CppLanguageStandard.GnuCpp17, () => { context.Options["ClangCppLanguageStandard"] = "-std=gnu++17"; }), + Options.Option(Options.Clang.Compiler.CppLanguageStandard.GnuCpp2a, () => { context.Options["ClangCppLanguageStandard"] = "-std=gnu++2a"; }) + ); + + context.SelectOption + ( + Options.Option(Options.Clang.Compiler.CLanguageStandard.Default, () => { context.Options["ClangCLanguageStandard"] = FileGeneratorUtilities.RemoveLineTag; }), + Options.Option(Options.Clang.Compiler.CLanguageStandard.C89, () => { context.Options["ClangCLanguageStandard"] = "-std=c89"; }), + Options.Option(Options.Clang.Compiler.CLanguageStandard.C90, () => { context.Options["ClangCLanguageStandard"] = "-std=c90"; }), + Options.Option(Options.Clang.Compiler.CLanguageStandard.C99, () => { context.Options["ClangCLanguageStandard"] = "-std=c99"; }), + Options.Option(Options.Clang.Compiler.CLanguageStandard.C11, () => { context.Options["ClangCLanguageStandard"] = "-std=c11"; }), + Options.Option(Options.Clang.Compiler.CLanguageStandard.C17, () => { context.Options["ClangCLanguageStandard"] = "-std=c17"; }), + Options.Option(Options.Clang.Compiler.CLanguageStandard.GnuC89, () => { context.Options["ClangCLanguageStandard"] = "-std=gnu89"; }), + Options.Option(Options.Clang.Compiler.CLanguageStandard.GnuC90, () => { context.Options["ClangCLanguageStandard"] = "-std=gnu90"; }), + Options.Option(Options.Clang.Compiler.CLanguageStandard.GnuC99, () => { context.Options["ClangCLanguageStandard"] = "-std=gnu99"; }), + Options.Option(Options.Clang.Compiler.CLanguageStandard.GnuC11, () => { context.Options["ClangCLanguageStandard"] = "-std=gnu11"; }), + Options.Option(Options.Clang.Compiler.CLanguageStandard.GnuC17, () => { context.Options["ClangCLanguageStandard"] = "-std=gnu17"; }) ); + + context.CommandLineOptions["CppLanguageStd"] = context.Options["ClangCppLanguageStandard"]; + context.CommandLineOptions["CLanguageStd"] = context.Options["ClangCLanguageStandard"]; } else { @@ -926,8 +980,7 @@ private void GenerateCompilerOptions(IGenerationContext context, ProjectOptionsG //Options.Vc.Compiler.DefineCPlusPlus. See: https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ // Disable /Zc:__cplusplus- // Enable /Zc:__cplusplus - if (!Options.GetObject(context.Configuration).IsLLVMToolchain() || - Options.GetObject(context.Configuration) != Options.Vc.LLVM.UseClangCl.Enable) + if (!useClangCl) { if (!context.Configuration.Platform.IsUsingClang()) { @@ -982,6 +1035,13 @@ private void GenerateCompilerOptions(IGenerationContext context, ProjectOptionsG // Default defines... optionsContext.PlatformVcxproj.SelectCompilerOptions(context); + if (useClangCl && context.Configuration.IsFastBuild) + { + // This prevents clang-cl from auto-detecting the locally installed MSVC toolchain. Only paths on the command line will be considered. + // It doesn't apply on MSVC build, where the toolchain is provided through environment variables. + context.Configuration.AdditionalCompilerOptions.Add("-nostdinc"); + } + // Options.Vc.Compiler.AdditionalOptions if (context.Configuration.AdditionalCompilerOptions.Any()) { @@ -1111,7 +1171,8 @@ private static void SelectPlatformToolsetOption(IGenerationContext context, Proj Options.Option(Options.Vc.General.PlatformToolset.v142, () => { context.Options["PlatformToolset"] = "v142"; }), Options.Option(Options.Vc.General.PlatformToolset.LLVM_vs2012, () => { context.Options["PlatformToolset"] = "LLVM-vs2012"; context.Options["TrackFileAccess"] = "false"; }), Options.Option(Options.Vc.General.PlatformToolset.LLVM_vs2014, () => { context.Options["PlatformToolset"] = "LLVM-vs2014"; }), - Options.Option(Options.Vc.General.PlatformToolset.LLVM, () => { context.Options["PlatformToolset"] = "llvm"; }) + Options.Option(Options.Vc.General.PlatformToolset.LLVM, () => { context.Options["PlatformToolset"] = "llvm"; }), + Options.Option(Options.Vc.General.PlatformToolset.ClangCL, () => { context.Options["PlatformToolset"] = "ClangCL"; }) ); optionsContext.PlatformVcxproj.SetupPlatformToolsetOptions(context); } @@ -1927,16 +1988,15 @@ private void GenerateLLVMOptions(IGenerationContext context, ProjectOptionsGener Options.Option(Options.Vc.LLVM.UseLldLink.Enable, () => { context.Options["UseLldLink"] = "true"; }), Options.Option(Options.Vc.LLVM.UseLldLink.Disable, () => { context.Options["UseLldLink"] = "false"; }) ); - - if (Options.GetObject(context.Configuration).IsLLVMToolchain() && - Options.GetObject(context.Configuration) == Options.Vc.LLVM.UseClangCl.Enable) - { - // This prevents clang-cl from auto-detecting the locally installed MSVC toolchain. Only paths on the command line will be considered. - context.Configuration.AdditionalCompilerOptions.Add("-nostdinc"); - } } + [Obsolete("Use MakeBuildStepName taking the 2 extra arguments projectRootPath and rootPath", error: true)] public static string MakeBuildStepName(Project.Configuration conf, Project.Configuration.BuildStepBase eventBuildStep, Vcxproj.BuildStep buildStep) + { + return null; + } + + public static string MakeBuildStepName(Project.Configuration conf, Project.Configuration.BuildStepBase eventBuildStep, Vcxproj.BuildStep buildStep, string projectRootPath, string projectPath) { if (!eventBuildStep.IsResolved) throw new Error("Event hasn't been resolved!"); @@ -1948,11 +2008,12 @@ public static string MakeBuildStepName(Project.Configuration conf, Project.Confi if (eventBuildStep is Project.Configuration.BuildStepExecutable) { var cEvent = eventBuildStep as Project.Configuration.BuildStepExecutable; + string normalizedConfTargetPath = UtilityMethods.GetNormalizedPathForBuildStep(projectRootPath, projectPath, conf.TargetPath); string execName; if (isPostBuildCustomActionWithSpecificName) { - execName = @"Exec_" + extractName(cEvent.ExecutableFile) + "_" + (conf.TargetPath + conf.TargetFileFullName + cEvent.ExecutableOtherArguments).GetHashCode().ToString("X8"); + execName = @"Exec_" + extractName(cEvent.ExecutableFile) + "_" + (normalizedConfTargetPath + conf.TargetFileFullName + cEvent.ExecutableOtherArguments).GetHashCode().ToString("X8"); } else { @@ -1965,15 +2026,17 @@ public static string MakeBuildStepName(Project.Configuration conf, Project.Confi else if (eventBuildStep is Project.Configuration.BuildStepCopy) { var cEvent = eventBuildStep as Project.Configuration.BuildStepCopy; + string sourcePath = UtilityMethods.GetNormalizedPathForBuildStep(projectRootPath, projectPath, cEvent.SourcePath); + string destinationPath = UtilityMethods.GetNormalizedPathForBuildStep(projectRootPath, projectPath, cEvent.DestinationPath); string copyName; if (isPostBuildCustomActionWithSpecificName) { - copyName = "Copy_" + (conf.TargetFileFullName + cEvent.SourcePath + cEvent.DestinationPath).GetHashCode().ToString("X8"); + copyName = "Copy_" + (conf.TargetFileFullName + sourcePath + destinationPath).GetHashCode().ToString("X8"); } else { - copyName = "Copy_" + (cEvent.SourcePath + cEvent.DestinationPath).GetHashCode().ToString("X8"); + copyName = "Copy_" + (sourcePath + destinationPath).GetHashCode().ToString("X8"); } return copyName; @@ -1981,16 +2044,17 @@ public static string MakeBuildStepName(Project.Configuration conf, Project.Confi else if (eventBuildStep is Project.Configuration.BuildStepTest) { var tEvent = eventBuildStep as Project.Configuration.BuildStepTest; + string normalizedConfTargetPath = UtilityMethods.GetNormalizedPathForBuildStep(projectRootPath, projectPath, conf.TargetPath); string testName; if (isPostBuildCustomActionWithSpecificName) { - testName = "Test_" + extractName(tEvent.TestExecutable) + "_" + (conf.TargetPath + conf.TargetFileFullName).GetHashCode().ToString("X8"); + testName = "Test_" + extractName(tEvent.TestExecutable) + "_" + (tEvent.TestArguments + normalizedConfTargetPath + conf.TargetFileFullName).GetHashCode().ToString("X8"); } else { testName = "Test_" + extractName(tEvent.TestExecutable); - testName += "_" + (testName).GetHashCode().ToString("X8"); + testName += "_" + (testName + tEvent.TestArguments).GetHashCode().ToString("X8"); } return testName; diff --git a/Sharpmake.Generators/VisualStudio/Vcxproj.cs b/Sharpmake.Generators/VisualStudio/Vcxproj.cs index c4e5ec022..057cffe70 100644 --- a/Sharpmake.Generators/VisualStudio/Vcxproj.cs +++ b/Sharpmake.Generators/VisualStudio/Vcxproj.cs @@ -1129,7 +1129,8 @@ private void GenerateBffFilesSection(IVcxprojGenerationContext context, IFileGen // Add FastBuild bff file to Project if (FastBuildSettings.IncludeBFFInProjects) { - string fastBuildFile = Bff.GetBffFileName(".", context.Configuration.BffFileName); + string relativeBffFilePath = Util.PathGetRelative(context.Configuration.ProjectPath, context.Configuration.BffFullFileName); + string fastBuildFile = Bff.GetBffFileName(".", relativeBffFilePath); fastBuildFile = Util.SimplifyPath(fastBuildFile); fileGenerator.Write(Template.Project.ProjectFilesBegin); @@ -1692,9 +1693,13 @@ IList skipFiles if (objsInSubdirectories) { - using (fileGenerator.Declare("ObjectFileName", conf.ObjectFileName(file.FileNameSourceRelative))) + string objectFileName = conf.ObjectFileName(file.FileNameSourceRelative); + if (!string.IsNullOrEmpty(objectFileName)) { - fileGenerator.Write(Template.Project.ProjectFilesSourceObjectFileName); + using (fileGenerator.Declare("ObjectFileName", objectFileName)) + { + fileGenerator.Write(Template.Project.ProjectFilesSourceObjectFileName); + } } } diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Android/AndroidPlatform.cs b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Android/AndroidPlatform.cs index 2dfa11836..e5617a203 100644 --- a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Android/AndroidPlatform.cs +++ b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Android/AndroidPlatform.cs @@ -479,6 +479,16 @@ public override IEnumerable GetLibraryPaths(IGenerationContext context) return dirs; } + public override 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(";").Replace(@"""", ""); + } + public override bool HasPrecomp(IGenerationContext context) { return !string.IsNullOrEmpty(context.Configuration.PrecompHeader); diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/BaseMicrosoftPlatform.cs b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/BaseMicrosoftPlatform.cs index fe9d85587..731519711 100644 --- a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/BaseMicrosoftPlatform.cs +++ b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/BaseMicrosoftPlatform.cs @@ -99,7 +99,7 @@ protected void GetLinkerExecutableInfo(Project.Configuration conf, out string li var platformToolset = Options.GetObject(conf); var useLldLink = Options.GetObject(conf); if (useLldLink == Options.Vc.LLVM.UseLldLink.Enable || - (useLldLink == Options.Vc.LLVM.UseLldLink.Default && platformToolset == Options.Vc.General.PlatformToolset.LLVM)) + (useLldLink == Options.Vc.LLVM.UseLldLink.Default && platformToolset.IsLLVMToolchain())) { linkerPathOverride = Path.Combine(ClangForWindows.Settings.LLVMInstallDir, "bin"); linkerExeOverride = "lld-link.exe"; diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/BasePlatform.Vcxproj.Template.cs b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/BasePlatform.Vcxproj.Template.cs index 1e582e885..b1a9c5b03 100644 --- a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/BasePlatform.Vcxproj.Template.cs +++ b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/BasePlatform.Vcxproj.Template.cs @@ -211,6 +211,10 @@ public abstract partial class BasePlatform [options.EnableManagedIncrementalBuild] [options.UseClangCl] [options.UseLldLink] + [options.CopyLocalDeploymentContent] + [options.CopyLocalProjectReference] + [options.CopyLocalDebugSymbols] + [options.CopyCppRuntimeToOutputDir] "; diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Linux/LinuxOptions.cs b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Linux/LinuxOptions.cs index c733a2e81..bda228bdd 100644 --- a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Linux/LinuxOptions.cs +++ b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Linux/LinuxOptions.cs @@ -31,6 +31,7 @@ public enum CopySources public enum PlatformRemoteTool { Gpp, //g++ + Clang, // Alpine [Default] Clang38 } diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Linux/LinuxPlatform.cs b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Linux/LinuxPlatform.cs index 5c7cc509f..3efff3b1b 100644 --- a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Linux/LinuxPlatform.cs +++ b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Linux/LinuxPlatform.cs @@ -122,16 +122,19 @@ public override void SetupSdkOptions(IGenerationContext context) context.SelectOption ( Sharpmake.Options.Option(Options.General.PlatformRemoteTool.Gpp, () => { context.Options["RemoteCppCompileToolExe"] = "g++"; }), + Sharpmake.Options.Option(Options.General.PlatformRemoteTool.Clang, () => { context.Options["RemoteCppCompileToolExe"] = "clang++"; }), Sharpmake.Options.Option(Options.General.PlatformRemoteTool.Clang38, () => { context.Options["RemoteCppCompileToolExe"] = "clang++-3.8"; }) ); context.SelectOption ( Sharpmake.Options.Option(Options.General.PlatformRemoteTool.Gpp, () => { context.Options["RemoteCCompileToolExe"] = "g++"; }), + Sharpmake.Options.Option(Options.General.PlatformRemoteTool.Clang, () => { context.Options["RemoteCCompileToolExe"] = "clang"; }), Sharpmake.Options.Option(Options.General.PlatformRemoteTool.Clang38, () => { context.Options["RemoteCCompileToolExe"] = "clang-3.8"; }) ); context.SelectOption ( Sharpmake.Options.Option(Options.General.PlatformRemoteTool.Gpp, () => { context.Options["RemoteLdToolExe"] = "g++"; }), + Sharpmake.Options.Option(Options.General.PlatformRemoteTool.Clang, () => { context.Options["RemoteLdToolExe"] = "clang"; }), Sharpmake.Options.Option(Options.General.PlatformRemoteTool.Clang38, () => { context.Options["RemoteLdToolExe"] = "clang-3.8"; }) ); } @@ -308,28 +311,12 @@ public override void GenerateProjectCompileVcxproj(IVcxprojGenerationContext con public override void GeneratePlatformSpecificProjectDescription(IVcxprojGenerationContext context, IFileGenerator generator) { using (generator.Declare("platformName", SimplePlatformString)) + using (generator.Declare("applicationType", "Linux")) + using (generator.Declare("applicationTypeRevision", "1.0")) + using (generator.Declare("targetLinuxPlatform", "Generic")) { generator.Write(Vcxproj.Template.Project.ProjectDescriptionStartPlatformConditional); - { - string applicationTypeRevision; - bool hasFastBuildConfig = context.ProjectConfigurations.Any(conf => conf.IsFastBuild); - bool hasNonFastBuildConfig = context.ProjectConfigurations.Any(conf => !conf.IsFastBuild); - if (hasFastBuildConfig && hasNonFastBuildConfig) - { - applicationTypeRevision = "1.0"; - } - else - { - applicationTypeRevision = hasFastBuildConfig ? FileGeneratorUtilities.RemoveLineTag : "1.0"; - } - - using (generator.Declare("applicationType", "Linux")) - using (generator.Declare("applicationTypeRevision", applicationTypeRevision)) - using (generator.Declare("targetLinuxPlatform", "Generic")) - { - generator.Write(_projectDescriptionPlatformSpecific); - } - } + generator.Write(_projectDescriptionPlatformSpecific); generator.Write(Vcxproj.Template.Project.PropertyGroupEnd); } } diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Properties/AssemblyInfo.cs b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Properties/AssemblyInfo.cs index 4a0d719e5..0cef2a604 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.4.0")] +[assembly: AssemblyVersion("0.14.5.0")] [assembly: SharpmakeExtension] diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Sharpmake.CommonPlatforms.csproj b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Sharpmake.CommonPlatforms.csproj index 894a53d29..2871102a6 100644 --- a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Sharpmake.CommonPlatforms.csproj +++ b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Sharpmake.CommonPlatforms.csproj @@ -1,6 +1,5 @@  - Debug AnyCPU @@ -20,8 +19,8 @@ false ..\..\bin\debug ..\..\tmp\obj\debug\sharpmake.commonplatforms - ..\..\tmp\obj\Debug\Sharpmake.CommonPlatforms - ..\..\bin\Debug\Sharpmake.CommonPlatforms.xml + ..\..\tmp\obj\debug\sharpmake.commonplatforms + ..\..\bin\debug\sharpmake.commonplatforms.xml DEBUG;TRACE 4 true @@ -37,8 +36,8 @@ true ..\..\bin\release ..\..\tmp\obj\release\sharpmake.commonplatforms - ..\..\tmp\obj\Release\Sharpmake.CommonPlatforms - ..\..\bin\Release\Sharpmake.CommonPlatforms.xml + ..\..\tmp\obj\release\sharpmake.commonplatforms + ..\..\bin\release\sharpmake.commonplatforms.xml TRACE 4 true diff --git a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Windows/Win64Platform.cs b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Windows/Win64Platform.cs index 95e96ffd2..1ba361c5d 100644 --- a/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Windows/Win64Platform.cs +++ b/Sharpmake.Platforms/Sharpmake.CommonPlatforms/Windows/Win64Platform.cs @@ -56,7 +56,7 @@ public override string CConfigName(Configuration conf) string lldString = string.Empty; var useLldLink = Options.GetObject(conf); if (useLldLink == Options.Vc.LLVM.UseLldLink.Enable || - (useLldLink == Options.Vc.LLVM.UseLldLink.Default && platformToolset == Options.Vc.General.PlatformToolset.LLVM)) + (useLldLink == Options.Vc.LLVM.UseLldLink.Default && platformToolset.IsLLVMToolchain())) { lldString = "_LLD"; } @@ -88,7 +88,7 @@ Project.Configuration conf string compilerName = "Compiler-" + Util.GetSimplePlatformString(platform); var platformToolset = Options.GetObject(conf); - if (platformToolset == Options.Vc.General.PlatformToolset.LLVM) + if (platformToolset.IsLLVMToolchain()) { var useClangCl = Options.GetObject(conf); @@ -167,6 +167,7 @@ bool useCCompiler case Options.Vc.General.PlatformToolset.LLVM_vs2012: case Options.Vc.General.PlatformToolset.LLVM_vs2014: case Options.Vc.General.PlatformToolset.LLVM: + case Options.Vc.General.PlatformToolset.ClangCL: platformToolSetPath = ClangForWindows.Settings.LLVMInstallDir; pathToCompiler = Path.Combine(platformToolSetPath, "bin"); diff --git a/Sharpmake.Platforms/Sharpmake.NvShield/Properties/AssemblyInfo.cs b/Sharpmake.Platforms/Sharpmake.NvShield/Properties/AssemblyInfo.cs index 3caf327a4..b3682ea16 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.4.0")] +[assembly: AssemblyVersion("0.14.5.0")] [assembly: SharpmakeExtension] diff --git a/Sharpmake.Platforms/Sharpmake.X360/Properties/AssemblyInfo.cs b/Sharpmake.Platforms/Sharpmake.X360/Properties/AssemblyInfo.cs index 85e503197..c7897309f 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.4.0")] +[assembly: AssemblyVersion("0.14.5.0")] [assembly: SharpmakeExtension] diff --git a/Sharpmake.UnitTests/KitsRootPathsTests.cs b/Sharpmake.UnitTests/KitsRootPathsTests.cs index 5c3f4e8f9..0f5f514f2 100644 --- a/Sharpmake.UnitTests/KitsRootPathsTests.cs +++ b/Sharpmake.UnitTests/KitsRootPathsTests.cs @@ -21,7 +21,7 @@ internal class KitsRootPathsTests [Test] public void Test_NETFXKitsDir_throws_for_old_frameworks() { - Assert.Throws(() => KitsRootPaths.GetNETFXKitsDir(DotNetFramework.v3)); + Assert.Throws(() => KitsRootPaths.GetNETFXKitsDir(DotNetFramework.v3_5)); Assert.Throws(() => KitsRootPaths.GetNETFXKitsDir(DotNetFramework.v4_0)); Assert.Throws(() => KitsRootPaths.GetNETFXKitsDir(DotNetFramework.v4_5)); } diff --git a/Sharpmake.UnitTests/UtilTest.cs b/Sharpmake.UnitTests/UtilTest.cs index 53273a356..8f914c236 100644 --- a/Sharpmake.UnitTests/UtilTest.cs +++ b/Sharpmake.UnitTests/UtilTest.cs @@ -975,12 +975,12 @@ public void PathIsSameDifferentSeparator() [Test] public void MakeDifferenceString() { - ITarget target1 = new Target(Platform.win64, DevEnv.vs2017, Optimization.Release, OutputType.Dll, Blob.Blob, BuildSystem.FastBuild, DotNetFramework.v2); - ITarget target2 = new Target(Platform.win64, DevEnv.vs2017, Optimization.Release, OutputType.Dll, Blob.Blob, BuildSystem.FastBuild, DotNetFramework.v2); + ITarget target1 = new Target(Platform.win64, DevEnv.vs2017, Optimization.Release, OutputType.Dll, Blob.Blob, BuildSystem.FastBuild, DotNetFramework.v3_5); + ITarget target2 = new Target(Platform.win64, DevEnv.vs2017, Optimization.Release, OutputType.Dll, Blob.Blob, BuildSystem.FastBuild, DotNetFramework.v3_5); ITarget target3 = new Target(Platform.win64, DevEnv.vs2017, Optimization.Debug, OutputType.Dll, Blob.Blob, BuildSystem.FastBuild, DotNetFramework.v4_5); Assert.True(Util.MakeDifferenceString(target1, target2).Length == 0); - Assert.True(Util.MakeDifferenceString(target1, target3).Contains("\"net20\" and \"net45\"")); + Assert.True(Util.MakeDifferenceString(target1, target3).Contains("\"net35\" and \"net45\"")); Assert.True(Util.MakeDifferenceString(target1, target3).Contains("\"Release\" and \"Debug\"")); } diff --git a/Sharpmake/ConfigureCollection.cs b/Sharpmake/ConfigureCollection.cs index a1bfb0164..9e7ddc6d3 100644 --- a/Sharpmake/ConfigureCollection.cs +++ b/Sharpmake/ConfigureCollection.cs @@ -49,7 +49,7 @@ internal class ConfigureCollection : IEnumerable internal static Configure GetConfigureAttribute(MethodInfo configure, bool inherit) { - return s_cachedMethodInfoToConfigureAttributes.GetOrAdd(Tuple.Create(configure, inherit), configure.GetCustomAttribute(typeof(Configure), inherit) as Configure); + return s_cachedMethodInfoToConfigureAttributes.GetOrAdd(Tuple.Create(configure, inherit), t => configure.GetCustomAttribute(typeof(Configure), inherit) as Configure); } private readonly IEnumerable _orderedConfigureCollection; diff --git a/Sharpmake/ExtensionMethods.cs b/Sharpmake/ExtensionMethods.cs index ae42f6a76..0a1c30bc1 100644 --- a/Sharpmake/ExtensionMethods.cs +++ b/Sharpmake/ExtensionMethods.cs @@ -40,10 +40,6 @@ public static string ToVersionString(this DotNetFramework framework) { switch (framework) { - case DotNetFramework.v2: - return "2.0"; - case DotNetFramework.v3: - return "3.0"; case DotNetFramework.v3_5: return "3.5"; case DotNetFramework.v3_5clientprofile: @@ -70,6 +66,8 @@ public static string ToVersionString(this DotNetFramework framework) return "4.7.1"; case DotNetFramework.v4_7_2: return "4.7.2"; + case DotNetFramework.v4_8: + return "4.8"; case DotNetFramework.netcore1_0: return "netcoreapp1.0"; case DotNetFramework.netcore1_1: @@ -84,6 +82,24 @@ public static string ToVersionString(this DotNetFramework framework) return "netcoreapp3.0"; case DotNetFramework.netcore3_1: return "netcoreapp3.1"; + case DotNetFramework.netstandard1_0: + return "netstandard1.0"; + case DotNetFramework.netstandard1_1: + return "netstandard1.1"; + case DotNetFramework.netstandard1_2: + return "netstandard1.2"; + case DotNetFramework.netstandard1_3: + return "netstandard1.3"; + case DotNetFramework.netstandard1_4: + return "netstandard1.4"; + case DotNetFramework.netstandard1_5: + return "netstandard1.5"; + case DotNetFramework.netstandard1_6: + return "netstandard1.6"; + case DotNetFramework.netstandard2_0: + return "netstandard2.0"; + case DotNetFramework.netstandard2_1: + return "netstandard2.1"; default: throw new ArgumentOutOfRangeException(nameof(framework)); } @@ -91,10 +107,9 @@ public static string ToVersionString(this DotNetFramework framework) public static string ToFolderName(this DotNetFramework framework) { + //https://docs.microsoft.com/en-us/dotnet/standard/frameworks switch (framework) { - case DotNetFramework.v2: - return "net20"; case DotNetFramework.v3_5: return "net35"; case DotNetFramework.v4_0: @@ -117,6 +132,8 @@ public static string ToFolderName(this DotNetFramework framework) return "net471"; case DotNetFramework.v4_7_2: return "net472"; + case DotNetFramework.v4_8: + return "net48"; case DotNetFramework.netcore1_0: return "netcoreapp1.0"; case DotNetFramework.netcore1_1: @@ -131,16 +148,44 @@ public static string ToFolderName(this DotNetFramework framework) return "netcoreapp3.0"; case DotNetFramework.netcore3_1: return "netcoreapp3.1"; + case DotNetFramework.netstandard1_0: + return "netstandard1.0"; + case DotNetFramework.netstandard1_1: + return "netstandard1.1"; + case DotNetFramework.netstandard1_2: + return "netstandard1.2"; + case DotNetFramework.netstandard1_3: + return "netstandard1.3"; + case DotNetFramework.netstandard1_4: + return "netstandard1.4"; + case DotNetFramework.netstandard1_5: + return "netstandard1.5"; + case DotNetFramework.netstandard1_6: + return "netstandard1.6"; + case DotNetFramework.netstandard2_0: + return "netstandard2.0"; + case DotNetFramework.netstandard2_1: + return "netstandard2.1"; default: throw new ArgumentOutOfRangeException(nameof(framework)); } } + public static bool IsDotNetFramework(this DotNetFramework framework) + { + return (0 != (framework & DotNetFramework.all_netframework)); + } + public static bool IsDotNetCore(this DotNetFramework framework) { return (0 != (framework & DotNetFramework.all_netcore)); } + public static bool IsDotNetStandard(this DotNetFramework framework) + { + return (0 != (framework & DotNetFramework.all_netstandard)); + } + public static string GetVisualProjectToolsVersionString(this DevEnv visualVersion) { switch (visualVersion) @@ -706,6 +751,7 @@ public static bool IsDefaultToolsetForDevEnv(this Options.Vc.General.PlatformToo case Options.Vc.General.PlatformToolset.LLVM_vs2012: case Options.Vc.General.PlatformToolset.LLVM_vs2014: case Options.Vc.General.PlatformToolset.LLVM: + case Options.Vc.General.PlatformToolset.ClangCL: case Options.Vc.General.PlatformToolset.Default: return false; default: @@ -738,6 +784,7 @@ public static bool IsDefaultToolsetForDevEnv(this Options.Vc.General.PlatformToo case Options.Vc.General.PlatformToolset.LLVM_vs2012: case Options.Vc.General.PlatformToolset.LLVM_vs2014: case Options.Vc.General.PlatformToolset.LLVM: + case Options.Vc.General.PlatformToolset.ClangCL: return null; default: throw new ArgumentOutOfRangeException(nameof(platformToolset), platformToolset, null); @@ -780,6 +827,7 @@ public static bool IsLLVMToolchain(this Options.Vc.General.PlatformToolset platf case Options.Vc.General.PlatformToolset.LLVM_vs2012: case Options.Vc.General.PlatformToolset.LLVM_vs2014: case Options.Vc.General.PlatformToolset.LLVM: + case Options.Vc.General.PlatformToolset.ClangCL: return true; } return false; diff --git a/Sharpmake/FileSystemStringComparer.cs b/Sharpmake/FileSystemStringComparer.cs index cc63c6567..1ae7ebd8e 100644 --- a/Sharpmake/FileSystemStringComparer.cs +++ b/Sharpmake/FileSystemStringComparer.cs @@ -70,5 +70,11 @@ public int GetHashCode(string obj) { return ((IEqualityComparer)_comparer).GetHashCode(obj); } + + private static FileSystemStringComparer s_instance = new FileSystemStringComparer(); + public static int StaticCompare(string x, string y) + { + return s_instance.Compare(x, y); + } } } diff --git a/Sharpmake/Options.Clang.cs b/Sharpmake/Options.Clang.cs index 74433f98a..742db8dea 100644 --- a/Sharpmake/Options.Clang.cs +++ b/Sharpmake/Options.Clang.cs @@ -53,9 +53,28 @@ public enum CppLanguageStandard Cpp11, Cpp14, Cpp17, + Cpp2a, GnuCpp98, GnuCpp11, - GnuCpp14 + GnuCpp14, + GnuCpp17, + GnuCpp2a + } + + public enum CLanguageStandard + { + [Default] + Default, + C89, + C90, + C99, + C11, + C17, + GnuC89, + GnuC90, + GnuC99, + GnuC11, + GnuC17, } public enum Exceptions diff --git a/Sharpmake/Options.Vc.cs b/Sharpmake/Options.Vc.cs index 953fbeecc..a2b8025b9 100644 --- a/Sharpmake/Options.Vc.cs +++ b/Sharpmake/Options.Vc.cs @@ -51,6 +51,8 @@ public enum PlatformToolset LLVM_vs2014, // LLVM from Visual Studio 2015 [DevEnvVersion(minimum = DevEnv.vs2017)] LLVM, // LLVM from Visual Studio 2017 + [DevEnvVersion(minimum = DevEnv.vs2019)] + ClangCL, // LLVM as of Visual Studio 2019 official extension } public enum WindowsTargetPlatformVersion @@ -190,6 +192,41 @@ public enum DisableFastUpToDateCheck } } + public static class Advanced + { + public enum CopyLocalDeploymentContent + { + [DevEnvVersion(minimum = DevEnv.vs2019)] // Introduced in Visual Studio 2019 version 16.7. + Enable, + [Default] + Disable + } + + public enum CopyLocalProjectReference + { + [DevEnvVersion(minimum = DevEnv.vs2019)] // Introduced in Visual Studio 2019 version 16.7. + Enable, + [Default] + Disable + } + + public enum CopyLocalDebugSymbols + { + [DevEnvVersion(minimum = DevEnv.vs2019)] // Introduced in Visual Studio 2019 version 16.7. + Enable, + [Default] + Disable + } + + public enum CopyCppRuntimeToOutputDir + { + [DevEnvVersion(minimum = DevEnv.vs2019)] // Introduced in Visual Studio 2019 version 16.7. + Enable, + [Default] + Disable + } + } + public static class Compiler { public enum MultiProcessorCompilation diff --git a/Sharpmake/Project.Configuration.cs b/Sharpmake/Project.Configuration.cs index c4a2b440b..59fbdb865 100644 --- a/Sharpmake/Project.Configuration.cs +++ b/Sharpmake/Project.Configuration.cs @@ -1568,11 +1568,13 @@ internal void Resolve(Resolver resolver) /// - /// If specified, every obj will be output to intermediate directories corresponding to the source hierarchy. + /// Specifies a function with a relative source file path as input and an object file path as output. /// /// /// - /// This will slow down your project's compile time! + /// This will slow down your project's compile time! Overwrite the object file output path + /// only for the files that absolutely require it. Let the function return null or empty string + /// to skip the overwrite for the given source file. /// /// See a discussion of this in StackOverflow /// http://stackoverflow.com/a/1999344 @@ -2207,6 +2209,8 @@ internal void Resolve(Resolver resolver) if (DebugBreaks.ShouldBreakOnProjectPath(DebugBreaks.Context.Resolving, Path.Combine(ProjectPath, ProjectFileName) + (Project is CSharpProject ? ".csproj" : ".vcxproj"), this)) System.Diagnostics.Debugger.Break(); Util.ResolvePath(Project.SharpmakeCsPath, ref IntermediatePath); + if (!string.IsNullOrEmpty(BaseIntermediateOutputPath)) + Util.ResolvePath(Project.SharpmakeCsPath, ref BaseIntermediateOutputPath); Util.ResolvePath(Project.SharpmakeCsPath, ref LibraryPaths); Util.ResolvePathAndFixCase(Project.SharpmakeCsPath, ref TargetCopyFiles); Util.ResolvePath(Project.SharpmakeCsPath, ref TargetDependsFiles); @@ -2241,6 +2245,8 @@ internal void Resolve(Resolver resolver) Util.ResolvePath(Project.SourceRootPath, ref SourceFilesExceptionsEnabledWithExternC); Util.ResolvePath(Project.SourceRootPath, ref SourceFilesExceptionsEnabledWithSEH); Util.ResolvePath(Project.SourceRootPath, ref AdditionalManifestFiles); + if (!string.IsNullOrEmpty(XmlDocumentationFile)) + Util.ResolvePath(Project.SourceRootPath, ref XmlDocumentationFile); if (ModuleDefinitionFile != null) { diff --git a/Sharpmake/Project.cs b/Sharpmake/Project.cs index 1b0794163..098b594ef 100644 --- a/Sharpmake/Project.cs +++ b/Sharpmake/Project.cs @@ -769,6 +769,70 @@ internal Strings GetConfigurationsNoBlobSourceFiles(Strings sourceFiles) return noBlobbebSourceFiles; } + private class RegexResolver + { + private static ThreadLocal s_md5Hasher = new ThreadLocal(() => System.Security.Cryptography.MD5.Create()); + public RegexResolver() + { + ConfRegexesHashToAnyConf = new Dictionary(); + ConfToRegexesHash = new Dictionary(); + } + public void Register(Project.Configuration conf, Strings str) + { + string md5 = ""; + if (str.Count != 0) + { + var stream = new MemoryStream(200); + var writer = new BinaryWriter(stream); + writer.Write(str.Count); + foreach (var val in str) + writer.Write(val); + byte[] data = s_md5Hasher.Value.ComputeHash(stream); + md5 = BitConverter.ToString(data); + } + ConfToRegexesHash[conf] = md5; + ConfRegexesHashToAnyConf[md5] = conf; + } + + public void Register(Project.Configuration conf, params Strings[] strs) + { + string md5 = ""; + bool hasSomeRegexes = false; + foreach (var str in strs) + { + if (str.Count != 0) + { + hasSomeRegexes = true; + break; + } + } + if (hasSomeRegexes) + { + var stream = new MemoryStream(500); + var writer = new BinaryWriter(stream); + foreach (var str in strs) + { + writer.Write(str.Count); + foreach (var val in str) + writer.Write(val); + } + byte[] buffer = stream.ToArray(); + byte[] data = s_md5Hasher.Value.ComputeHash(stream.ToArray()); + md5 = BitConverter.ToString(data); + } + ConfToRegexesHash[conf] = md5; + ConfRegexesHashToAnyConf[md5] = conf; + } + + public Project.Configuration GetCorrespondingConf(Project.Configuration conf) + { + return ConfRegexesHashToAnyConf[ConfToRegexesHash[conf]]; + } + + public Dictionary ConfRegexesHashToAnyConf; + public Dictionary ConfToRegexesHash; + } + internal virtual void ResolveSourceFiles(Builder builder) { var sourceFilesIncludeRegex = RegexCache.GetCachedRegexes(SourceFilesIncludeRegex); @@ -927,128 +991,117 @@ internal virtual void ResolveSourceFiles(Builder builder) bool oneBlobbed = false; bool fastBuildBlobs = false; + var resolvedSourceFilesBuildExclude = new Strings(); + var resolvedSourceFilesWithCompileAsCOption = new Strings(); + var resolvedSourceFilesWithCompileAsCPPOption = new Strings(); + var resolvedSourceFilesWithCompileAsCLROption = new Strings(); + var compileAsClrFilesExclude = new Strings(); + var resolvedSourceFilesWithCompileAsNonCLROption = new Strings(); + var resolvedSourceFilesWithCompileAsWinRTOption = new Strings(); + var resolvedSourceFilesWithExcludeAsWinRTOption = new Strings(); + { + // Do first part that is specific to project to not repeat for each config + AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref resolvedSourceFilesBuildExclude, sourceFilesBuildExcludeRegex); + AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref resolvedSourceFilesWithCompileAsCOption, sourceFilesCompileAsCRegex); + AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref resolvedSourceFilesWithCompileAsCPPOption, sourceFilesCompileAsCPPRegex); + AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref resolvedSourceFilesWithCompileAsCLROption, sourceFilesCompileAsCLRRegex); + AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref compileAsClrFilesExclude, sourceFilesCompileAsCLRExcludeRegex); + AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref resolvedSourceFilesWithCompileAsNonCLROption, sourceFilesCompileAsNonCLRRegex); + AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref resolvedSourceFilesWithCompileAsWinRTOption, sourceFilesCompileAsWinRTRegex); + AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref resolvedSourceFilesWithExcludeAsWinRTOption, sourceFilesExcludeAsWinRTRegex); + } + + // Optimization: with projects with huge number of configurations, regexes are the exact same in multiple confs. + // Here we group confs with exact same md5 of regexes to do a lot of matching a single time. + var md5Hasher = System.Security.Cryptography.MD5.Create(); + var confRegexesHashToAnyConf = new Dictionary(); + var confToRegexesHash = new Dictionary(); foreach (Configuration conf in Configurations) { - if (conf.IsBlobbed) - oneBlobbed = true; - - if (conf.IsFastBuild && conf.FastBuildBlobbed) - fastBuildBlobs = true; - - conf.ResolvedSourceFilesBuildExclude.AddRange(SourceFilesExclude); - - // add SourceFilesBuildExclude from the project - if (DebugBreaks.ShouldBreakOnSourcePath(DebugBreaks.Context.Resolving, ResolvedSourceFilesBuildExclude)) - Debugger.Break(); - conf.ResolvedSourceFilesBuildExclude.AddRange(ResolvedSourceFilesBuildExclude); - if (DebugBreaks.ShouldBreakOnSourcePath(DebugBreaks.Context.Resolving, conf.SourceFilesBuildExclude)) - Debugger.Break(); - conf.ResolvedSourceFilesBuildExclude.AddRange(conf.SourceFilesBuildExclude); + var stream = new MemoryStream(2000); + var writer = new BinaryWriter(stream); + writer.Write(conf.SourceFilesBuildExcludeRegex.Count); + foreach (string val in conf.SourceFilesBuildExcludeRegex) + writer.Write(val); + writer.Write(conf.SourceFilesCompileAsCRegex.Count); + foreach (string val in conf.SourceFilesCompileAsCRegex) + writer.Write(val); + writer.Write(conf.SourceFilesCompileAsCPPRegex.Count); + foreach (string val in conf.SourceFilesCompileAsCPPRegex) + writer.Write(val); + writer.Write(conf.SourceFilesCompileAsCLRRegex.Count); + foreach (string val in conf.SourceFilesCompileAsCLRRegex) + writer.Write(val); + writer.Write(conf.SourceFilesCompileAsCLRExcludeRegex.Count); + foreach (string val in conf.SourceFilesCompileAsCLRExcludeRegex) + writer.Write(val); + writer.Write(conf.SourceFilesCompileAsNonCLRRegex.Count); + foreach (string val in conf.SourceFilesCompileAsNonCLRRegex) + writer.Write(val); + writer.Write(conf.SourceFilesCompileAsWinRTRegex.Count); + foreach (string val in conf.SourceFilesCompileAsWinRTRegex) + writer.Write(val); + writer.Write(conf.SourceFilesExcludeAsWinRTRegex.Count); + foreach (string val in conf.SourceFilesExcludeAsWinRTRegex) + writer.Write(val); + writer.Write(conf.SourceFilesFiltersRegex.Count); + foreach (string val in conf.SourceFilesFiltersRegex) + writer.Write(val); + + byte[] data = md5Hasher.ComputeHash(stream.GetBuffer()); + string md5 = BitConverter.ToString(data); + confToRegexesHash[conf] = md5; + confRegexesHashToAnyConf[md5] = conf; + } + + foreach (var conf in confRegexesHashToAnyConf.Values) + { + conf.ResolvedSourceFilesBuildExclude.AddRange(resolvedSourceFilesBuildExclude); var configSourceFilesBuildExcludeRegex = RegexCache.GetCachedRegexes(conf.SourceFilesBuildExcludeRegex); - - if (AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesBuildExclude, configSourceFilesBuildExcludeRegex) && - DebugBreaks.CanBreakOnProjectConfiguration(conf)) - Debugger.Break(); - - if (SourceFilesBuildExcludeRegex.Count > 0) - { - if (AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesBuildExclude, sourceFilesBuildExcludeRegex) && - DebugBreaks.CanBreakOnProjectConfiguration(conf)) - Debugger.Break(); - } + AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesBuildExclude, configSourceFilesBuildExcludeRegex); // Resolve files that will be built as C Files - if (AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesWithCompileAsCOption, sourceFilesCompileAsCRegex) && - DebugBreaks.CanBreakOnProjectConfiguration(conf)) - Debugger.Break(); - + conf.ResolvedSourceFilesWithCompileAsCOption.AddRange(resolvedSourceFilesWithCompileAsCOption); var configSourceFilesCompileAsCRegex = RegexCache.GetCachedRegexes(conf.SourceFilesCompileAsCRegex); - if (AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesWithCompileAsCOption, configSourceFilesCompileAsCRegex) && - DebugBreaks.CanBreakOnProjectConfiguration(conf)) - Debugger.Break(); - - conf.ResolvedSourceFilesBlobExclude.AddRange(conf.ResolvedSourceFilesWithCompileAsCOption); + AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesWithCompileAsCOption, configSourceFilesCompileAsCRegex); // Resolve files that will be built as CPP Files - if (AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesWithCompileAsCPPOption, sourceFilesCompileAsCPPRegex) && - DebugBreaks.CanBreakOnProjectConfiguration(conf)) - Debugger.Break(); - + conf.ResolvedSourceFilesWithCompileAsCPPOption.AddRange(resolvedSourceFilesWithCompileAsCPPOption); var configSourceFilesCompileAsCPPRegex = RegexCache.GetCachedRegexes(conf.SourceFilesCompileAsCPPRegex); - if (AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesWithCompileAsCPPOption, configSourceFilesCompileAsCPPRegex) && - DebugBreaks.CanBreakOnProjectConfiguration(conf)) - Debugger.Break(); - - conf.ResolvedSourceFilesBlobExclude.AddRange(conf.ResolvedSourceFilesWithCompileAsCPPOption); + AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesWithCompileAsCPPOption, configSourceFilesCompileAsCPPRegex); // Resolve files that will be built as CLR Files - if (AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesWithCompileAsCLROption, sourceFilesCompileAsCLRRegex) && - DebugBreaks.CanBreakOnProjectConfiguration(conf)) - Debugger.Break(); - + conf.ResolvedSourceFilesWithCompileAsCLROption.AddRange(resolvedSourceFilesWithCompileAsCLROption); var configSourceFilesCompileAsCLRRegex = RegexCache.GetCachedRegexes(conf.SourceFilesCompileAsCLRRegex); - - if (AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesWithCompileAsCLROption, configSourceFilesCompileAsCLRRegex) && - DebugBreaks.CanBreakOnProjectConfiguration(conf)) - Debugger.Break(); + AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesWithCompileAsCLROption, configSourceFilesCompileAsCLRRegex); // Remove file that match SourceFilesCompileAsCLRExcludeRegex - var compileAsClrFilesExclude = new Strings(); - if (AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref compileAsClrFilesExclude, sourceFilesCompileAsCLRExcludeRegex) && - DebugBreaks.CanBreakOnProjectConfiguration(conf)) - Debugger.Break(); - + var configCompileAsClrFilesExclude = new Strings(); + configCompileAsClrFilesExclude.AddRange(compileAsClrFilesExclude); var configSourceFilesCompileAsCLRExcludeRegex = RegexCache.GetCachedRegexes(conf.SourceFilesCompileAsCLRExcludeRegex); - - if (AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref compileAsClrFilesExclude, configSourceFilesCompileAsCLRExcludeRegex) && - DebugBreaks.CanBreakOnProjectConfiguration(conf)) - Debugger.Break(); - - foreach (var excludeSourceFile in compileAsClrFilesExclude) - { - conf.ResolvedSourceFilesWithCompileAsCLROption.Remove(excludeSourceFile); - } - - conf.ResolvedSourceFilesBlobExclude.AddRange(conf.ResolvedSourceFilesWithCompileAsCLROption); + AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref configCompileAsClrFilesExclude, configSourceFilesCompileAsCLRExcludeRegex); + conf.ResolvedSourceFilesWithCompileAsCLROption.RemoveRange(configCompileAsClrFilesExclude); // Resolve non-CLR files. - if (AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, - ref conf.ResolvedSourceFilesWithCompileAsNonCLROption, sourceFilesCompileAsNonCLRRegex) && - DebugBreaks.CanBreakOnProjectConfiguration(conf)) - Debugger.Break(); - - var configSourceFilesCompileAsNonCLRRegex = - RegexCache.GetCachedRegexes(conf.SourceFilesCompileAsNonCLRRegex); - - if (AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, - ref conf.ResolvedSourceFilesWithCompileAsNonCLROption, configSourceFilesCompileAsNonCLRRegex) && - DebugBreaks.CanBreakOnProjectConfiguration(conf)) - Debugger.Break(); - - conf.ResolvedSourceFilesBlobExclude.AddRange(conf.ResolvedSourceFilesWithCompileAsNonCLROption); + conf.ResolvedSourceFilesWithCompileAsNonCLROption.AddRange(resolvedSourceFilesWithCompileAsNonCLROption); + var configSourceFilesCompileAsNonCLRRegex = RegexCache.GetCachedRegexes(conf.SourceFilesCompileAsNonCLRRegex); + AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesWithCompileAsNonCLROption, configSourceFilesCompileAsNonCLRRegex); // Resolve files that will be built as WinRT Files - if (AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesWithCompileAsWinRTOption, sourceFilesCompileAsWinRTRegex) && - DebugBreaks.CanBreakOnProjectConfiguration(conf)) - Debugger.Break(); - + conf.ResolvedSourceFilesWithCompileAsWinRTOption.AddRange(resolvedSourceFilesWithCompileAsWinRTOption); var configSourceFilesCompileAsWinRTRegex = RegexCache.GetCachedRegexes(conf.SourceFilesCompileAsWinRTRegex); - if (AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesWithCompileAsWinRTOption, configSourceFilesCompileAsWinRTRegex) && - DebugBreaks.CanBreakOnProjectConfiguration(conf)) - Debugger.Break(); - - conf.ResolvedSourceFilesBlobExclude.AddRange(conf.ResolvedSourceFilesWithCompileAsWinRTOption); + AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesWithCompileAsWinRTOption, configSourceFilesCompileAsWinRTRegex); // Resolve files that will not be built as WinRT Files - if (AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesWithExcludeAsWinRTOption, sourceFilesExcludeAsWinRTRegex) && - DebugBreaks.CanBreakOnProjectConfiguration(conf)) - Debugger.Break(); - + conf.ResolvedSourceFilesWithExcludeAsWinRTOption.AddRange(resolvedSourceFilesWithExcludeAsWinRTOption); var configSourceFilesExcludeAsWinRTRegex = RegexCache.GetCachedRegexes(conf.SourceFilesExcludeAsWinRTRegex); - if (AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesWithExcludeAsWinRTOption, configSourceFilesExcludeAsWinRTRegex) && - DebugBreaks.CanBreakOnProjectConfiguration(conf)) - Debugger.Break(); + AddMatchFiles(RootPath, resolvedSourceFilesRelative, ResolvedSourceFiles, ref conf.ResolvedSourceFilesWithExcludeAsWinRTOption, configSourceFilesExcludeAsWinRTRegex); + conf.ResolvedSourceFilesBlobExclude.AddRange(conf.ResolvedSourceFilesWithCompileAsCOption); + conf.ResolvedSourceFilesBlobExclude.AddRange(conf.ResolvedSourceFilesWithCompileAsCPPOption); + conf.ResolvedSourceFilesBlobExclude.AddRange(conf.ResolvedSourceFilesWithCompileAsNonCLROption); + conf.ResolvedSourceFilesBlobExclude.AddRange(conf.ResolvedSourceFilesWithCompileAsCLROption); + conf.ResolvedSourceFilesBlobExclude.AddRange(conf.ResolvedSourceFilesWithCompileAsWinRTOption); conf.ResolvedSourceFilesBlobExclude.AddRange(conf.ResolvedSourceFilesWithExcludeAsWinRTOption); var configSourceFilesFiltersRegex = RegexCache.GetCachedRegexes(conf.SourceFilesFiltersRegex).ToArray(); @@ -1061,6 +1114,51 @@ internal virtual void ResolveSourceFiles(Builder builder) } Util.ResolvePath(SourceRootPath, ref conf.ResolvedSourceFilesBuildExclude); } + + // To allow sharing with other configs + conf.ResolvedSourceFilesWithCompileAsCOption.SetReadOnly(true); + conf.ResolvedSourceFilesWithCompileAsCPPOption.SetReadOnly(true); + conf.ResolvedSourceFilesWithCompileAsCLROption.SetReadOnly(true); + conf.ResolvedSourceFilesWithCompileAsNonCLROption.SetReadOnly(true); + conf.ResolvedSourceFilesWithCompileAsWinRTOption.SetReadOnly(true); + conf.ResolvedSourceFilesWithExcludeAsWinRTOption.SetReadOnly(true); + } + + + { + foreach (Configuration conf in Configurations) + { + if (conf.IsBlobbed) + oneBlobbed = true; + + if (conf.IsFastBuild && conf.FastBuildBlobbed) + fastBuildBlobs = true; + + conf.ResolvedSourceFilesBuildExclude.AddRange(SourceFilesExclude); + + // add SourceFilesBuildExclude from the project + if (DebugBreaks.ShouldBreakOnSourcePath(DebugBreaks.Context.Resolving, ResolvedSourceFilesBuildExclude)) + Debugger.Break(); + conf.ResolvedSourceFilesBuildExclude.AddRange(ResolvedSourceFilesBuildExclude); + if (DebugBreaks.ShouldBreakOnSourcePath(DebugBreaks.Context.Resolving, conf.SourceFilesBuildExclude)) + Debugger.Break(); + conf.ResolvedSourceFilesBuildExclude.AddRange(conf.SourceFilesBuildExclude); + + var doneConfWithSameRegexes = confRegexesHashToAnyConf[confToRegexesHash[conf]]; + + if (!Object.ReferenceEquals(doneConfWithSameRegexes, conf)) + { + conf.ResolvedSourceFilesBuildExclude.AddRange(doneConfWithSameRegexes.ResolvedSourceFilesBuildExclude); + + // Copy references here to be faster, these must not be modified from now on + conf.ResolvedSourceFilesWithCompileAsCOption = doneConfWithSameRegexes.ResolvedSourceFilesWithCompileAsCOption; + conf.ResolvedSourceFilesWithCompileAsCPPOption = doneConfWithSameRegexes.ResolvedSourceFilesWithCompileAsCPPOption; + conf.ResolvedSourceFilesWithCompileAsCLROption = doneConfWithSameRegexes.ResolvedSourceFilesWithCompileAsCLROption; + conf.ResolvedSourceFilesWithCompileAsNonCLROption = doneConfWithSameRegexes.ResolvedSourceFilesWithCompileAsNonCLROption; + conf.ResolvedSourceFilesWithCompileAsWinRTOption = doneConfWithSameRegexes.ResolvedSourceFilesWithCompileAsWinRTOption; + conf.ResolvedSourceFilesWithExcludeAsWinRTOption = doneConfWithSameRegexes.ResolvedSourceFilesWithExcludeAsWinRTOption; + } + } } foreach (string sourceFile in ResolvedSourceFiles) @@ -1898,8 +1996,10 @@ public override int GetHashCode() public override bool Equals(object obj) { ImportProject other = (ImportProject)obj; - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; + if (ReferenceEquals(null, other)) + return false; + if (ReferenceEquals(this, other)) + return true; return string.Equals(Project, other.Project) && string.Equals(Condition, other.Condition); } } @@ -2294,16 +2394,9 @@ internal CSharpProject(Type targetType, Type configurationType, bool isInternal) InitCSharpSpecifics(); } + [Obsolete("This method was meant to only be called internally, think again if you were calling it from your scripts.")] public static void AddCSharpSpecificPreImportProjects(List importProjects, DevEnv devEnv) { - if (devEnv >= DevEnv.vs2017) - { - importProjects.Add(new ImportProject - { - Project = @"$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props", - Condition = @"Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" - }); - } } public void AddCSharpSpecificImportProjects(List importProjects, DevEnv devEnv) @@ -2391,11 +2484,12 @@ private Strings FilterSourceFiles(Strings sourceFiles) protected override void ExcludeOutputFiles() { - foreach (var conf in Configurations) + // Don't put back this, this is pure evil + /*foreach (var conf in Configurations) { SourceFilesExcludeRegex.Add(conf.TargetPath.Replace("\\", "\\\\")); SourceFilesExcludeRegex.Add(conf.IntermediatePath.Replace("\\", "\\\\")); - } + }*/ } private List _filteredEmbeddedAssemblies = null; diff --git a/Sharpmake/Properties/AssemblyInfo.cs b/Sharpmake/Properties/AssemblyInfo.cs index 1a86c2d88..bbb5914f6 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.4.0")] +[assembly: AssemblyVersion("0.14.5.0")] #pragma warning disable CS7035 -[assembly: AssemblyFileVersion("0.14.4.0 (LocalBuild)")] +[assembly: AssemblyFileVersion("0.14.5.0 (LocalBuild)")] #pragma warning restore [assembly: InternalsVisibleTo("Sharpmake.Application")] diff --git a/Sharpmake/Resolver.cs b/Sharpmake/Resolver.cs index b7efdd121..e128558b8 100644 --- a/Sharpmake/Resolver.cs +++ b/Sharpmake/Resolver.cs @@ -103,6 +103,77 @@ namespace Sharpmake /// public class Resolver { + private class TypeWrapper + { + public List MemberInfos; + + public TypeWrapper(Type type) + { + if (!type.IsDefined(typeof(Resolvable), true)) + return; + + MemberInfo[] memberInfos = type.GetMembers(); + + foreach (MemberInfo memberInfo in memberInfos) + { + if (memberInfo.MemberType != MemberTypes.Field && memberInfo.MemberType != MemberTypes.Property) + continue; + + if (memberInfo.IsDefined(typeof(SkipResolveOnMember), false)) + continue; + + Type memberType = null; + if (memberInfo.MemberType == MemberTypes.Field) + { + FieldInfo fieldInfo = memberInfo as FieldInfo; + Type fieldType = fieldInfo.FieldType; + if (fieldType.IsClass || + (CanWriteFieldValue(fieldInfo) && + (fieldType == typeof(string) || + fieldType == typeof(Strings) || + fieldType.IsAssignableFrom(typeof(IList))))) + { + memberType = fieldInfo.FieldType; + } + } + else if (memberInfo.MemberType == MemberTypes.Property) + { + PropertyInfo propertyInfo = memberInfo as PropertyInfo; + Type propertyType = propertyInfo.PropertyType; + if (propertyInfo.CanRead && + (propertyType.IsClass || + propertyType == typeof(Strings) || + (propertyType == typeof(string) && propertyInfo.CanWrite) || + propertyType.IsAssignableFrom(typeof(IList)))) + { + memberType = propertyType; + } + } + if (memberType != null) + { + if (MemberInfos == null) + { + MemberInfos = new List(memberInfos.Length); + } + MemberInfos.Add(memberInfo); + } + } + } + } + + static private ConcurrentDictionary s_typeWrappers = new ConcurrentDictionary(); + + private TypeWrapper GetTypeWrapper(Type type) + { + return s_typeWrappers.GetOrAdd(type, (key) => + { + var wrapper = new TypeWrapper(type); + if (wrapper.MemberInfos == null || wrapper.MemberInfos.Count == 0) + return null; + return wrapper; + }); + } + [System.AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] public class Resolvable : Attribute { @@ -224,14 +295,26 @@ public void Resolve(object obj, object fallbackValue = null) ResolveObject(null, obj, fallbackValue); } + public void Resolve(ref Strings strs) + { + } + public virtual string Resolve(string str) { return Resolve(str, null); } - // Note: The method doesn't use regex as this was slower with regexes(mainly due to MT contention) public string Resolve(string str, object fallbackValue = null) { + bool wasChanged; + return Resolve(str, fallbackValue, out wasChanged); + } + + // Note: The method doesn't use regex as this was slower with regexes(mainly due to MT contention) + public string Resolve(string str, object fallbackValue, out bool wasChanged) + { + wasChanged = false; + // Early out if (str == null) return str; @@ -344,6 +427,7 @@ public string Resolve(string str, object fallbackValue = null) builder.Append(str, currentSearchIndex, strLength - currentSearchIndex); str = builder.ToString(); + wasChanged = true; builder.Clear(); if (nbrReplacements == 0) @@ -359,6 +443,7 @@ public string Resolve(string str, object fallbackValue = null) if (beginStr.Length != 1) continue; string escapedStr = beginStr + beginStr; + wasChanged = true; str = str.Replace(escapedStr, beginStr); } @@ -366,6 +451,7 @@ public string Resolve(string str, object fallbackValue = null) { string endStr = string.Empty + endChar; string escapedStr = endStr + endStr; + wasChanged = true; str = str.Replace(escapedStr, endStr); } @@ -472,22 +558,21 @@ private ResolveStatus GetResolveStatus(string pathName) return _resolveStatusFields.TryGetValue(pathName, out status) ? status : ResolveStatus.UnResolved; } - private static ConcurrentDictionary> s_typeFieldPropertyCache = new ConcurrentDictionary>(); + private static ConcurrentDictionary, Tuple> s_typeFieldPropertyCache = new ConcurrentDictionary, Tuple>(); private static void GetFieldInfoOrPropertyInfo(Type type, string name, out FieldInfo fieldInfo, out PropertyInfo propertyInfo) { - // build a unique name - string uniqueName = type.FullName + name; + var key = new Tuple(type, name); - var value = s_typeFieldPropertyCache.GetOrAdd(uniqueName, keyname => + var value = s_typeFieldPropertyCache.GetOrAdd(key, keyArg => { FieldInfo field = type.GetField(name); PropertyInfo property = (field == null) ? type.GetProperty(name) : null; - return new KeyValuePair(field, property); + return new Tuple(field, property); }); - fieldInfo = value.Key; - propertyInfo = value.Value; + fieldInfo = value.Item1; + propertyInfo = value.Item2; } [Serializable] @@ -547,9 +632,9 @@ private string GetMemberStringValue(string memberPath, bool throwIfNotFound) string nameChunk = names[i]; + Type parameterType = parameter.GetType(); FieldInfo fieldInfo; PropertyInfo propertyInfo; - Type parameterType = parameter.GetType(); GetFieldInfoOrPropertyInfo(parameterType, nameChunk, out fieldInfo, out propertyInfo); if (fieldInfo != null) @@ -615,9 +700,6 @@ private static bool CanWriteFieldValue(FieldInfo fieldInfo) private void ResolveMember(string objectPath, object obj, MemberInfo memberInfo, object fallbackValue) { - if (memberInfo.MemberType != MemberTypes.Field && memberInfo.MemberType != MemberTypes.Property) - return; - string memberPath; if (objectPath != null) memberPath = objectPath + _pathSeparator + memberInfo.Name; @@ -627,9 +709,6 @@ private void ResolveMember(string objectPath, object obj, MemberInfo memberInfo, if (GetResolveStatus(memberPath) == ResolveStatus.Resolved) return; - if (memberInfo.IsDefined(typeof(SkipResolveOnMember), false)) - return; - if (memberInfo.MemberType == MemberTypes.Field) { FieldInfo fieldInfo = memberInfo as FieldInfo; @@ -643,7 +722,10 @@ private void ResolveMember(string objectPath, object obj, MemberInfo memberInfo, { SetResolving(memberPath); string value = fieldValue as string; - fieldInfo.SetValue(obj, Resolve(value, fallbackValue)); + bool wasChanged; + value = Resolve(value, fallbackValue, out wasChanged); + if (wasChanged) + fieldInfo.SetValue(obj, value); SetResolved(memberPath); } } @@ -658,8 +740,10 @@ private void ResolveMember(string objectPath, object obj, MemberInfo memberInfo, { foreach (string value in values.Values) { - string newValue = Resolve(value, fallbackValue); - values.UpdateValue(value, newValue); + bool wasChanged; + string newValue = Resolve(value, fallbackValue, out wasChanged); + if (wasChanged) + values.UpdateValue(value, newValue); } } @@ -674,7 +758,12 @@ private void ResolveMember(string objectPath, object obj, MemberInfo memberInfo, IList values = fieldValue as IList; for (int i = 0; i < values.Count; ++i) - values[i] = Resolve(values[i], fallbackValue); + { + bool wasChanged; + string value = Resolve(values[i], fallbackValue, out wasChanged); + if (wasChanged) + values[i] = value; + } SetResolved(memberPath); } @@ -743,8 +832,7 @@ private void ResolveObject(string objectPath, object obj, object fallbackValue) if (_resolvedObject.Add(obj) == false) return; - if (!obj.GetType().IsDefined(typeof(Resolvable), true)) - return; + var typeWrapper = GetTypeWrapper(obj.GetType()); if (objectPath != null) { @@ -754,15 +842,13 @@ private void ResolveObject(string objectPath, object obj, object fallbackValue) SetResolving(objectPath); } - MemberInfo[] memberInfos = obj.GetType().GetMembers(); + if (typeWrapper == null) + return; - foreach (MemberInfo memberInfo in memberInfos) + foreach (MemberInfo memberInfo in typeWrapper.MemberInfos) { ResolveMember(objectPath, obj, memberInfo, fallbackValue); } - - if (objectPath != null) - SetResolved(objectPath); } #endregion diff --git a/Sharpmake/Sharpmake.csproj b/Sharpmake/Sharpmake.csproj index c1bdcbe95..11372ada1 100644 --- a/Sharpmake/Sharpmake.csproj +++ b/Sharpmake/Sharpmake.csproj @@ -1,6 +1,5 @@  - Debug AnyCPU @@ -23,8 +22,8 @@ false ..\bin\debug ..\tmp\obj\debug\sharpmake - ..\tmp\obj\Debug\Sharpmake - ..\bin\Debug\Sharpmake.xml + ..\tmp\obj\debug\sharpmake + ..\bin\debug\sharpmake.xml DEBUG;TRACE 4 true @@ -41,8 +40,8 @@ true ..\bin\release ..\tmp\obj\release\sharpmake - ..\tmp\obj\Release\Sharpmake - ..\bin\Release\Sharpmake.xml + ..\tmp\obj\release\sharpmake + ..\bin\release\sharpmake.xml TRACE 4 true diff --git a/Sharpmake/Target.cs b/Sharpmake/Target.cs index 38b5b5fc4..2d294e5c1 100644 --- a/Sharpmake/Target.cs +++ b/Sharpmake/Target.cs @@ -139,31 +139,48 @@ public enum OutputType [Fragment, Flags] public enum DotNetFramework { - v2 = 1 << 0, - v3 = 1 << 1, - v3_5 = 1 << 2, - v3_5clientprofile = 1 << 3, - v4_0 = 1 << 4, - v4_5 = 1 << 5, - v4_5_1 = 1 << 6, - v4_5_2 = 1 << 7, - v4_5clientprofile = 1 << 8, - v4_6 = 1 << 9, - v4_6_1 = 1 << 10, - v4_6_2 = 1 << 11, - v4_7 = 1 << 12, - v4_7_1 = 1 << 13, - v4_7_2 = 1 << 14, - netcore1_0 = 1 << 15, - netcore1_1 = 1 << 16, - netcore2_0 = 1 << 17, - netcore2_1 = 1 << 18, - netcore2_2 = 1 << 19, - netcore3_0 = 1 << 20, - netcore3_1 = 1 << 21, + [Obsolete("Please use at least .net framework 3.5.", error: false)] + v2 = v3_5, + [Obsolete("Please use at least .net framework 3.5.", error: false)] + v3 = v3_5, + + v3_5 = 1 << 0, + v3_5clientprofile = 1 << 1, + v4_0 = 1 << 2, + v4_5 = 1 << 3, + v4_5_1 = 1 << 4, + v4_5_2 = 1 << 5, + v4_5clientprofile = 1 << 6, + v4_6 = 1 << 7, + v4_6_1 = 1 << 8, + v4_6_2 = 1 << 9, + v4_7 = 1 << 10, + v4_7_1 = 1 << 11, + v4_7_2 = 1 << 12, + v4_8 = 1 << 13, + netcore1_0 = 1 << 14, + netcore1_1 = 1 << 15, + netcore2_0 = 1 << 16, + netcore2_1 = 1 << 17, + netcore2_2 = 1 << 18, + netcore3_0 = 1 << 19, + netcore3_1 = 1 << 20, + netstandard1_0 = 1 << 21, + netstandard1_1 = 1 << 22, + netstandard1_2 = 1 << 23, + netstandard1_3 = 1 << 24, + netstandard1_4 = 1 << 25, + netstandard1_5 = 1 << 26, + netstandard1_6 = 1 << 27, + netstandard2_0 = 1 << 28, + netstandard2_1 = 1 << 29, [CompositeFragment] - all_netcore = netcore1_0 | netcore1_1 | netcore2_0 | netcore2_1 | netcore3_0 | netcore3_1 + all_netframework = v3_5 | v3_5clientprofile | v4_0 | v4_5 | v4_5_1 | v4_5_2 | v4_5clientprofile | v4_6 | v4_6_1 | v4_6_2 | v4_7 | v4_7_1 | v4_7_2 | v4_8, + [CompositeFragment] + all_netcore = netcore1_0 | netcore1_1 | netcore2_0 | netcore2_1 | netcore3_0 | netcore3_1, + [CompositeFragment] + all_netstandard = netstandard1_0 | netstandard1_1 | netstandard1_2 | netstandard1_3 | netstandard1_4 | netstandard1_5 | netstandard1_6 | netstandard2_0 | netstandard2_1 } // Optional @@ -598,6 +615,9 @@ internal void Initialize(Type targetType) if (enumFields[i].Attributes.HasFlag(FieldAttributes.SpecialName)) continue; + if (enumFields[i].GetCustomAttribute() != null) + continue; + // combinations of fragments are not actual fragments so skip them if (enumFields[i].GetCustomAttribute() != null) continue; @@ -620,13 +640,16 @@ internal void Initialize(Type targetType) if (enumFields[j].Attributes.HasFlag(FieldAttributes.SpecialName)) continue; + if (enumFields[j].GetCustomAttribute() != null) + continue; + if (i != j) { int jEnumFieldValue = (int)enumFields[j].GetRawConstantValue(); if (enumFieldValue == jEnumFieldValue) { - throw new Error("2 enum field with he same value found in {0} fragment: {1}={2} and {3}={4}", + throw new Error("2 enum fields with the same value found in {0} fragment: {1}={2} and {3}={4}", enumType.FullName, enumFields[i].Name, enumFieldValue, diff --git a/UpdateSamplesOutput.bat b/UpdateSamplesOutput.bat index ecc699773..f7e9ae769 100644 --- a/UpdateSamplesOutput.bat +++ b/UpdateSamplesOutput.bat @@ -38,6 +38,8 @@ call :UpdateRef samples NetCore\DotNetCoreFrameworkHelloWorld HelloWorld.shar if not "%ERRORLEVEL_BACKUP%" == "0" goto error call :UpdateRef samples NetCore\DotNetFrameworkHelloWorld HelloWorld.sharpmake.cs reference NetCore\DotNetFrameworkHelloWorld if not "%ERRORLEVEL_BACKUP%" == "0" goto error +call :UpdateRef samples NetCore\DotNetMultiFrameworksHelloWorld HelloWorld.sharpmake.cs reference NetCore\DotNetMultiFrameworksHelloWorld +if not "%ERRORLEVEL_BACKUP%" == "0" goto error :: functional tests call :UpdateRef Sharpmake.FunctionalTests FastBuildFunctionalTest FastBuildFunctionalTest.sharpmake.cs reference FastBuildFunctionalTest diff --git a/functional_test.py b/functional_test.py index 00d6eac2f..eda1ab170 100644 --- a/functional_test.py +++ b/functional_test.py @@ -72,7 +72,7 @@ def __init__(self): def verifyCustomBuildEventsInTargetDir(self, targetDir): #verify copied files exist - expected_copied_files = ["dummyfile_to_be_copied_to_buildoutput.txt", "main.cpp", "postbuildcopysinglefiletest.exe"] + expected_copied_files = ["dummyfile_to_be_copied_to_buildoutput.txt", "main.cpp", "postbuildcopysinglefiletest.exe", "explicitlyorderedpostbuildtest.exe", "explicitlyorderedpostbuildtest.pdb"] for expected_file in expected_copied_files: expected_file = os.path.join(targetDir, "file_copy_destination", expected_file) if not os.path.isfile(expected_file): diff --git a/samples/CPPCLI/reference/projects/OtherCSharpProj.vs2017.v4_5.csproj b/samples/CPPCLI/reference/projects/OtherCSharpProj.vs2017.v4_5.csproj index 34180196e..858318e4e 100644 --- a/samples/CPPCLI/reference/projects/OtherCSharpProj.vs2017.v4_5.csproj +++ b/samples/CPPCLI/reference/projects/OtherCSharpProj.vs2017.v4_5.csproj @@ -1,6 +1,5 @@  - Debug x86 diff --git a/samples/CPPCLI/reference/projects/OtherCSharpProj.vs2017.v4_6_2.csproj b/samples/CPPCLI/reference/projects/OtherCSharpProj.vs2017.v4_6_2.csproj index 302424c03..6dc3453c5 100644 --- a/samples/CPPCLI/reference/projects/OtherCSharpProj.vs2017.v4_6_2.csproj +++ b/samples/CPPCLI/reference/projects/OtherCSharpProj.vs2017.v4_6_2.csproj @@ -1,6 +1,5 @@  - Debug x86 diff --git a/samples/CPPCLI/reference/projects/TestCSharpConsole.vs2017.v4_5.csproj b/samples/CPPCLI/reference/projects/TestCSharpConsole.vs2017.v4_5.csproj index 18c8d5e05..bf5c1f804 100644 --- a/samples/CPPCLI/reference/projects/TestCSharpConsole.vs2017.v4_5.csproj +++ b/samples/CPPCLI/reference/projects/TestCSharpConsole.vs2017.v4_5.csproj @@ -1,6 +1,5 @@  - Debug x86 diff --git a/samples/CPPCLI/reference/projects/TestCSharpConsole.vs2017.v4_6_2.csproj b/samples/CPPCLI/reference/projects/TestCSharpConsole.vs2017.v4_6_2.csproj index ab66dbeb4..9ec8239a9 100644 --- a/samples/CPPCLI/reference/projects/TestCSharpConsole.vs2017.v4_6_2.csproj +++ b/samples/CPPCLI/reference/projects/TestCSharpConsole.vs2017.v4_6_2.csproj @@ -1,6 +1,5 @@  - Debug x86 diff --git a/samples/CSharpHelloWorld/reference/projects/helloworld/HelloWorld.vs2017.v4_6_1.csproj b/samples/CSharpHelloWorld/reference/projects/helloworld/HelloWorld.vs2017.v4_6_1.csproj index b06b5b9cf..614508238 100644 --- a/samples/CSharpHelloWorld/reference/projects/helloworld/HelloWorld.vs2017.v4_6_1.csproj +++ b/samples/CSharpHelloWorld/reference/projects/helloworld/HelloWorld.vs2017.v4_6_1.csproj @@ -1,6 +1,5 @@  - Debug AnyCPU diff --git a/samples/CSharpImports/reference/projects/csharpimports/CSharpImports.vs2017.v4_6_1.csproj b/samples/CSharpImports/reference/projects/csharpimports/CSharpImports.vs2017.v4_6_1.csproj index de652315b..6e907cb6d 100644 --- a/samples/CSharpImports/reference/projects/csharpimports/CSharpImports.vs2017.v4_6_1.csproj +++ b/samples/CSharpImports/reference/projects/csharpimports/CSharpImports.vs2017.v4_6_1.csproj @@ -1,7 +1,6 @@  - Debug AnyCPU diff --git a/samples/CSharpVsix/reference/projects/csharpvsix/CSharpVsix.vs2015.v4_5.csproj b/samples/CSharpVsix/reference/projects/csharpvsix/CSharpVsix.vs2015.v4_5.csproj index 40c1cb49d..f0e2c0499 100644 --- a/samples/CSharpVsix/reference/projects/csharpvsix/CSharpVsix.vs2015.v4_5.csproj +++ b/samples/CSharpVsix/reference/projects/csharpvsix/CSharpVsix.vs2015.v4_5.csproj @@ -108,6 +108,9 @@ False + + False + False @@ -132,9 +135,6 @@ False - - False - diff --git a/samples/NetCore/DotNetFrameworkHelloWorld/reference/projects/helloworld/HelloWorld.vs2017.v4_6_1.csproj b/samples/NetCore/DotNetFrameworkHelloWorld/reference/projects/helloworld/HelloWorld.vs2017.v4_6_1.csproj index 6b2eb4f89..0b3ee64c3 100644 --- a/samples/NetCore/DotNetFrameworkHelloWorld/reference/projects/helloworld/HelloWorld.vs2017.v4_6_1.csproj +++ b/samples/NetCore/DotNetFrameworkHelloWorld/reference/projects/helloworld/HelloWorld.vs2017.v4_6_1.csproj @@ -1,6 +1,5 @@  - Debug AnyCPU diff --git a/samples/NetCore/DotNetFrameworkHelloWorld/reference/projects/helloworld/HelloWorld.vs2019.v4_6_2.csproj b/samples/NetCore/DotNetFrameworkHelloWorld/reference/projects/helloworld/HelloWorld.vs2019.v4_6_2.csproj index be7078c01..1a501738d 100644 --- a/samples/NetCore/DotNetFrameworkHelloWorld/reference/projects/helloworld/HelloWorld.vs2019.v4_6_2.csproj +++ b/samples/NetCore/DotNetFrameworkHelloWorld/reference/projects/helloworld/HelloWorld.vs2019.v4_6_2.csproj @@ -1,6 +1,5 @@  - Debug AnyCPU diff --git a/samples/NetCore/DotNetMultiFrameworksHelloWorld/HelloWorld.sharpmake.cs b/samples/NetCore/DotNetMultiFrameworksHelloWorld/HelloWorld.sharpmake.cs new file mode 100644 index 000000000..a10a98944 --- /dev/null +++ b/samples/NetCore/DotNetMultiFrameworksHelloWorld/HelloWorld.sharpmake.cs @@ -0,0 +1,141 @@ +// 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 Sharpmake; +using System; +namespace NetCore +{ + namespace DotNetMultiFrameworksHelloWorld + { + [Generate] + public class HelloWorldLib : CSharpProject + { + internal static ITarget[] SampleTargets = { + new Target( + Platform.anycpu, + DevEnv.vs2019, + Optimization.Debug | Optimization.Release, + OutputType.Dll, + Blob.NoBlob, + BuildSystem.MSBuild, + DotNetFramework.v4_6_1 | DotNetFramework.netstandard2_0) + }; + + public HelloWorldLib() + { + ClearTargets(); + AddTargets(SampleTargets); + + RootPath = @"[project.SharpmakeCsPath]\projects\[project.Name]"; + + // This Path will be used to get all SourceFiles in this Folder and all subFolders + SourceRootPath = @"[project.SharpmakeCsPath]\codebase\[project.Name]"; + } + + [Configure] + public virtual void ConfigureAll(Configuration conf, ITarget target) + { + conf.ProjectFileName = "[project.Name].[target.DevEnv]"; + conf.ProjectPath = @"[project.RootPath]"; + conf.Output = Configuration.OutputType.DotNetClassLibrary; + + conf.Options.Add(Sharpmake.Options.CSharp.TreatWarningsAsErrors.Enabled); + + if (target.GetFragment().IsDotNetFramework()) + { + conf.ReferencesByName.Add("System"); + } + + if (target.GetFragment().IsDotNetStandard()) + { + conf.ReferencesByNuGetPackage.Add("System.Text.Encoding.CodePages", "4.5.0"); + } + } + } + + [Sharpmake.Generate] + public class HelloWorldMultiFrameworks : CSharpProject + { + internal static ITarget[] SampleTargets = { + new Target( + Platform.anycpu, + DevEnv.vs2019, + Optimization.Debug | Optimization.Release, + OutputType.Dll, + Blob.NoBlob, + BuildSystem.MSBuild, + DotNetFramework.v4_6_1 | DotNetFramework.netcore3_1) + }; + + public HelloWorldMultiFrameworks() + { + ClearTargets(); + AddTargets(SampleTargets); + + RootPath = @"[project.SharpmakeCsPath]\projects\[project.Name]"; + + // This Path will be used to get all SourceFiles in this Folder and all subFolders + SourceRootPath = @"[project.SharpmakeCsPath]\codebase\[project.Name]"; + } + + [Configure] + public virtual void ConfigureAll(Configuration conf, ITarget target) + { + conf.ProjectFileName = "[project.Name].[target.DevEnv]"; + conf.ProjectPath = @"[project.RootPath]"; + + conf.Options.Add(Sharpmake.Options.CSharp.TreatWarningsAsErrors.Enabled); + + conf.AddPrivateDependency(GetLibraryTargetFromApplicationTarget(target)); + } + + private static ITarget GetLibraryTargetFromApplicationTarget(ITarget target) + { + if (!target.GetFragment().IsDotNetCore()) + return target; + // if target is a .net core application, libraries are .net standard + return target.Clone(DotNetFramework.netstandard2_0); + } + } + + [Generate] + public class HelloWorldMultiFrameworksSolution : CSharpSolution + { + public HelloWorldMultiFrameworksSolution() + { + AddTargets(HelloWorldMultiFrameworks.SampleTargets); + } + + [Configure] + public void ConfigureAll(Configuration conf, ITarget target) + { + conf.SolutionFileName = String.Format("{0}.{1}", + Name, + "[target.DevEnv]"); + conf.SolutionPath = @"[solution.SharpmakeCsPath]\projects\"; + + conf.AddProject(target); + } + } + + public static class Main + { + [Sharpmake.Main] + public static void SharpmakeMain(Arguments arguments) + { + arguments.Generate(); + } + } + } +} diff --git a/samples/NetCore/DotNetMultiFrameworksHelloWorld/codebase/HelloWorldLib/HelloWorldWriter.cs b/samples/NetCore/DotNetMultiFrameworksHelloWorld/codebase/HelloWorldLib/HelloWorldWriter.cs new file mode 100644 index 000000000..2b8d4f4f6 --- /dev/null +++ b/samples/NetCore/DotNetMultiFrameworksHelloWorld/codebase/HelloWorldLib/HelloWorldWriter.cs @@ -0,0 +1,12 @@ +using System; + +namespace HelloWorld +{ + public static class HelloWorldWriter + { + public static void WriteHelloWorldLine() + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/samples/NetCore/DotNetMultiFrameworksHelloWorld/codebase/HelloWorldMultiframeworks/Program.cs b/samples/NetCore/DotNetMultiFrameworksHelloWorld/codebase/HelloWorldMultiframeworks/Program.cs new file mode 100644 index 000000000..8dbbd67e6 --- /dev/null +++ b/samples/NetCore/DotNetMultiFrameworksHelloWorld/codebase/HelloWorldMultiframeworks/Program.cs @@ -0,0 +1,10 @@ +namespace HelloWorldMultiframeworks +{ + class Program + { + static void Main(string[] args) + { + HelloWorld.HelloWorldWriter.WriteHelloWorldLine(); + } + } +} diff --git a/samples/NetCore/DotNetMultiFrameworksHelloWorld/codebase/HelloWorldMultiframeworks/Properties/AssemblyInfo.cs b/samples/NetCore/DotNetMultiFrameworksHelloWorld/codebase/HelloWorldMultiframeworks/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..825ace357 --- /dev/null +++ b/samples/NetCore/DotNetMultiFrameworksHelloWorld/codebase/HelloWorldMultiframeworks/Properties/AssemblyInfo.cs @@ -0,0 +1,14 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +[assembly: AssemblyTitle("HelloWorld")] +[assembly: AssemblyDescription("Dummy description")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Ubisoft")] +[assembly: AssemblyProduct("Sharpamke")] +[assembly: AssemblyCopyright("Copyright © Ubisoft 2020")] + +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/samples/NetCore/DotNetMultiFrameworksHelloWorld/reference/projects/HelloWorldMultiFrameworksSolution.vs2019.sln b/samples/NetCore/DotNetMultiFrameworksHelloWorld/reference/projects/HelloWorldMultiFrameworksSolution.vs2019.sln new file mode 100644 index 000000000..232809be5 --- /dev/null +++ b/samples/NetCore/DotNetMultiFrameworksHelloWorld/reference/projects/HelloWorldMultiFrameworksSolution.vs2019.sln @@ -0,0 +1,23 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29424.173 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorldMultiFrameworks", "helloworldmultiframeworks\HelloWorldMultiFrameworks.vs2019.csproj", "{39A4FB20-F152-B28B-4386-81262F615392}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorldLib", "helloworldlib\HelloWorldLib.vs2019.csproj", "{2118A95F-4FDA-D7C9-6CC8-A7A85A81062E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {39A4FB20-F152-B28B-4386-81262F615392}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {39A4FB20-F152-B28B-4386-81262F615392}.Debug|Any CPU.Build.0 = Debug|Any CPU + {39A4FB20-F152-B28B-4386-81262F615392}.Release|Any CPU.ActiveCfg = Release|Any CPU + {39A4FB20-F152-B28B-4386-81262F615392}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/samples/NetCore/DotNetMultiFrameworksHelloWorld/reference/projects/helloworldlib/HelloWorldLib.vs2019.csproj b/samples/NetCore/DotNetMultiFrameworksHelloWorld/reference/projects/helloworldlib/HelloWorldLib.vs2019.csproj new file mode 100644 index 000000000..b7e9f1d79 --- /dev/null +++ b/samples/NetCore/DotNetMultiFrameworksHelloWorld/reference/projects/helloworldlib/HelloWorldLib.vs2019.csproj @@ -0,0 +1,76 @@ + + + Debug + AnyCPU + AnyCPU + Library + Properties + HelloWorldLib + HelloWorldLib + net461;netstandard2.0 + 512 + false + false + + + AnyCPU + true + full + false + output\anycpu\debug + obj\anycpu\debug + DEBUG;TRACE + 4 + true + false + + + AnyCPU + true + full + false + output\anycpu\debug + obj\anycpu\debug + DEBUG;TRACE + 4 + true + false + + + AnyCPU + false + pdbonly + true + output\anycpu\release + obj\anycpu\release + TRACE + 4 + true + false + + + AnyCPU + false + pdbonly + true + output\anycpu\release + obj\anycpu\release + TRACE + 4 + true + false + + + + False + + + + + HelloWorldWriter.cs + + + + + + \ No newline at end of file diff --git a/samples/NetCore/DotNetMultiFrameworksHelloWorld/reference/projects/helloworldmultiframeworks/HelloWorldMultiFrameworks.vs2019.csproj b/samples/NetCore/DotNetMultiFrameworksHelloWorld/reference/projects/helloworldmultiframeworks/HelloWorldMultiFrameworks.vs2019.csproj new file mode 100644 index 000000000..c6d09b1c9 --- /dev/null +++ b/samples/NetCore/DotNetMultiFrameworksHelloWorld/reference/projects/helloworldmultiframeworks/HelloWorldMultiFrameworks.vs2019.csproj @@ -0,0 +1,77 @@ + + + Debug + AnyCPU + AnyCPU + Exe + Properties + HelloWorldMultiFrameworks + HelloWorldMultiFrameworks + net461;netcoreapp3.1 + 512 + false + false + + + AnyCPU + true + full + false + output\anycpu\debug + obj\anycpu\debug + DEBUG;TRACE + 4 + true + false + + + AnyCPU + true + full + false + output\anycpu\debug + obj\anycpu\debug + DEBUG;TRACE + 4 + true + false + + + AnyCPU + false + pdbonly + true + output\anycpu\release + obj\anycpu\release + TRACE + 4 + true + false + + + AnyCPU + false + pdbonly + true + output\anycpu\release + obj\anycpu\release + TRACE + 4 + true + false + + + + Program.cs + + + Properties\AssemblyInfo.cs + + + + + {2118a95f-4fda-d7c9-6cc8-a7a85a81062e} + HelloWorldLib + + + \ No newline at end of file diff --git a/samples/PackageReferences/reference/projects/packagereferences/PackageReferences.vs2017.v4_5.csproj b/samples/PackageReferences/reference/projects/packagereferences/PackageReferences.vs2017.v4_5.csproj index e7b8e0429..972d2483f 100644 --- a/samples/PackageReferences/reference/projects/packagereferences/PackageReferences.vs2017.v4_5.csproj +++ b/samples/PackageReferences/reference/projects/packagereferences/PackageReferences.vs2017.v4_5.csproj @@ -1,6 +1,5 @@  - Debug AnyCPU diff --git a/samples/PackageReferences/reference/projects/packagereferences/PackageReferences.vs2017.v4_6_2.csproj b/samples/PackageReferences/reference/projects/packagereferences/PackageReferences.vs2017.v4_6_2.csproj index a0f534419..a157b4e5e 100644 --- a/samples/PackageReferences/reference/projects/packagereferences/PackageReferences.vs2017.v4_6_2.csproj +++ b/samples/PackageReferences/reference/projects/packagereferences/PackageReferences.vs2017.v4_6_2.csproj @@ -1,6 +1,5 @@  - Debug AnyCPU diff --git a/samples/PackageReferences/reference/projects/packagereferences/PackageReferences.vs2019.v4_5.csproj b/samples/PackageReferences/reference/projects/packagereferences/PackageReferences.vs2019.v4_5.csproj index f6d3197f9..6702eb779 100644 --- a/samples/PackageReferences/reference/projects/packagereferences/PackageReferences.vs2019.v4_5.csproj +++ b/samples/PackageReferences/reference/projects/packagereferences/PackageReferences.vs2019.v4_5.csproj @@ -1,6 +1,5 @@  - Debug AnyCPU diff --git a/samples/PackageReferences/reference/projects/packagereferences/PackageReferences.vs2019.v4_6_2.csproj b/samples/PackageReferences/reference/projects/packagereferences/PackageReferences.vs2019.v4_6_2.csproj index 7699ca2f3..aa2fb3f75 100644 --- a/samples/PackageReferences/reference/projects/packagereferences/PackageReferences.vs2019.v4_6_2.csproj +++ b/samples/PackageReferences/reference/projects/packagereferences/PackageReferences.vs2019.v4_6_2.csproj @@ -1,6 +1,5 @@  - Debug AnyCPU diff --git a/samples/Sharpmake.Samples.sharpmake.cs b/samples/Sharpmake.Samples.sharpmake.cs index b809afdbe..8000ebf20 100644 --- a/samples/Sharpmake.Samples.sharpmake.cs +++ b/samples/Sharpmake.Samples.sharpmake.cs @@ -138,6 +138,17 @@ public DotNetFrameworkHelloWorldProject() } } + [Generate] + public class DotNetMultiFrameworksHelloWorldProject : SampleProject + { + public DotNetMultiFrameworksHelloWorldProject() + { + Name = "DotNetMultiFrameworksHelloWorld"; + SharpmakeMainFile = "HelloWorld.sharpmake.cs"; + SourceRootPath = @"[project.SharpmakeCsPath]\NetCore\[project.Name]"; + } + } + [Generate] public class FastBuildSimpleExecutable : SampleProject {