Add custom toolchain option (#110)
Fixed #48 Signed-off-by: Hidenori Matsubayashi <[email protected]>
This commit is contained in:
@@ -60,6 +60,11 @@ class BuildPackageCommand extends BuildSubCommand
|
|||||||
'the app is compiled. This option is valid only '
|
'the app is compiled. This option is valid only '
|
||||||
'if the current host and target architectures are different.',
|
'if the current host and target architectures are different.',
|
||||||
);
|
);
|
||||||
|
argParser.addOption(
|
||||||
|
'target-toolchain',
|
||||||
|
defaultsTo: '/',
|
||||||
|
help: 'The toolchain path for Clang.',
|
||||||
|
);
|
||||||
argParser.addOption(
|
argParser.addOption(
|
||||||
'system-include-directories',
|
'system-include-directories',
|
||||||
defaultsTo: null,
|
defaultsTo: null,
|
||||||
@@ -120,8 +125,9 @@ class BuildPackageCommand extends BuildSubCommand
|
|||||||
targetBackendType: stringArg('target-backend-type'),
|
targetBackendType: stringArg('target-backend-type'),
|
||||||
targetCompilerTriple: stringArg('target-compiler-triple'),
|
targetCompilerTriple: stringArg('target-compiler-triple'),
|
||||||
targetSysroot: stringArg('target-sysroot'),
|
targetSysroot: stringArg('target-sysroot'),
|
||||||
systemIncludeDirectories: stringArg('system-include-directories'),
|
|
||||||
targetCompilerFlags: stringArg('target-compiler-flags'),
|
targetCompilerFlags: stringArg('target-compiler-flags'),
|
||||||
|
targetToolchain: stringArg('target-toolchain'),
|
||||||
|
systemIncludeDirectories: stringArg('system-include-directories'),
|
||||||
);
|
);
|
||||||
validateBuild(eLinuxBuildInfo);
|
validateBuild(eLinuxBuildInfo);
|
||||||
displayNullSafetyMode(buildInfo);
|
displayNullSafetyMode(buildInfo);
|
||||||
|
|||||||
@@ -357,6 +357,7 @@ class NativeBundle {
|
|||||||
final String targetCompilerTriple = buildInfo.targetCompilerTriple;
|
final String targetCompilerTriple = buildInfo.targetCompilerTriple;
|
||||||
final String targetSysroot = buildInfo.targetSysroot;
|
final String targetSysroot = buildInfo.targetSysroot;
|
||||||
final String targetCompilerFlags = buildInfo.targetCompilerFlags;
|
final String targetCompilerFlags = buildInfo.targetCompilerFlags;
|
||||||
|
final String targetToolchain = buildInfo.targetToolchain;
|
||||||
final String systemIncludeDirectories = buildInfo.systemIncludeDirectories;
|
final String systemIncludeDirectories = buildInfo.systemIncludeDirectories;
|
||||||
RunResult result = await _processUtils.run(
|
RunResult result = await _processUtils.run(
|
||||||
<String>[
|
<String>[
|
||||||
@@ -378,7 +379,12 @@ class NativeBundle {
|
|||||||
eLinuxDir.path,
|
eLinuxDir.path,
|
||||||
],
|
],
|
||||||
workingDirectory: outputDir.path,
|
workingDirectory: outputDir.path,
|
||||||
environment: <String, String>{'CC': 'clang', 'CXX': 'clang++'},
|
environment: (targetToolchain == null)
|
||||||
|
? <String, String>{'CC': 'clang', 'CXX': 'clang++'}
|
||||||
|
: <String, String>{
|
||||||
|
'CC': '$targetToolchain/bin/clang',
|
||||||
|
'CXX': '$targetToolchain/bin/clang++'
|
||||||
|
},
|
||||||
);
|
);
|
||||||
if (result.exitCode != 0) {
|
if (result.exitCode != 0) {
|
||||||
throwToolExit('Failed to cmake:\n$result');
|
throwToolExit('Failed to cmake:\n$result');
|
||||||
|
|||||||
@@ -37,8 +37,9 @@ class ELinuxBuildInfo {
|
|||||||
@required this.targetBackendType,
|
@required this.targetBackendType,
|
||||||
@required this.targetCompilerTriple,
|
@required this.targetCompilerTriple,
|
||||||
@required this.targetSysroot,
|
@required this.targetSysroot,
|
||||||
@required this.systemIncludeDirectories,
|
|
||||||
@required this.targetCompilerFlags,
|
@required this.targetCompilerFlags,
|
||||||
|
@required this.targetToolchain,
|
||||||
|
@required this.systemIncludeDirectories,
|
||||||
}) : assert(targetArch != null),
|
}) : assert(targetArch != null),
|
||||||
assert(targetBackendType != null);
|
assert(targetBackendType != null);
|
||||||
|
|
||||||
@@ -47,8 +48,9 @@ class ELinuxBuildInfo {
|
|||||||
final String targetBackendType;
|
final String targetBackendType;
|
||||||
final String targetCompilerTriple;
|
final String targetCompilerTriple;
|
||||||
final String targetSysroot;
|
final String targetSysroot;
|
||||||
final String systemIncludeDirectories;
|
|
||||||
final String targetCompilerFlags;
|
final String targetCompilerFlags;
|
||||||
|
final String targetToolchain;
|
||||||
|
final String systemIncludeDirectories;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// See:
|
/// See:
|
||||||
|
|||||||
@@ -299,8 +299,9 @@ class ELinuxDevice extends Device {
|
|||||||
targetBackendType: _backendType,
|
targetBackendType: _backendType,
|
||||||
targetCompilerTriple: null,
|
targetCompilerTriple: null,
|
||||||
targetSysroot: '/',
|
targetSysroot: '/',
|
||||||
systemIncludeDirectories: null,
|
|
||||||
targetCompilerFlags: null,
|
targetCompilerFlags: null,
|
||||||
|
targetToolchain: null,
|
||||||
|
systemIncludeDirectories: null,
|
||||||
);
|
);
|
||||||
await ELinuxBuilder.buildBundle(
|
await ELinuxBuilder.buildBundle(
|
||||||
project: project,
|
project: project,
|
||||||
|
|||||||
Reference in New Issue
Block a user