diff --git a/scripts/build/build_appdeps.ps1 b/scripts/build/build_appdeps.ps1 index f7f996f2b..f2fd8d5bc 100644 --- a/scripts/build/build_appdeps.ps1 +++ b/scripts/build/build_appdeps.ps1 @@ -14,6 +14,6 @@ If (Test-Path $appdepBinDir){ mkdir -Force "$appdepBinDir" -ls "$env:NUGET_PACKAGES\toolchain.win7-x64.Microsoft.DotNet.AppDep\1.0.4-prerelease-00001\*" | foreach { +ls "$env:NUGET_PACKAGES\toolchain.win7-x64.Microsoft.DotNet.AppDep\1.0.5-prerelease-00001\*" | foreach { copy -Rec $_ "$appdepBinDir" -} \ No newline at end of file +} diff --git a/scripts/build/build_appdeps.sh b/scripts/build/build_appdeps.sh index 208c41211..3c47986bb 100755 --- a/scripts/build/build_appdeps.sh +++ b/scripts/build/build_appdeps.sh @@ -34,6 +34,6 @@ OUTPUT_DIR="$(pwd)" popd ## App Deps ## -APPDEP_SDK=$NUGET_PACKAGES/toolchain.$RID.Microsoft.DotNet.AppDep/1.0.4-prerelease-00001/ +APPDEP_SDK=$NUGET_PACKAGES/toolchain.$RID.Microsoft.DotNet.AppDep/1.0.5-prerelease-00001/ mkdir -p $OUTPUT_DIR/appdepsdk cp -a $APPDEP_SDK/. $OUTPUT_DIR/appdepsdk diff --git a/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Mac/MacCppCompileStep.cs b/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Mac/MacCppCompileStep.cs index 735916f5d..b2f49b408 100644 --- a/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Mac/MacCppCompileStep.cs +++ b/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Mac/MacCppCompileStep.cs @@ -87,7 +87,6 @@ namespace Microsoft.DotNet.Tools.Compiler.Native foreach (var libPath in _ilcSdkLibs.Select(lib => Path.Combine(ilcSdkLibPath, lib))) { // Forward the library to linked to the linker - argsList.Add("-Xlinker"); argsList.Add(libPath); } @@ -95,7 +94,6 @@ namespace Microsoft.DotNet.Tools.Compiler.Native var baseAppDeplibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/osx.10.10/x64"); foreach (var appDeplibPath in _appdeplibs.Select(lib => Path.Combine(baseAppDeplibPath, lib))) { - argsList.Add("-Xlinker"); argsList.Add(appDeplibPath); } @@ -139,4 +137,4 @@ namespace Microsoft.DotNet.Tools.Compiler.Native return outfile; } } -} \ No newline at end of file +} diff --git a/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Mac/MacRyuJitCompileStep.cs b/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Mac/MacRyuJitCompileStep.cs index 9fdc8ed6d..1bd94abb1 100644 --- a/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Mac/MacRyuJitCompileStep.cs +++ b/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Mac/MacRyuJitCompileStep.cs @@ -66,15 +66,15 @@ namespace Microsoft.DotNet.Tools.Compiler.Native // Input File var inLibFile = DetermineInFile(config); - argsList.Add("-Xlinker "+inLibFile); + argsList.Add(inLibFile); // ILC SDK Libs var ilcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk"); - argsList.AddRange(_ilcSdkLibs.Select(lib => Path.Combine(ilcSdkLibPath, lib)).Select(libPath => "-Xlinker " + libPath)); + argsList.AddRange(_ilcSdkLibs.Select(lib => Path.Combine(ilcSdkLibPath, lib))); // AppDep Libs var baseAppDepLibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/osx.10.10", config.Architecture.ToString()); - argsList.AddRange(appdeplibs.Select(lib => Path.Combine(baseAppDepLibPath, lib)).Select(appDepLibPath => "-Xlinker " + appDepLibPath)); + argsList.AddRange(appdeplibs.Select(lib => Path.Combine(baseAppDepLibPath, lib))); // Output var libOut = DetermineOutputFile(config); diff --git a/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Windows/WindowsCppCompileStep.cs b/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Windows/WindowsCppCompileStep.cs index 7ba4c5d99..196304a1e 100644 --- a/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Windows/WindowsCppCompileStep.cs +++ b/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Windows/WindowsCppCompileStep.cs @@ -19,11 +19,13 @@ namespace Microsoft.DotNet.Tools.Compiler.Native private readonly string InputExtension = ".cpp"; private readonly string CompilerOutputExtension = ".obj"; - + + private static readonly string[] DefaultCompilerOptions = { "/nologo", "/W3", "/GS", "/DCPPCODEGEN", "/EHs", "/MT", "/Zi" }; + private static readonly Dictionary ConfigurationCompilerOptionsMap = new Dictionary { - { BuildConfiguration.debug, new string[] {"/ZI", "/nologo", "/W3", "/WX-", "/sdl", "/Od", "/D", "CPPCODEGEN", "/D", "WIN32", "/D", "_CONSOLE", "/D", "_LIB", "/D", "_UNICODE", "/D", "UNICODE", "/Gm", "/EHsc", "/RTC1", "/MD", "/GS", "/fp:precise", "/Zc:wchar_t", "/Zc:forScope", "/Zc:inline", "/Gd", "/TP", "/wd4477", "/errorReport:prompt"} }, - { BuildConfiguration.release, new string[] {"/Zi", "/nologo", "/W3", "/WX-", "/sdl", "/O2", "/Oi", "/GL", "/D", "CPPCODEGEN", "/D", "WIN32", "/D", "NDEBUG", "/D", "_CONSOLE", "/D", "_LIB", "/D", "_UNICODE", "/D", "UNICODE", "/Gm-", "/EHsc", "/MD", "/GS", "/Gy", "/fp:precise", "/Zc:wchar_t", "/Zc:forScope", "/Zc:inline", "/Gd", "/TP", "/wd4477", "/errorReport:prompt"} } + { BuildConfiguration.debug, new string[] { "/Od" } }, + { BuildConfiguration.release, new string[] { "/O2" } } }; private IEnumerable CompilerArgs { get; set; } @@ -72,6 +74,8 @@ namespace Microsoft.DotNet.Tools.Compiler.Native argsList.Add("/I"); argsList.Add($"{ilcSdkIncPath}"); + argsList.AddRange(DefaultCompilerOptions); + // Configuration Based Compiler Options argsList.AddRange(ConfigurationCompilerOptionsMap[config.BuildType]); diff --git a/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Windows/WindowsLinkStep.cs b/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Windows/WindowsLinkStep.cs index e925079ca..817badef9 100644 --- a/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Windows/WindowsLinkStep.cs +++ b/src/dotnet/commands/dotnet-compile-native/IntermediateCompilation/Windows/WindowsLinkStep.cs @@ -18,10 +18,12 @@ namespace Microsoft.DotNet.Tools.Compiler.Native private readonly string InputExtension = ".obj"; - private static readonly Dictionary ConfigurationLinkerOptionsMap = new Dictionary + private static readonly string[] DefaultLinkerOptions = new string[] { "/NOLOGO", "/DEBUG", "/MANIFEST:NO" }; + + private static readonly Dictionary ConfigurationLinkerOptionsMap = new Dictionary { - { BuildConfiguration.debug, "/NOLOGO /ERRORREPORT:PROMPT /MANIFEST /MANIFESTUAC:\"level='asInvoker' uiAccess='false'\" /manifest:embed /Debug /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT" }, - { BuildConfiguration.release, "/NOLOGO /ERRORREPORT:PROMPT /INCREMENTAL:NO /OPT:REF /OPT:ICF /LTCG:incremental /MANIFEST /MANIFESTUAC:\"level='asInvoker' uiAccess='false'\" /manifest:embed /Debug /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT" } + { BuildConfiguration.debug, new string[] { } }, + { BuildConfiguration.release, new string[] { "/INCREMENTAL:NO", "/OPT:REF", "/OPT:ICF" } } }; private static readonly Dictionary IlcSdkLibMap = new Dictionary @@ -46,14 +48,6 @@ namespace Microsoft.DotNet.Tools.Compiler.Native "odbccp32.lib" }; - // We will always link against msvcrt.lib since the runtime libraries are also built against msvcrt.lib as we are not interested in assertions - // from CRT code. - private static readonly Dictionary ConfigurationLinkLibMap = new Dictionary() - { - { BuildConfiguration.debug , new string[] { "msvcrt.lib" } }, - { BuildConfiguration.release , new string[] { "msvcrt.lib" } } - }; - private IEnumerable Args { get; set; } private NativeCompileSettings config; @@ -89,9 +83,11 @@ namespace Microsoft.DotNet.Tools.Compiler.Native private void InitializeArgs(NativeCompileSettings config) { var argsList = new List(); - + + argsList.AddRange(DefaultLinkerOptions); + // Configuration Based Linker Options - argsList.Add(ConfigurationLinkerOptionsMap[config.BuildType]); + argsList.AddRange(ConfigurationLinkerOptionsMap[config.BuildType]); //Output var outFile = DetermineOutputFile(config); @@ -112,13 +108,6 @@ namespace Microsoft.DotNet.Tools.Compiler.Native argsList.Add($"{sdkLibPath}"); } - // Configuration Based Libs - var configLibs = ConfigurationLinkLibMap[config.BuildType]; - foreach (var lib in configLibs) - { - argsList.Add($"{lib}"); - } - // Link Libs foreach(var path in config.LinkLibPaths){ argsList.Add($"{path}"); diff --git a/src/dotnet/commands/dotnet-compile-native/appdep/project.json b/src/dotnet/commands/dotnet-compile-native/appdep/project.json index 42fca71f1..ed2573da0 100644 --- a/src/dotnet/commands/dotnet-compile-native/appdep/project.json +++ b/src/dotnet/commands/dotnet-compile-native/appdep/project.json @@ -5,7 +5,7 @@ }, "dependencies": { "NETStandard.Library": "1.0.0-rc2-23728", - "Microsoft.DotNet.AppDep":"1.0.4-prerelease-00001" + "Microsoft.DotNet.AppDep":"1.0.5-prerelease-00001" }, "frameworks": { "dnxcore50": { } diff --git a/src/dotnet/project.json b/src/dotnet/project.json index 074d49938..9a3271e15 100644 --- a/src/dotnet/project.json +++ b/src/dotnet/project.json @@ -28,7 +28,7 @@ "Microsoft.DotNet.ProjectModel": "1.0.0-*", "Microsoft.DotNet.Compiler.Common": "1.0.0-*", "Microsoft.DotNet.Cli.Utils": "1.0.0-*", - "Microsoft.DotNet.ILCompiler.SDK": "1.0.4-prerelease-00006", + "Microsoft.DotNet.ILCompiler.SDK": "1.0.5-prerelease-00002", "Microsoft.Extensions.Logging": "1.0.0-rc2-16040", "Microsoft.Extensions.Logging.Console": "1.0.0-rc2-16040",