Merge pull request #1 from piotrpMSFT/brthor-dotnet-compile-natives
Brthor dotnet compile natives
This commit is contained in:
commit
bd9277e906
5 changed files with 107 additions and 26 deletions
|
@ -56,6 +56,8 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Dotnet.Cli.Compil
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Tools.Init", "src\Microsoft.DotNet.Tools.Init\Microsoft.DotNet.Tools.Init.xproj", "{BC765FBF-AD7A-4A99-9902-5540C5A74181}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Tools.Init", "src\Microsoft.DotNet.Tools.Init\Microsoft.DotNet.Tools.Init.xproj", "{BC765FBF-AD7A-4A99-9902-5540C5A74181}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Tools.Compiler.Native", "src\Microsoft.DotNet.Tools.Compiler.Native\Microsoft.DotNet.Tools.Compiler.Native.xproj", "{172485DD-B94E-4F3E-851E-CF23908FF960}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -296,6 +298,22 @@ Global
|
||||||
{BC765FBF-AD7A-4A99-9902-5540C5A74181}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
{BC765FBF-AD7A-4A99-9902-5540C5A74181}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||||
{BC765FBF-AD7A-4A99-9902-5540C5A74181}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
{BC765FBF-AD7A-4A99-9902-5540C5A74181}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||||
{BC765FBF-AD7A-4A99-9902-5540C5A74181}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
{BC765FBF-AD7A-4A99-9902-5540C5A74181}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||||
|
{172485DD-B94E-4F3E-851E-CF23908FF960}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{172485DD-B94E-4F3E-851E-CF23908FF960}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{172485DD-B94E-4F3E-851E-CF23908FF960}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{172485DD-B94E-4F3E-851E-CF23908FF960}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{172485DD-B94E-4F3E-851E-CF23908FF960}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{172485DD-B94E-4F3E-851E-CF23908FF960}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{172485DD-B94E-4F3E-851E-CF23908FF960}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{172485DD-B94E-4F3E-851E-CF23908FF960}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
||||||
|
{172485DD-B94E-4F3E-851E-CF23908FF960}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{172485DD-B94E-4F3E-851E-CF23908FF960}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{172485DD-B94E-4F3E-851E-CF23908FF960}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{172485DD-B94E-4F3E-851E-CF23908FF960}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{172485DD-B94E-4F3E-851E-CF23908FF960}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{172485DD-B94E-4F3E-851E-CF23908FF960}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{172485DD-B94E-4F3E-851E-CF23908FF960}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{172485DD-B94E-4F3E-851E-CF23908FF960}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -318,5 +336,6 @@ Global
|
||||||
{1C16108C-C786-482D-BB0A-36BDAFE109ED} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
{1C16108C-C786-482D-BB0A-36BDAFE109ED} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||||
{A16958E1-24C7-4F1E-B317-204AD91625DD} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
{A16958E1-24C7-4F1E-B317-204AD91625DD} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||||
{BC765FBF-AD7A-4A99-9902-5540C5A74181} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
{BC765FBF-AD7A-4A99-9902-5540C5A74181} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||||
|
{172485DD-B94E-4F3E-851E-CF23908FF960} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
|
||||||
public string InputManagedAssemblyPath { get; set; }
|
public string InputManagedAssemblyPath { get; set; }
|
||||||
public string OutputDirectory { get; set; }
|
public string OutputDirectory { get; set; }
|
||||||
public string IntermediateDirectory { get; set; }
|
public string IntermediateDirectory { get; set; }
|
||||||
public string BuildType { get; set; }
|
public string BuildConfiguration { get; set; }
|
||||||
public string Architecture { get; set; }
|
public string Architecture { get; set; }
|
||||||
public string NativeMode { get; set; }
|
public string NativeMode { get; set; }
|
||||||
public List<string> ReferencePaths { get; set; }
|
public List<string> ReferencePaths { get; set; }
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||||
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>172485dd-b94e-4f3e-851e-cf23908ff960</ProjectGuid>
|
||||||
|
<RootNamespace>Microsoft.DotNet.Tools.Compiler.Native</RootNamespace>
|
||||||
|
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||||
|
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||||
|
</Project>
|
|
@ -1,13 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
using Microsoft.Dnx.Runtime.Common.CommandLine;
|
using Microsoft.Dnx.Runtime.Common.CommandLine;
|
||||||
using Microsoft.DotNet.Cli.Utils;
|
using Microsoft.DotNet.Cli.Utils;
|
||||||
using Microsoft.DotNet.Tools.Common;
|
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Tools.Compiler.Native
|
namespace Microsoft.DotNet.Tools.Compiler.Native
|
||||||
{
|
{
|
||||||
|
@ -78,17 +72,19 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
|
||||||
|
|
||||||
private static CommandLineApplication SetupApp()
|
private static CommandLineApplication SetupApp()
|
||||||
{
|
{
|
||||||
var app = new CommandLineApplication();
|
var app = new CommandLineApplication
|
||||||
app.Name = "dotnet compile native";
|
{
|
||||||
app.FullName = "IL to Native compiler";
|
Name = "dotnet compile native",
|
||||||
app.Description = "IL to Native compiler Compiler for the .NET Platform";
|
FullName = "IL to Native compiler",
|
||||||
|
Description = "IL to Native compiler Compiler for the .NET Platform"
|
||||||
|
};
|
||||||
|
|
||||||
app.HelpOption("-h|--help");
|
app.HelpOption("-h|--help");
|
||||||
|
|
||||||
var managedInputArg = app.Argument("<INPUT_ASSEMBLY>", "The managed input assembly to compile to native.");
|
var managedInputArg = app.Argument("<INPUT_ASSEMBLY>", "The managed input assembly to compile to native.");
|
||||||
var outputArg = app.Option("-o|--out <OUTPUT_DIR>", "Output Directory for native executable.", CommandOptionType.SingleValue);
|
var outputArg = app.Option("-o|--out <OUTPUT_DIR>", "Output Directory for native executable.", CommandOptionType.SingleValue);
|
||||||
var intermediateArg = app.Option("--temp-output <OUTPUT_DIR>", "Directory for intermediate files.", CommandOptionType.SingleValue);
|
var intermediateArg = app.Option("-t|--temp-output <OUTPUT_DIR>", "Directory for intermediate files.", CommandOptionType.SingleValue);
|
||||||
var archArg = app.Option("-a|--arch <ARCH>", "Architecture type to compile for, defaults to the arch of the machine.", CommandOptionType.SingleValue );
|
var buildConfigArg = app.Option("-c|--configuration <TYPE>", "debug/release build configuration. Defaults to debug.", CommandOptionType.SingleValue);
|
||||||
var buildTypeArg = app.Option("-c|--configuration <TYPE>", "debug/release build type. Defaults to debug.", CommandOptionType.SingleValue);
|
|
||||||
var modeArg = app.Option("-m|--mode <MODE>", "Code Generation mode. Defaults to ryujit. ", CommandOptionType.SingleValue);
|
var modeArg = app.Option("-m|--mode <MODE>", "Code Generation mode. Defaults to ryujit. ", CommandOptionType.SingleValue);
|
||||||
|
|
||||||
var referencesArg = app.Option("-r|--reference <REF_PATH>", "Use to specify Managed DLL references of the app.", CommandOptionType.MultipleValue);
|
var referencesArg = app.Option("-r|--reference <REF_PATH>", "Use to specify Managed DLL references of the app.", CommandOptionType.MultipleValue);
|
||||||
|
@ -99,14 +95,11 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
|
||||||
var linklibArg = app.Option("--linklib <LINKLIB>", "Use to link in additional static libs", CommandOptionType.MultipleValue);
|
var linklibArg = app.Option("--linklib <LINKLIB>", "Use to link in additional static libs", CommandOptionType.MultipleValue);
|
||||||
|
|
||||||
// TEMPORARY Hack until CoreRT compatible Framework Libs are available
|
// TEMPORARY Hack until CoreRT compatible Framework Libs are available
|
||||||
var appdepSDKPathArg = app.Option("--appdepsdk <SDK>", "Use to plug in custom appdepsdk path", CommandOptionType.SingleValue);
|
var appdepSdkPathArg = app.Option("--appdepsdk <SDK>", "Use to plug in custom appdepsdk path", CommandOptionType.SingleValue);
|
||||||
|
|
||||||
// Optional Log Path
|
// Optional Log Path
|
||||||
var logpathArg = app.Option("--logpath <LOG_PATH>", "Use to dump Native Compilation Logs to a file.", CommandOptionType.SingleValue);
|
var logpathArg = app.Option("--logpath <LOG_PATH>", "Use to dump Native Compilation Logs to a file.", CommandOptionType.SingleValue);
|
||||||
|
|
||||||
// Use Response File
|
|
||||||
var responseFilePathArg = app.Option("--rsp <RSP_FILE>", "Compilation Response File", CommandOptionType.SingleValue);
|
|
||||||
|
|
||||||
app.OnExecute(() =>
|
app.OnExecute(() =>
|
||||||
{
|
{
|
||||||
var cmdLineArgs = new ArgValues()
|
var cmdLineArgs = new ArgValues()
|
||||||
|
@ -114,14 +107,14 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
|
||||||
InputManagedAssemblyPath = managedInputArg.Value,
|
InputManagedAssemblyPath = managedInputArg.Value,
|
||||||
OutputDirectory = outputArg.Value(),
|
OutputDirectory = outputArg.Value(),
|
||||||
IntermediateDirectory = intermediateArg.Value(),
|
IntermediateDirectory = intermediateArg.Value(),
|
||||||
Architecture = archArg.Value(),
|
Architecture = "x64",
|
||||||
BuildType = buildTypeArg.Value(),
|
BuildConfiguration = buildConfigArg.Value(),
|
||||||
NativeMode = modeArg.Value(),
|
NativeMode = modeArg.Value(),
|
||||||
ReferencePaths = referencesArg.Values,
|
ReferencePaths = referencesArg.Values,
|
||||||
IlcArgs = ilcArgs.Value(),
|
IlcArgs = ilcArgs.Value(),
|
||||||
IlcPath = ilcPathArg.Value(),
|
IlcPath = ilcPathArg.Value(),
|
||||||
LinkLibPaths = linklibArg.Values,
|
LinkLibPaths = linklibArg.Values,
|
||||||
AppDepSDKPath = appdepSDKPathArg.Value(),
|
AppDepSDKPath = appdepSdkPathArg.Value(),
|
||||||
LogPath = logpathArg.Value()
|
LogPath = logpathArg.Value()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -176,8 +169,8 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// BuildType
|
// BuildConfiguration
|
||||||
if(string.IsNullOrEmpty(args.BuildType))
|
if(string.IsNullOrEmpty(args.BuildConfiguration))
|
||||||
{
|
{
|
||||||
config.BuildType = GetDefaultBuildType();
|
config.BuildType = GetDefaultBuildType();
|
||||||
}
|
}
|
||||||
|
@ -185,11 +178,11 @@ namespace Microsoft.DotNet.Tools.Compiler.Native
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
config.BuildType = EnumExtensions.Parse<BuildConfiguration>(args.BuildType.ToLower());
|
config.BuildType = EnumExtensions.Parse<BuildConfiguration>(args.BuildConfiguration.ToLower());
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new Exception("Invalid BuildType Option.");
|
throw new Exception("Invalid Configuration Option.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
50
src/Microsoft.DotNet.Tools.Compiler.Native/README.md
Normal file
50
src/Microsoft.DotNet.Tools.Compiler.Native/README.md
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
dotnet-compile
|
||||||
|
===========
|
||||||
|
|
||||||
|
**NAME**
|
||||||
|
dotnet-compile-native -- Compiles IL binaries to native binaries.
|
||||||
|
|
||||||
|
**SYNOPSIS**
|
||||||
|
dotnet compile [options]
|
||||||
|
|
||||||
|
**DESCRIPTION**
|
||||||
|
The `compile-native` command compiles IL assemblies to native machine code. It is used by `dotnet-compile --native`.
|
||||||
|
|
||||||
|
The output is a native exe that conforms to the architecture of the underlying operating system (i.e. running on 64-bit OS will produce a native 64-bit exe). This can be overriden via the --arch switch and specifying the wanted architecture. The executable has a default extension of "" on Linux and OS X and ".exe" on Windows. The source must include a `static void Main(string[] args) entry point and specify compilerOptions.emitEntryPoint in the project.json.
|
||||||
|
|
||||||
|
Output files are written to the child `bin` folder, which will be created if it doesn't exist. Files will be overwritten as needed.
|
||||||
|
|
||||||
|
**Options**
|
||||||
|
|
||||||
|
--appdepsdk <SDK_PATH>
|
||||||
|
Path to custom AppDepSDK
|
||||||
|
|
||||||
|
-c, --configuration [debug|release]
|
||||||
|
Build configuration. Defaults to `debug`.
|
||||||
|
|
||||||
|
--ilcargs <args>
|
||||||
|
Custom arguments for the IL Compiler.
|
||||||
|
|
||||||
|
--ilcpath <ILC_PATH>
|
||||||
|
Path to a custom ilc.exe
|
||||||
|
|
||||||
|
--linklib <LIB_PATH>
|
||||||
|
Path to static lib to link
|
||||||
|
|
||||||
|
--logpath <LOG_PATH>
|
||||||
|
Enables logging and writes native compilation logs to the given path.
|
||||||
|
|
||||||
|
-m, --mode [cpp|ryujit|custom]
|
||||||
|
Code generation mode. Defaults to ryujit.
|
||||||
|
|
||||||
|
-o, --out directoryname
|
||||||
|
Output directory for the native executable.
|
||||||
|
|
||||||
|
-r, --reference
|
||||||
|
Path to a managed dll reference for the app.
|
||||||
|
|
||||||
|
-t, --temp-out
|
||||||
|
Specifies temporary directory for intermediate files.
|
||||||
|
|
||||||
|
-v, --verbose
|
||||||
|
Prints verbose logging information, to follow the flow of execution of the command.
|
Loading…
Add table
Add a link
Reference in a new issue