This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
forked from desktop-app/patches
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgyp.diff
182 lines (172 loc) · 7.13 KB
/
gyp.diff
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
diff --git a/pylib/gyp/MSVSVersion.py b/pylib/gyp/MSVSVersion.py
index 71582ccd..6c873b62 100644
--- a/pylib/gyp/MSVSVersion.py
+++ b/pylib/gyp/MSVSVersion.py
@@ -268,7 +268,7 @@ def _CreateVersion(name, path, sdk_based=False):
uses_vcxproj=True,
path=path,
sdk_based=sdk_based,
- default_toolset='v141',
+ default_toolset='v142',
compatible_sdks=['v8.1', 'v10.0']),
'2017': VisualStudioVersion('2017',
'Visual Studio 2017',
@@ -409,10 +409,18 @@ def _DetectVisualStudioVersions(versions_to_check, force_express):
'11.0': '2012',
'12.0': '2013',
'14.0': '2015',
- '15.0': '2017'
+ '15.0': '2017',
+ '16.0': '2019'
}
+ shell_path = os.environ.get('VSINSTALLDIR')
+ shell_path = _ConvertToCygpath(shell_path) if shell_path else None
+ shell_version = os.environ.get('VisualStudioVersion') if shell_path else None
versions = []
for version in versions_to_check:
+ if version == shell_version:
+ if os.path.exists(shell_path):
+ versions.append(_CreateVersion(version_to_year[version], shell_path))
+
# Old method of searching for which VS version is installed
# We don't use the 2010-encouraged-way because we also want to get the
# path to the binaries, which it doesn't offer.
@@ -470,7 +478,7 @@ def SelectVisualStudioVersion(version='auto', allow_fallback=True):
if version == 'auto':
version = os.environ.get('GYP_MSVS_VERSION', 'auto')
version_map = {
- 'auto': ('15.0', '14.0', '12.0', '10.0', '9.0', '8.0', '11.0'),
+ 'auto': ('16.0', '15.0', '14.0', '12.0', '10.0', '9.0', '8.0', '11.0'),
'2005': ('8.0',),
'2005e': ('8.0',),
'2008': ('9.0',),
@@ -483,6 +491,7 @@ def SelectVisualStudioVersion(version='auto', allow_fallback=True):
'2013e': ('12.0',),
'2015': ('14.0',),
'2017': ('15.0',),
+ '2019': ('16.0',),
}
override_path = os.environ.get('GYP_MSVS_OVERRIDE_PATH')
if override_path:
diff --git a/pylib/gyp/generator/cmake.py b/pylib/gyp/generator/cmake.py
index 4a2041cf..e5333926 100644
--- a/pylib/gyp/generator/cmake.py
+++ b/pylib/gyp/generator/cmake.py
@@ -1078,6 +1078,23 @@ def WriteTarget(namer, qualified_target, target_dicts, build_dir, config_to_use,
output.write(')\n')
+ # Precompile header
+ precompiled_header = config.get('cmake_precompiled_header', '')
+ if precompiled_header:
+ precompiled_header_script = config.get('cmake_precompiled_header_script', '')
+ if not precompiled_header_script:
+ print ('ERROR: cmake_precompiled_header requires cmake_precompiled_header_script')
+ cmake_precompiled_header = NormjoinPath(path_from_cmakelists_to_gyp, precompiled_header)
+ cmake_precompiled_header_script = NormjoinPathForceCMakeSource(path_from_cmakelists_to_gyp, precompiled_header_script)
+ output.write('include(')
+ output.write(cmake_precompiled_header_script)
+ output.write(')\n')
+ output.write('add_precompiled_header(')
+ output.write(cmake_target_name)
+ output.write(' ')
+ output.write(cmake_precompiled_header)
+ output.write(')\n')
+
UnsetVariable(output, 'TOOLSET')
UnsetVariable(output, 'TARGET')
@@ -1120,6 +1137,8 @@ def GenerateOutputForConfig(target_list, target_dicts, data,
SetVariable(output, 'configuration', config_to_use)
ar = None
+ ranlib = None
+ nm = None
cc = None
cxx = None
@@ -1129,17 +1148,27 @@ def GenerateOutputForConfig(target_list, target_dicts, data,
for key, value in make_global_settings:
if key == 'AR':
ar = os.path.join(build_to_top, value)
+ if key == 'RANLIB':
+ ranlib = os.path.join(build_to_top, value)
+ if key == 'NM':
+ nm = os.path.join(build_to_top, value)
if key == 'CC':
cc = os.path.join(build_to_top, value)
if key == 'CXX':
cxx = os.path.join(build_to_top, value)
ar = gyp.common.GetEnvironFallback(['AR_target', 'AR'], ar)
+ ranlib = gyp.common.GetEnvironFallback(['RANLIB_target', 'RANLIB'], ranlib)
+ nm = gyp.common.GetEnvironFallback(['NM_target', 'NM'], nm)
cc = gyp.common.GetEnvironFallback(['CC_target', 'CC'], cc)
cxx = gyp.common.GetEnvironFallback(['CXX_target', 'CXX'], cxx)
if ar:
SetVariable(output, 'CMAKE_AR', ar)
+ if ranlib:
+ SetVariable(output, 'CMAKE_RANLIB', ranlib)
+ if nm:
+ SetVariable(output, 'CMAKE_NM', nm)
if cc:
SetVariable(output, 'CMAKE_C_COMPILER', cc)
if cxx:
diff --git a/pylib/gyp/generator/xcode.py b/pylib/gyp/generator/xcode.py
index 8bc22bed..24bee427 100644
--- a/pylib/gyp/generator/xcode.py
+++ b/pylib/gyp/generator/xcode.py
@@ -74,6 +74,12 @@ generator_additional_non_configuration_keys = [
'ios_app_extension',
'ios_watch_app',
'ios_watchkit_extension',
+
+ 'mac_sandbox', # sandbox support
+ 'mac_sandbox_development_team',
+
+ 'mac_hardened_runtime', # hardened runtime support
+
'mac_bundle',
'mac_bundle_resources',
'mac_framework_headers',
@@ -774,6 +780,39 @@ def GenerateOutput(target_list, target_dicts, data, params):
xcode_targets[qualified_target] = xct
xcode_target_to_target_dict[xct] = spec
+ # sandbox and hardened runtime support
+ is_sandbox = int(spec.get('mac_sandbox', 0))
+ is_hardened_runtime = int(spec.get('mac_hardened_runtime', 0))
+ if is_sandbox or is_hardened_runtime:
+ try:
+ tmp = pbxp._properties['attributes']['TargetAttributes']
+ except KeyError:
+ pbxp._properties['attributes']['TargetAttributes'] = {}
+ try:
+ tmp = pbxp._properties['attributes']['TargetAttributes'][xct]
+ except KeyError:
+ pbxp._properties['attributes']['TargetAttributes'][xct] = {}
+ try:
+ tmp = pbxp._properties['attributes']['TargetAttributes'][xct]['SystemCapabilities']
+ except KeyError:
+ pbxp._properties['attributes']['TargetAttributes'][xct]['SystemCapabilities'] = {}
+
+ if is_sandbox:
+ dev_team = spec.get('mac_sandbox_development_team', '%%ERROR%%')
+ assert dev_team != '%%ERROR%%', (
+ 'mac_sandbox must be accompanied by mac_sandbox_development_team (target "%s")' %
+ target_name)
+ pbxp._properties['attributes']['TargetAttributes'][xct]['DevelopmentTeam'] = dev_team
+ pbxp._properties['attributes']['TargetAttributes'][xct]['SystemCapabilities']['com.apple.Sandbox'] = {
+ 'enabled': 1,
+ }
+
+ # hardened runtime support
+ if is_hardened_runtime:
+ pbxp._properties['attributes']['TargetAttributes'][xct]['SystemCapabilities']['com.apple.HardenedRuntime'] = {
+ 'enabled': 1,
+ }
+
spec_actions = spec.get('actions', [])
spec_rules = spec.get('rules', [])
@@ -1132,7 +1171,8 @@ exit 1
groups = [x for x in groups if not x.endswith('_excluded')]
for group in groups:
for item in rule.get(group, []):
- pbxp.AddOrGetFileInRootGroup(item)
+ concrete_item = ExpandXcodeVariables(item, rule_input_dict)
+ pbxp.AddOrGetFileInRootGroup(concrete_item)
# Add "sources".
for source in spec.get('sources', []):