mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
iOS,macOS: Add Obj-C cflags to all Obj-C targets (flutter/engine#56386)
Ensure that all Objective-C code in the codebase is being built with the standard set of Flutter Objective-C compiler flags with ARC enabled. Also bumps the cflags config up to the top of the first block within each target in which Objective-C sources appear, so that the location is consistent. Migrates The following targets to ARC, which had been missed in previous passes since they didn't declare the standard Flutter Obj-C[++] cflags: * `//flutter/fml:fml_unittests` * `//flutter/impeller/golden_tests:metal_screenshot` * `//flutter/impeller/playground:playground` * `//flutter/impeller/backend/metal:metal` * `//flutter/impeller/backend/metal:metal_unittests` * `//shell/gpu:gpu_surface_metal_unittests` * `//flutter/shell/platform/embedder:embedder_unittests` This patch includes no semantic changes. Issue: https://github.com/flutter/flutter/issues/137801 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
parent
5662b172be
commit
5a3f245710
@ -135,18 +135,13 @@ source_set("fml") {
|
||||
libs = []
|
||||
|
||||
if (is_ios || is_mac) {
|
||||
sources += [ "platform/darwin/concurrent_message_loop_factory.mm" ]
|
||||
} else {
|
||||
sources += [ "concurrent_message_loop_factory.cc" ]
|
||||
}
|
||||
|
||||
if (is_ios || is_mac) {
|
||||
cflags_objc = flutter_cflags_objc
|
||||
cflags_objcc = flutter_cflags_objcc
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
sources += [
|
||||
"platform/darwin/cf_utils.cc",
|
||||
"platform/darwin/cf_utils.h",
|
||||
"platform/darwin/concurrent_message_loop_factory.mm",
|
||||
"platform/darwin/message_loop_darwin.h",
|
||||
"platform/darwin/message_loop_darwin.mm",
|
||||
"platform/darwin/paths_darwin.mm",
|
||||
@ -163,6 +158,8 @@ source_set("fml") {
|
||||
]
|
||||
|
||||
frameworks = [ "Foundation.framework" ]
|
||||
} else {
|
||||
sources += [ "concurrent_message_loop_factory.cc" ]
|
||||
}
|
||||
|
||||
if (is_android) {
|
||||
@ -365,7 +362,10 @@ if (enable_unittests) {
|
||||
"time/time_unittest.cc",
|
||||
]
|
||||
|
||||
if (is_mac) {
|
||||
if (is_mac || is_ios) {
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
sources += [
|
||||
"platform/darwin/cf_utils_unittests.mm",
|
||||
"platform/darwin/string_range_sanitization_unittests.mm",
|
||||
|
||||
@ -60,7 +60,6 @@ impeller_component("impeller_unittests") {
|
||||
"core:allocator_unittests",
|
||||
"display_list:skia_conversions_unittests",
|
||||
"geometry:geometry_unittests",
|
||||
"renderer/backend/metal:metal_unittests",
|
||||
"runtime_stage:runtime_stage_unittests",
|
||||
"shader_archive:shader_archive_unittests",
|
||||
"tessellator:tessellator_unittests",
|
||||
@ -80,6 +79,10 @@ impeller_component("impeller_unittests") {
|
||||
]
|
||||
}
|
||||
|
||||
if (impeller_enable_metal) {
|
||||
deps += [ "//flutter/impeller/renderer/backend/metal:metal_unittests" ]
|
||||
}
|
||||
|
||||
if (impeller_enable_vulkan) {
|
||||
deps += [ "//flutter/impeller/renderer/backend/vulkan:vulkan_unittests" ]
|
||||
}
|
||||
|
||||
@ -296,14 +296,14 @@ if (enable_unittests) {
|
||||
}
|
||||
|
||||
if (test_enable_metal) {
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
sources += [
|
||||
"shell_test_platform_view_metal.h",
|
||||
"shell_test_platform_view_metal.mm",
|
||||
]
|
||||
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
public_deps += [ "//flutter/shell/platform/darwin/graphics" ]
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,6 +71,9 @@ source_set("gpu_surface_vulkan") {
|
||||
|
||||
if (shell_enable_metal) {
|
||||
source_set("gpu_surface_metal") {
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
sources = [
|
||||
"gpu_surface_metal_delegate.cc",
|
||||
"gpu_surface_metal_delegate.h",
|
||||
@ -80,9 +83,6 @@ if (shell_enable_metal) {
|
||||
"gpu_surface_noop.mm",
|
||||
]
|
||||
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
public_deps = gpu_common_deps
|
||||
|
||||
if (impeller_enable_metal) {
|
||||
@ -99,6 +99,9 @@ if (shell_enable_metal) {
|
||||
if (is_mac) {
|
||||
impeller_component("gpu_surface_metal_unittests") {
|
||||
testonly = true
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
target_type = "executable"
|
||||
sources = [
|
||||
"gpu_surface_metal_impeller_unittests.mm",
|
||||
|
||||
@ -111,6 +111,9 @@ test_fixtures("framework_common_fixtures") {
|
||||
# Unit tests for channels.
|
||||
executable("framework_common_unittests") {
|
||||
testonly = true
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
ldflags = [ "-ObjC" ]
|
||||
|
||||
sources = [
|
||||
"framework/Source/FlutterBinaryMessengerRelayTest.mm",
|
||||
@ -119,10 +122,6 @@ executable("framework_common_unittests") {
|
||||
"framework/Source/flutter_standard_codec_unittest.mm",
|
||||
]
|
||||
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
ldflags = [ "-ObjC" ]
|
||||
|
||||
deps = [
|
||||
":framework_common",
|
||||
":framework_common_fixtures",
|
||||
|
||||
@ -52,6 +52,8 @@ _flutter_framework_headers_copy_dir =
|
||||
|
||||
source_set("flutter_framework_source") {
|
||||
visibility = [ ":*" ]
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
sources = [
|
||||
"framework/Source/AccessibilityBridgeMac.h",
|
||||
@ -141,8 +143,6 @@ source_set("flutter_framework_source") {
|
||||
"FLUTTER_ENGINE_NO_PROTOTYPES",
|
||||
]
|
||||
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
frameworks = [
|
||||
"Carbon.framework",
|
||||
"Cocoa.framework",
|
||||
@ -173,6 +173,9 @@ test_fixtures("flutter_desktop_darwin_fixtures") {
|
||||
|
||||
executable("flutter_desktop_darwin_unittests") {
|
||||
testonly = true
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
ldflags = [ "-ObjC" ]
|
||||
|
||||
sources = [
|
||||
"framework/Source/AccessibilityBridgeMacTest.mm",
|
||||
@ -205,10 +208,6 @@ executable("flutter_desktop_darwin_unittests") {
|
||||
"framework/Source/TestFlutterPlatformView.mm",
|
||||
]
|
||||
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
ldflags = [ "-ObjC" ]
|
||||
|
||||
deps = [
|
||||
":flutter_desktop_darwin_fixtures",
|
||||
":flutter_framework_source",
|
||||
|
||||
@ -144,6 +144,9 @@ template("embedder_source_set") {
|
||||
}
|
||||
|
||||
if (embedder_enable_metal) {
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
sources += [
|
||||
"embedder_external_texture_metal.h",
|
||||
"embedder_external_texture_metal.mm",
|
||||
@ -159,9 +162,6 @@ template("embedder_source_set") {
|
||||
deps += [ "//flutter/impeller/renderer/backend/metal" ]
|
||||
}
|
||||
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
deps += [ "//flutter/shell/platform/darwin/graphics" ]
|
||||
}
|
||||
|
||||
@ -375,6 +375,9 @@ if (enable_unittests) {
|
||||
}
|
||||
|
||||
if (test_enable_metal) {
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
sources += [ "tests/embedder_metal_unittests.mm" ]
|
||||
}
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ static sk_sp<SkSurface> GetSurfaceFromTexture(const sk_sp<GrDirectContext>& skia
|
||||
SkISize texture_size,
|
||||
void* texture) {
|
||||
GrMtlTextureInfo info;
|
||||
info.fTexture.reset([(id<MTLTexture>)texture retain]);
|
||||
info.fTexture.retain(texture);
|
||||
GrBackendTexture backend_texture = GrBackendTextures::MakeMtl(
|
||||
texture_size.width(), texture_size.height(), skgpu::Mipmapped::kNo, info);
|
||||
|
||||
|
||||
@ -190,7 +190,12 @@ if (enable_unittests) {
|
||||
# On iOS, this is enabled to allow for Metal tests to run within a test app
|
||||
if (is_mac || is_ios) {
|
||||
source_set("metal") {
|
||||
testonly = true
|
||||
|
||||
if (shell_enable_metal) {
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
sources = [
|
||||
"test_metal_context.h",
|
||||
"test_metal_context.mm",
|
||||
@ -210,11 +215,6 @@ if (is_mac || is_ios) {
|
||||
deps += [ "//flutter/vulkan" ]
|
||||
}
|
||||
}
|
||||
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
testonly = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -76,6 +76,10 @@ if (enable_unittests) {
|
||||
]
|
||||
|
||||
if (is_mac) {
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
ldflags = [ "-ObjC" ]
|
||||
|
||||
sources += [ "ax/platform/ax_platform_node_mac_unittest.mm" ]
|
||||
frameworks = [
|
||||
"AppKit.framework",
|
||||
@ -84,10 +88,6 @@ if (enable_unittests) {
|
||||
"CoreText.framework",
|
||||
"IOSurface.framework",
|
||||
]
|
||||
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
ldflags = [ "-ObjC" ]
|
||||
}
|
||||
if (is_win) {
|
||||
sources += [
|
||||
|
||||
@ -82,12 +82,13 @@ source_set("ax") {
|
||||
]
|
||||
|
||||
if (is_mac) {
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
|
||||
sources += [
|
||||
"platform/ax_platform_node_mac.h",
|
||||
"platform/ax_platform_node_mac.mm",
|
||||
]
|
||||
cflags_objc = flutter_cflags_objc_arc
|
||||
cflags_objcc = flutter_cflags_objcc_arc
|
||||
} else if (is_win) {
|
||||
sources += [
|
||||
"platform/ax_fragment_root_delegate_win.h",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user