-
Notifications
You must be signed in to change notification settings - Fork 72
/
mac_sdk.gni
96 lines (83 loc) · 3.42 KB
/
mac_sdk.gni
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/toolchain/mac/mac_sdk_overrides.gni")
import("//build/toolchain/mac/settings.gni")
assert(current_os == "mac" || current_toolchain == default_toolchain)
declare_args() {
# The MACOSX_DEPLOYMENT_TARGET variable used when compiling. This partially
# controls the minimum supported version of macOS for Chromium by
# affecting the symbol availability rules. This may differ from
# mac_min_system_version when dropping support for older macOSes but where
# additional code changes are required to be compliant with the availability
# rules.
# Must be of the form x.x.x for Info.plist files.
mac_deployment_target = "10.11.0"
# The value of the LSMinimmumSystemVersion in Info.plist files. This partially
# controls the minimum supported version of macOS for Chromium by
# affecting the Info.plist. This may differ from mac_deployment_target when
# dropping support for older macOSes. This should be greater than or equal to
# the mac_deployment_target version.
# Must be of the form x.x.x for Info.plist files.
mac_min_system_version = "10.11.0"
# Path to a specific version of the Mac SDK, not including a slash at the end.
# If empty, the path to the lowest version greater than or equal to
# mac_sdk_min is used.
mac_sdk_path = ""
# The SDK name as accepted by xcodebuild.
mac_sdk_name = "macosx"
# The SDK version used when making official builds. This is a single exact
# version, not a minimum. If this version isn't available official builds
# will fail.
mac_sdk_official_version = "10.15"
# If Xcode is not installed, and you are going to build standard C/C++ code only,
# you should set it to false.
mac_use_sdk = true
}
sdk_info_args = []
if (!use_system_xcode) {
sdk_info_args += [
"--developer_dir",
rebase_path(hermetic_xcode_path, "", root_build_dir),
]
}
sdk_info_args += [ mac_sdk_name ]
if (mac_use_sdk) {
_mac_sdk_result = exec_script("//build/toolchain/apple/sdk_info.py", sdk_info_args, "scope")
xcode_version = _mac_sdk_result.xcode_version
xcode_build = _mac_sdk_result.xcode_build
if (use_system_xcode) {
# The tool will print the SDK path on the first line, and the version on the
# second line.
find_sdk_args = [
"--print_sdk_path",
"--print_bin_path",
mac_sdk_min,
]
find_sdk_lines =
exec_script("//build/toolchain/mac/find_sdk.py", find_sdk_args, "list lines")
mac_sdk_version = find_sdk_lines[2]
if (mac_sdk_path == "") {
mac_sdk_path = find_sdk_lines[0]
mac_bin_path = find_sdk_lines[1]
} else {
mac_bin_path = find_sdk_lines[1]
}
} else {
mac_sdk_version = mac_sdk_official_version
_dev = hermetic_xcode_path + "/Contents/Developer"
_sdk = "MacOSX${mac_sdk_version}.sdk"
mac_sdk_path = _dev + "/Platforms/MacOSX.platform/Developer/SDKs/$_sdk"
mac_bin_path = _dev + "/Toolchains/XcodeDefault.xctoolchain/usr/bin/"
# If we're using hermetic Xcode, then we want the paths to be relative so that
# generated ninja files are independent of the directory location.
# TODO(thakis): Do this at the uses of this variable instead.
mac_bin_path = rebase_path(mac_bin_path, root_build_dir)
}
} else {
xcode_version = ""
xcode_build = ""
mac_sdk_version = ""
mac_sdk_path = ""
mac_bin_path = ""
}