浏览代码

build android

/siyaoH-1.17-PlatformMessage
siyao 4 年前
当前提交
b41da6c1
共有 19 个文件被更改,包括 865 次插入51 次删除
  1. 2
      com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs
  2. 1
      com.unity.uiwidgets/Runtime/material/material_state.cs
  3. 1
      com.unity.uiwidgets/Runtime/rendering/debug_overflow_indicator.cs
  4. 2
      com.unity.uiwidgets/Runtime/services/keyboard.cs
  5. 246
      engine/Build.bee.cs
  6. 41
      engine/README.md
  7. 2
      engine/src/flow/layers/opacity_layer.cc
  8. 2
      engine/src/lib/ui/compositing/scene_builder.cc
  9. 2
      engine/src/lib/ui/painting/gradient.h
  10. 36
      engine/src/lib/ui/text/paragraph.cc
  11. 2
      engine/src/shell/common/canvas_spy.cc
  12. 2
      engine/src/shell/common/canvas_spy.h
  13. 2
      engine/src/shell/common/lists.cc
  14. 2
      engine/src/shell/gpu/gpu_surface_gl_delegate.cc
  15. 2
      engine/src/shell/platform/embedder/embedder.cc
  16. 2
      engine/src/shell/platform/embedder/embedder_render_target.cc
  17. 2
      engine/src/shell/platform/embedder/embedder_surface_software.cc
  18. 4
      engine/src/shell/platform/unity/uiwidgets_system.h
  19. 563
      engine/build.py

2
com.unity.uiwidgets/Runtime/engine2/UIWidgetsPanel.cs


IntPtr ptr, IntPtr nativeTexturePtr, int width, int height, float dpi);
}
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
#elif UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX || UNITY_ANDROID
public partial class UIWidgetsPanel {
Texture _renderTexture;

1
com.unity.uiwidgets/Runtime/material/material_state.cs


using System.Collections.Generic;
using Unity.UIWidgets.material;
using Unity.UIWidgets.ui;
using UnityEditor.VersionControl;
namespace Unity.UIWidgets.material {
public enum MaterialState {

1
com.unity.uiwidgets/Runtime/rendering/debug_overflow_indicator.cs


using Unity.UIWidgets.rendering;
using Unity.UIWidgets.ui;
using Unity.UIWidgets.widgets;
using UnityEditor.PackageManager;
using UnityEngine;
using Color = Unity.UIWidgets.ui.Color;
using Gradient = Unity.UIWidgets.ui.Gradient;

2
com.unity.uiwidgets/Runtime/services/keyboard.cs


}
public override void setEditingState(TextEditingValue value) {
UIWidgetsTextInputSetTextInputEditingState(value.toJson().ToString());
UIWidgetsTextInputSetTextInputEditingState(value.toJSON().ToString());
}
public override void setIMEPos(Offset imeGlobalPos) {

246
engine/Build.bee.cs


flutterRoot = Environment.GetEnvironmentVariable("USERPROFILE") + "/engine/src";
}
var buildAndroidEnv = Environment.GetEnvironmentVariable("BUILD_ANDROID");
buildAndroid = true;// buildAndroidEnv == "true";
var libUIWidgets = SetupLibUIWidgets();
//create ide projects

}
else if (BuildUtils.IsHostMac())
{
//create xcode project
var nativePrograms = new List<NativeProgram>();
nativePrograms.Add(libUIWidgets);
var xcodeProject = new XCodeProjectFile(nativePrograms, new NPath("libUIWidgets.xcodeproj/project.pbxproj"));
if(buildAndroid){
var androidProject = AndroidNativeProgramExtensions.DynamicLinkerSettingsForAndroid(libUIWidgets);
}else {
//create xcode project
var nativePrograms = new List<NativeProgram>();
nativePrograms.Add(libUIWidgets);
var xcodeProject = new XCodeProjectFile(nativePrograms, new NPath("libUIWidgets.xcodeproj/project.pbxproj"));
}
private static bool buildAndroid;
static NativeProgram SetupLibUIWidgets()
{

{
//"src/assets/test.cc",
//"src/assets/test.h",
"src/assets/asset_manager.cc",
"src/assets/asset_manager.h",
"src/assets/asset_resolver.h",

"src/shell/platform/unity/darwin/macos/unity_surface_manager.h",
};
np.Sources.Add(c => IsMac(c), macSources);
np.Sources.Add(c => {
var a = IsMac(c);
return a;
}, macSources);
np.Libraries.Add(c => IsWindows(c), new BagOfObjectFilesLibrary(
new NPath[]{

np.CompilerSettings().Add(c => IsMac(c), c => c.WithCustomFlags(new []{"-Wno-c++11-narrowing"}));
np.CompilerSettings().Add(c => IsAndroid(c), c => c.WithCustomFlags(new[] { "-stdlib=libc++" }));
np.CompilerSettings().Add(c => IsAndroid(c), c => c.WithCustomFlags(new[] { "-nostdlib" }));
np.CompilerSettings().Add(c => IsAndroid(c), c => c.WithCustomFlags(new[] { "-Wno-c++11-narrowing" }));
np.IncludeDirectories.Add("third_party");
np.IncludeDirectories.Add("src");

np.Defines.Add(c => IsAndroid(c), "UIWIDGETS_FORCE_ALIGNAS_8=\\\"1\\\"");
np.Defines.Add(c => c.CodeGen == CodeGen.Debug,
new[] { "_ITERATOR_DEBUG_LEVEL=2", "_HAS_ITERATOR_DEBUGGING=1", "_SECURE_SCL=1" });

np.LinkerSettings().Add(c => IsWindows(c), l => l.WithCustomFlags_workaround(new[] { "/DEBUG:FULL" }));
np.LinkerSettings().Add(c => IsAndroid(c), l => l.WithCustomFlags_workaround(new[] {
"-Wl,--fatal-warnings",
"-fPIC",
"-Wl,-z,noexecstack",
"-Wl,-z,now",
"-Wl,-z,relro",
"-Wl,-z,defs",
"--gcc-toolchain=/Users/siyao/temp/flutter/engine/src/third_party/android_tools/ndk/toolchains/x86_64-4.9/prebuilt/darwin-x86_64",
"-Wl,--no-undefined",
"-Wl,--exclude-libs,ALL",
"-fuse-ld=lld",
"-Wl,--icf=all",
"--target=arm-linux-androideabi",
"-nostdlib++",
"-Wl,--warn-shared-textrel",
"-nostdlib",
"--sysroot=/Users/siyao/temp/flutter/engine/src/third_party/android_tools/ndk/platforms/android-16/arch-arm"
}));
SetupFml(np);
SetupRadidJson(np);
SetupSkia(np);

}
else if (BuildUtils.IsHostMac())
{
var toolchain = ToolChain.Store.Host();
var validConfigurations = new List<NativeProgramConfiguration>();
foreach (var codegen in codegens)
if (buildAndroid)
var config = new NativeProgramConfiguration(codegen, toolchain, lump: true);
validConfigurations.Add(config);
//var codegens = new[] { CodeGen.Debug };
var androidToolchain = ToolChain.Store.Android().r19().Armv7();
var validConfigurations = new List<NativeProgramConfiguration>();
foreach (var codegen in codegens)
{
var config = new NativeProgramConfiguration(codegen, androidToolchain, lump: true);
validConfigurations.Add(config);
var builtNP = np.SetupSpecificConfiguration(config, toolchain.DynamicLibraryFormat).DeployTo("build");
var builtNP = np.SetupSpecificConfiguration(config, androidToolchain.DynamicLibraryFormat).DeployTo("build");
builtNP.DeployTo("../Samples/UIWidgetsSamples_2019_4/Assets/Plugins/osx");
builtNP.DeployTo("../Samples/UIWidgetsSamples_2019_4/Assets/Plugins/Android");
}
np.ValidConfigurations = validConfigurations;
else
{
var toolchain = ToolChain.Store.Host();
var validConfigurations = new List<NativeProgramConfiguration>();
foreach (var codegen in codegens)
{
var config = new NativeProgramConfiguration(codegen, toolchain, lump: true);
validConfigurations.Add(config);
np.ValidConfigurations = validConfigurations;
var builtNP = np.SetupSpecificConfiguration(config, toolchain.DynamicLibraryFormat).DeployTo("build");
builtNP.DeployTo("../Samples/UIWidgetsSamples_2019_4/Assets/Plugins/osx");
}
np.ValidConfigurations = validConfigurations;
}
}
return np;

"FLUTTER_JIT_RUNTIME=1"
});
np.Defines.Add(c => IsAndroid(c), new[]
{
// bin/gn desc out/arm //:skia defines
"SK_ENABLE_SPIRV_VALIDATION",
"SK_GAMMA_APPLY_TO_A8",
"SK_GAMMA_EXPONENT=1.4",
"SK_GAMMA_CONTRAST=0.0",
"SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
"GR_TEST_UTILS=1",
"SKIA_IMPLEMENTATION=1",
"SK_GL",
"SK_ENABLE_DUMP_GPU",
"SK_SUPPORT_PDF",
"SK_CODEC_DECODES_JPEG",
"SK_ENCODE_JPEG",
"SK_ENABLE_ANDROID_UTILS",
"SK_USE_LIBGIFCODEC",
"SK_HAS_HEIF_LIBRARY",
"SK_CODEC_DECODES_PNG",
"SK_ENCODE_PNG",
"SK_CODEC_DECODES_RAW",
"SK_ENABLE_SKSL_INTERPRETER",
"SK_CODEC_DECODES_WEBP",
"SK_ENCODE_WEBP",
"SK_XML",
"XML_STATIC"
});
np.IncludeDirectories.Add(flutterRoot);
var fmlLibPath = flutterRoot + "/out/host_debug_unopt";

new SystemFramework("Foundation"),
};
});
np.Libraries.Add(c => IsAndroid(c), c =>
{
var basePath = flutterRoot + "/out/android_debug_unopt";
return new PrecompiledLibrary[]
{
new StaticLibrary(basePath + "/obj/flutter/fml/libfml_lib.a"),
};
});
//np.CompilerSettings().Add(c => IsAndroid(c), c => c.WithCustomFlags(new[] { "-fvisibility-inlines-hidden -std=c++17 -fno-rtti -fno-exceptions" }));
np.CompilerSettings().Add(c => IsAndroid(c), c => c.WithCustomFlags(new[] { "-std=c++14 -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables" }));
}
static void SetupSkia(NativeProgram np)

"SK_XML"
});
np.Defines.Add(c => IsAndroid(c), new[]
{
// bin/gn desc out/arm //:skia defines
"SK_ENABLE_SPIRV_VALIDATION",
"SK_GAMMA_APPLY_TO_A8",
"SK_GAMMA_EXPONENT=1.4",
"SK_GAMMA_CONTRAST=0.0",
"SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
"GR_TEST_UTILS=1",
"SKIA_IMPLEMENTATION=1",
"SK_GL",
"SK_ENABLE_DUMP_GPU",
"SK_SUPPORT_PDF",
"SK_CODEC_DECODES_JPEG",
"SK_ENCODE_JPEG",
"SK_ENABLE_ANDROID_UTILS",
"SK_USE_LIBGIFCODEC",
"SK_HAS_HEIF_LIBRARY",
"SK_CODEC_DECODES_PNG",
"SK_ENCODE_PNG",
"SK_CODEC_DECODES_RAW",
"SK_ENABLE_SKSL_INTERPRETER",
"SK_CODEC_DECODES_WEBP",
"SK_ENCODE_WEBP",
"SK_XML",
"XML_STATIC"
});
np.IncludeDirectories.Add(c => IsAndroid(c), skiaRoot + "/include/third_party/vulkan");
np.CompilerSettings().Add(c => IsAndroid(c), c => c.WithCustomFlags(new[] { "-std=c++14" }));
np.Libraries.Add(IsWindows, c =>
{

};
});
np.Libraries.Add(IsAndroid, c => {
var basePath = skiaRoot + "/out/arm";
return new PrecompiledLibrary[]
{
new StaticLibrary(basePath + "/libskia.a"),
new StaticLibrary(basePath + "/libskottie.a"),
new StaticLibrary(basePath + "/libsksg.a"),
new StaticLibrary(basePath + "/libskshaper.a"),
//new SystemLibrary("/Users/siyao/temp/flutter/engine/src/third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a"),
//new StaticLibrary("/Users/siyao/temp/flutter/engine/src/third_party/android_tools/ndk/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/arm-linux-androideabi/libunwind.a"),
//new StaticLibrary("/Users/siyao/temp/flutter/engine/src/third_party/android_tools/ndk/toolchains/llvm/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/libgcc.a"),
//new StaticLibrary("/Users/siyao/temp/flutter/engine/src/third_party/android_tools/ndk/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/arm-linux-androideabi/libandroid_support.a"),
new SystemLibrary("android"),
new SystemLibrary("EGL"),
new SystemLibrary("GLESv2"),
new SystemLibrary("android_support"),
new SystemLibrary("gcc"),
new SystemLibrary("stdc++"),
new SystemLibrary("unwind"),
new SystemLibrary("c"),
new SystemLibrary("dl"),
new SystemLibrary("m"),
new SystemLibrary("log")
};
});
var basePath = skiaRoot + "/out/Debug";
np.SupportFiles.Add(c => IsWindows(c), new [] {
new DeployableFile(basePath + "/libEGL.dll"),

}
);
np.Defines.Add(new[] { "SK_USING_THIRD_PARTY_ICU", "U_USING_ICU_NAMESPACE=0", "U_DISABLE_RENAMING",
np.Defines.Add(IsWindows, new[] { "SK_USING_THIRD_PARTY_ICU", "U_USING_ICU_NAMESPACE=0", "U_DISABLE_RENAMING",
});
np.Defines.Add(IsAndroid, new string[] {
// gn desc out/android_debug_unopt //flutter/third_party/txt:txt defines
"USE_OPENSSL=1",
"USE_OPENSSL_CERTS=1",
"ANDROID",
"HAVE_SYS_UIO_H",
"__STDC_CONSTANT_MACROS",
"__STDC_FORMAT_MACROS",
"_FORTIFY_SOURCE=2",
"__compiler_offsetof=__builtin_offsetof",
"nan=__builtin_nan",
"_LIBCPP_DISABLE_AVAILABILITY=1",
"_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
"_DEBUG",
"SK_GL",
"SK_ENABLE_DUMP_GPU",
"SK_CODEC_DECODES_JPEG",
"SK_ENCODE_JPEG",
"SK_CODEC_DECODES_PNG",
"SK_ENCODE_PNG",
"SK_CODEC_DECODES_WEBP",
"SK_ENCODE_WEBP",
"SK_HAS_WUFFS_LIBRARY",
"SK_XML",
"FLUTTER_RUNTIME_MODE_DEBUG=1",
"FLUTTER_RUNTIME_MODE_PROFILE=2",
"FLUTTER_RUNTIME_MODE_RELEASE=3",
"FLUTTER_RUNTIME_MODE_JIT_RELEASE=4",
"FLUTTER_RUNTIME_MODE=1",
"FLUTTER_JIT_RUNTIME=1",
"U_USING_ICU_NAMESPACE=0",
"U_ENABLE_DYLOAD=0",
"USE_CHROMIUM_ICU=1",
"U_STATIC_IMPLEMENTATION",
"ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
"UCHAR_TYPE=uint16_t",
"SK_DISABLE_REDUCE_OPLIST_SPLITTING",
"SK_ENABLE_DUMP_GPU",
"SK_DISABLE_AAA",
"SK_DISABLE_READBUFFER",
"SK_DISABLE_EFFECT_DESERIALIZATION",
"SK_SUPPORT_LEGACY_DIDCONCAT44",
"SK_DISABLE_LEGACY_SHADERCONTEXT",
"SK_DISABLE_LOWP_RASTER_PIPELINE",
"SK_FORCE_RASTER_PIPELINE_BLITTER",
"SK_GL",
"SK_ASSUME_GL_ES=1"
});
np.IncludeDirectories.Add(flutterRoot + "/flutter/third_party/txt/src");
np.IncludeDirectories.Add(skiaRoot + "/third_party/externals/harfbuzz/src");

{
IncludeDirectories = {
"third_party",
flutterRoot,
skiaRoot,
},

txtLib.CompilerSettings().Add(c => IsMac(c), c => c.WithCppLanguageVersion(CppLanguageVersion.Cpp17));
txtLib.CompilerSettings().Add(c => IsMac(c), c => c.WithCustomFlags(new []{"-Wno-c++11-narrowing"}));
txtLib.CompilerSettings().Add(c => IsAndroid(c), c => c.WithCppLanguageVersion(CppLanguageVersion.Cpp17));
txtLib.CompilerSettings().Add(c => IsAndroid(c), c => c.WithCustomFlags(new[] { "-stdlib=libc++" }));
txtLib.CompilerSettings().Add(c => IsAndroid(c), c => c.WithCustomFlags(new[] { "-Wno-c++11-narrowing" }));
new[] { "UCHAR_TYPE=uint16_t" });
new[] { "UCHAR_TYPE=uint16_t " });
txtLib.Defines.Add(c => c.CodeGen == CodeGen.Release,
new[] { "UIWidgets_RELEASE=1" });

41
engine/README.md


```
## build android sdk on mac
### Build flutter fml + skia + txt
1. Setting up the Engine development environment
Follow https://github.com/flutter/flutter/wiki/Setting-up-the-Engine-development-environment
2. Compiling for Windows
Follow https://github.com/flutter/flutter/wiki/Compiling-the-engine#compiling-for-windows
3. Checkout flutter-1.18-candidate.5
```
cd engine/src/flutter
git checkout flutter-1.18-candidate.5
gclient sync -D
```
Apply following to end of `flutter/third_party/txt/BUILD.gn`
```
static_library("txt_lib") {
complete_static_lib = true
deps = [
":txt",
]
}
```
cmd
```
cd $FLUTTER_ROOT
python ./flutter/tools/gn --unoptimized --android
ninja -C out/android_debug_unopt/ flutter/third_party/txt:txt_lib
ninja -C out/android_debug_unopt/ third_party/libcxx
ninja -C out/android_debug_unopt/ third_party/libcxxabi
```
If the compilation fails because "no available Mac SDK is found" (in flutter-1.17 the build tool will only try to find Mac 10.XX SDKs), please modify the file "/src/build/Mac/find_sdk.py" under flutter root by setting "sdks" as your current sdk, e.g., ['11.0'].
### build icu
```
python $FLUTTER_ROOT/flutter/sky/tools/objcopy.py --objcopy $FLUTTER_ROOT/third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-objcopy --input $FLUTTER_ROOT/third_party/icu/flutter/icudtl.dat --output icudtl.o --arch arm
```

2
engine/src/flow/layers/opacity_layer.cc


context->is_opaque = parent_is_opaque && (alpha_ == SK_AlphaOPAQUE);
context->mutators_stack.PushTransform(
SkMatrix::Translate(offset_.fX, offset_.fY));
SkMatrix::MakeTrans(offset_.fX, offset_.fY));
context->mutators_stack.PushOpacity(alpha_);
Layer::AutoPrerollSaveLayerState save =
Layer::AutoPrerollSaveLayerState::Create(context);

2
engine/src/lib/ui/compositing/scene_builder.cc


}
fml::RefPtr<EngineLayer> SceneBuilder::pushOffset(float dx, float dy) {
SkMatrix sk_matrix = SkMatrix::Translate(dx, dy);
SkMatrix sk_matrix = SkMatrix::MakeTrans(dx, dy);
auto layer = std::make_shared<TransformLayer>(sk_matrix);
PushLayer(layer);
return EngineLayer::MakeRetained(layer);

2
engine/src/lib/ui/painting/gradient.h


#pragma
#pragma once
#include "include/effects/SkGradientShader.h"
#include "lib/ui/painting/matrix.h"

36
engine/src/lib/ui/text/paragraph.cc


// text direction index.
int size = boxes.size() * 5;
Float32List result = {(float*)malloc(sizeof(float) * size),
boxes.size() * size};
(int)boxes.size() * size};
unsigned long position = 0;
for (unsigned long i = 0; i < boxes.size(); i++) {
const txt::Paragraph::TextBox& box = boxes[i];

return result;
}
static void EncodeTextBoxes(const std::vector<txt::Paragraph::TextBox>& boxes,
float* result) {
// Layout:
// First value is the number of values.
// Then there are boxes.size() groups of 5 which are LTRBD, where D is the
// text direction index.
// static void EncodeTextBoxes(const std::vector<txt::Paragraph::TextBox>& boxes,
// float* result) {
// // Layout:
// // First value is the number of values.
// // Then there are boxes.size() groups of 5 which are LTRBD, where D is the
// // text direction index.
unsigned long position = 0;
for (unsigned long i = 0; i < boxes.size(); i++) {
const txt::Paragraph::TextBox& box = boxes[i];
result[position++] = box.rect.fLeft;
result[position++] = box.rect.fTop;
result[position++] = box.rect.fRight;
result[position++] = box.rect.fBottom;
result[position++] = static_cast<float>(box.direction);
}
}
// unsigned long position = 0;
// for (unsigned long i = 0; i < boxes.size(); i++) {
// const txt::Paragraph::TextBox& box = boxes[i];
// result[position++] = box.rect.fLeft;
// result[position++] = box.rect.fTop;
// result[position++] = box.rect.fRight;
// result[position++] = box.rect.fBottom;
// result[position++] = static_cast<float>(box.direction);
// }
// }
Float32List Paragraph::getRectsForRange(unsigned start, unsigned end,
unsigned boxHeightStyle,

}
UIWIDGETS_API(void) Paragraph_dispose(Paragraph* ptr) { ptr->Release(); }
} // namespace uiwidgets
} // namespace uiwidgets

2
engine/src/shell/common/canvas_spy.cc


void DidDrawCanvas::didConcat(const SkMatrix& matrix) {}
void DidDrawCanvas::didConcat44(const SkM44&) {}
void DidDrawCanvas::didConcat44(const SkScalar[]) {}
void DidDrawCanvas::didScale(SkScalar, SkScalar) {}

2
engine/src/shell/common/canvas_spy.h


// |SkCanvasVirtualEnforcer<SkNoDrawCanvas>|
void didConcat(const SkMatrix&) override;
void didConcat44(const SkM44&) override;
void didConcat44(const SkScalar[]) override;
void didScale(SkScalar, SkScalar) override;
void didTranslate(SkScalar, SkScalar) override;

2
engine/src/shell/common/lists.cc


#pragma once
#include "lists.h"
namespace uiwidgets {

2
engine/src/shell/gpu/gpu_surface_gl_delegate.cc


#pragma once
#include "gpu_surface_gl_delegate.h"
#include "include/gpu/gl/GrGLAssembleInterface.h"

2
engine/src/shell/platform/embedder/embedder.cc


case PointerData::Change::kHover:
case PointerData::Change::kUp:
return 0;
default:
return 0;
}
return 0;
}

2
engine/src/shell/platform/embedder/embedder_render_target.cc


#pragma once
#include "embedder_render_target.h"
#include "flutter/fml/logging.h"

2
engine/src/shell/platform/embedder/embedder_surface_software.cc


#pragma once
#include "embedder_surface_software.h"
#include "flutter/fml/trace_event.h"

4
engine/src/shell/platform/unity/uiwidgets_system.h


#pragma once
#ifdef __APPLE__
#ifdef __ANDROID__
#include "shell/platform/unity/darwin/android/uiwidgets_system.h"
#elif __APPLE__
#include "shell/platform/unity/darwin/macos/uiwidgets_system.h"
#elif _WIN64
#include "shell/platform/unity/windows/uiwidgets_system.h"

563
engine/build.py


import subprocess
import os
import sys
def runCmd(cmds, log = False):
process = subprocess.Popen(
cmds,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
stdout, stderr = process.communicate()
if log:
print("out:", stdout)
print("err:", stderr)
return stdout, stderr
linkOnly = len(sys.argv) > 1
buildEngine = linkOnly and (sys.argv[1] == 'e')
FLUTTER_ROOT = os.environ['FLUTTER_ROOT']
SKIA_ROOT = FLUTTER_ROOT+"/third_party/skia"
clang = FLUTTER_ROOT+"/buildtools/mac-x64/clang/bin/clang++"
codeFiles = [
"src/assets/asset_manager.cc",
"src/assets/asset_manager.h",
"src/assets/asset_resolver.h",
"src/assets/directory_asset_bundle.cc",
"src/assets/directory_asset_bundle.h",
"src/common/settings.cc",
"src/common/settings.h",
"src/common/task_runners.cc",
"src/common/task_runners.h",
"src/flow/layers/backdrop_filter_layer.cc",
"src/flow/layers/backdrop_filter_layer.h",
"src/flow/layers/clip_path_layer.cc",
"src/flow/layers/clip_path_layer.h",
"src/flow/layers/clip_rect_layer.cc",
"src/flow/layers/clip_rect_layer.h",
"src/flow/layers/clip_rrect_layer.cc",
"src/flow/layers/clip_rrect_layer.h",
"src/flow/layers/color_filter_layer.cc",
"src/flow/layers/color_filter_layer.h",
"src/flow/layers/container_layer.cc",
"src/flow/layers/container_layer.h",
"src/flow/layers/image_filter_layer.cc",
"src/flow/layers/image_filter_layer.h",
"src/flow/layers/layer.cc",
"src/flow/layers/layer.h",
"src/flow/layers/layer_tree.cc",
"src/flow/layers/layer_tree.h",
"src/flow/layers/opacity_layer.cc",
"src/flow/layers/opacity_layer.h",
"src/flow/layers/performance_overlay_layer.cc",
"src/flow/layers/performance_overlay_layer.h",
"src/flow/layers/physical_shape_layer.cc",
"src/flow/layers/physical_shape_layer.h",
"src/flow/layers/picture_layer.cc",
"src/flow/layers/picture_layer.h",
"src/flow/layers/platform_view_layer.cc",
"src/flow/layers/platform_view_layer.h",
"src/flow/layers/shader_mask_layer.cc",
"src/flow/layers/shader_mask_layer.h",
"src/flow/layers/texture_layer.cc",
"src/flow/layers/texture_layer.h",
"src/flow/layers/transform_layer.cc",
"src/flow/layers/transform_layer.h",
"src/flow/compositor_context.cc",
"src/flow/compositor_context.h",
"src/flow/embedded_views.cc",
"src/flow/embedded_views.h",
"src/flow/instrumentation.cc",
"src/flow/instrumentation.h",
"src/flow/matrix_decomposition.cc",
"src/flow/matrix_decomposition.h",
"src/flow/paint_utils.cc",
"src/flow/paint_utils.h",
"src/flow/raster_cache.cc",
"src/flow/raster_cache.h",
"src/flow/raster_cache_key.cc",
"src/flow/raster_cache_key.h",
"src/flow/rtree.cc",
"src/flow/rtree.h",
"src/flow/skia_gpu_object.cc",
"src/flow/skia_gpu_object.h",
"src/flow/texture.cc",
"src/flow/texture.h",
"src/lib/ui/compositing/scene.cc",
"src/lib/ui/compositing/scene.h",
"src/lib/ui/compositing/scene_builder.cc",
"src/lib/ui/compositing/scene_builder.h",
"src/lib/ui/text/icu_util.h",
"src/lib/ui/text/icu_util.cc",
"src/lib/ui/text/asset_manager_font_provider.cc",
"src/lib/ui/text/asset_manager_font_provider.h",
"src/lib/ui/text/paragraph_builder.cc",
"src/lib/ui/text/paragraph_builder.h",
"src/lib/ui/text/font_collection.cc",
"src/lib/ui/text/font_collection.h",
"src/lib/ui/text/paragraph.cc",
"src/lib/ui/text/paragraph.h",
"src/lib/ui/painting/canvas.cc",
"src/lib/ui/painting/canvas.h",
"src/lib/ui/painting/codec.cc",
"src/lib/ui/painting/codec.h",
"src/lib/ui/painting/color_filter.cc",
"src/lib/ui/painting/color_filter.h",
"src/lib/ui/painting/engine_layer.cc",
"src/lib/ui/painting/engine_layer.h",
"src/lib/ui/painting/frame_info.cc",
"src/lib/ui/painting/frame_info.h",
"src/lib/ui/painting/gradient.cc",
"src/lib/ui/painting/gradient.h",
"src/lib/ui/painting/image.cc",
"src/lib/ui/painting/image.h",
"src/lib/ui/painting/image_decoder.cc",
"src/lib/ui/painting/image_decoder.h",
"src/lib/ui/painting/image_encoding.cc",
"src/lib/ui/painting/image_encoding.h",
"src/lib/ui/painting/image_filter.cc",
"src/lib/ui/painting/image_filter.h",
"src/lib/ui/painting/image_shader.cc",
"src/lib/ui/painting/image_shader.h",
"src/lib/ui/painting/matrix.cc",
"src/lib/ui/painting/matrix.h",
"src/lib/ui/painting/multi_frame_codec.cc",
"src/lib/ui/painting/multi_frame_codec.h",
"src/lib/ui/painting/path.cc",
"src/lib/ui/painting/path.h",
"src/lib/ui/painting/path_measure.cc",
"src/lib/ui/painting/path_measure.h",
"src/lib/ui/painting/paint.cc",
"src/lib/ui/painting/paint.h",
"src/lib/ui/painting/picture.cc",
"src/lib/ui/painting/picture.h",
"src/lib/ui/painting/picture_recorder.cc",
"src/lib/ui/painting/picture_recorder.h",
"src/lib/ui/painting/rrect.cc",
"src/lib/ui/painting/rrect.h",
"src/lib/ui/painting/shader.cc",
"src/lib/ui/painting/shader.h",
"src/lib/ui/painting/single_frame_codec.cc",
"src/lib/ui/painting/single_frame_codec.h",
# "src/lib/ui/painting/skottie.cc",
# "src/lib/ui/painting/skottie.h",
"src/lib/ui/painting/vertices.cc",
"src/lib/ui/painting/vertices.h",
"src/lib/ui/window/platform_message_response_mono.cc",
"src/lib/ui/window/platform_message_response_mono.h",
"src/lib/ui/window/platform_message_response.cc",
"src/lib/ui/window/platform_message_response.h",
"src/lib/ui/window/platform_message.cc",
"src/lib/ui/window/platform_message.h",
"src/lib/ui/window/pointer_data.cc",
"src/lib/ui/window/pointer_data.h",
"src/lib/ui/window/pointer_data_packet.cc",
"src/lib/ui/window/pointer_data_packet.h",
"src/lib/ui/window/pointer_data_packet_converter.cc",
"src/lib/ui/window/pointer_data_packet_converter.h",
"src/lib/ui/window/viewport_metrics.cc",
"src/lib/ui/window/viewport_metrics.h",
"src/lib/ui/window/window.cc",
"src/lib/ui/window/window.h",
"src/lib/ui/io_manager.h",
"src/lib/ui/snapshot_delegate.h",
"src/lib/ui/ui_mono_state.cc",
"src/lib/ui/ui_mono_state.h",
"src/runtime/mono_api.cc",
"src/runtime/mono_api.h",
"src/runtime/mono_isolate.cc",
"src/runtime/mono_isolate.h",
"src/runtime/mono_isolate_scope.cc",
"src/runtime/mono_isolate_scope.h",
"src/runtime/mono_microtask_queue.cc",
"src/runtime/mono_microtask_queue.h",
"src/runtime/mono_state.cc",
"src/runtime/mono_state.h",
"src/runtime/runtime_controller.cc",
"src/runtime/runtime_controller.h",
"src/runtime/runtime_delegate.cc",
"src/runtime/runtime_delegate.h",
"src/runtime/start_up.cc",
"src/runtime/start_up.h",
"src/runtime/window_data.cc",
"src/runtime/window_data.h",
"src/shell/common/animator.cc",
"src/shell/common/animator.h",
"src/shell/common/canvas_spy.cc",
"src/shell/common/canvas_spy.h",
"src/shell/common/engine.cc",
"src/shell/common/engine.h",
"src/shell/common/lists.h",
"src/shell/common/lists.cc",
"src/shell/common/persistent_cache.cc",
"src/shell/common/persistent_cache.h",
"src/shell/common/pipeline.cc",
"src/shell/common/pipeline.h",
"src/shell/common/platform_view.cc",
"src/shell/common/platform_view.h",
"src/shell/common/pointer_data_dispatcher.cc",
"src/shell/common/pointer_data_dispatcher.h",
"src/shell/common/rasterizer.cc",
"src/shell/common/rasterizer.h",
"src/shell/common/run_configuration.cc",
"src/shell/common/run_configuration.h",
"src/shell/common/shell.cc",
"src/shell/common/shell.h",
"src/shell/common/shell_io_manager.cc",
"src/shell/common/shell_io_manager.h",
"src/shell/common/surface.cc",
"src/shell/common/surface.h",
"src/shell/common/switches.cc",
"src/shell/common/switches.h",
"src/shell/common/thread_host.cc",
"src/shell/common/thread_host.h",
"src/shell/common/vsync_waiter.cc",
"src/shell/common/vsync_waiter.h",
"src/shell/common/vsync_waiter_fallback.cc",
"src/shell/common/vsync_waiter_fallback.h",
"src/shell/gpu/gpu_surface_delegate.h",
"src/shell/gpu/gpu_surface_gl.cc",
"src/shell/gpu/gpu_surface_gl.h",
"src/shell/gpu/gpu_surface_gl_delegate.cc",
"src/shell/gpu/gpu_surface_gl_delegate.h",
"src/shell/gpu/gpu_surface_software.cc",
"src/shell/gpu/gpu_surface_software.h",
"src/shell/gpu/gpu_surface_software_delegate.cc",
"src/shell/gpu/gpu_surface_software_delegate.h",
"src/shell/platform/embedder/embedder.cc",
"src/shell/platform/embedder/embedder.h",
"src/shell/platform/embedder/embedder_engine.cc",
"src/shell/platform/embedder/embedder_engine.h",
"src/shell/platform/embedder/embedder_external_texture_gl.cc",
"src/shell/platform/embedder/embedder_external_texture_gl.h",
"src/shell/platform/embedder/embedder_external_view.cc",
"src/shell/platform/embedder/embedder_external_view.h",
"src/shell/platform/embedder/embedder_external_view_embedder.cc",
"src/shell/platform/embedder/embedder_external_view_embedder.h",
"src/shell/platform/embedder/embedder_layers.cc",
"src/shell/platform/embedder/embedder_layers.h",
"src/shell/platform/embedder/embedder_platform_message_response.cc",
"src/shell/platform/embedder/embedder_platform_message_response.h",
"src/shell/platform/embedder/embedder_render_target.cc",
"src/shell/platform/embedder/embedder_render_target.h",
"src/shell/platform/embedder/embedder_render_target_cache.cc",
"src/shell/platform/embedder/embedder_render_target_cache.h",
"src/shell/platform/embedder/embedder_surface.cc",
"src/shell/platform/embedder/embedder_surface.h",
"src/shell/platform/embedder/embedder_surface_gl.cc",
"src/shell/platform/embedder/embedder_surface_gl.h",
"src/shell/platform/embedder/embedder_surface_software.cc",
"src/shell/platform/embedder/embedder_surface_software.h",
"src/shell/platform/embedder/embedder_task_runner.cc",
"src/shell/platform/embedder/embedder_task_runner.h",
"src/shell/platform/embedder/embedder_thread_host.cc",
"src/shell/platform/embedder/embedder_thread_host.h",
"src/shell/platform/embedder/platform_view_embedder.cc",
"src/shell/platform/embedder/platform_view_embedder.h",
"src/shell/platform/embedder/vsync_waiter_embedder.cc",
"src/shell/platform/embedder/vsync_waiter_embedder.h",
"src/shell/platform/unity/gfx_worker_task_runner.cc",
"src/shell/platform/unity/gfx_worker_task_runner.h",
"src/shell/platform/unity/uiwidgets_system.h",
"src/shell/platform/unity/unity_console.cc",
"src/shell/platform/unity/unity_console.h",
"src/shell/version/version.cc",
"src/shell/version/version.h",
"src/engine.cc",
"src/platform_base.h"
]
objs = [
# icudtl
"icudtl.o",
# libcxx
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.algorithm.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.any.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.bind.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.charconv.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.chrono.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.condition_variable.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.condition_variable_destructor.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.debug.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.exception.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.functional.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.future.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.hash.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.ios.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.iostream.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.locale.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.memory.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.mutex.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.mutex_destructor.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.new.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.optional.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.random.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.regex.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.shared_mutex.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.stdexcept.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.string.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.strstream.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.system_error.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.thread.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.typeinfo.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.utility.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.valarray.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.variant.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxx/src/libcxx.vector.o",
# libcxxabi
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxxabi/src/libcxxabi.abort_message.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxxabi/src/libcxxabi.cxa_aux_runtime.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxxabi/src/libcxxabi.cxa_default_handlers.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxxabi/src/libcxxabi.cxa_demangle.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxxabi/src/libcxxabi.cxa_exception_storage.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxxabi/src/libcxxabi.cxa_guard.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxxabi/src/libcxxabi.cxa_handlers.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxxabi/src/libcxxabi.cxa_noexception.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxxabi/src/libcxxabi.cxa_unexpected.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxxabi/src/libcxxabi.cxa_vector.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxxabi/src/libcxxabi.cxa_virtual.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxxabi/src/libcxxabi.fallback_malloc.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxxabi/src/libcxxabi.private_typeinfo.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxxabi/src/libcxxabi.stdlib_exception.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxxabi/src/libcxxabi.stdlib_stdexcept.o",
FLUTTER_ROOT+"/out/android_debug_unopt/obj/third_party/libcxxabi/src/libcxxabi.stdlib_typeinfo.o",
]
# compile uiwidgets object
for codeFile in codeFiles:
div = codeFile.rfind("/")+1
dir = codeFile[0:div-1]
fileName = codeFile[div::]
div = fileName.index(".")
name = fileName[0:div]
extention = fileName[div::]
if extention != ".cc":
continue
FLUTTER_ROOT = FLUTTER_ROOT+""
clang = FLUTTER_ROOT + "/buildtools/mac-x64/clang/bin/clang++"
mkdirScript = ["mkdir", "-p", "obj/"+dir]
process = subprocess.Popen(
mkdirScript, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
buildScript = [
clang,
"-MD",
"-MF",
"obj/"+dir+"/"+name+".o.d",
"-DUSE_OPENSSL=1",
"-DUSE_OPENSSL_CERTS=1",
"-DANDROID",
"-DHAVE_SYS_UIO_H",
"-D__STDC_CONSTANT_MACROS",
"-D__STDC_FORMAT_MACROS",
"-D_FORTIFY_SOURCE=2",
"-D__compiler_offsetof=__builtin_offsetof",
"-Dnan=__builtin_nan",
"-D__GNU_SOURCE=1",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
"-D_DEBUG",
"-DU_USING_ICU_NAMESPACE=0",
"-DU_ENABLE_DYLOAD=0",
"-DUSE_CHROMIUM_ICU=1",
"-DU_STATIC_IMPLEMENTATION",
"-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
"-DUCHAR_TYPE=uint16_t",
"-DFLUTTER_RUNTIME_MODE_DEBUG=1",
"-DFLUTTER_RUNTIME_MODE_PROFILE=2",
"-DFLUTTER_RUNTIME_MODE_RELEASE=3",
"-DFLUTTER_RUNTIME_MODE_JIT_RELEASE=4",
"-DFLUTTER_RUNTIME_MODE=1",
"-DFLUTTER_JIT_RUNTIME=1",
# confige for rapidjson
"-DUIWIDGETS_FORCE_ALIGNAS_8=\"1\"",
"-DRAPIDJSON_HAS_STDSTRING",
"-DRAPIDJSON_HAS_CXX11_RANGE_FOR",
"-DRAPIDJSON_HAS_CXX11_RVALUE_REFS",
"-DRAPIDJSON_HAS_CXX11_TYPETRAITS",
"-DRAPIDJSON_HAS_CXX11_NOEXCEPT",
"-DSK_ENABLE_SPIRV_VALIDATION",
"-DSK_GAMMA_APPLY_TO_A8",
"-DSK_GAMMA_EXPONENT=1.4",
"-DSK_GAMMA_CONTRAST=0.0",
"-DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1",
"-DGR_TEST_UTILS=1",
"-DSKIA_IMPLEMENTATION=1",
"-DSK_GL",
"-DSK_ENABLE_DUMP_GPU",
"-DSK_SUPPORT_PDF",
"-DSK_CODEC_DECODES_JPEG",
"-DSK_ENCODE_JPEG",
"-DSK_ENABLE_ANDROID_UTILS",
"-DSK_USE_LIBGIFCODEC",
"-DSK_HAS_HEIF_LIBRARY",
"-DSK_CODEC_DECODES_PNG",
"-DSK_ENCODE_PNG",
"-DSK_CODEC_DECODES_RAW",
"-DSK_ENABLE_SKSL_INTERPRETER",
"-DSK_CODEC_DECODES_WEBP",
"-DSK_ENCODE_WEBP",
"-DSK_XML",
"-DUIWIDGETS_ENGINE_VERSION=\"0.0\"",
"-DSKIA_VERSION=\"0.0\"",
"-DXML_STATIC",
"-I.",
"-Ithird_party",
"-Isrc",
"-I"+FLUTTER_ROOT,
"-I"+FLUTTER_ROOT+"/third_party/rapidjson/include",
"-I"+SKIA_ROOT,
"-I"+SKIA_ROOT + "/include/third_party/vulkan",
"-I"+FLUTTER_ROOT+"/flutter/third_party/txt/src",
"-I" + FLUTTER_ROOT + "/third_party/harfbuzz/src",
"-I" + SKIA_ROOT + "/third_party/externals/icu/source/common",
# "-Igen",
"-I"+FLUTTER_ROOT+"/third_party/libcxx/include",
"-I"+FLUTTER_ROOT+"/third_party/libcxxabi/include",
"-I"+FLUTTER_ROOT+"/third_party/icu/source/common",
"-I"+FLUTTER_ROOT+"/third_party/icu/source/i18n",
# ignore deprecated code
"-Wno-deprecated-declarations",
"-fno-strict-aliasing",
"-march=armv7-a",
"-mfloat-abi=softfp",
"-mtune=generic-armv7-a",
"-mthumb",
"-fPIC",
"-pipe",
"-fcolor-diagnostics",
"-ffunction-sections",
"-funwind-tables",
"-fno-short-enums",
"-nostdinc++",
"--target=arm-linux-androideabi",
"-mfpu=neon",
"-Wall",
"-Wextra",
"-Wendif-labels",
"-Werror",
"-Wno-missing-field-initializers",
"-Wno-unused-parameter",
"-Wno-unused-variable",
# "-Wno-non-c-typedef-for-linkage",
"-isystem"+FLUTTER_ROOT+"/third_party/android_tools/ndk/sources/android/support/include",
"-isystem"+FLUTTER_ROOT +
"/third_party/android_tools/ndk/sysroot/usr/include/arm-linux-androideabi",
"-D__ANDROID_API__=16",
# "-fvisibility=hidden",
"--sysroot="+FLUTTER_ROOT+"/third_party/android_tools/ndk/sysroot",
"-Wstring-conversion",
# supress new line error
# "-Wnewline-eof",
"-O0",
"-g2",
"-fvisibility-inlines-hidden",
"-std=c++17",
"-fno-rtti",
"-fno-exceptions",
"-c",
dir+"/" + name + extention,
"-o",
"obj/"+dir+"/"+name+".o"
]
objs.append("obj/"+dir+"/"+name+".o")
if linkOnly and (buildEngine == False):
continue
if buildEngine and name != 'engine':
continue
_, stderr = runCmd(buildScript, False)
# process = subprocess.Popen(
# buildScript, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# stdout, stderr = process.communicate()
# print(codeFile)
if len(stderr) > 0:
print(stdout)
print(stderr)
exit()
# delete .so file
soFile = "../Samples/UIWidgetsSamples_2019_4/Assets/Plugins/Android/libUIWidgets_d.so"
deleteCmd = ["rm", soFile]
runCmd(deleteCmd, False)
# link .so file
linkCmd = [
clang,
"-shared",
# "-Wl,--version-script="+FLUTTER_ROOT+"/flutter/shell/platform/android/android_exports.lst",
"-Wl,--fatal-warnings",
"-fPIC",
"-Wl,-z,noexecstack",
"-Wl,-z,now",
"-Wl,-z,relro",
"-Wl,-z,defs",
"--gcc-toolchain="+FLUTTER_ROOT + \
"/third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64",
"-Wl,--no-undefined",
"-Wl,--exclude-libs,ALL",
"-fuse-ld=lld",
"-Wl,--icf=all",
"--target=arm-linux-androideabi",
"-nostdlib++",
"-Wl,--warn-shared-textrel",
"-nostdlib",
"--sysroot="+FLUTTER_ROOT+"/third_party/android_tools/ndk/platforms/android-16/arch-arm",
"-L"+FLUTTER_ROOT + \
"/third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a",
"-o",
soFile,
"-Wl,--build-id=sha1",
"-Wl,-soname=libUIWidgets_d.so",
"-Wl,--whole-archive",
]
linkCmd.extend(objs)
linkCmd.extend([
FLUTTER_ROOT+"/out/android_debug_unopt/obj/flutter/third_party/txt/libtxt_lib.a",
"-Wl,--no-whole-archive",
# lib for atexit
FLUTTER_ROOT+"/third_party/android_tools/ndk/platforms/android-16/arch-arm/usr/lib/crtbegin_so.o",
"-landroid",
"-lEGL",
"-lGLESv2",
"-landroid_support",
"-lunwind",
"-lgcc",
"-lc",
"-ldl",
"-lm",
"-llog",
FLUTTER_ROOT+"/third_party/android_tools/ndk/platforms/android-16/arch-arm/usr/lib/crtend_so.o",
])
runCmd(linkCmd, True)
正在加载...
取消
保存