Skip to content

Commit

Permalink
Use host toolchain for all mac and ios targets (project-chip#32283)
Browse files Browse the repository at this point in the history
* Use host toolchain for all mac and ios targets.

* Fix ASAN options for clang build

* Collect .ips files from the system directory as well
  • Loading branch information
ksperling-apple authored and huangxuyong committed Mar 19, 2024
1 parent c3b0108 commit 475fb16
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 58 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,10 @@ jobs:
run: |
xcodebuild -target "MatterTvCastingBridge" -sdk iphoneos
working-directory: examples/tv-casting-app/darwin/MatterTvCastingBridge
- name: Uploading .ips files in Xcode derived data to debug the failure
uses: actions/upload-artifact@v4
if: ${{ failure() && !env.ACT }}
with:
name: darwin-framework-derived-data
path: ~/Library/Developer/Xcode/DerivedData/**/*.ips
retention-days: 5
- name: Collect crash logs
run: |
mkdir -p /tmp/darwin/framework-tests
find ~/Library/Developer/Xcode/DerivedData /Library/Logs/DiagnosticReports -name '*.ips' -print0 | xargs -0 -J % cp % /tmp/darwin/framework-tests
- name: Uploading log files
uses: actions/upload-artifact@v4
if: ${{ failure() && !env.ACT }}
Expand Down
11 changes: 4 additions & 7 deletions build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ if (_chip_defaults.custom_toolchain != "") {
} else {
_target_compiler = "gcc"
}

_default_toolchain = "${_build_overrides.build_root}/toolchain/linux:linux_${target_cpu}_${_target_compiler}"
} else if (target_os == host_os &&
(target_cpu == host_cpu ||
(target_cpu == "arm64e" && host_cpu == "arm64"))) {
} else if (host_os == "mac" && (target_os == "mac" || target_os == "ios")) {
# On Mac the host toolchain supports building for all mac and ios targets
_default_toolchain = host_toolchain
} else if (target_os == host_os && target_cpu == host_cpu) {
_default_toolchain = host_toolchain
} else if (target_os == "freertos") {
if (_chip_defaults.is_clang) {
Expand Down Expand Up @@ -113,9 +113,6 @@ if (_chip_defaults.custom_toolchain != "") {
} else {
assert(false, "Unsupported target_cpu: ${current_cpu}")
}
} else if (target_os == "ios") {
_default_toolchain =
"${_build_overrides.build_root}/toolchain/ios:ios_${target_cpu}"
} else if (target_os == "tizen") {
_default_toolchain =
"${_build_overrides.build_root}/toolchain/tizen:tizen_${target_cpu}"
Expand Down
4 changes: 2 additions & 2 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ config("cosmetic_default") {
}

config("runtime_default") {
if (is_clang) {
if (is_clang) { # Using Pigweed clang instead of Darwin host clang
configs = [
"$dir_pw_toolchain/host_clang:no_system_libcpp",
"$dir_pw_toolchain/host_clang:xcode_sysroot",
Expand Down Expand Up @@ -402,7 +402,7 @@ config("sanitize_address") {
]
ldflags = cflags

if (target_os == "mac" || target_os == "ios") {
if ((target_os == "mac" || target_os == "ios") && !is_clang) {
defines += [ "_LIBCPP_HAS_NO_ASAN" ]
}
}
Expand Down
42 changes: 0 additions & 42 deletions build/toolchain/ios/BUILD.gn

This file was deleted.

1 change: 1 addition & 0 deletions examples/darwin-framework-tool/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ action("build-darwin-framework") {
config("config") {
include_dirs = [
".",
"include",
"${chip_root}/examples/common",
"${chip_root}/examples/darwin-framework-tool/commands/common",
"${chip_root}/zzz_generated/darwin-framework-tool",
Expand Down

0 comments on commit 475fb16

Please sign in to comment.