Add --target-compiler-flags argument to specify flags for clang. (#106)
Also, avoid using environment variables to prevent interference to other commands run by CMake. Only CMAKE_C(XX)_COMPILER is sufficient to build flutter.
This commit is contained in:
@@ -356,6 +356,7 @@ class NativeBundle {
|
||||
final String hostArch = _getCurrentHostPlatformArchName();
|
||||
final String targetCompilerTriple = buildInfo.targetCompilerTriple;
|
||||
final String targetSysroot = buildInfo.targetSysroot;
|
||||
final String targetCompilerFlags = buildInfo.targetCompilerFlags;
|
||||
final String systemIncludeDirectories = buildInfo.systemIncludeDirectories;
|
||||
RunResult result = await _processUtils.run(
|
||||
<String>[
|
||||
@@ -371,10 +372,14 @@ class NativeBundle {
|
||||
'-DCMAKE_C_COMPILER_TARGET=$targetCompilerTriple',
|
||||
if (targetCompilerTriple != null)
|
||||
'-DCMAKE_CXX_COMPILER_TARGET=$targetCompilerTriple',
|
||||
if (targetCompilerFlags != null) '-DCMAKE_C_FLAGS=$targetCompilerFlags',
|
||||
if (targetCompilerFlags != null)
|
||||
'-DCMAKE_CXX_FLAGS=$targetCompilerFlags',
|
||||
'-DCMAKE_C_COMPILER=clang',
|
||||
'-DCMAKE_CXX_COMPILER=clang++',
|
||||
eLinuxDir.path,
|
||||
],
|
||||
workingDirectory: outputDir.path,
|
||||
environment: <String, String>{'CC': 'clang', 'CXX': 'clang++'},
|
||||
);
|
||||
if (result.exitCode != 0) {
|
||||
throwToolExit('Failed to cmake:\n$result');
|
||||
|
||||
Reference in New Issue
Block a user