File tree 4 files changed +29
-8
lines changed
examples/darwin-framework-tool
4 files changed +29
-8
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ if (current_cpu == "x86") {
17
17
target_arch = " i386"
18
18
} else if (current_cpu == " x64" ) {
19
19
target_arch = " x86_64"
20
- } else if (current_cpu == " armv7 " ) {
21
- target_arch = " arm "
20
+ } else if (current_cpu == " arm " ) {
21
+ target_arch = " armv7 "
22
22
} else if (current_cpu == " arm64" ) {
23
23
target_arch = " arm64"
24
24
}
@@ -40,6 +40,7 @@ if (current_os == "mac") {
40
40
declare_args () {
41
41
# SDK version to target when compiling.
42
42
mac_deployment_target = target_sdk + deployment_target
43
+ mac_target_arch = target_arch
43
44
}
44
45
45
- mac_target_triple = " ${ target_arch } -apple-${ mac_deployment_target } "
46
+ mac_target_triple = " ${ mac_target_arch } -apple-${ mac_deployment_target } "
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import("//build_overrides/build.gni")
16
16
import (" //build_overrides/chip.gni" )
17
17
18
18
import (" ${ chip_root } /build/chip/tools.gni" )
19
+ import (" ${ chip_root } /build/config/mac/mac_sdk.gni" )
19
20
import (" ${ chip_root } /examples//chip-tool/chip-tool.gni" )
20
21
21
22
if (config_use_interactive_mode ) {
@@ -28,8 +29,10 @@ declare_args() {
28
29
chip_codesign = current_os == " ios"
29
30
}
30
31
32
+ sdk = " macosx"
31
33
sdk_build_dir_suffix = " "
32
34
if (getenv (" SDKROOT" ) != " " ) {
35
+ sdk = getenv (" SDKROOT" )
33
36
sdk_root_parts = string_split (getenv (" SDKROOT" ), " ." )
34
37
sdk_build_dir_suffix = " -${ sdk_root_parts[0] } "
35
38
}
@@ -56,6 +59,15 @@ action("build-darwin-framework") {
56
59
rebase_path (" ${ root_build_dir } /darwin_framework_build.log" , root_build_dir ),
57
60
]
58
61
62
+ if (sdk != " macosx" ) {
63
+ args += [
64
+ " --target_sdk" ,
65
+ sdk ,
66
+ " --target_arch" ,
67
+ mac_target_arch ,
68
+ ]
69
+ }
70
+
59
71
output_name = " Matter.framework"
60
72
outputs = [
61
73
" ${ root_out_dir } /macos_framework_output/Build/Products/${ output_sdk_type } /${ output_name } " ,
Original file line number Diff line number Diff line change @@ -42,20 +42,17 @@ def build_darwin_framework(args):
42
42
if not os .path .exists (abs_path ):
43
43
os .mkdir (abs_path )
44
44
45
- sdk = 'macosx' if os .environ .get ('SDKROOT' ) == None else os .environ .get ('SDKROOT' )
46
- arch = platform .machine () if sdk .startswith ('macosx' ) else 'arm64'
47
-
48
45
command = [
49
46
'xcodebuild' ,
50
47
'-scheme' ,
51
48
args .target ,
52
49
'-sdk' ,
53
- sdk ,
50
+ args . target_sdk ,
54
51
'-project' ,
55
52
args .project_path ,
56
53
'-derivedDataPath' ,
57
54
abs_path ,
58
- "PLATFORM_PREFERRED_ARCH={}" .format (arch ),
55
+ "PLATFORM_PREFERRED_ARCH={}" .format (args . target_arch ),
59
56
]
60
57
61
58
if sdk != "macosx" :
@@ -89,6 +86,16 @@ def build_darwin_framework(args):
89
86
default = "Matter" ,
90
87
help = "Name of target to build" ,
91
88
required = True )
89
+ parser .add_argument ("--target_sdk" ,
90
+ default = "macosx" ,
91
+ help = "Set the target sdk" ,
92
+ required = False ,
93
+ )
94
+ parser .add_argument ("--target_arch" ,
95
+ default = platform .machine (),
96
+ help = "Set the target architecture" ,
97
+ required = False ,
98
+ )
92
99
parser .add_argument ("--log_path" ,
93
100
help = "Output log file destination" ,
94
101
required = True )
Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ declare -a args=(
105
105
' target_cpu="' " $target_cpu " ' "'
106
106
' target_defines=' " $target_defines "
107
107
' target_cflags=[' " $target_cflags " ' ]'
108
+ ' mac_target_arch="' " $PLATFORM_PREFERRED_ARCH " ' "'
108
109
' mac_deployment_target="' " $LLVM_TARGET_TRIPLE_OS_VERSION " ' ' " $LLVM_TARGET_TRIPLE_SUFFIX " ' "'
109
110
)
110
111
You can’t perform that action at this time.
0 commit comments