Add target-compiler-triple option (#88)
This commit is contained in:
@@ -38,7 +38,7 @@ class BuildPackageCommand extends BuildSubCommand
|
|||||||
'target-arch',
|
'target-arch',
|
||||||
defaultsTo: _getCurrentHostPlatformArchName(),
|
defaultsTo: _getCurrentHostPlatformArchName(),
|
||||||
allowed: <String>['x64', 'arm64'],
|
allowed: <String>['x64', 'arm64'],
|
||||||
help: 'Target architecture for which the the app is compiled',
|
help: 'Target architecture for which the app is compiled',
|
||||||
);
|
);
|
||||||
argParser.addOption(
|
argParser.addOption(
|
||||||
'target-backend-type',
|
'target-backend-type',
|
||||||
@@ -46,6 +46,13 @@ class BuildPackageCommand extends BuildSubCommand
|
|||||||
allowed: <String>['wayland', 'gbm', 'eglstream', 'x11'],
|
allowed: <String>['wayland', 'gbm', 'eglstream', 'x11'],
|
||||||
help: 'Target backend type that the app will run on devices.',
|
help: 'Target backend type that the app will run on devices.',
|
||||||
);
|
);
|
||||||
|
argParser.addOption(
|
||||||
|
'target-compiler-triple',
|
||||||
|
defaultsTo: 'aarch64-linux-gnu',
|
||||||
|
help: 'Target compiler triple for which the app is compiled. '
|
||||||
|
'This option is used only if the target architectures is '
|
||||||
|
'arm64 (for cross-building for x64 on arm64).',
|
||||||
|
);
|
||||||
argParser.addOption(
|
argParser.addOption(
|
||||||
'target-sysroot',
|
'target-sysroot',
|
||||||
defaultsTo: '/',
|
defaultsTo: '/',
|
||||||
@@ -105,6 +112,7 @@ class BuildPackageCommand extends BuildSubCommand
|
|||||||
final ELinuxBuildInfo eLinuxBuildInfo = ELinuxBuildInfo(buildInfo,
|
final ELinuxBuildInfo eLinuxBuildInfo = ELinuxBuildInfo(buildInfo,
|
||||||
targetArch: targetArch,
|
targetArch: targetArch,
|
||||||
targetBackendType: stringArg('target-backend-type'),
|
targetBackendType: stringArg('target-backend-type'),
|
||||||
|
targetCompilerTriple: stringArg('target-compiler-triple'),
|
||||||
targetSysroot: stringArg('target-sysroot'),
|
targetSysroot: stringArg('target-sysroot'),
|
||||||
systemIncludeDirectories: stringArg('system-include-directories'));
|
systemIncludeDirectories: stringArg('system-include-directories'));
|
||||||
validateBuild(eLinuxBuildInfo);
|
validateBuild(eLinuxBuildInfo);
|
||||||
|
|||||||
@@ -353,6 +353,7 @@ class NativeBundle {
|
|||||||
final String cmakeBuildType = buildMode.isPrecompiled ? 'Release' : 'Debug';
|
final String cmakeBuildType = buildMode.isPrecompiled ? 'Release' : 'Debug';
|
||||||
final String targetArch = buildInfo.targetArch;
|
final String targetArch = buildInfo.targetArch;
|
||||||
final String hostArch = _getCurrentHostPlatformArchName();
|
final String hostArch = _getCurrentHostPlatformArchName();
|
||||||
|
final String targetCompilerTriple = buildInfo.targetCompilerTriple;
|
||||||
final String targetSysroot = buildInfo.targetSysroot;
|
final String targetSysroot = buildInfo.targetSysroot;
|
||||||
final String systemIncludeDirectories = buildInfo.systemIncludeDirectories;
|
final String systemIncludeDirectories = buildInfo.systemIncludeDirectories;
|
||||||
final bool needCrossBuild = targetArch != hostArch;
|
final bool needCrossBuild = targetArch != hostArch;
|
||||||
@@ -365,10 +366,10 @@ class NativeBundle {
|
|||||||
if (needCrossBuild) '-DFLUTTER_TARGET_PLATFORM_SYSROOT=$targetSysroot',
|
if (needCrossBuild) '-DFLUTTER_TARGET_PLATFORM_SYSROOT=$targetSysroot',
|
||||||
if (needCrossBuild && systemIncludeDirectories != null)
|
if (needCrossBuild && systemIncludeDirectories != null)
|
||||||
'-DFLUTTER_SYSTEM_INCLUDE_DIRECTORIES=$systemIncludeDirectories',
|
'-DFLUTTER_SYSTEM_INCLUDE_DIRECTORIES=$systemIncludeDirectories',
|
||||||
if (needCrossBuildOptionsForArm64)
|
if (needCrossBuildOptionsForArm64 && targetCompilerTriple != null)
|
||||||
'-DCMAKE_C_COMPILER_TARGET=aarch64-linux-gnu',
|
'-DCMAKE_C_COMPILER_TARGET=$targetCompilerTriple',
|
||||||
if (needCrossBuildOptionsForArm64)
|
if (needCrossBuildOptionsForArm64 && targetCompilerTriple != null)
|
||||||
'-DCMAKE_CXX_COMPILER_TARGET=aarch64-linux-gnu',
|
'-DCMAKE_CXX_COMPILER_TARGET=$targetCompilerTriple',
|
||||||
eLinuxDir.path,
|
eLinuxDir.path,
|
||||||
],
|
],
|
||||||
workingDirectory: outputDir.path,
|
workingDirectory: outputDir.path,
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class ELinuxBuildInfo {
|
|||||||
this.buildInfo, {
|
this.buildInfo, {
|
||||||
@required this.targetArch,
|
@required this.targetArch,
|
||||||
@required this.targetBackendType,
|
@required this.targetBackendType,
|
||||||
|
@required this.targetCompilerTriple,
|
||||||
@required this.targetSysroot,
|
@required this.targetSysroot,
|
||||||
@required this.systemIncludeDirectories,
|
@required this.systemIncludeDirectories,
|
||||||
}) : assert(targetArch != null),
|
}) : assert(targetArch != null),
|
||||||
@@ -43,6 +44,7 @@ class ELinuxBuildInfo {
|
|||||||
final BuildInfo buildInfo;
|
final BuildInfo buildInfo;
|
||||||
final String targetArch;
|
final String targetArch;
|
||||||
final String targetBackendType;
|
final String targetBackendType;
|
||||||
|
final String targetCompilerTriple;
|
||||||
final String targetSysroot;
|
final String targetSysroot;
|
||||||
final String systemIncludeDirectories;
|
final String systemIncludeDirectories;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,12 +291,13 @@ class ELinuxDevice extends Device {
|
|||||||
BuildInfo buildInfo,
|
BuildInfo buildInfo,
|
||||||
}) async {
|
}) async {
|
||||||
final FlutterProject project = FlutterProject.current();
|
final FlutterProject project = FlutterProject.current();
|
||||||
// TODO(hidenori): change the fixed values (|targetSysroot| and |systemIncludeDirectories|)
|
// TODO(hidenori): change the fixed values (|targetSysroot|, |systemIncludeDirectories| and |targetCompilerTriple|)
|
||||||
// to the values from user-specified custom-devices feilds.
|
// to the values from user-specified custom-devices feilds.
|
||||||
final ELinuxBuildInfo eLinuxBuildInfo = ELinuxBuildInfo(
|
final ELinuxBuildInfo eLinuxBuildInfo = ELinuxBuildInfo(
|
||||||
buildInfo,
|
buildInfo,
|
||||||
targetArch: _targetArch,
|
targetArch: _targetArch,
|
||||||
targetBackendType: _backendType,
|
targetBackendType: _backendType,
|
||||||
|
targetCompilerTriple: null,
|
||||||
targetSysroot: '/',
|
targetSysroot: '/',
|
||||||
systemIncludeDirectories: null,
|
systemIncludeDirectories: null,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user