Commit 3baa4e4

Browse files
MarshallOfSoundrvagg
authored andcommitted
gyp: update gyp to 0.4.0
Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> PR-URL: #2165
1 parent f461d56 commit 3baa4e4

10 files changed

Lines changed: 162 additions & 67 deletions

File tree

‎gyp/.github/workflows/Python_tests.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
os: [macos-latest, ubuntu-latest] # , windows-latest]
1515
python-version: [2.7, 3.6, 3.7, 3.8] # 3.5,
1616
steps:
17-
- uses: actions/checkout@v1
17+
- uses: actions/checkout@v2
1818
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v1
19+
uses: actions/setup-python@v2
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Install dependencies

‎gyp/CHANGELOG.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6+
7+
## [Unreleased]
8+
9+
## [0.4.0] - 2020-07-14
10+
11+
### Added
12+
- Added support for passing arbitrary architectures to Xcode builds, enables `arm64` builds.
13+
14+
### Fixed
15+
- Fixed a bug on Solaris where copying archives failed.
16+
17+
## [0.3.0] - 2020-06-06
18+
19+
### Added
20+
- Added support for MSVC cross-compilation. This allows compilation on x64 for
21+
a Windows ARM target.
22+
23+
### Fixed
24+
- Fixed XCode CLT version detection on macOS Catalina.
25+
26+
## [0.2.1] - 2020-05-05
27+
28+
### Fixed
29+
- Relicensed to Node.js contributors.
30+
- Fixed Windows bug introduced in v0.2.0.
31+
32+
## [0.2.0] - 2020-04-06
33+
34+
This is the first release of this project, based on https://chromium.googlesource.com/external/gyp
35+
with changes made over the years in Node.js and node-gyp.
36+
37+
[Unreleased]: https://github.com/nodejs/gyp-next/compare/v0.4.0...HEAD
38+
[0.4.0]: https://github.com/nodejs/gyp-next/compare/v0.3.0...v0.4.0
39+
[0.3.0]: https://github.com/nodejs/gyp-next/compare/v0.2.1...v0.3.0
40+
[0.2.1]: https://github.com/nodejs/gyp-next/compare/v0.2.0...v0.2.1
41+
[0.2.0]: https://github.com/nodejs/gyp-next/releases/tag/v0.2.0

‎gyp/pylib/gyp/generator/android.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,9 @@ def WriteList(
981981
"""
982982
values=""
983983
ifvalue_list:
984-
value_list= [quoter(prefix+l) forlinvalue_list]
984+
value_list= [quoter(prefix+value) forvalueinvalue_list]
985985
iflocal_pathify:
986-
value_list= [self.LocalPathify(l) forlinvalue_list]
986+
value_list= [self.LocalPathify(value) forvalueinvalue_list]
987987
values=" \\\n\t"+" \\\n\t".join(value_list)
988988
self.fp.write("%s :=%s\n\n"% (variable, values))
989989

‎gyp/pylib/gyp/generator/make.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ def WriteSources(
13421342
)
13431343

13441344
ifself.flavor=="mac":
1345-
cflags=self.xcode_settings.GetCflags(configname)
1345+
cflags=self.xcode_settings.GetCflags(configname, arch=config.get('xcode_configuration_platform'))
13461346
cflags_c=self.xcode_settings.GetCflagsC(configname)
13471347
cflags_cc=self.xcode_settings.GetCflagsCC(configname)
13481348
cflags_objc=self.xcode_settings.GetCflagsObjC(configname)
@@ -1637,6 +1637,7 @@ def WriteTarget(
16371637
configname,
16381638
generator_default_variables["PRODUCT_DIR"],
16391639
lambdap: Sourceify(self.Absolutify(p)),
1640+
arch=config.get('xcode_configuration_platform')
16401641
)
16411642

16421643
# TARGET_POSTBUILDS_$(BUILDTYPE) is added to postbuilds later on.
@@ -1944,7 +1945,7 @@ def WriteList(self, value_list, variable=None, prefix="", quoter=QuoteIfNecessar
19441945
"""
19451946
values=""
19461947
ifvalue_list:
1947-
value_list= [quoter(prefix+l) forlinvalue_list]
1948+
value_list= [quoter(prefix+value) forvalueinvalue_list]
19481949
values=" \\\n\t"+" \\\n\t".join(value_list)
19491950
self.fp.write("%s :=%s\n\n"% (variable, values))
19501951

@@ -2362,7 +2363,14 @@ def CalculateMakefilePath(build_file, base_name):
23622363
}
23632364
)
23642365
elifflavor=="solaris":
2365-
header_params.update({"flock": "./gyp-flock-tool flock", "flock_index": 2})
2366+
copy_archive_arguments="-pPRf@"
2367+
header_params.update(
2368+
{
2369+
"copy_archive_args": copy_archive_arguments,
2370+
"flock": "./gyp-flock-tool flock",
2371+
"flock_index": 2
2372+
}
2373+
)
23662374
elifflavor=="freebsd":
23672375
# Note: OpenBSD has sysutils/flock. lockf seems to be FreeBSD specific.
23682376
header_params.update({"flock": "lockf"})

‎gyp/pylib/gyp/generator/msvs.py‎

Lines changed: 67 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
# letters.
4040
VALID_MSVS_GUID_CHARS=re.compile(r"^[A-F0-9\-]+$")
4141

42+
generator_supports_multiple_toolsets=gyp.common.CrossCompileRequested()
4243

4344
generator_default_variables= {
4445
"DRIVER_PREFIX": "",
@@ -50,7 +51,7 @@
5051
"STATIC_LIB_SUFFIX": ".lib",
5152
"SHARED_LIB_SUFFIX": ".dll",
5253
"INTERMEDIATE_DIR": "$(IntDir)",
53-
"SHARED_INTERMEDIATE_DIR": "$(OutDir)obj/global_intermediate",
54+
"SHARED_INTERMEDIATE_DIR": "$(OutDir)/obj/global_intermediate",
5455
"OS": "win",
5556
"PRODUCT_DIR": "$(OutDir)",
5657
"LIB_DIR": "$(OutDir)lib",
@@ -1005,7 +1006,7 @@ def _GetMsbuildToolsetOfProject(proj_path, spec, version):
10051006
returntoolset
10061007

10071008

1008-
def_GenerateProject(project, options, version, generator_flags):
1009+
def_GenerateProject(project, options, version, generator_flags, spec):
10091010
"""Generates a vcproj file.
10101011
10111012
Arguments:
@@ -1023,7 +1024,7 @@ def _GenerateProject(project, options, version, generator_flags):
10231024
return []
10241025

10251026
ifversion.UsesVcxproj():
1026-
return_GenerateMSBuildProject(project, options, version, generator_flags)
1027+
return_GenerateMSBuildProject(project, options, version, generator_flags, spec)
10271028
else:
10281029
return_GenerateMSVSProject(project, options, version, generator_flags)
10291030

@@ -1903,6 +1904,8 @@ def _GatherSolutionFolders(sln_projects, project_objects, flat):
19031904
# Convert into a tree of dicts on path.
19041905
forpinsln_projects:
19051906
gyp_file, target=gyp.common.ParseQualifiedTarget(p)[0:2]
1907+
ifp.endswith("#host"):
1908+
target+="_host"
19061909
gyp_dir=os.path.dirname(gyp_file)
19071910
path_dict=_GetPathDict(root, gyp_dir)
19081911
path_dict[target+".vcproj"] =project_objects[p]
@@ -1921,9 +1924,10 @@ def _GetPathOfProject(qualified_target, spec, options, msvs_version):
19211924
default_config=_GetDefaultConfiguration(spec)
19221925
proj_filename=default_config.get("msvs_existing_vcproj")
19231926
ifnotproj_filename:
1924-
proj_filename= (
1925-
spec["target_name"] +options.suffix+msvs_version.ProjectExtension()
1926-
)
1927+
proj_filename=spec["target_name"]
1928+
ifspec["toolset"] =="host":
1929+
proj_filename+="_host"
1930+
proj_filename=proj_filename+options.suffix+msvs_version.ProjectExtension()
19271931

19281932
build_file=gyp.common.BuildFile(qualified_target)
19291933
proj_path=os.path.join(os.path.dirname(build_file), proj_filename)
@@ -1948,6 +1952,8 @@ def _GetPlatformOverridesOfProject(spec):
19481952
_ConfigBaseName(config_name, _ConfigPlatform(c)),
19491953
platform,
19501954
)
1955+
ifspec["toolset"] =="host"andgenerator_supports_multiple_toolsets:
1956+
fixed_config_fullname="%s|x64"% (config_name,)
19511957
config_platform_overrides[config_fullname] =fixed_config_fullname
19521958
returnconfig_platform_overrides
19531959

@@ -1968,21 +1974,19 @@ def _CreateProjectObjects(target_list, target_dicts, options, msvs_version):
19681974
projects= {}
19691975
forqualified_targetintarget_list:
19701976
spec=target_dicts[qualified_target]
1971-
ifspec["toolset"] !="target":
1972-
raiseGypError(
1973-
"Multiple toolsets not supported in msvs build (target %s)"
1974-
%qualified_target
1975-
)
19761977
proj_path, fixpath_prefix=_GetPathOfProject(
19771978
qualified_target, spec, options, msvs_version
19781979
)
19791980
guid=_GetGuidOfProject(proj_path, spec)
19801981
overrides=_GetPlatformOverridesOfProject(spec)
19811982
build_file=gyp.common.BuildFile(qualified_target)
19821983
# Create object for this project.
1984+
target_name=spec["target_name"]
1985+
ifspec["toolset"] =="host":
1986+
target_name+="_host"
19831987
obj=MSVSNew.MSVSProject(
19841988
proj_path,
1985-
name=spec["target_name"],
1989+
name=target_name,
19861990
guid=guid,
19871991
spec=spec,
19881992
build_file=build_file,
@@ -2161,7 +2165,10 @@ def GenerateOutput(target_list, target_dicts, data, params):
21612165
forqualified_targetintarget_list:
21622166
spec=target_dicts[qualified_target]
21632167
forconfig_name, configinspec["configurations"].items():
2164-
configs.add(_ConfigFullName(config_name, config))
2168+
config_name=_ConfigFullName(config_name, config)
2169+
configs.add(config_name)
2170+
ifconfig_name=="Release|arm64":
2171+
configs.add("Release|x64")
21652172
configs=list(configs)
21662173

21672174
# Figure out all the projects that will be generated and their guids
@@ -2174,12 +2181,15 @@ def GenerateOutput(target_list, target_dicts, data, params):
21742181
forprojectinproject_objects.values():
21752182
fixpath_prefix=project.fixpath_prefix
21762183
missing_sources.extend(
2177-
_GenerateProject(project, options, msvs_version, generator_flags)
2184+
_GenerateProject(project, options, msvs_version, generator_flags, spec)
21782185
)
21792186
fixpath_prefix=None
21802187

21812188
forbuild_fileindata:
21822189
# Validate build_file extension
2190+
target_only_configs=configs
2191+
ifgenerator_supports_multiple_toolsets:
2192+
target_only_configs= [iforiinconfigsifi.endswith("arm64")]
21832193
ifnotbuild_file.endswith(".gyp"):
21842194
continue
21852195
sln_path=os.path.splitext(build_file)[0] +options.suffix+".sln"
@@ -2196,7 +2206,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
21962206
sln=MSVSNew.MSVSSolution(
21972207
sln_path,
21982208
entries=root_entries,
2199-
variants=configs,
2209+
variants=target_only_configs,
22002210
websiteProperties=False,
22012211
version=msvs_version,
22022212
)
@@ -2930,22 +2940,24 @@ def _GenerateMSBuildRuleXmlFile(xml_path, msbuild_rules):
29302940
easy_xml.WriteXmlIfChanged(content, xml_path, pretty=True, win32=True)
29312941

29322942

2933-
def_GetConfigurationAndPlatform(name, settings):
2943+
def_GetConfigurationAndPlatform(name, settings, spec):
29342944
configuration=name.rsplit("_", 1)[0]
29352945
platform=settings.get("msvs_configuration_platform", "Win32")
2946+
ifspec["toolset"] =="host"andplatform=="arm64":
2947+
platform="x64"# Host-only tools are always built for x64
29362948
return (configuration, platform)
29372949

29382950

2939-
def_GetConfigurationCondition(name, settings):
2951+
def_GetConfigurationCondition(name, settings, spec):
29402952
returnr"'$(Configuration)|$(Platform)'=='%s|%s'"%_GetConfigurationAndPlatform(
2941-
name, settings
2953+
name, settings, spec
29422954
)
29432955

29442956

2945-
def_GetMSBuildProjectConfigurations(configurations):
2957+
def_GetMSBuildProjectConfigurations(configurations, spec):
29462958
group= ["ItemGroup", {"Label": "ProjectConfigurations"}]
29472959
for (name, settings) insorted(configurations.items()):
2948-
configuration, platform=_GetConfigurationAndPlatform(name, settings)
2960+
configuration, platform=_GetConfigurationAndPlatform(name, settings, spec)
29492961
designation="%s|%s"% (configuration, platform)
29502962
group.append(
29512963
[
@@ -3033,7 +3045,7 @@ def _GetMSBuildConfigurationDetails(spec, build_file):
30333045
properties= {}
30343046
forname, settingsinspec["configurations"].items():
30353047
msbuild_attributes=_GetMSBuildAttributes(spec, settings, build_file)
3036-
condition=_GetConfigurationCondition(name, settings)
3048+
condition=_GetConfigurationCondition(name, settings, spec)
30373049
character_set=msbuild_attributes.get("CharacterSet")
30383050
config_type=msbuild_attributes.get("ConfigurationType")
30393051
_AddConditionalProperty(properties, condition, "ConfigurationType", config_type)
@@ -3064,12 +3076,12 @@ def _GetMSBuildLocalProperties(msbuild_toolset):
30643076
returnproperties
30653077

30663078

3067-
def_GetMSBuildPropertySheets(configurations):
3079+
def_GetMSBuildPropertySheets(configurations, spec):
30683080
user_props=r"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
30693081
additional_props= {}
30703082
props_specified=False
30713083
forname, settingsinsorted(configurations.items()):
3072-
configuration=_GetConfigurationCondition(name, settings)
3084+
configuration=_GetConfigurationCondition(name, settings, spec)
30733085
if"msbuild_props"insettings:
30743086
additional_props[configuration] =_FixPaths(settings["msbuild_props"])
30753087
props_specified=True
@@ -3222,7 +3234,7 @@ def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file):
32223234

32233235
properties= {}
32243236
for (name, configuration) insorted(configurations.items()):
3225-
condition=_GetConfigurationCondition(name, configuration)
3237+
condition=_GetConfigurationCondition(name, configuration, spec)
32263238
attributes=_GetMSBuildAttributes(spec, configuration, build_file)
32273239
msbuild_settings=configuration["finalized_msbuild_settings"]
32283240
_AddConditionalProperty(
@@ -3345,7 +3357,7 @@ def _GetMSBuildToolSettingsSections(spec, configurations):
33453357
msbuild_settings=configuration["finalized_msbuild_settings"]
33463358
group= [
33473359
"ItemDefinitionGroup",
3348-
{"Condition": _GetConfigurationCondition(name, configuration)},
3360+
{"Condition": _GetConfigurationCondition(name, configuration, spec)},
33493361
]
33503362
fortool_name, tool_settingsinsorted(msbuild_settings.items()):
33513363
# Skip the tool named '' which is a holder of global settings handled
@@ -3625,7 +3637,7 @@ def _AddSources2(
36253637

36263638
ifprecompiled_source==source:
36273639
condition=_GetConfigurationCondition(
3628-
config_name, configuration
3640+
config_name, configuration, spec
36293641
)
36303642
detail.append(
36313643
["PrecompiledHeader", {"Condition": condition}, "Create"]
@@ -3652,7 +3664,21 @@ def _GetMSBuildProjectReferences(project):
36523664
references= []
36533665
ifproject.dependencies:
36543666
group= ["ItemGroup"]
3667+
added_dependency_set=set()
36553668
fordependencyinproject.dependencies:
3669+
dependency_spec=dependency.spec
3670+
should_skip_dep=False
3671+
ifproject.spec["toolset"] =="target":
3672+
ifdependency_spec["toolset"] =="host":
3673+
ifdependency_spec["type"] =="static_library":
3674+
should_skip_dep=True
3675+
ifdependency.name.startswith("run_"):
3676+
should_skip_dep=False
3677+
ifshould_skip_dep:
3678+
continue
3679+
3680+
canonical_name=dependency.name.replace("_host", "")
3681+
added_dependency_set.add(canonical_name)
36563682
guid=dependency.guid
36573683
project_dir=os.path.split(project.path)[0]
36583684
relative_path=gyp.common.RelativePath(dependency.path, project_dir)
@@ -3675,7 +3701,7 @@ def _GetMSBuildProjectReferences(project):
36753701
returnreferences
36763702

36773703

3678-
def_GenerateMSBuildProject(project, options, version, generator_flags):
3704+
def_GenerateMSBuildProject(project, options, version, generator_flags, spec):
36793705
spec=project.spec
36803706
configurations=spec["configurations"]
36813707
project_dir, project_file_name=os.path.split(project.path)
@@ -3774,7 +3800,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37743800
},
37753801
]
37763802

3777-
content+=_GetMSBuildProjectConfigurations(configurations)
3803+
content+=_GetMSBuildProjectConfigurations(configurations, spec)
37783804
content+=_GetMSBuildGlobalProperties(
37793805
spec, version, project.guid, project_file_name
37803806
)
@@ -3789,7 +3815,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37893815
ifspec.get("msvs_enable_marmasm"):
37903816
content+=import_marmasm_props_section
37913817
content+=_GetMSBuildExtensions(props_files_of_rules)
3792-
content+=_GetMSBuildPropertySheets(configurations)
3818+
content+=_GetMSBuildPropertySheets(configurations, spec)
37933819
content+=macro_section
37943820
content+=_GetMSBuildConfigurationGlobalProperties(
37953821
spec, configurations, project.build_file
@@ -3893,15 +3919,27 @@ def _GenerateActionsForMSBuild(spec, actions_to_add):
38933919
sources_handled_by_action=OrderedSet()
38943920
actions_spec= []
38953921
forprimary_input, actionsinactions_to_add.items():
3922+
ifgenerator_supports_multiple_toolsets:
3923+
primary_input=primary_input.replace(".exe", "_host.exe")
38963924
inputs=OrderedSet()
38973925
outputs=OrderedSet()
38983926
descriptions= []
38993927
commands= []
39003928
foractioninactions:
3929+
3930+
deffixup_host_exe(i):
3931+
if"$(OutDir)"ini:
3932+
i=i.replace(".exe", "_host.exe")
3933+
returni
3934+
3935+
ifgenerator_supports_multiple_toolsets:
3936+
action["inputs"] = [fixup_host_exe(i) foriinaction["inputs"]]
39013937
inputs.update(OrderedSet(action["inputs"]))
39023938
outputs.update(OrderedSet(action["outputs"]))
39033939
descriptions.append(action["description"])
39043940
cmd=action["command"]
3941+
ifgenerator_supports_multiple_toolsets:
3942+
cmd=cmd.replace(".exe", "_host.exe")
39053943
# For most actions, add 'call' so that actions that invoke batch files
39063944
# return and continue executing. msbuild_use_call provides a way to
39073945
# disable this but I have not seen any adverse effect from doing that

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Commit 3baa4e4

Browse files
MarshallOfSoundrvagg
authored andcommitted
gyp: update gyp to 0.4.0
Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> PR-URL: #2165
1 parent f461d56 commit 3baa4e4

10 files changed

Lines changed: 162 additions & 67 deletions

File tree

‎gyp/.github/workflows/Python_tests.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
os: [macos-latest, ubuntu-latest] # , windows-latest]
1515
python-version: [2.7, 3.6, 3.7, 3.8] # 3.5,
1616
steps:
17-
- uses: actions/checkout@v1
17+
- uses: actions/checkout@v2
1818
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v1
19+
uses: actions/setup-python@v2
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Install dependencies

‎gyp/CHANGELOG.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6+
7+
## [Unreleased]
8+
9+
## [0.4.0] - 2020-07-14
10+
11+
### Added
12+
- Added support for passing arbitrary architectures to Xcode builds, enables `arm64` builds.
13+
14+
### Fixed
15+
- Fixed a bug on Solaris where copying archives failed.
16+
17+
## [0.3.0] - 2020-06-06
18+
19+
### Added
20+
- Added support for MSVC cross-compilation. This allows compilation on x64 for
21+
a Windows ARM target.
22+
23+
### Fixed
24+
- Fixed XCode CLT version detection on macOS Catalina.
25+
26+
## [0.2.1] - 2020-05-05
27+
28+
### Fixed
29+
- Relicensed to Node.js contributors.
30+
- Fixed Windows bug introduced in v0.2.0.
31+
32+
## [0.2.0] - 2020-04-06
33+
34+
This is the first release of this project, based on https://chromium.googlesource.com/external/gyp
35+
with changes made over the years in Node.js and node-gyp.
36+
37+
[Unreleased]: https://github.com/nodejs/gyp-next/compare/v0.4.0...HEAD
38+
[0.4.0]: https://github.com/nodejs/gyp-next/compare/v0.3.0...v0.4.0
39+
[0.3.0]: https://github.com/nodejs/gyp-next/compare/v0.2.1...v0.3.0
40+
[0.2.1]: https://github.com/nodejs/gyp-next/compare/v0.2.0...v0.2.1
41+
[0.2.0]: https://github.com/nodejs/gyp-next/releases/tag/v0.2.0

‎gyp/pylib/gyp/generator/android.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,9 @@ def WriteList(
981981
"""
982982
values=""
983983
ifvalue_list:
984-
value_list= [quoter(prefix+l) forlinvalue_list]
984+
value_list= [quoter(prefix+value) forvalueinvalue_list]
985985
iflocal_pathify:
986-
value_list= [self.LocalPathify(l) forlinvalue_list]
986+
value_list= [self.LocalPathify(value) forvalueinvalue_list]
987987
values=" \\\n\t"+" \\\n\t".join(value_list)
988988
self.fp.write("%s :=%s\n\n"% (variable, values))
989989

‎gyp/pylib/gyp/generator/make.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ def WriteSources(
13421342
)
13431343

13441344
ifself.flavor=="mac":
1345-
cflags=self.xcode_settings.GetCflags(configname)
1345+
cflags=self.xcode_settings.GetCflags(configname, arch=config.get('xcode_configuration_platform'))
13461346
cflags_c=self.xcode_settings.GetCflagsC(configname)
13471347
cflags_cc=self.xcode_settings.GetCflagsCC(configname)
13481348
cflags_objc=self.xcode_settings.GetCflagsObjC(configname)
@@ -1637,6 +1637,7 @@ def WriteTarget(
16371637
configname,
16381638
generator_default_variables["PRODUCT_DIR"],
16391639
lambdap: Sourceify(self.Absolutify(p)),
1640+
arch=config.get('xcode_configuration_platform')
16401641
)
16411642

16421643
# TARGET_POSTBUILDS_$(BUILDTYPE) is added to postbuilds later on.
@@ -1944,7 +1945,7 @@ def WriteList(self, value_list, variable=None, prefix="", quoter=QuoteIfNecessar
19441945
"""
19451946
values=""
19461947
ifvalue_list:
1947-
value_list= [quoter(prefix+l) forlinvalue_list]
1948+
value_list= [quoter(prefix+value) forvalueinvalue_list]
19481949
values=" \\\n\t"+" \\\n\t".join(value_list)
19491950
self.fp.write("%s :=%s\n\n"% (variable, values))
19501951

@@ -2362,7 +2363,14 @@ def CalculateMakefilePath(build_file, base_name):
23622363
}
23632364
)
23642365
elifflavor=="solaris":
2365-
header_params.update({"flock": "./gyp-flock-tool flock", "flock_index": 2})
2366+
copy_archive_arguments="-pPRf@"
2367+
header_params.update(
2368+
{
2369+
"copy_archive_args": copy_archive_arguments,
2370+
"flock": "./gyp-flock-tool flock",
2371+
"flock_index": 2
2372+
}
2373+
)
23662374
elifflavor=="freebsd":
23672375
# Note: OpenBSD has sysutils/flock. lockf seems to be FreeBSD specific.
23682376
header_params.update({"flock": "lockf"})

‎gyp/pylib/gyp/generator/msvs.py‎

Lines changed: 67 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
# letters.
4040
VALID_MSVS_GUID_CHARS=re.compile(r"^[A-F0-9\-]+$")
4141

42+
generator_supports_multiple_toolsets=gyp.common.CrossCompileRequested()
4243

4344
generator_default_variables= {
4445
"DRIVER_PREFIX": "",
@@ -50,7 +51,7 @@
5051
"STATIC_LIB_SUFFIX": ".lib",
5152
"SHARED_LIB_SUFFIX": ".dll",
5253
"INTERMEDIATE_DIR": "$(IntDir)",
53-
"SHARED_INTERMEDIATE_DIR": "$(OutDir)obj/global_intermediate",
54+
"SHARED_INTERMEDIATE_DIR": "$(OutDir)/obj/global_intermediate",
5455
"OS": "win",
5556
"PRODUCT_DIR": "$(OutDir)",
5657
"LIB_DIR": "$(OutDir)lib",
@@ -1005,7 +1006,7 @@ def _GetMsbuildToolsetOfProject(proj_path, spec, version):
10051006
returntoolset
10061007

10071008

1008-
def_GenerateProject(project, options, version, generator_flags):
1009+
def_GenerateProject(project, options, version, generator_flags, spec):
10091010
"""Generates a vcproj file.
10101011
10111012
Arguments:
@@ -1023,7 +1024,7 @@ def _GenerateProject(project, options, version, generator_flags):
10231024
return []
10241025

10251026
ifversion.UsesVcxproj():
1026-
return_GenerateMSBuildProject(project, options, version, generator_flags)
1027+
return_GenerateMSBuildProject(project, options, version, generator_flags, spec)
10271028
else:
10281029
return_GenerateMSVSProject(project, options, version, generator_flags)
10291030

@@ -1903,6 +1904,8 @@ def _GatherSolutionFolders(sln_projects, project_objects, flat):
19031904
# Convert into a tree of dicts on path.
19041905
forpinsln_projects:
19051906
gyp_file, target=gyp.common.ParseQualifiedTarget(p)[0:2]
1907+
ifp.endswith("#host"):
1908+
target+="_host"
19061909
gyp_dir=os.path.dirname(gyp_file)
19071910
path_dict=_GetPathDict(root, gyp_dir)
19081911
path_dict[target+".vcproj"] =project_objects[p]
@@ -1921,9 +1924,10 @@ def _GetPathOfProject(qualified_target, spec, options, msvs_version):
19211924
default_config=_GetDefaultConfiguration(spec)
19221925
proj_filename=default_config.get("msvs_existing_vcproj")
19231926
ifnotproj_filename:
1924-
proj_filename= (
1925-
spec["target_name"] +options.suffix+msvs_version.ProjectExtension()
1926-
)
1927+
proj_filename=spec["target_name"]
1928+
ifspec["toolset"] =="host":
1929+
proj_filename+="_host"
1930+
proj_filename=proj_filename+options.suffix+msvs_version.ProjectExtension()
19271931

19281932
build_file=gyp.common.BuildFile(qualified_target)
19291933
proj_path=os.path.join(os.path.dirname(build_file), proj_filename)
@@ -1948,6 +1952,8 @@ def _GetPlatformOverridesOfProject(spec):
19481952
_ConfigBaseName(config_name, _ConfigPlatform(c)),
19491953
platform,
19501954
)
1955+
ifspec["toolset"] =="host"andgenerator_supports_multiple_toolsets:
1956+
fixed_config_fullname="%s|x64"% (config_name,)
19511957
config_platform_overrides[config_fullname] =fixed_config_fullname
19521958
returnconfig_platform_overrides
19531959

@@ -1968,21 +1974,19 @@ def _CreateProjectObjects(target_list, target_dicts, options, msvs_version):
19681974
projects= {}
19691975
forqualified_targetintarget_list:
19701976
spec=target_dicts[qualified_target]
1971-
ifspec["toolset"] !="target":
1972-
raiseGypError(
1973-
"Multiple toolsets not supported in msvs build (target %s)"
1974-
%qualified_target
1975-
)
19761977
proj_path, fixpath_prefix=_GetPathOfProject(
19771978
qualified_target, spec, options, msvs_version
19781979
)
19791980
guid=_GetGuidOfProject(proj_path, spec)
19801981
overrides=_GetPlatformOverridesOfProject(spec)
19811982
build_file=gyp.common.BuildFile(qualified_target)
19821983
# Create object for this project.
1984+
target_name=spec["target_name"]
1985+
ifspec["toolset"] =="host":
1986+
target_name+="_host"
19831987
obj=MSVSNew.MSVSProject(
19841988
proj_path,
1985-
name=spec["target_name"],
1989+
name=target_name,
19861990
guid=guid,
19871991
spec=spec,
19881992
build_file=build_file,
@@ -2161,7 +2165,10 @@ def GenerateOutput(target_list, target_dicts, data, params):
21612165
forqualified_targetintarget_list:
21622166
spec=target_dicts[qualified_target]
21632167
forconfig_name, configinspec["configurations"].items():
2164-
configs.add(_ConfigFullName(config_name, config))
2168+
config_name=_ConfigFullName(config_name, config)
2169+
configs.add(config_name)
2170+
ifconfig_name=="Release|arm64":
2171+
configs.add("Release|x64")
21652172
configs=list(configs)
21662173

21672174
# Figure out all the projects that will be generated and their guids
@@ -2174,12 +2181,15 @@ def GenerateOutput(target_list, target_dicts, data, params):
21742181
forprojectinproject_objects.values():
21752182
fixpath_prefix=project.fixpath_prefix
21762183
missing_sources.extend(
2177-
_GenerateProject(project, options, msvs_version, generator_flags)
2184+
_GenerateProject(project, options, msvs_version, generator_flags, spec)
21782185
)
21792186
fixpath_prefix=None
21802187

21812188
forbuild_fileindata:
21822189
# Validate build_file extension
2190+
target_only_configs=configs
2191+
ifgenerator_supports_multiple_toolsets:
2192+
target_only_configs= [iforiinconfigsifi.endswith("arm64")]
21832193
ifnotbuild_file.endswith(".gyp"):
21842194
continue
21852195
sln_path=os.path.splitext(build_file)[0] +options.suffix+".sln"
@@ -2196,7 +2206,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
21962206
sln=MSVSNew.MSVSSolution(
21972207
sln_path,
21982208
entries=root_entries,
2199-
variants=configs,
2209+
variants=target_only_configs,
22002210
websiteProperties=False,
22012211
version=msvs_version,
22022212
)
@@ -2930,22 +2940,24 @@ def _GenerateMSBuildRuleXmlFile(xml_path, msbuild_rules):
29302940
easy_xml.WriteXmlIfChanged(content, xml_path, pretty=True, win32=True)
29312941

29322942

2933-
def_GetConfigurationAndPlatform(name, settings):
2943+
def_GetConfigurationAndPlatform(name, settings, spec):
29342944
configuration=name.rsplit("_", 1)[0]
29352945
platform=settings.get("msvs_configuration_platform", "Win32")
2946+
ifspec["toolset"] =="host"andplatform=="arm64":
2947+
platform="x64"# Host-only tools are always built for x64
29362948
return (configuration, platform)
29372949

29382950

2939-
def_GetConfigurationCondition(name, settings):
2951+
def_GetConfigurationCondition(name, settings, spec):
29402952
returnr"'$(Configuration)|$(Platform)'=='%s|%s'"%_GetConfigurationAndPlatform(
2941-
name, settings
2953+
name, settings, spec
29422954
)
29432955

29442956

2945-
def_GetMSBuildProjectConfigurations(configurations):
2957+
def_GetMSBuildProjectConfigurations(configurations, spec):
29462958
group= ["ItemGroup", {"Label": "ProjectConfigurations"}]
29472959
for (name, settings) insorted(configurations.items()):
2948-
configuration, platform=_GetConfigurationAndPlatform(name, settings)
2960+
configuration, platform=_GetConfigurationAndPlatform(name, settings, spec)
29492961
designation="%s|%s"% (configuration, platform)
29502962
group.append(
29512963
[
@@ -3033,7 +3045,7 @@ def _GetMSBuildConfigurationDetails(spec, build_file):
30333045
properties= {}
30343046
forname, settingsinspec["configurations"].items():
30353047
msbuild_attributes=_GetMSBuildAttributes(spec, settings, build_file)
3036-
condition=_GetConfigurationCondition(name, settings)
3048+
condition=_GetConfigurationCondition(name, settings, spec)
30373049
character_set=msbuild_attributes.get("CharacterSet")
30383050
config_type=msbuild_attributes.get("ConfigurationType")
30393051
_AddConditionalProperty(properties, condition, "ConfigurationType", config_type)
@@ -3064,12 +3076,12 @@ def _GetMSBuildLocalProperties(msbuild_toolset):
30643076
returnproperties
30653077

30663078

3067-
def_GetMSBuildPropertySheets(configurations):
3079+
def_GetMSBuildPropertySheets(configurations, spec):
30683080
user_props=r"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
30693081
additional_props= {}
30703082
props_specified=False
30713083
forname, settingsinsorted(configurations.items()):
3072-
configuration=_GetConfigurationCondition(name, settings)
3084+
configuration=_GetConfigurationCondition(name, settings, spec)
30733085
if"msbuild_props"insettings:
30743086
additional_props[configuration] =_FixPaths(settings["msbuild_props"])
30753087
props_specified=True
@@ -3222,7 +3234,7 @@ def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file):
32223234

32233235
properties= {}
32243236
for (name, configuration) insorted(configurations.items()):
3225-
condition=_GetConfigurationCondition(name, configuration)
3237+
condition=_GetConfigurationCondition(name, configuration, spec)
32263238
attributes=_GetMSBuildAttributes(spec, configuration, build_file)
32273239
msbuild_settings=configuration["finalized_msbuild_settings"]
32283240
_AddConditionalProperty(
@@ -3345,7 +3357,7 @@ def _GetMSBuildToolSettingsSections(spec, configurations):
33453357
msbuild_settings=configuration["finalized_msbuild_settings"]
33463358
group= [
33473359
"ItemDefinitionGroup",
3348-
{"Condition": _GetConfigurationCondition(name, configuration)},
3360+
{"Condition": _GetConfigurationCondition(name, configuration, spec)},
33493361
]
33503362
fortool_name, tool_settingsinsorted(msbuild_settings.items()):
33513363
# Skip the tool named '' which is a holder of global settings handled
@@ -3625,7 +3637,7 @@ def _AddSources2(
36253637

36263638
ifprecompiled_source==source:
36273639
condition=_GetConfigurationCondition(
3628-
config_name, configuration
3640+
config_name, configuration, spec
36293641
)
36303642
detail.append(
36313643
["PrecompiledHeader", {"Condition": condition}, "Create"]
@@ -3652,7 +3664,21 @@ def _GetMSBuildProjectReferences(project):
36523664
references= []
36533665
ifproject.dependencies:
36543666
group= ["ItemGroup"]
3667+
added_dependency_set=set()
36553668
fordependencyinproject.dependencies:
3669+
dependency_spec=dependency.spec
3670+
should_skip_dep=False
3671+
ifproject.spec["toolset"] =="target":
3672+
ifdependency_spec["toolset"] =="host":
3673+
ifdependency_spec["type"] =="static_library":
3674+
should_skip_dep=True
3675+
ifdependency.name.startswith("run_"):
3676+
should_skip_dep=False
3677+
ifshould_skip_dep:
3678+
continue
3679+
3680+
canonical_name=dependency.name.replace("_host", "")
3681+
added_dependency_set.add(canonical_name)
36563682
guid=dependency.guid
36573683
project_dir=os.path.split(project.path)[0]
36583684
relative_path=gyp.common.RelativePath(dependency.path, project_dir)
@@ -3675,7 +3701,7 @@ def _GetMSBuildProjectReferences(project):
36753701
returnreferences
36763702

36773703

3678-
def_GenerateMSBuildProject(project, options, version, generator_flags):
3704+
def_GenerateMSBuildProject(project, options, version, generator_flags, spec):
36793705
spec=project.spec
36803706
configurations=spec["configurations"]
36813707
project_dir, project_file_name=os.path.split(project.path)
@@ -3774,7 +3800,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37743800
},
37753801
]
37763802

3777-
content+=_GetMSBuildProjectConfigurations(configurations)
3803+
content+=_GetMSBuildProjectConfigurations(configurations, spec)
37783804
content+=_GetMSBuildGlobalProperties(
37793805
spec, version, project.guid, project_file_name
37803806
)
@@ -3789,7 +3815,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37893815
ifspec.get("msvs_enable_marmasm"):
37903816
content+=import_marmasm_props_section
37913817
content+=_GetMSBuildExtensions(props_files_of_rules)
3792-
content+=_GetMSBuildPropertySheets(configurations)
3818+
content+=_GetMSBuildPropertySheets(configurations, spec)
37933819
content+=macro_section
37943820
content+=_GetMSBuildConfigurationGlobalProperties(
37953821
spec, configurations, project.build_file
@@ -3893,15 +3919,27 @@ def _GenerateActionsForMSBuild(spec, actions_to_add):
38933919
sources_handled_by_action=OrderedSet()
38943920
actions_spec= []
38953921
forprimary_input, actionsinactions_to_add.items():
3922+
ifgenerator_supports_multiple_toolsets:
3923+
primary_input=primary_input.replace(".exe", "_host.exe")
38963924
inputs=OrderedSet()
38973925
outputs=OrderedSet()
38983926
descriptions= []
38993927
commands= []
39003928
foractioninactions:
3929+
3930+
deffixup_host_exe(i):
3931+
if"$(OutDir)"ini:
3932+
i=i.replace(".exe", "_host.exe")
3933+
returni
3934+
3935+
ifgenerator_supports_multiple_toolsets:
3936+
action["inputs"] = [fixup_host_exe(i) foriinaction["inputs"]]
39013937
inputs.update(OrderedSet(action["inputs"]))
39023938
outputs.update(OrderedSet(action["outputs"]))
39033939
descriptions.append(action["description"])
39043940
cmd=action["command"]
3941+
ifgenerator_supports_multiple_toolsets:
3942+
cmd=cmd.replace(".exe", "_host.exe")
39053943
# For most actions, add 'call' so that actions that invoke batch files
39063944
# return and continue executing. msbuild_use_call provides a way to
39073945
# disable this but I have not seen any adverse effect from doing that

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 3baa4e4

Browse files
MarshallOfSoundrvagg
authored andcommitted
gyp: update gyp to 0.4.0
Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> PR-URL: #2165
1 parent f461d56 commit 3baa4e4

10 files changed

Lines changed: 162 additions & 67 deletions

File tree

‎gyp/.github/workflows/Python_tests.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
os: [macos-latest, ubuntu-latest] # , windows-latest]
1515
python-version: [2.7, 3.6, 3.7, 3.8] # 3.5,
1616
steps:
17-
- uses: actions/checkout@v1
17+
- uses: actions/checkout@v2
1818
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v1
19+
uses: actions/setup-python@v2
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Install dependencies

‎gyp/CHANGELOG.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6+
7+
## [Unreleased]
8+
9+
## [0.4.0] - 2020-07-14
10+
11+
### Added
12+
- Added support for passing arbitrary architectures to Xcode builds, enables `arm64` builds.
13+
14+
### Fixed
15+
- Fixed a bug on Solaris where copying archives failed.
16+
17+
## [0.3.0] - 2020-06-06
18+
19+
### Added
20+
- Added support for MSVC cross-compilation. This allows compilation on x64 for
21+
a Windows ARM target.
22+
23+
### Fixed
24+
- Fixed XCode CLT version detection on macOS Catalina.
25+
26+
## [0.2.1] - 2020-05-05
27+
28+
### Fixed
29+
- Relicensed to Node.js contributors.
30+
- Fixed Windows bug introduced in v0.2.0.
31+
32+
## [0.2.0] - 2020-04-06
33+
34+
This is the first release of this project, based on https://chromium.googlesource.com/external/gyp
35+
with changes made over the years in Node.js and node-gyp.
36+
37+
[Unreleased]: https://github.com/nodejs/gyp-next/compare/v0.4.0...HEAD
38+
[0.4.0]: https://github.com/nodejs/gyp-next/compare/v0.3.0...v0.4.0
39+
[0.3.0]: https://github.com/nodejs/gyp-next/compare/v0.2.1...v0.3.0
40+
[0.2.1]: https://github.com/nodejs/gyp-next/compare/v0.2.0...v0.2.1
41+
[0.2.0]: https://github.com/nodejs/gyp-next/releases/tag/v0.2.0

‎gyp/pylib/gyp/generator/android.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,9 @@ def WriteList(
981981
"""
982982
values=""
983983
ifvalue_list:
984-
value_list= [quoter(prefix+l) forlinvalue_list]
984+
value_list= [quoter(prefix+value) forvalueinvalue_list]
985985
iflocal_pathify:
986-
value_list= [self.LocalPathify(l) forlinvalue_list]
986+
value_list= [self.LocalPathify(value) forvalueinvalue_list]
987987
values=" \\\n\t"+" \\\n\t".join(value_list)
988988
self.fp.write("%s :=%s\n\n"% (variable, values))
989989

‎gyp/pylib/gyp/generator/make.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ def WriteSources(
13421342
)
13431343

13441344
ifself.flavor=="mac":
1345-
cflags=self.xcode_settings.GetCflags(configname)
1345+
cflags=self.xcode_settings.GetCflags(configname, arch=config.get('xcode_configuration_platform'))
13461346
cflags_c=self.xcode_settings.GetCflagsC(configname)
13471347
cflags_cc=self.xcode_settings.GetCflagsCC(configname)
13481348
cflags_objc=self.xcode_settings.GetCflagsObjC(configname)
@@ -1637,6 +1637,7 @@ def WriteTarget(
16371637
configname,
16381638
generator_default_variables["PRODUCT_DIR"],
16391639
lambdap: Sourceify(self.Absolutify(p)),
1640+
arch=config.get('xcode_configuration_platform')
16401641
)
16411642

16421643
# TARGET_POSTBUILDS_$(BUILDTYPE) is added to postbuilds later on.
@@ -1944,7 +1945,7 @@ def WriteList(self, value_list, variable=None, prefix="", quoter=QuoteIfNecessar
19441945
"""
19451946
values=""
19461947
ifvalue_list:
1947-
value_list= [quoter(prefix+l) forlinvalue_list]
1948+
value_list= [quoter(prefix+value) forvalueinvalue_list]
19481949
values=" \\\n\t"+" \\\n\t".join(value_list)
19491950
self.fp.write("%s :=%s\n\n"% (variable, values))
19501951

@@ -2362,7 +2363,14 @@ def CalculateMakefilePath(build_file, base_name):
23622363
}
23632364
)
23642365
elifflavor=="solaris":
2365-
header_params.update({"flock": "./gyp-flock-tool flock", "flock_index": 2})
2366+
copy_archive_arguments="-pPRf@"
2367+
header_params.update(
2368+
{
2369+
"copy_archive_args": copy_archive_arguments,
2370+
"flock": "./gyp-flock-tool flock",
2371+
"flock_index": 2
2372+
}
2373+
)
23662374
elifflavor=="freebsd":
23672375
# Note: OpenBSD has sysutils/flock. lockf seems to be FreeBSD specific.
23682376
header_params.update({"flock": "lockf"})

‎gyp/pylib/gyp/generator/msvs.py‎

Lines changed: 67 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
# letters.
4040
VALID_MSVS_GUID_CHARS=re.compile(r"^[A-F0-9\-]+$")
4141

42+
generator_supports_multiple_toolsets=gyp.common.CrossCompileRequested()
4243

4344
generator_default_variables= {
4445
"DRIVER_PREFIX": "",
@@ -50,7 +51,7 @@
5051
"STATIC_LIB_SUFFIX": ".lib",
5152
"SHARED_LIB_SUFFIX": ".dll",
5253
"INTERMEDIATE_DIR": "$(IntDir)",
53-
"SHARED_INTERMEDIATE_DIR": "$(OutDir)obj/global_intermediate",
54+
"SHARED_INTERMEDIATE_DIR": "$(OutDir)/obj/global_intermediate",
5455
"OS": "win",
5556
"PRODUCT_DIR": "$(OutDir)",
5657
"LIB_DIR": "$(OutDir)lib",
@@ -1005,7 +1006,7 @@ def _GetMsbuildToolsetOfProject(proj_path, spec, version):
10051006
returntoolset
10061007

10071008

1008-
def_GenerateProject(project, options, version, generator_flags):
1009+
def_GenerateProject(project, options, version, generator_flags, spec):
10091010
"""Generates a vcproj file.
10101011
10111012
Arguments:
@@ -1023,7 +1024,7 @@ def _GenerateProject(project, options, version, generator_flags):
10231024
return []
10241025

10251026
ifversion.UsesVcxproj():
1026-
return_GenerateMSBuildProject(project, options, version, generator_flags)
1027+
return_GenerateMSBuildProject(project, options, version, generator_flags, spec)
10271028
else:
10281029
return_GenerateMSVSProject(project, options, version, generator_flags)
10291030

@@ -1903,6 +1904,8 @@ def _GatherSolutionFolders(sln_projects, project_objects, flat):
19031904
# Convert into a tree of dicts on path.
19041905
forpinsln_projects:
19051906
gyp_file, target=gyp.common.ParseQualifiedTarget(p)[0:2]
1907+
ifp.endswith("#host"):
1908+
target+="_host"
19061909
gyp_dir=os.path.dirname(gyp_file)
19071910
path_dict=_GetPathDict(root, gyp_dir)
19081911
path_dict[target+".vcproj"] =project_objects[p]
@@ -1921,9 +1924,10 @@ def _GetPathOfProject(qualified_target, spec, options, msvs_version):
19211924
default_config=_GetDefaultConfiguration(spec)
19221925
proj_filename=default_config.get("msvs_existing_vcproj")
19231926
ifnotproj_filename:
1924-
proj_filename= (
1925-
spec["target_name"] +options.suffix+msvs_version.ProjectExtension()
1926-
)
1927+
proj_filename=spec["target_name"]
1928+
ifspec["toolset"] =="host":
1929+
proj_filename+="_host"
1930+
proj_filename=proj_filename+options.suffix+msvs_version.ProjectExtension()
19271931

19281932
build_file=gyp.common.BuildFile(qualified_target)
19291933
proj_path=os.path.join(os.path.dirname(build_file), proj_filename)
@@ -1948,6 +1952,8 @@ def _GetPlatformOverridesOfProject(spec):
19481952
_ConfigBaseName(config_name, _ConfigPlatform(c)),
19491953
platform,
19501954
)
1955+
ifspec["toolset"] =="host"andgenerator_supports_multiple_toolsets:
1956+
fixed_config_fullname="%s|x64"% (config_name,)
19511957
config_platform_overrides[config_fullname] =fixed_config_fullname
19521958
returnconfig_platform_overrides
19531959

@@ -1968,21 +1974,19 @@ def _CreateProjectObjects(target_list, target_dicts, options, msvs_version):
19681974
projects= {}
19691975
forqualified_targetintarget_list:
19701976
spec=target_dicts[qualified_target]
1971-
ifspec["toolset"] !="target":
1972-
raiseGypError(
1973-
"Multiple toolsets not supported in msvs build (target %s)"
1974-
%qualified_target
1975-
)
19761977
proj_path, fixpath_prefix=_GetPathOfProject(
19771978
qualified_target, spec, options, msvs_version
19781979
)
19791980
guid=_GetGuidOfProject(proj_path, spec)
19801981
overrides=_GetPlatformOverridesOfProject(spec)
19811982
build_file=gyp.common.BuildFile(qualified_target)
19821983
# Create object for this project.
1984+
target_name=spec["target_name"]
1985+
ifspec["toolset"] =="host":
1986+
target_name+="_host"
19831987
obj=MSVSNew.MSVSProject(
19841988
proj_path,
1985-
name=spec["target_name"],
1989+
name=target_name,
19861990
guid=guid,
19871991
spec=spec,
19881992
build_file=build_file,
@@ -2161,7 +2165,10 @@ def GenerateOutput(target_list, target_dicts, data, params):
21612165
forqualified_targetintarget_list:
21622166
spec=target_dicts[qualified_target]
21632167
forconfig_name, configinspec["configurations"].items():
2164-
configs.add(_ConfigFullName(config_name, config))
2168+
config_name=_ConfigFullName(config_name, config)
2169+
configs.add(config_name)
2170+
ifconfig_name=="Release|arm64":
2171+
configs.add("Release|x64")
21652172
configs=list(configs)
21662173

21672174
# Figure out all the projects that will be generated and their guids
@@ -2174,12 +2181,15 @@ def GenerateOutput(target_list, target_dicts, data, params):
21742181
forprojectinproject_objects.values():
21752182
fixpath_prefix=project.fixpath_prefix
21762183
missing_sources.extend(
2177-
_GenerateProject(project, options, msvs_version, generator_flags)
2184+
_GenerateProject(project, options, msvs_version, generator_flags, spec)
21782185
)
21792186
fixpath_prefix=None
21802187

21812188
forbuild_fileindata:
21822189
# Validate build_file extension
2190+
target_only_configs=configs
2191+
ifgenerator_supports_multiple_toolsets:
2192+
target_only_configs= [iforiinconfigsifi.endswith("arm64")]
21832193
ifnotbuild_file.endswith(".gyp"):
21842194
continue
21852195
sln_path=os.path.splitext(build_file)[0] +options.suffix+".sln"
@@ -2196,7 +2206,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
21962206
sln=MSVSNew.MSVSSolution(
21972207
sln_path,
21982208
entries=root_entries,
2199-
variants=configs,
2209+
variants=target_only_configs,
22002210
websiteProperties=False,
22012211
version=msvs_version,
22022212
)
@@ -2930,22 +2940,24 @@ def _GenerateMSBuildRuleXmlFile(xml_path, msbuild_rules):
29302940
easy_xml.WriteXmlIfChanged(content, xml_path, pretty=True, win32=True)
29312941

29322942

2933-
def_GetConfigurationAndPlatform(name, settings):
2943+
def_GetConfigurationAndPlatform(name, settings, spec):
29342944
configuration=name.rsplit("_", 1)[0]
29352945
platform=settings.get("msvs_configuration_platform", "Win32")
2946+
ifspec["toolset"] =="host"andplatform=="arm64":
2947+
platform="x64"# Host-only tools are always built for x64
29362948
return (configuration, platform)
29372949

29382950

2939-
def_GetConfigurationCondition(name, settings):
2951+
def_GetConfigurationCondition(name, settings, spec):
29402952
returnr"'$(Configuration)|$(Platform)'=='%s|%s'"%_GetConfigurationAndPlatform(
2941-
name, settings
2953+
name, settings, spec
29422954
)
29432955

29442956

2945-
def_GetMSBuildProjectConfigurations(configurations):
2957+
def_GetMSBuildProjectConfigurations(configurations, spec):
29462958
group= ["ItemGroup", {"Label": "ProjectConfigurations"}]
29472959
for (name, settings) insorted(configurations.items()):
2948-
configuration, platform=_GetConfigurationAndPlatform(name, settings)
2960+
configuration, platform=_GetConfigurationAndPlatform(name, settings, spec)
29492961
designation="%s|%s"% (configuration, platform)
29502962
group.append(
29512963
[
@@ -3033,7 +3045,7 @@ def _GetMSBuildConfigurationDetails(spec, build_file):
30333045
properties= {}
30343046
forname, settingsinspec["configurations"].items():
30353047
msbuild_attributes=_GetMSBuildAttributes(spec, settings, build_file)
3036-
condition=_GetConfigurationCondition(name, settings)
3048+
condition=_GetConfigurationCondition(name, settings, spec)
30373049
character_set=msbuild_attributes.get("CharacterSet")
30383050
config_type=msbuild_attributes.get("ConfigurationType")
30393051
_AddConditionalProperty(properties, condition, "ConfigurationType", config_type)
@@ -3064,12 +3076,12 @@ def _GetMSBuildLocalProperties(msbuild_toolset):
30643076
returnproperties
30653077

30663078

3067-
def_GetMSBuildPropertySheets(configurations):
3079+
def_GetMSBuildPropertySheets(configurations, spec):
30683080
user_props=r"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
30693081
additional_props= {}
30703082
props_specified=False
30713083
forname, settingsinsorted(configurations.items()):
3072-
configuration=_GetConfigurationCondition(name, settings)
3084+
configuration=_GetConfigurationCondition(name, settings, spec)
30733085
if"msbuild_props"insettings:
30743086
additional_props[configuration] =_FixPaths(settings["msbuild_props"])
30753087
props_specified=True
@@ -3222,7 +3234,7 @@ def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file):
32223234

32233235
properties= {}
32243236
for (name, configuration) insorted(configurations.items()):
3225-
condition=_GetConfigurationCondition(name, configuration)
3237+
condition=_GetConfigurationCondition(name, configuration, spec)
32263238
attributes=_GetMSBuildAttributes(spec, configuration, build_file)
32273239
msbuild_settings=configuration["finalized_msbuild_settings"]
32283240
_AddConditionalProperty(
@@ -3345,7 +3357,7 @@ def _GetMSBuildToolSettingsSections(spec, configurations):
33453357
msbuild_settings=configuration["finalized_msbuild_settings"]
33463358
group= [
33473359
"ItemDefinitionGroup",
3348-
{"Condition": _GetConfigurationCondition(name, configuration)},
3360+
{"Condition": _GetConfigurationCondition(name, configuration, spec)},
33493361
]
33503362
fortool_name, tool_settingsinsorted(msbuild_settings.items()):
33513363
# Skip the tool named '' which is a holder of global settings handled
@@ -3625,7 +3637,7 @@ def _AddSources2(
36253637

36263638
ifprecompiled_source==source:
36273639
condition=_GetConfigurationCondition(
3628-
config_name, configuration
3640+
config_name, configuration, spec
36293641
)
36303642
detail.append(
36313643
["PrecompiledHeader", {"Condition": condition}, "Create"]
@@ -3652,7 +3664,21 @@ def _GetMSBuildProjectReferences(project):
36523664
references= []
36533665
ifproject.dependencies:
36543666
group= ["ItemGroup"]
3667+
added_dependency_set=set()
36553668
fordependencyinproject.dependencies:
3669+
dependency_spec=dependency.spec
3670+
should_skip_dep=False
3671+
ifproject.spec["toolset"] =="target":
3672+
ifdependency_spec["toolset"] =="host":
3673+
ifdependency_spec["type"] =="static_library":
3674+
should_skip_dep=True
3675+
ifdependency.name.startswith("run_"):
3676+
should_skip_dep=False
3677+
ifshould_skip_dep:
3678+
continue
3679+
3680+
canonical_name=dependency.name.replace("_host", "")
3681+
added_dependency_set.add(canonical_name)
36563682
guid=dependency.guid
36573683
project_dir=os.path.split(project.path)[0]
36583684
relative_path=gyp.common.RelativePath(dependency.path, project_dir)
@@ -3675,7 +3701,7 @@ def _GetMSBuildProjectReferences(project):
36753701
returnreferences
36763702

36773703

3678-
def_GenerateMSBuildProject(project, options, version, generator_flags):
3704+
def_GenerateMSBuildProject(project, options, version, generator_flags, spec):
36793705
spec=project.spec
36803706
configurations=spec["configurations"]
36813707
project_dir, project_file_name=os.path.split(project.path)
@@ -3774,7 +3800,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37743800
},
37753801
]
37763802

3777-
content+=_GetMSBuildProjectConfigurations(configurations)
3803+
content+=_GetMSBuildProjectConfigurations(configurations, spec)
37783804
content+=_GetMSBuildGlobalProperties(
37793805
spec, version, project.guid, project_file_name
37803806
)
@@ -3789,7 +3815,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37893815
ifspec.get("msvs_enable_marmasm"):
37903816
content+=import_marmasm_props_section
37913817
content+=_GetMSBuildExtensions(props_files_of_rules)
3792-
content+=_GetMSBuildPropertySheets(configurations)
3818+
content+=_GetMSBuildPropertySheets(configurations, spec)
37933819
content+=macro_section
37943820
content+=_GetMSBuildConfigurationGlobalProperties(
37953821
spec, configurations, project.build_file
@@ -3893,15 +3919,27 @@ def _GenerateActionsForMSBuild(spec, actions_to_add):
38933919
sources_handled_by_action=OrderedSet()
38943920
actions_spec= []
38953921
forprimary_input, actionsinactions_to_add.items():
3922+
ifgenerator_supports_multiple_toolsets:
3923+
primary_input=primary_input.replace(".exe", "_host.exe")
38963924
inputs=OrderedSet()
38973925
outputs=OrderedSet()
38983926
descriptions= []
38993927
commands= []
39003928
foractioninactions:
3929+
3930+
deffixup_host_exe(i):
3931+
if"$(OutDir)"ini:
3932+
i=i.replace(".exe", "_host.exe")
3933+
returni
3934+
3935+
ifgenerator_supports_multiple_toolsets:
3936+
action["inputs"] = [fixup_host_exe(i) foriinaction["inputs"]]
39013937
inputs.update(OrderedSet(action["inputs"]))
39023938
outputs.update(OrderedSet(action["outputs"]))
39033939
descriptions.append(action["description"])
39043940
cmd=action["command"]
3941+
ifgenerator_supports_multiple_toolsets:
3942+
cmd=cmd.replace(".exe", "_host.exe")
39053943
# For most actions, add 'call' so that actions that invoke batch files
39063944
# return and continue executing. msbuild_use_call provides a way to
39073945
# disable this but I have not seen any adverse effect from doing that

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 3baa4e4

Browse files
MarshallOfSoundrvagg
authored andcommitted
gyp: update gyp to 0.4.0
Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> PR-URL: #2165
1 parent f461d56 commit 3baa4e4

10 files changed

Lines changed: 162 additions & 67 deletions

File tree

‎gyp/.github/workflows/Python_tests.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
os: [macos-latest, ubuntu-latest] # , windows-latest]
1515
python-version: [2.7, 3.6, 3.7, 3.8] # 3.5,
1616
steps:
17-
- uses: actions/checkout@v1
17+
- uses: actions/checkout@v2
1818
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v1
19+
uses: actions/setup-python@v2
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Install dependencies

‎gyp/CHANGELOG.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6+
7+
## [Unreleased]
8+
9+
## [0.4.0] - 2020-07-14
10+
11+
### Added
12+
- Added support for passing arbitrary architectures to Xcode builds, enables `arm64` builds.
13+
14+
### Fixed
15+
- Fixed a bug on Solaris where copying archives failed.
16+
17+
## [0.3.0] - 2020-06-06
18+
19+
### Added
20+
- Added support for MSVC cross-compilation. This allows compilation on x64 for
21+
a Windows ARM target.
22+
23+
### Fixed
24+
- Fixed XCode CLT version detection on macOS Catalina.
25+
26+
## [0.2.1] - 2020-05-05
27+
28+
### Fixed
29+
- Relicensed to Node.js contributors.
30+
- Fixed Windows bug introduced in v0.2.0.
31+
32+
## [0.2.0] - 2020-04-06
33+
34+
This is the first release of this project, based on https://chromium.googlesource.com/external/gyp
35+
with changes made over the years in Node.js and node-gyp.
36+
37+
[Unreleased]: https://github.com/nodejs/gyp-next/compare/v0.4.0...HEAD
38+
[0.4.0]: https://github.com/nodejs/gyp-next/compare/v0.3.0...v0.4.0
39+
[0.3.0]: https://github.com/nodejs/gyp-next/compare/v0.2.1...v0.3.0
40+
[0.2.1]: https://github.com/nodejs/gyp-next/compare/v0.2.0...v0.2.1
41+
[0.2.0]: https://github.com/nodejs/gyp-next/releases/tag/v0.2.0

‎gyp/pylib/gyp/generator/android.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,9 @@ def WriteList(
981981
"""
982982
values=""
983983
ifvalue_list:
984-
value_list= [quoter(prefix+l) forlinvalue_list]
984+
value_list= [quoter(prefix+value) forvalueinvalue_list]
985985
iflocal_pathify:
986-
value_list= [self.LocalPathify(l) forlinvalue_list]
986+
value_list= [self.LocalPathify(value) forvalueinvalue_list]
987987
values=" \\\n\t"+" \\\n\t".join(value_list)
988988
self.fp.write("%s :=%s\n\n"% (variable, values))
989989

‎gyp/pylib/gyp/generator/make.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ def WriteSources(
13421342
)
13431343

13441344
ifself.flavor=="mac":
1345-
cflags=self.xcode_settings.GetCflags(configname)
1345+
cflags=self.xcode_settings.GetCflags(configname, arch=config.get('xcode_configuration_platform'))
13461346
cflags_c=self.xcode_settings.GetCflagsC(configname)
13471347
cflags_cc=self.xcode_settings.GetCflagsCC(configname)
13481348
cflags_objc=self.xcode_settings.GetCflagsObjC(configname)
@@ -1637,6 +1637,7 @@ def WriteTarget(
16371637
configname,
16381638
generator_default_variables["PRODUCT_DIR"],
16391639
lambdap: Sourceify(self.Absolutify(p)),
1640+
arch=config.get('xcode_configuration_platform')
16401641
)
16411642

16421643
# TARGET_POSTBUILDS_$(BUILDTYPE) is added to postbuilds later on.
@@ -1944,7 +1945,7 @@ def WriteList(self, value_list, variable=None, prefix="", quoter=QuoteIfNecessar
19441945
"""
19451946
values=""
19461947
ifvalue_list:
1947-
value_list= [quoter(prefix+l) forlinvalue_list]
1948+
value_list= [quoter(prefix+value) forvalueinvalue_list]
19481949
values=" \\\n\t"+" \\\n\t".join(value_list)
19491950
self.fp.write("%s :=%s\n\n"% (variable, values))
19501951

@@ -2362,7 +2363,14 @@ def CalculateMakefilePath(build_file, base_name):
23622363
}
23632364
)
23642365
elifflavor=="solaris":
2365-
header_params.update({"flock": "./gyp-flock-tool flock", "flock_index": 2})
2366+
copy_archive_arguments="-pPRf@"
2367+
header_params.update(
2368+
{
2369+
"copy_archive_args": copy_archive_arguments,
2370+
"flock": "./gyp-flock-tool flock",
2371+
"flock_index": 2
2372+
}
2373+
)
23662374
elifflavor=="freebsd":
23672375
# Note: OpenBSD has sysutils/flock. lockf seems to be FreeBSD specific.
23682376
header_params.update({"flock": "lockf"})

‎gyp/pylib/gyp/generator/msvs.py‎

Lines changed: 67 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
# letters.
4040
VALID_MSVS_GUID_CHARS=re.compile(r"^[A-F0-9\-]+$")
4141

42+
generator_supports_multiple_toolsets=gyp.common.CrossCompileRequested()
4243

4344
generator_default_variables= {
4445
"DRIVER_PREFIX": "",
@@ -50,7 +51,7 @@
5051
"STATIC_LIB_SUFFIX": ".lib",
5152
"SHARED_LIB_SUFFIX": ".dll",
5253
"INTERMEDIATE_DIR": "$(IntDir)",
53-
"SHARED_INTERMEDIATE_DIR": "$(OutDir)obj/global_intermediate",
54+
"SHARED_INTERMEDIATE_DIR": "$(OutDir)/obj/global_intermediate",
5455
"OS": "win",
5556
"PRODUCT_DIR": "$(OutDir)",
5657
"LIB_DIR": "$(OutDir)lib",
@@ -1005,7 +1006,7 @@ def _GetMsbuildToolsetOfProject(proj_path, spec, version):
10051006
returntoolset
10061007

10071008

1008-
def_GenerateProject(project, options, version, generator_flags):
1009+
def_GenerateProject(project, options, version, generator_flags, spec):
10091010
"""Generates a vcproj file.
10101011
10111012
Arguments:
@@ -1023,7 +1024,7 @@ def _GenerateProject(project, options, version, generator_flags):
10231024
return []
10241025

10251026
ifversion.UsesVcxproj():
1026-
return_GenerateMSBuildProject(project, options, version, generator_flags)
1027+
return_GenerateMSBuildProject(project, options, version, generator_flags, spec)
10271028
else:
10281029
return_GenerateMSVSProject(project, options, version, generator_flags)
10291030

@@ -1903,6 +1904,8 @@ def _GatherSolutionFolders(sln_projects, project_objects, flat):
19031904
# Convert into a tree of dicts on path.
19041905
forpinsln_projects:
19051906
gyp_file, target=gyp.common.ParseQualifiedTarget(p)[0:2]
1907+
ifp.endswith("#host"):
1908+
target+="_host"
19061909
gyp_dir=os.path.dirname(gyp_file)
19071910
path_dict=_GetPathDict(root, gyp_dir)
19081911
path_dict[target+".vcproj"] =project_objects[p]
@@ -1921,9 +1924,10 @@ def _GetPathOfProject(qualified_target, spec, options, msvs_version):
19211924
default_config=_GetDefaultConfiguration(spec)
19221925
proj_filename=default_config.get("msvs_existing_vcproj")
19231926
ifnotproj_filename:
1924-
proj_filename= (
1925-
spec["target_name"] +options.suffix+msvs_version.ProjectExtension()
1926-
)
1927+
proj_filename=spec["target_name"]
1928+
ifspec["toolset"] =="host":
1929+
proj_filename+="_host"
1930+
proj_filename=proj_filename+options.suffix+msvs_version.ProjectExtension()
19271931

19281932
build_file=gyp.common.BuildFile(qualified_target)
19291933
proj_path=os.path.join(os.path.dirname(build_file), proj_filename)
@@ -1948,6 +1952,8 @@ def _GetPlatformOverridesOfProject(spec):
19481952
_ConfigBaseName(config_name, _ConfigPlatform(c)),
19491953
platform,
19501954
)
1955+
ifspec["toolset"] =="host"andgenerator_supports_multiple_toolsets:
1956+
fixed_config_fullname="%s|x64"% (config_name,)
19511957
config_platform_overrides[config_fullname] =fixed_config_fullname
19521958
returnconfig_platform_overrides
19531959

@@ -1968,21 +1974,19 @@ def _CreateProjectObjects(target_list, target_dicts, options, msvs_version):
19681974
projects= {}
19691975
forqualified_targetintarget_list:
19701976
spec=target_dicts[qualified_target]
1971-
ifspec["toolset"] !="target":
1972-
raiseGypError(
1973-
"Multiple toolsets not supported in msvs build (target %s)"
1974-
%qualified_target
1975-
)
19761977
proj_path, fixpath_prefix=_GetPathOfProject(
19771978
qualified_target, spec, options, msvs_version
19781979
)
19791980
guid=_GetGuidOfProject(proj_path, spec)
19801981
overrides=_GetPlatformOverridesOfProject(spec)
19811982
build_file=gyp.common.BuildFile(qualified_target)
19821983
# Create object for this project.
1984+
target_name=spec["target_name"]
1985+
ifspec["toolset"] =="host":
1986+
target_name+="_host"
19831987
obj=MSVSNew.MSVSProject(
19841988
proj_path,
1985-
name=spec["target_name"],
1989+
name=target_name,
19861990
guid=guid,
19871991
spec=spec,
19881992
build_file=build_file,
@@ -2161,7 +2165,10 @@ def GenerateOutput(target_list, target_dicts, data, params):
21612165
forqualified_targetintarget_list:
21622166
spec=target_dicts[qualified_target]
21632167
forconfig_name, configinspec["configurations"].items():
2164-
configs.add(_ConfigFullName(config_name, config))
2168+
config_name=_ConfigFullName(config_name, config)
2169+
configs.add(config_name)
2170+
ifconfig_name=="Release|arm64":
2171+
configs.add("Release|x64")
21652172
configs=list(configs)
21662173

21672174
# Figure out all the projects that will be generated and their guids
@@ -2174,12 +2181,15 @@ def GenerateOutput(target_list, target_dicts, data, params):
21742181
forprojectinproject_objects.values():
21752182
fixpath_prefix=project.fixpath_prefix
21762183
missing_sources.extend(
2177-
_GenerateProject(project, options, msvs_version, generator_flags)
2184+
_GenerateProject(project, options, msvs_version, generator_flags, spec)
21782185
)
21792186
fixpath_prefix=None
21802187

21812188
forbuild_fileindata:
21822189
# Validate build_file extension
2190+
target_only_configs=configs
2191+
ifgenerator_supports_multiple_toolsets:
2192+
target_only_configs= [iforiinconfigsifi.endswith("arm64")]
21832193
ifnotbuild_file.endswith(".gyp"):
21842194
continue
21852195
sln_path=os.path.splitext(build_file)[0] +options.suffix+".sln"
@@ -2196,7 +2206,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
21962206
sln=MSVSNew.MSVSSolution(
21972207
sln_path,
21982208
entries=root_entries,
2199-
variants=configs,
2209+
variants=target_only_configs,
22002210
websiteProperties=False,
22012211
version=msvs_version,
22022212
)
@@ -2930,22 +2940,24 @@ def _GenerateMSBuildRuleXmlFile(xml_path, msbuild_rules):
29302940
easy_xml.WriteXmlIfChanged(content, xml_path, pretty=True, win32=True)
29312941

29322942

2933-
def_GetConfigurationAndPlatform(name, settings):
2943+
def_GetConfigurationAndPlatform(name, settings, spec):
29342944
configuration=name.rsplit("_", 1)[0]
29352945
platform=settings.get("msvs_configuration_platform", "Win32")
2946+
ifspec["toolset"] =="host"andplatform=="arm64":
2947+
platform="x64"# Host-only tools are always built for x64
29362948
return (configuration, platform)
29372949

29382950

2939-
def_GetConfigurationCondition(name, settings):
2951+
def_GetConfigurationCondition(name, settings, spec):
29402952
returnr"'$(Configuration)|$(Platform)'=='%s|%s'"%_GetConfigurationAndPlatform(
2941-
name, settings
2953+
name, settings, spec
29422954
)
29432955

29442956

2945-
def_GetMSBuildProjectConfigurations(configurations):
2957+
def_GetMSBuildProjectConfigurations(configurations, spec):
29462958
group= ["ItemGroup", {"Label": "ProjectConfigurations"}]
29472959
for (name, settings) insorted(configurations.items()):
2948-
configuration, platform=_GetConfigurationAndPlatform(name, settings)
2960+
configuration, platform=_GetConfigurationAndPlatform(name, settings, spec)
29492961
designation="%s|%s"% (configuration, platform)
29502962
group.append(
29512963
[
@@ -3033,7 +3045,7 @@ def _GetMSBuildConfigurationDetails(spec, build_file):
30333045
properties= {}
30343046
forname, settingsinspec["configurations"].items():
30353047
msbuild_attributes=_GetMSBuildAttributes(spec, settings, build_file)
3036-
condition=_GetConfigurationCondition(name, settings)
3048+
condition=_GetConfigurationCondition(name, settings, spec)
30373049
character_set=msbuild_attributes.get("CharacterSet")
30383050
config_type=msbuild_attributes.get("ConfigurationType")
30393051
_AddConditionalProperty(properties, condition, "ConfigurationType", config_type)
@@ -3064,12 +3076,12 @@ def _GetMSBuildLocalProperties(msbuild_toolset):
30643076
returnproperties
30653077

30663078

3067-
def_GetMSBuildPropertySheets(configurations):
3079+
def_GetMSBuildPropertySheets(configurations, spec):
30683080
user_props=r"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
30693081
additional_props= {}
30703082
props_specified=False
30713083
forname, settingsinsorted(configurations.items()):
3072-
configuration=_GetConfigurationCondition(name, settings)
3084+
configuration=_GetConfigurationCondition(name, settings, spec)
30733085
if"msbuild_props"insettings:
30743086
additional_props[configuration] =_FixPaths(settings["msbuild_props"])
30753087
props_specified=True
@@ -3222,7 +3234,7 @@ def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file):
32223234

32233235
properties= {}
32243236
for (name, configuration) insorted(configurations.items()):
3225-
condition=_GetConfigurationCondition(name, configuration)
3237+
condition=_GetConfigurationCondition(name, configuration, spec)
32263238
attributes=_GetMSBuildAttributes(spec, configuration, build_file)
32273239
msbuild_settings=configuration["finalized_msbuild_settings"]
32283240
_AddConditionalProperty(
@@ -3345,7 +3357,7 @@ def _GetMSBuildToolSettingsSections(spec, configurations):
33453357
msbuild_settings=configuration["finalized_msbuild_settings"]
33463358
group= [
33473359
"ItemDefinitionGroup",
3348-
{"Condition": _GetConfigurationCondition(name, configuration)},
3360+
{"Condition": _GetConfigurationCondition(name, configuration, spec)},
33493361
]
33503362
fortool_name, tool_settingsinsorted(msbuild_settings.items()):
33513363
# Skip the tool named '' which is a holder of global settings handled
@@ -3625,7 +3637,7 @@ def _AddSources2(
36253637

36263638
ifprecompiled_source==source:
36273639
condition=_GetConfigurationCondition(
3628-
config_name, configuration
3640+
config_name, configuration, spec
36293641
)
36303642
detail.append(
36313643
["PrecompiledHeader", {"Condition": condition}, "Create"]
@@ -3652,7 +3664,21 @@ def _GetMSBuildProjectReferences(project):
36523664
references= []
36533665
ifproject.dependencies:
36543666
group= ["ItemGroup"]
3667+
added_dependency_set=set()
36553668
fordependencyinproject.dependencies:
3669+
dependency_spec=dependency.spec
3670+
should_skip_dep=False
3671+
ifproject.spec["toolset"] =="target":
3672+
ifdependency_spec["toolset"] =="host":
3673+
ifdependency_spec["type"] =="static_library":
3674+
should_skip_dep=True
3675+
ifdependency.name.startswith("run_"):
3676+
should_skip_dep=False
3677+
ifshould_skip_dep:
3678+
continue
3679+
3680+
canonical_name=dependency.name.replace("_host", "")
3681+
added_dependency_set.add(canonical_name)
36563682
guid=dependency.guid
36573683
project_dir=os.path.split(project.path)[0]
36583684
relative_path=gyp.common.RelativePath(dependency.path, project_dir)
@@ -3675,7 +3701,7 @@ def _GetMSBuildProjectReferences(project):
36753701
returnreferences
36763702

36773703

3678-
def_GenerateMSBuildProject(project, options, version, generator_flags):
3704+
def_GenerateMSBuildProject(project, options, version, generator_flags, spec):
36793705
spec=project.spec
36803706
configurations=spec["configurations"]
36813707
project_dir, project_file_name=os.path.split(project.path)
@@ -3774,7 +3800,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37743800
},
37753801
]
37763802

3777-
content+=_GetMSBuildProjectConfigurations(configurations)
3803+
content+=_GetMSBuildProjectConfigurations(configurations, spec)
37783804
content+=_GetMSBuildGlobalProperties(
37793805
spec, version, project.guid, project_file_name
37803806
)
@@ -3789,7 +3815,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37893815
ifspec.get("msvs_enable_marmasm"):
37903816
content+=import_marmasm_props_section
37913817
content+=_GetMSBuildExtensions(props_files_of_rules)
3792-
content+=_GetMSBuildPropertySheets(configurations)
3818+
content+=_GetMSBuildPropertySheets(configurations, spec)
37933819
content+=macro_section
37943820
content+=_GetMSBuildConfigurationGlobalProperties(
37953821
spec, configurations, project.build_file
@@ -3893,15 +3919,27 @@ def _GenerateActionsForMSBuild(spec, actions_to_add):
38933919
sources_handled_by_action=OrderedSet()
38943920
actions_spec= []
38953921
forprimary_input, actionsinactions_to_add.items():
3922+
ifgenerator_supports_multiple_toolsets:
3923+
primary_input=primary_input.replace(".exe", "_host.exe")
38963924
inputs=OrderedSet()
38973925
outputs=OrderedSet()
38983926
descriptions= []
38993927
commands= []
39003928
foractioninactions:
3929+
3930+
deffixup_host_exe(i):
3931+
if"$(OutDir)"ini:
3932+
i=i.replace(".exe", "_host.exe")
3933+
returni
3934+
3935+
ifgenerator_supports_multiple_toolsets:
3936+
action["inputs"] = [fixup_host_exe(i) foriinaction["inputs"]]
39013937
inputs.update(OrderedSet(action["inputs"]))
39023938
outputs.update(OrderedSet(action["outputs"]))
39033939
descriptions.append(action["description"])
39043940
cmd=action["command"]
3941+
ifgenerator_supports_multiple_toolsets:
3942+
cmd=cmd.replace(".exe", "_host.exe")
39053943
# For most actions, add 'call' so that actions that invoke batch files
39063944
# return and continue executing. msbuild_use_call provides a way to
39073945
# disable this but I have not seen any adverse effect from doing that

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Commit 3baa4e4

Browse files
MarshallOfSoundrvagg
authored andcommitted
gyp: update gyp to 0.4.0
Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> PR-URL: #2165
1 parent f461d56 commit 3baa4e4

10 files changed

Lines changed: 162 additions & 67 deletions

File tree

‎gyp/.github/workflows/Python_tests.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
os: [macos-latest, ubuntu-latest] # , windows-latest]
1515
python-version: [2.7, 3.6, 3.7, 3.8] # 3.5,
1616
steps:
17-
- uses: actions/checkout@v1
17+
- uses: actions/checkout@v2
1818
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v1
19+
uses: actions/setup-python@v2
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Install dependencies

‎gyp/CHANGELOG.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6+
7+
## [Unreleased]
8+
9+
## [0.4.0] - 2020-07-14
10+
11+
### Added
12+
- Added support for passing arbitrary architectures to Xcode builds, enables `arm64` builds.
13+
14+
### Fixed
15+
- Fixed a bug on Solaris where copying archives failed.
16+
17+
## [0.3.0] - 2020-06-06
18+
19+
### Added
20+
- Added support for MSVC cross-compilation. This allows compilation on x64 for
21+
a Windows ARM target.
22+
23+
### Fixed
24+
- Fixed XCode CLT version detection on macOS Catalina.
25+
26+
## [0.2.1] - 2020-05-05
27+
28+
### Fixed
29+
- Relicensed to Node.js contributors.
30+
- Fixed Windows bug introduced in v0.2.0.
31+
32+
## [0.2.0] - 2020-04-06
33+
34+
This is the first release of this project, based on https://chromium.googlesource.com/external/gyp
35+
with changes made over the years in Node.js and node-gyp.
36+
37+
[Unreleased]: https://github.com/nodejs/gyp-next/compare/v0.4.0...HEAD
38+
[0.4.0]: https://github.com/nodejs/gyp-next/compare/v0.3.0...v0.4.0
39+
[0.3.0]: https://github.com/nodejs/gyp-next/compare/v0.2.1...v0.3.0
40+
[0.2.1]: https://github.com/nodejs/gyp-next/compare/v0.2.0...v0.2.1
41+
[0.2.0]: https://github.com/nodejs/gyp-next/releases/tag/v0.2.0

‎gyp/pylib/gyp/generator/android.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,9 @@ def WriteList(
981981
"""
982982
values=""
983983
ifvalue_list:
984-
value_list= [quoter(prefix+l) forlinvalue_list]
984+
value_list= [quoter(prefix+value) forvalueinvalue_list]
985985
iflocal_pathify:
986-
value_list= [self.LocalPathify(l) forlinvalue_list]
986+
value_list= [self.LocalPathify(value) forvalueinvalue_list]
987987
values=" \\\n\t"+" \\\n\t".join(value_list)
988988
self.fp.write("%s :=%s\n\n"% (variable, values))
989989

‎gyp/pylib/gyp/generator/make.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ def WriteSources(
13421342
)
13431343

13441344
ifself.flavor=="mac":
1345-
cflags=self.xcode_settings.GetCflags(configname)
1345+
cflags=self.xcode_settings.GetCflags(configname, arch=config.get('xcode_configuration_platform'))
13461346
cflags_c=self.xcode_settings.GetCflagsC(configname)
13471347
cflags_cc=self.xcode_settings.GetCflagsCC(configname)
13481348
cflags_objc=self.xcode_settings.GetCflagsObjC(configname)
@@ -1637,6 +1637,7 @@ def WriteTarget(
16371637
configname,
16381638
generator_default_variables["PRODUCT_DIR"],
16391639
lambdap: Sourceify(self.Absolutify(p)),
1640+
arch=config.get('xcode_configuration_platform')
16401641
)
16411642

16421643
# TARGET_POSTBUILDS_$(BUILDTYPE) is added to postbuilds later on.
@@ -1944,7 +1945,7 @@ def WriteList(self, value_list, variable=None, prefix="", quoter=QuoteIfNecessar
19441945
"""
19451946
values=""
19461947
ifvalue_list:
1947-
value_list= [quoter(prefix+l) forlinvalue_list]
1948+
value_list= [quoter(prefix+value) forvalueinvalue_list]
19481949
values=" \\\n\t"+" \\\n\t".join(value_list)
19491950
self.fp.write("%s :=%s\n\n"% (variable, values))
19501951

@@ -2362,7 +2363,14 @@ def CalculateMakefilePath(build_file, base_name):
23622363
}
23632364
)
23642365
elifflavor=="solaris":
2365-
header_params.update({"flock": "./gyp-flock-tool flock", "flock_index": 2})
2366+
copy_archive_arguments="-pPRf@"
2367+
header_params.update(
2368+
{
2369+
"copy_archive_args": copy_archive_arguments,
2370+
"flock": "./gyp-flock-tool flock",
2371+
"flock_index": 2
2372+
}
2373+
)
23662374
elifflavor=="freebsd":
23672375
# Note: OpenBSD has sysutils/flock. lockf seems to be FreeBSD specific.
23682376
header_params.update({"flock": "lockf"})

‎gyp/pylib/gyp/generator/msvs.py‎

Lines changed: 67 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
# letters.
4040
VALID_MSVS_GUID_CHARS=re.compile(r"^[A-F0-9\-]+$")
4141

42+
generator_supports_multiple_toolsets=gyp.common.CrossCompileRequested()
4243

4344
generator_default_variables= {
4445
"DRIVER_PREFIX": "",
@@ -50,7 +51,7 @@
5051
"STATIC_LIB_SUFFIX": ".lib",
5152
"SHARED_LIB_SUFFIX": ".dll",
5253
"INTERMEDIATE_DIR": "$(IntDir)",
53-
"SHARED_INTERMEDIATE_DIR": "$(OutDir)obj/global_intermediate",
54+
"SHARED_INTERMEDIATE_DIR": "$(OutDir)/obj/global_intermediate",
5455
"OS": "win",
5556
"PRODUCT_DIR": "$(OutDir)",
5657
"LIB_DIR": "$(OutDir)lib",
@@ -1005,7 +1006,7 @@ def _GetMsbuildToolsetOfProject(proj_path, spec, version):
10051006
returntoolset
10061007

10071008

1008-
def_GenerateProject(project, options, version, generator_flags):
1009+
def_GenerateProject(project, options, version, generator_flags, spec):
10091010
"""Generates a vcproj file.
10101011
10111012
Arguments:
@@ -1023,7 +1024,7 @@ def _GenerateProject(project, options, version, generator_flags):
10231024
return []
10241025

10251026
ifversion.UsesVcxproj():
1026-
return_GenerateMSBuildProject(project, options, version, generator_flags)
1027+
return_GenerateMSBuildProject(project, options, version, generator_flags, spec)
10271028
else:
10281029
return_GenerateMSVSProject(project, options, version, generator_flags)
10291030

@@ -1903,6 +1904,8 @@ def _GatherSolutionFolders(sln_projects, project_objects, flat):
19031904
# Convert into a tree of dicts on path.
19041905
forpinsln_projects:
19051906
gyp_file, target=gyp.common.ParseQualifiedTarget(p)[0:2]
1907+
ifp.endswith("#host"):
1908+
target+="_host"
19061909
gyp_dir=os.path.dirname(gyp_file)
19071910
path_dict=_GetPathDict(root, gyp_dir)
19081911
path_dict[target+".vcproj"] =project_objects[p]
@@ -1921,9 +1924,10 @@ def _GetPathOfProject(qualified_target, spec, options, msvs_version):
19211924
default_config=_GetDefaultConfiguration(spec)
19221925
proj_filename=default_config.get("msvs_existing_vcproj")
19231926
ifnotproj_filename:
1924-
proj_filename= (
1925-
spec["target_name"] +options.suffix+msvs_version.ProjectExtension()
1926-
)
1927+
proj_filename=spec["target_name"]
1928+
ifspec["toolset"] =="host":
1929+
proj_filename+="_host"
1930+
proj_filename=proj_filename+options.suffix+msvs_version.ProjectExtension()
19271931

19281932
build_file=gyp.common.BuildFile(qualified_target)
19291933
proj_path=os.path.join(os.path.dirname(build_file), proj_filename)
@@ -1948,6 +1952,8 @@ def _GetPlatformOverridesOfProject(spec):
19481952
_ConfigBaseName(config_name, _ConfigPlatform(c)),
19491953
platform,
19501954
)
1955+
ifspec["toolset"] =="host"andgenerator_supports_multiple_toolsets:
1956+
fixed_config_fullname="%s|x64"% (config_name,)
19511957
config_platform_overrides[config_fullname] =fixed_config_fullname
19521958
returnconfig_platform_overrides
19531959

@@ -1968,21 +1974,19 @@ def _CreateProjectObjects(target_list, target_dicts, options, msvs_version):
19681974
projects= {}
19691975
forqualified_targetintarget_list:
19701976
spec=target_dicts[qualified_target]
1971-
ifspec["toolset"] !="target":
1972-
raiseGypError(
1973-
"Multiple toolsets not supported in msvs build (target %s)"
1974-
%qualified_target
1975-
)
19761977
proj_path, fixpath_prefix=_GetPathOfProject(
19771978
qualified_target, spec, options, msvs_version
19781979
)
19791980
guid=_GetGuidOfProject(proj_path, spec)
19801981
overrides=_GetPlatformOverridesOfProject(spec)
19811982
build_file=gyp.common.BuildFile(qualified_target)
19821983
# Create object for this project.
1984+
target_name=spec["target_name"]
1985+
ifspec["toolset"] =="host":
1986+
target_name+="_host"
19831987
obj=MSVSNew.MSVSProject(
19841988
proj_path,
1985-
name=spec["target_name"],
1989+
name=target_name,
19861990
guid=guid,
19871991
spec=spec,
19881992
build_file=build_file,
@@ -2161,7 +2165,10 @@ def GenerateOutput(target_list, target_dicts, data, params):
21612165
forqualified_targetintarget_list:
21622166
spec=target_dicts[qualified_target]
21632167
forconfig_name, configinspec["configurations"].items():
2164-
configs.add(_ConfigFullName(config_name, config))
2168+
config_name=_ConfigFullName(config_name, config)
2169+
configs.add(config_name)
2170+
ifconfig_name=="Release|arm64":
2171+
configs.add("Release|x64")
21652172
configs=list(configs)
21662173

21672174
# Figure out all the projects that will be generated and their guids
@@ -2174,12 +2181,15 @@ def GenerateOutput(target_list, target_dicts, data, params):
21742181
forprojectinproject_objects.values():
21752182
fixpath_prefix=project.fixpath_prefix
21762183
missing_sources.extend(
2177-
_GenerateProject(project, options, msvs_version, generator_flags)
2184+
_GenerateProject(project, options, msvs_version, generator_flags, spec)
21782185
)
21792186
fixpath_prefix=None
21802187

21812188
forbuild_fileindata:
21822189
# Validate build_file extension
2190+
target_only_configs=configs
2191+
ifgenerator_supports_multiple_toolsets:
2192+
target_only_configs= [iforiinconfigsifi.endswith("arm64")]
21832193
ifnotbuild_file.endswith(".gyp"):
21842194
continue
21852195
sln_path=os.path.splitext(build_file)[0] +options.suffix+".sln"
@@ -2196,7 +2206,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
21962206
sln=MSVSNew.MSVSSolution(
21972207
sln_path,
21982208
entries=root_entries,
2199-
variants=configs,
2209+
variants=target_only_configs,
22002210
websiteProperties=False,
22012211
version=msvs_version,
22022212
)
@@ -2930,22 +2940,24 @@ def _GenerateMSBuildRuleXmlFile(xml_path, msbuild_rules):
29302940
easy_xml.WriteXmlIfChanged(content, xml_path, pretty=True, win32=True)
29312941

29322942

2933-
def_GetConfigurationAndPlatform(name, settings):
2943+
def_GetConfigurationAndPlatform(name, settings, spec):
29342944
configuration=name.rsplit("_", 1)[0]
29352945
platform=settings.get("msvs_configuration_platform", "Win32")
2946+
ifspec["toolset"] =="host"andplatform=="arm64":
2947+
platform="x64"# Host-only tools are always built for x64
29362948
return (configuration, platform)
29372949

29382950

2939-
def_GetConfigurationCondition(name, settings):
2951+
def_GetConfigurationCondition(name, settings, spec):
29402952
returnr"'$(Configuration)|$(Platform)'=='%s|%s'"%_GetConfigurationAndPlatform(
2941-
name, settings
2953+
name, settings, spec
29422954
)
29432955

29442956

2945-
def_GetMSBuildProjectConfigurations(configurations):
2957+
def_GetMSBuildProjectConfigurations(configurations, spec):
29462958
group= ["ItemGroup", {"Label": "ProjectConfigurations"}]
29472959
for (name, settings) insorted(configurations.items()):
2948-
configuration, platform=_GetConfigurationAndPlatform(name, settings)
2960+
configuration, platform=_GetConfigurationAndPlatform(name, settings, spec)
29492961
designation="%s|%s"% (configuration, platform)
29502962
group.append(
29512963
[
@@ -3033,7 +3045,7 @@ def _GetMSBuildConfigurationDetails(spec, build_file):
30333045
properties= {}
30343046
forname, settingsinspec["configurations"].items():
30353047
msbuild_attributes=_GetMSBuildAttributes(spec, settings, build_file)
3036-
condition=_GetConfigurationCondition(name, settings)
3048+
condition=_GetConfigurationCondition(name, settings, spec)
30373049
character_set=msbuild_attributes.get("CharacterSet")
30383050
config_type=msbuild_attributes.get("ConfigurationType")
30393051
_AddConditionalProperty(properties, condition, "ConfigurationType", config_type)
@@ -3064,12 +3076,12 @@ def _GetMSBuildLocalProperties(msbuild_toolset):
30643076
returnproperties
30653077

30663078

3067-
def_GetMSBuildPropertySheets(configurations):
3079+
def_GetMSBuildPropertySheets(configurations, spec):
30683080
user_props=r"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
30693081
additional_props= {}
30703082
props_specified=False
30713083
forname, settingsinsorted(configurations.items()):
3072-
configuration=_GetConfigurationCondition(name, settings)
3084+
configuration=_GetConfigurationCondition(name, settings, spec)
30733085
if"msbuild_props"insettings:
30743086
additional_props[configuration] =_FixPaths(settings["msbuild_props"])
30753087
props_specified=True
@@ -3222,7 +3234,7 @@ def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file):
32223234

32233235
properties= {}
32243236
for (name, configuration) insorted(configurations.items()):
3225-
condition=_GetConfigurationCondition(name, configuration)
3237+
condition=_GetConfigurationCondition(name, configuration, spec)
32263238
attributes=_GetMSBuildAttributes(spec, configuration, build_file)
32273239
msbuild_settings=configuration["finalized_msbuild_settings"]
32283240
_AddConditionalProperty(
@@ -3345,7 +3357,7 @@ def _GetMSBuildToolSettingsSections(spec, configurations):
33453357
msbuild_settings=configuration["finalized_msbuild_settings"]
33463358
group= [
33473359
"ItemDefinitionGroup",
3348-
{"Condition": _GetConfigurationCondition(name, configuration)},
3360+
{"Condition": _GetConfigurationCondition(name, configuration, spec)},
33493361
]
33503362
fortool_name, tool_settingsinsorted(msbuild_settings.items()):
33513363
# Skip the tool named '' which is a holder of global settings handled
@@ -3625,7 +3637,7 @@ def _AddSources2(
36253637

36263638
ifprecompiled_source==source:
36273639
condition=_GetConfigurationCondition(
3628-
config_name, configuration
3640+
config_name, configuration, spec
36293641
)
36303642
detail.append(
36313643
["PrecompiledHeader", {"Condition": condition}, "Create"]
@@ -3652,7 +3664,21 @@ def _GetMSBuildProjectReferences(project):
36523664
references= []
36533665
ifproject.dependencies:
36543666
group= ["ItemGroup"]
3667+
added_dependency_set=set()
36553668
fordependencyinproject.dependencies:
3669+
dependency_spec=dependency.spec
3670+
should_skip_dep=False
3671+
ifproject.spec["toolset"] =="target":
3672+
ifdependency_spec["toolset"] =="host":
3673+
ifdependency_spec["type"] =="static_library":
3674+
should_skip_dep=True
3675+
ifdependency.name.startswith("run_"):
3676+
should_skip_dep=False
3677+
ifshould_skip_dep:
3678+
continue
3679+
3680+
canonical_name=dependency.name.replace("_host", "")
3681+
added_dependency_set.add(canonical_name)
36563682
guid=dependency.guid
36573683
project_dir=os.path.split(project.path)[0]
36583684
relative_path=gyp.common.RelativePath(dependency.path, project_dir)
@@ -3675,7 +3701,7 @@ def _GetMSBuildProjectReferences(project):
36753701
returnreferences
36763702

36773703

3678-
def_GenerateMSBuildProject(project, options, version, generator_flags):
3704+
def_GenerateMSBuildProject(project, options, version, generator_flags, spec):
36793705
spec=project.spec
36803706
configurations=spec["configurations"]
36813707
project_dir, project_file_name=os.path.split(project.path)
@@ -3774,7 +3800,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37743800
},
37753801
]
37763802

3777-
content+=_GetMSBuildProjectConfigurations(configurations)
3803+
content+=_GetMSBuildProjectConfigurations(configurations, spec)
37783804
content+=_GetMSBuildGlobalProperties(
37793805
spec, version, project.guid, project_file_name
37803806
)
@@ -3789,7 +3815,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37893815
ifspec.get("msvs_enable_marmasm"):
37903816
content+=import_marmasm_props_section
37913817
content+=_GetMSBuildExtensions(props_files_of_rules)
3792-
content+=_GetMSBuildPropertySheets(configurations)
3818+
content+=_GetMSBuildPropertySheets(configurations, spec)
37933819
content+=macro_section
37943820
content+=_GetMSBuildConfigurationGlobalProperties(
37953821
spec, configurations, project.build_file
@@ -3893,15 +3919,27 @@ def _GenerateActionsForMSBuild(spec, actions_to_add):
38933919
sources_handled_by_action=OrderedSet()
38943920
actions_spec= []
38953921
forprimary_input, actionsinactions_to_add.items():
3922+
ifgenerator_supports_multiple_toolsets:
3923+
primary_input=primary_input.replace(".exe", "_host.exe")
38963924
inputs=OrderedSet()
38973925
outputs=OrderedSet()
38983926
descriptions= []
38993927
commands= []
39003928
foractioninactions:
3929+
3930+
deffixup_host_exe(i):
3931+
if"$(OutDir)"ini:
3932+
i=i.replace(".exe", "_host.exe")
3933+
returni
3934+
3935+
ifgenerator_supports_multiple_toolsets:
3936+
action["inputs"] = [fixup_host_exe(i) foriinaction["inputs"]]
39013937
inputs.update(OrderedSet(action["inputs"]))
39023938
outputs.update(OrderedSet(action["outputs"]))
39033939
descriptions.append(action["description"])
39043940
cmd=action["command"]
3941+
ifgenerator_supports_multiple_toolsets:
3942+
cmd=cmd.replace(".exe", "_host.exe")
39053943
# For most actions, add 'call' so that actions that invoke batch files
39063944
# return and continue executing. msbuild_use_call provides a way to
39073945
# disable this but I have not seen any adverse effect from doing that

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 3baa4e4

Browse files
MarshallOfSoundrvagg
authored andcommitted
gyp: update gyp to 0.4.0
Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> PR-URL: #2165
1 parent f461d56 commit 3baa4e4

10 files changed

Lines changed: 162 additions & 67 deletions

File tree

‎gyp/.github/workflows/Python_tests.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
os: [macos-latest, ubuntu-latest] # , windows-latest]
1515
python-version: [2.7, 3.6, 3.7, 3.8] # 3.5,
1616
steps:
17-
- uses: actions/checkout@v1
17+
- uses: actions/checkout@v2
1818
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v1
19+
uses: actions/setup-python@v2
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Install dependencies

‎gyp/CHANGELOG.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6+
7+
## [Unreleased]
8+
9+
## [0.4.0] - 2020-07-14
10+
11+
### Added
12+
- Added support for passing arbitrary architectures to Xcode builds, enables `arm64` builds.
13+
14+
### Fixed
15+
- Fixed a bug on Solaris where copying archives failed.
16+
17+
## [0.3.0] - 2020-06-06
18+
19+
### Added
20+
- Added support for MSVC cross-compilation. This allows compilation on x64 for
21+
a Windows ARM target.
22+
23+
### Fixed
24+
- Fixed XCode CLT version detection on macOS Catalina.
25+
26+
## [0.2.1] - 2020-05-05
27+
28+
### Fixed
29+
- Relicensed to Node.js contributors.
30+
- Fixed Windows bug introduced in v0.2.0.
31+
32+
## [0.2.0] - 2020-04-06
33+
34+
This is the first release of this project, based on https://chromium.googlesource.com/external/gyp
35+
with changes made over the years in Node.js and node-gyp.
36+
37+
[Unreleased]: https://github.com/nodejs/gyp-next/compare/v0.4.0...HEAD
38+
[0.4.0]: https://github.com/nodejs/gyp-next/compare/v0.3.0...v0.4.0
39+
[0.3.0]: https://github.com/nodejs/gyp-next/compare/v0.2.1...v0.3.0
40+
[0.2.1]: https://github.com/nodejs/gyp-next/compare/v0.2.0...v0.2.1
41+
[0.2.0]: https://github.com/nodejs/gyp-next/releases/tag/v0.2.0

‎gyp/pylib/gyp/generator/android.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,9 @@ def WriteList(
981981
"""
982982
values=""
983983
ifvalue_list:
984-
value_list= [quoter(prefix+l) forlinvalue_list]
984+
value_list= [quoter(prefix+value) forvalueinvalue_list]
985985
iflocal_pathify:
986-
value_list= [self.LocalPathify(l) forlinvalue_list]
986+
value_list= [self.LocalPathify(value) forvalueinvalue_list]
987987
values=" \\\n\t"+" \\\n\t".join(value_list)
988988
self.fp.write("%s :=%s\n\n"% (variable, values))
989989

‎gyp/pylib/gyp/generator/make.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ def WriteSources(
13421342
)
13431343

13441344
ifself.flavor=="mac":
1345-
cflags=self.xcode_settings.GetCflags(configname)
1345+
cflags=self.xcode_settings.GetCflags(configname, arch=config.get('xcode_configuration_platform'))
13461346
cflags_c=self.xcode_settings.GetCflagsC(configname)
13471347
cflags_cc=self.xcode_settings.GetCflagsCC(configname)
13481348
cflags_objc=self.xcode_settings.GetCflagsObjC(configname)
@@ -1637,6 +1637,7 @@ def WriteTarget(
16371637
configname,
16381638
generator_default_variables["PRODUCT_DIR"],
16391639
lambdap: Sourceify(self.Absolutify(p)),
1640+
arch=config.get('xcode_configuration_platform')
16401641
)
16411642

16421643
# TARGET_POSTBUILDS_$(BUILDTYPE) is added to postbuilds later on.
@@ -1944,7 +1945,7 @@ def WriteList(self, value_list, variable=None, prefix="", quoter=QuoteIfNecessar
19441945
"""
19451946
values=""
19461947
ifvalue_list:
1947-
value_list= [quoter(prefix+l) forlinvalue_list]
1948+
value_list= [quoter(prefix+value) forvalueinvalue_list]
19481949
values=" \\\n\t"+" \\\n\t".join(value_list)
19491950
self.fp.write("%s :=%s\n\n"% (variable, values))
19501951

@@ -2362,7 +2363,14 @@ def CalculateMakefilePath(build_file, base_name):
23622363
}
23632364
)
23642365
elifflavor=="solaris":
2365-
header_params.update({"flock": "./gyp-flock-tool flock", "flock_index": 2})
2366+
copy_archive_arguments="-pPRf@"
2367+
header_params.update(
2368+
{
2369+
"copy_archive_args": copy_archive_arguments,
2370+
"flock": "./gyp-flock-tool flock",
2371+
"flock_index": 2
2372+
}
2373+
)
23662374
elifflavor=="freebsd":
23672375
# Note: OpenBSD has sysutils/flock. lockf seems to be FreeBSD specific.
23682376
header_params.update({"flock": "lockf"})

‎gyp/pylib/gyp/generator/msvs.py‎

Lines changed: 67 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
# letters.
4040
VALID_MSVS_GUID_CHARS=re.compile(r"^[A-F0-9\-]+$")
4141

42+
generator_supports_multiple_toolsets=gyp.common.CrossCompileRequested()
4243

4344
generator_default_variables= {
4445
"DRIVER_PREFIX": "",
@@ -50,7 +51,7 @@
5051
"STATIC_LIB_SUFFIX": ".lib",
5152
"SHARED_LIB_SUFFIX": ".dll",
5253
"INTERMEDIATE_DIR": "$(IntDir)",
53-
"SHARED_INTERMEDIATE_DIR": "$(OutDir)obj/global_intermediate",
54+
"SHARED_INTERMEDIATE_DIR": "$(OutDir)/obj/global_intermediate",
5455
"OS": "win",
5556
"PRODUCT_DIR": "$(OutDir)",
5657
"LIB_DIR": "$(OutDir)lib",
@@ -1005,7 +1006,7 @@ def _GetMsbuildToolsetOfProject(proj_path, spec, version):
10051006
returntoolset
10061007

10071008

1008-
def_GenerateProject(project, options, version, generator_flags):
1009+
def_GenerateProject(project, options, version, generator_flags, spec):
10091010
"""Generates a vcproj file.
10101011
10111012
Arguments:
@@ -1023,7 +1024,7 @@ def _GenerateProject(project, options, version, generator_flags):
10231024
return []
10241025

10251026
ifversion.UsesVcxproj():
1026-
return_GenerateMSBuildProject(project, options, version, generator_flags)
1027+
return_GenerateMSBuildProject(project, options, version, generator_flags, spec)
10271028
else:
10281029
return_GenerateMSVSProject(project, options, version, generator_flags)
10291030

@@ -1903,6 +1904,8 @@ def _GatherSolutionFolders(sln_projects, project_objects, flat):
19031904
# Convert into a tree of dicts on path.
19041905
forpinsln_projects:
19051906
gyp_file, target=gyp.common.ParseQualifiedTarget(p)[0:2]
1907+
ifp.endswith("#host"):
1908+
target+="_host"
19061909
gyp_dir=os.path.dirname(gyp_file)
19071910
path_dict=_GetPathDict(root, gyp_dir)
19081911
path_dict[target+".vcproj"] =project_objects[p]
@@ -1921,9 +1924,10 @@ def _GetPathOfProject(qualified_target, spec, options, msvs_version):
19211924
default_config=_GetDefaultConfiguration(spec)
19221925
proj_filename=default_config.get("msvs_existing_vcproj")
19231926
ifnotproj_filename:
1924-
proj_filename= (
1925-
spec["target_name"] +options.suffix+msvs_version.ProjectExtension()
1926-
)
1927+
proj_filename=spec["target_name"]
1928+
ifspec["toolset"] =="host":
1929+
proj_filename+="_host"
1930+
proj_filename=proj_filename+options.suffix+msvs_version.ProjectExtension()
19271931

19281932
build_file=gyp.common.BuildFile(qualified_target)
19291933
proj_path=os.path.join(os.path.dirname(build_file), proj_filename)
@@ -1948,6 +1952,8 @@ def _GetPlatformOverridesOfProject(spec):
19481952
_ConfigBaseName(config_name, _ConfigPlatform(c)),
19491953
platform,
19501954
)
1955+
ifspec["toolset"] =="host"andgenerator_supports_multiple_toolsets:
1956+
fixed_config_fullname="%s|x64"% (config_name,)
19511957
config_platform_overrides[config_fullname] =fixed_config_fullname
19521958
returnconfig_platform_overrides
19531959

@@ -1968,21 +1974,19 @@ def _CreateProjectObjects(target_list, target_dicts, options, msvs_version):
19681974
projects= {}
19691975
forqualified_targetintarget_list:
19701976
spec=target_dicts[qualified_target]
1971-
ifspec["toolset"] !="target":
1972-
raiseGypError(
1973-
"Multiple toolsets not supported in msvs build (target %s)"
1974-
%qualified_target
1975-
)
19761977
proj_path, fixpath_prefix=_GetPathOfProject(
19771978
qualified_target, spec, options, msvs_version
19781979
)
19791980
guid=_GetGuidOfProject(proj_path, spec)
19801981
overrides=_GetPlatformOverridesOfProject(spec)
19811982
build_file=gyp.common.BuildFile(qualified_target)
19821983
# Create object for this project.
1984+
target_name=spec["target_name"]
1985+
ifspec["toolset"] =="host":
1986+
target_name+="_host"
19831987
obj=MSVSNew.MSVSProject(
19841988
proj_path,
1985-
name=spec["target_name"],
1989+
name=target_name,
19861990
guid=guid,
19871991
spec=spec,
19881992
build_file=build_file,
@@ -2161,7 +2165,10 @@ def GenerateOutput(target_list, target_dicts, data, params):
21612165
forqualified_targetintarget_list:
21622166
spec=target_dicts[qualified_target]
21632167
forconfig_name, configinspec["configurations"].items():
2164-
configs.add(_ConfigFullName(config_name, config))
2168+
config_name=_ConfigFullName(config_name, config)
2169+
configs.add(config_name)
2170+
ifconfig_name=="Release|arm64":
2171+
configs.add("Release|x64")
21652172
configs=list(configs)
21662173

21672174
# Figure out all the projects that will be generated and their guids
@@ -2174,12 +2181,15 @@ def GenerateOutput(target_list, target_dicts, data, params):
21742181
forprojectinproject_objects.values():
21752182
fixpath_prefix=project.fixpath_prefix
21762183
missing_sources.extend(
2177-
_GenerateProject(project, options, msvs_version, generator_flags)
2184+
_GenerateProject(project, options, msvs_version, generator_flags, spec)
21782185
)
21792186
fixpath_prefix=None
21802187

21812188
forbuild_fileindata:
21822189
# Validate build_file extension
2190+
target_only_configs=configs
2191+
ifgenerator_supports_multiple_toolsets:
2192+
target_only_configs= [iforiinconfigsifi.endswith("arm64")]
21832193
ifnotbuild_file.endswith(".gyp"):
21842194
continue
21852195
sln_path=os.path.splitext(build_file)[0] +options.suffix+".sln"
@@ -2196,7 +2206,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
21962206
sln=MSVSNew.MSVSSolution(
21972207
sln_path,
21982208
entries=root_entries,
2199-
variants=configs,
2209+
variants=target_only_configs,
22002210
websiteProperties=False,
22012211
version=msvs_version,
22022212
)
@@ -2930,22 +2940,24 @@ def _GenerateMSBuildRuleXmlFile(xml_path, msbuild_rules):
29302940
easy_xml.WriteXmlIfChanged(content, xml_path, pretty=True, win32=True)
29312941

29322942

2933-
def_GetConfigurationAndPlatform(name, settings):
2943+
def_GetConfigurationAndPlatform(name, settings, spec):
29342944
configuration=name.rsplit("_", 1)[0]
29352945
platform=settings.get("msvs_configuration_platform", "Win32")
2946+
ifspec["toolset"] =="host"andplatform=="arm64":
2947+
platform="x64"# Host-only tools are always built for x64
29362948
return (configuration, platform)
29372949

29382950

2939-
def_GetConfigurationCondition(name, settings):
2951+
def_GetConfigurationCondition(name, settings, spec):
29402952
returnr"'$(Configuration)|$(Platform)'=='%s|%s'"%_GetConfigurationAndPlatform(
2941-
name, settings
2953+
name, settings, spec
29422954
)
29432955

29442956

2945-
def_GetMSBuildProjectConfigurations(configurations):
2957+
def_GetMSBuildProjectConfigurations(configurations, spec):
29462958
group= ["ItemGroup", {"Label": "ProjectConfigurations"}]
29472959
for (name, settings) insorted(configurations.items()):
2948-
configuration, platform=_GetConfigurationAndPlatform(name, settings)
2960+
configuration, platform=_GetConfigurationAndPlatform(name, settings, spec)
29492961
designation="%s|%s"% (configuration, platform)
29502962
group.append(
29512963
[
@@ -3033,7 +3045,7 @@ def _GetMSBuildConfigurationDetails(spec, build_file):
30333045
properties= {}
30343046
forname, settingsinspec["configurations"].items():
30353047
msbuild_attributes=_GetMSBuildAttributes(spec, settings, build_file)
3036-
condition=_GetConfigurationCondition(name, settings)
3048+
condition=_GetConfigurationCondition(name, settings, spec)
30373049
character_set=msbuild_attributes.get("CharacterSet")
30383050
config_type=msbuild_attributes.get("ConfigurationType")
30393051
_AddConditionalProperty(properties, condition, "ConfigurationType", config_type)
@@ -3064,12 +3076,12 @@ def _GetMSBuildLocalProperties(msbuild_toolset):
30643076
returnproperties
30653077

30663078

3067-
def_GetMSBuildPropertySheets(configurations):
3079+
def_GetMSBuildPropertySheets(configurations, spec):
30683080
user_props=r"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
30693081
additional_props= {}
30703082
props_specified=False
30713083
forname, settingsinsorted(configurations.items()):
3072-
configuration=_GetConfigurationCondition(name, settings)
3084+
configuration=_GetConfigurationCondition(name, settings, spec)
30733085
if"msbuild_props"insettings:
30743086
additional_props[configuration] =_FixPaths(settings["msbuild_props"])
30753087
props_specified=True
@@ -3222,7 +3234,7 @@ def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file):
32223234

32233235
properties= {}
32243236
for (name, configuration) insorted(configurations.items()):
3225-
condition=_GetConfigurationCondition(name, configuration)
3237+
condition=_GetConfigurationCondition(name, configuration, spec)
32263238
attributes=_GetMSBuildAttributes(spec, configuration, build_file)
32273239
msbuild_settings=configuration["finalized_msbuild_settings"]
32283240
_AddConditionalProperty(
@@ -3345,7 +3357,7 @@ def _GetMSBuildToolSettingsSections(spec, configurations):
33453357
msbuild_settings=configuration["finalized_msbuild_settings"]
33463358
group= [
33473359
"ItemDefinitionGroup",
3348-
{"Condition": _GetConfigurationCondition(name, configuration)},
3360+
{"Condition": _GetConfigurationCondition(name, configuration, spec)},
33493361
]
33503362
fortool_name, tool_settingsinsorted(msbuild_settings.items()):
33513363
# Skip the tool named '' which is a holder of global settings handled
@@ -3625,7 +3637,7 @@ def _AddSources2(
36253637

36263638
ifprecompiled_source==source:
36273639
condition=_GetConfigurationCondition(
3628-
config_name, configuration
3640+
config_name, configuration, spec
36293641
)
36303642
detail.append(
36313643
["PrecompiledHeader", {"Condition": condition}, "Create"]
@@ -3652,7 +3664,21 @@ def _GetMSBuildProjectReferences(project):
36523664
references= []
36533665
ifproject.dependencies:
36543666
group= ["ItemGroup"]
3667+
added_dependency_set=set()
36553668
fordependencyinproject.dependencies:
3669+
dependency_spec=dependency.spec
3670+
should_skip_dep=False
3671+
ifproject.spec["toolset"] =="target":
3672+
ifdependency_spec["toolset"] =="host":
3673+
ifdependency_spec["type"] =="static_library":
3674+
should_skip_dep=True
3675+
ifdependency.name.startswith("run_"):
3676+
should_skip_dep=False
3677+
ifshould_skip_dep:
3678+
continue
3679+
3680+
canonical_name=dependency.name.replace("_host", "")
3681+
added_dependency_set.add(canonical_name)
36563682
guid=dependency.guid
36573683
project_dir=os.path.split(project.path)[0]
36583684
relative_path=gyp.common.RelativePath(dependency.path, project_dir)
@@ -3675,7 +3701,7 @@ def _GetMSBuildProjectReferences(project):
36753701
returnreferences
36763702

36773703

3678-
def_GenerateMSBuildProject(project, options, version, generator_flags):
3704+
def_GenerateMSBuildProject(project, options, version, generator_flags, spec):
36793705
spec=project.spec
36803706
configurations=spec["configurations"]
36813707
project_dir, project_file_name=os.path.split(project.path)
@@ -3774,7 +3800,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37743800
},
37753801
]
37763802

3777-
content+=_GetMSBuildProjectConfigurations(configurations)
3803+
content+=_GetMSBuildProjectConfigurations(configurations, spec)
37783804
content+=_GetMSBuildGlobalProperties(
37793805
spec, version, project.guid, project_file_name
37803806
)
@@ -3789,7 +3815,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37893815
ifspec.get("msvs_enable_marmasm"):
37903816
content+=import_marmasm_props_section
37913817
content+=_GetMSBuildExtensions(props_files_of_rules)
3792-
content+=_GetMSBuildPropertySheets(configurations)
3818+
content+=_GetMSBuildPropertySheets(configurations, spec)
37933819
content+=macro_section
37943820
content+=_GetMSBuildConfigurationGlobalProperties(
37953821
spec, configurations, project.build_file
@@ -3893,15 +3919,27 @@ def _GenerateActionsForMSBuild(spec, actions_to_add):
38933919
sources_handled_by_action=OrderedSet()
38943920
actions_spec= []
38953921
forprimary_input, actionsinactions_to_add.items():
3922+
ifgenerator_supports_multiple_toolsets:
3923+
primary_input=primary_input.replace(".exe", "_host.exe")
38963924
inputs=OrderedSet()
38973925
outputs=OrderedSet()
38983926
descriptions= []
38993927
commands= []
39003928
foractioninactions:
3929+
3930+
deffixup_host_exe(i):
3931+
if"$(OutDir)"ini:
3932+
i=i.replace(".exe", "_host.exe")
3933+
returni
3934+
3935+
ifgenerator_supports_multiple_toolsets:
3936+
action["inputs"] = [fixup_host_exe(i) foriinaction["inputs"]]
39013937
inputs.update(OrderedSet(action["inputs"]))
39023938
outputs.update(OrderedSet(action["outputs"]))
39033939
descriptions.append(action["description"])
39043940
cmd=action["command"]
3941+
ifgenerator_supports_multiple_toolsets:
3942+
cmd=cmd.replace(".exe", "_host.exe")
39053943
# For most actions, add 'call' so that actions that invoke batch files
39063944
# return and continue executing. msbuild_use_call provides a way to
39073945
# disable this but I have not seen any adverse effect from doing that

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 3baa4e4

Browse files
MarshallOfSoundrvagg
authored andcommitted
gyp: update gyp to 0.4.0
Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> PR-URL: #2165
1 parent f461d56 commit 3baa4e4

10 files changed

Lines changed: 162 additions & 67 deletions

File tree

‎gyp/.github/workflows/Python_tests.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
os: [macos-latest, ubuntu-latest] # , windows-latest]
1515
python-version: [2.7, 3.6, 3.7, 3.8] # 3.5,
1616
steps:
17-
- uses: actions/checkout@v1
17+
- uses: actions/checkout@v2
1818
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v1
19+
uses: actions/setup-python@v2
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Install dependencies

‎gyp/CHANGELOG.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6+
7+
## [Unreleased]
8+
9+
## [0.4.0] - 2020-07-14
10+
11+
### Added
12+
- Added support for passing arbitrary architectures to Xcode builds, enables `arm64` builds.
13+
14+
### Fixed
15+
- Fixed a bug on Solaris where copying archives failed.
16+
17+
## [0.3.0] - 2020-06-06
18+
19+
### Added
20+
- Added support for MSVC cross-compilation. This allows compilation on x64 for
21+
a Windows ARM target.
22+
23+
### Fixed
24+
- Fixed XCode CLT version detection on macOS Catalina.
25+
26+
## [0.2.1] - 2020-05-05
27+
28+
### Fixed
29+
- Relicensed to Node.js contributors.
30+
- Fixed Windows bug introduced in v0.2.0.
31+
32+
## [0.2.0] - 2020-04-06
33+
34+
This is the first release of this project, based on https://chromium.googlesource.com/external/gyp
35+
with changes made over the years in Node.js and node-gyp.
36+
37+
[Unreleased]: https://github.com/nodejs/gyp-next/compare/v0.4.0...HEAD
38+
[0.4.0]: https://github.com/nodejs/gyp-next/compare/v0.3.0...v0.4.0
39+
[0.3.0]: https://github.com/nodejs/gyp-next/compare/v0.2.1...v0.3.0
40+
[0.2.1]: https://github.com/nodejs/gyp-next/compare/v0.2.0...v0.2.1
41+
[0.2.0]: https://github.com/nodejs/gyp-next/releases/tag/v0.2.0

‎gyp/pylib/gyp/generator/android.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,9 @@ def WriteList(
981981
"""
982982
values=""
983983
ifvalue_list:
984-
value_list= [quoter(prefix+l) forlinvalue_list]
984+
value_list= [quoter(prefix+value) forvalueinvalue_list]
985985
iflocal_pathify:
986-
value_list= [self.LocalPathify(l) forlinvalue_list]
986+
value_list= [self.LocalPathify(value) forvalueinvalue_list]
987987
values=" \\\n\t"+" \\\n\t".join(value_list)
988988
self.fp.write("%s :=%s\n\n"% (variable, values))
989989

‎gyp/pylib/gyp/generator/make.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ def WriteSources(
13421342
)
13431343

13441344
ifself.flavor=="mac":
1345-
cflags=self.xcode_settings.GetCflags(configname)
1345+
cflags=self.xcode_settings.GetCflags(configname, arch=config.get('xcode_configuration_platform'))
13461346
cflags_c=self.xcode_settings.GetCflagsC(configname)
13471347
cflags_cc=self.xcode_settings.GetCflagsCC(configname)
13481348
cflags_objc=self.xcode_settings.GetCflagsObjC(configname)
@@ -1637,6 +1637,7 @@ def WriteTarget(
16371637
configname,
16381638
generator_default_variables["PRODUCT_DIR"],
16391639
lambdap: Sourceify(self.Absolutify(p)),
1640+
arch=config.get('xcode_configuration_platform')
16401641
)
16411642

16421643
# TARGET_POSTBUILDS_$(BUILDTYPE) is added to postbuilds later on.
@@ -1944,7 +1945,7 @@ def WriteList(self, value_list, variable=None, prefix="", quoter=QuoteIfNecessar
19441945
"""
19451946
values=""
19461947
ifvalue_list:
1947-
value_list= [quoter(prefix+l) forlinvalue_list]
1948+
value_list= [quoter(prefix+value) forvalueinvalue_list]
19481949
values=" \\\n\t"+" \\\n\t".join(value_list)
19491950
self.fp.write("%s :=%s\n\n"% (variable, values))
19501951

@@ -2362,7 +2363,14 @@ def CalculateMakefilePath(build_file, base_name):
23622363
}
23632364
)
23642365
elifflavor=="solaris":
2365-
header_params.update({"flock": "./gyp-flock-tool flock", "flock_index": 2})
2366+
copy_archive_arguments="-pPRf@"
2367+
header_params.update(
2368+
{
2369+
"copy_archive_args": copy_archive_arguments,
2370+
"flock": "./gyp-flock-tool flock",
2371+
"flock_index": 2
2372+
}
2373+
)
23662374
elifflavor=="freebsd":
23672375
# Note: OpenBSD has sysutils/flock. lockf seems to be FreeBSD specific.
23682376
header_params.update({"flock": "lockf"})

‎gyp/pylib/gyp/generator/msvs.py‎

Lines changed: 67 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
# letters.
4040
VALID_MSVS_GUID_CHARS=re.compile(r"^[A-F0-9\-]+$")
4141

42+
generator_supports_multiple_toolsets=gyp.common.CrossCompileRequested()
4243

4344
generator_default_variables= {
4445
"DRIVER_PREFIX": "",
@@ -50,7 +51,7 @@
5051
"STATIC_LIB_SUFFIX": ".lib",
5152
"SHARED_LIB_SUFFIX": ".dll",
5253
"INTERMEDIATE_DIR": "$(IntDir)",
53-
"SHARED_INTERMEDIATE_DIR": "$(OutDir)obj/global_intermediate",
54+
"SHARED_INTERMEDIATE_DIR": "$(OutDir)/obj/global_intermediate",
5455
"OS": "win",
5556
"PRODUCT_DIR": "$(OutDir)",
5657
"LIB_DIR": "$(OutDir)lib",
@@ -1005,7 +1006,7 @@ def _GetMsbuildToolsetOfProject(proj_path, spec, version):
10051006
returntoolset
10061007

10071008

1008-
def_GenerateProject(project, options, version, generator_flags):
1009+
def_GenerateProject(project, options, version, generator_flags, spec):
10091010
"""Generates a vcproj file.
10101011
10111012
Arguments:
@@ -1023,7 +1024,7 @@ def _GenerateProject(project, options, version, generator_flags):
10231024
return []
10241025

10251026
ifversion.UsesVcxproj():
1026-
return_GenerateMSBuildProject(project, options, version, generator_flags)
1027+
return_GenerateMSBuildProject(project, options, version, generator_flags, spec)
10271028
else:
10281029
return_GenerateMSVSProject(project, options, version, generator_flags)
10291030

@@ -1903,6 +1904,8 @@ def _GatherSolutionFolders(sln_projects, project_objects, flat):
19031904
# Convert into a tree of dicts on path.
19041905
forpinsln_projects:
19051906
gyp_file, target=gyp.common.ParseQualifiedTarget(p)[0:2]
1907+
ifp.endswith("#host"):
1908+
target+="_host"
19061909
gyp_dir=os.path.dirname(gyp_file)
19071910
path_dict=_GetPathDict(root, gyp_dir)
19081911
path_dict[target+".vcproj"] =project_objects[p]
@@ -1921,9 +1924,10 @@ def _GetPathOfProject(qualified_target, spec, options, msvs_version):
19211924
default_config=_GetDefaultConfiguration(spec)
19221925
proj_filename=default_config.get("msvs_existing_vcproj")
19231926
ifnotproj_filename:
1924-
proj_filename= (
1925-
spec["target_name"] +options.suffix+msvs_version.ProjectExtension()
1926-
)
1927+
proj_filename=spec["target_name"]
1928+
ifspec["toolset"] =="host":
1929+
proj_filename+="_host"
1930+
proj_filename=proj_filename+options.suffix+msvs_version.ProjectExtension()
19271931

19281932
build_file=gyp.common.BuildFile(qualified_target)
19291933
proj_path=os.path.join(os.path.dirname(build_file), proj_filename)
@@ -1948,6 +1952,8 @@ def _GetPlatformOverridesOfProject(spec):
19481952
_ConfigBaseName(config_name, _ConfigPlatform(c)),
19491953
platform,
19501954
)
1955+
ifspec["toolset"] =="host"andgenerator_supports_multiple_toolsets:
1956+
fixed_config_fullname="%s|x64"% (config_name,)
19511957
config_platform_overrides[config_fullname] =fixed_config_fullname
19521958
returnconfig_platform_overrides
19531959

@@ -1968,21 +1974,19 @@ def _CreateProjectObjects(target_list, target_dicts, options, msvs_version):
19681974
projects= {}
19691975
forqualified_targetintarget_list:
19701976
spec=target_dicts[qualified_target]
1971-
ifspec["toolset"] !="target":
1972-
raiseGypError(
1973-
"Multiple toolsets not supported in msvs build (target %s)"
1974-
%qualified_target
1975-
)
19761977
proj_path, fixpath_prefix=_GetPathOfProject(
19771978
qualified_target, spec, options, msvs_version
19781979
)
19791980
guid=_GetGuidOfProject(proj_path, spec)
19801981
overrides=_GetPlatformOverridesOfProject(spec)
19811982
build_file=gyp.common.BuildFile(qualified_target)
19821983
# Create object for this project.
1984+
target_name=spec["target_name"]
1985+
ifspec["toolset"] =="host":
1986+
target_name+="_host"
19831987
obj=MSVSNew.MSVSProject(
19841988
proj_path,
1985-
name=spec["target_name"],
1989+
name=target_name,
19861990
guid=guid,
19871991
spec=spec,
19881992
build_file=build_file,
@@ -2161,7 +2165,10 @@ def GenerateOutput(target_list, target_dicts, data, params):
21612165
forqualified_targetintarget_list:
21622166
spec=target_dicts[qualified_target]
21632167
forconfig_name, configinspec["configurations"].items():
2164-
configs.add(_ConfigFullName(config_name, config))
2168+
config_name=_ConfigFullName(config_name, config)
2169+
configs.add(config_name)
2170+
ifconfig_name=="Release|arm64":
2171+
configs.add("Release|x64")
21652172
configs=list(configs)
21662173

21672174
# Figure out all the projects that will be generated and their guids
@@ -2174,12 +2181,15 @@ def GenerateOutput(target_list, target_dicts, data, params):
21742181
forprojectinproject_objects.values():
21752182
fixpath_prefix=project.fixpath_prefix
21762183
missing_sources.extend(
2177-
_GenerateProject(project, options, msvs_version, generator_flags)
2184+
_GenerateProject(project, options, msvs_version, generator_flags, spec)
21782185
)
21792186
fixpath_prefix=None
21802187

21812188
forbuild_fileindata:
21822189
# Validate build_file extension
2190+
target_only_configs=configs
2191+
ifgenerator_supports_multiple_toolsets:
2192+
target_only_configs= [iforiinconfigsifi.endswith("arm64")]
21832193
ifnotbuild_file.endswith(".gyp"):
21842194
continue
21852195
sln_path=os.path.splitext(build_file)[0] +options.suffix+".sln"
@@ -2196,7 +2206,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
21962206
sln=MSVSNew.MSVSSolution(
21972207
sln_path,
21982208
entries=root_entries,
2199-
variants=configs,
2209+
variants=target_only_configs,
22002210
websiteProperties=False,
22012211
version=msvs_version,
22022212
)
@@ -2930,22 +2940,24 @@ def _GenerateMSBuildRuleXmlFile(xml_path, msbuild_rules):
29302940
easy_xml.WriteXmlIfChanged(content, xml_path, pretty=True, win32=True)
29312941

29322942

2933-
def_GetConfigurationAndPlatform(name, settings):
2943+
def_GetConfigurationAndPlatform(name, settings, spec):
29342944
configuration=name.rsplit("_", 1)[0]
29352945
platform=settings.get("msvs_configuration_platform", "Win32")
2946+
ifspec["toolset"] =="host"andplatform=="arm64":
2947+
platform="x64"# Host-only tools are always built for x64
29362948
return (configuration, platform)
29372949

29382950

2939-
def_GetConfigurationCondition(name, settings):
2951+
def_GetConfigurationCondition(name, settings, spec):
29402952
returnr"'$(Configuration)|$(Platform)'=='%s|%s'"%_GetConfigurationAndPlatform(
2941-
name, settings
2953+
name, settings, spec
29422954
)
29432955

29442956

2945-
def_GetMSBuildProjectConfigurations(configurations):
2957+
def_GetMSBuildProjectConfigurations(configurations, spec):
29462958
group= ["ItemGroup", {"Label": "ProjectConfigurations"}]
29472959
for (name, settings) insorted(configurations.items()):
2948-
configuration, platform=_GetConfigurationAndPlatform(name, settings)
2960+
configuration, platform=_GetConfigurationAndPlatform(name, settings, spec)
29492961
designation="%s|%s"% (configuration, platform)
29502962
group.append(
29512963
[
@@ -3033,7 +3045,7 @@ def _GetMSBuildConfigurationDetails(spec, build_file):
30333045
properties= {}
30343046
forname, settingsinspec["configurations"].items():
30353047
msbuild_attributes=_GetMSBuildAttributes(spec, settings, build_file)
3036-
condition=_GetConfigurationCondition(name, settings)
3048+
condition=_GetConfigurationCondition(name, settings, spec)
30373049
character_set=msbuild_attributes.get("CharacterSet")
30383050
config_type=msbuild_attributes.get("ConfigurationType")
30393051
_AddConditionalProperty(properties, condition, "ConfigurationType", config_type)
@@ -3064,12 +3076,12 @@ def _GetMSBuildLocalProperties(msbuild_toolset):
30643076
returnproperties
30653077

30663078

3067-
def_GetMSBuildPropertySheets(configurations):
3079+
def_GetMSBuildPropertySheets(configurations, spec):
30683080
user_props=r"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
30693081
additional_props= {}
30703082
props_specified=False
30713083
forname, settingsinsorted(configurations.items()):
3072-
configuration=_GetConfigurationCondition(name, settings)
3084+
configuration=_GetConfigurationCondition(name, settings, spec)
30733085
if"msbuild_props"insettings:
30743086
additional_props[configuration] =_FixPaths(settings["msbuild_props"])
30753087
props_specified=True
@@ -3222,7 +3234,7 @@ def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file):
32223234

32233235
properties= {}
32243236
for (name, configuration) insorted(configurations.items()):
3225-
condition=_GetConfigurationCondition(name, configuration)
3237+
condition=_GetConfigurationCondition(name, configuration, spec)
32263238
attributes=_GetMSBuildAttributes(spec, configuration, build_file)
32273239
msbuild_settings=configuration["finalized_msbuild_settings"]
32283240
_AddConditionalProperty(
@@ -3345,7 +3357,7 @@ def _GetMSBuildToolSettingsSections(spec, configurations):
33453357
msbuild_settings=configuration["finalized_msbuild_settings"]
33463358
group= [
33473359
"ItemDefinitionGroup",
3348-
{"Condition": _GetConfigurationCondition(name, configuration)},
3360+
{"Condition": _GetConfigurationCondition(name, configuration, spec)},
33493361
]
33503362
fortool_name, tool_settingsinsorted(msbuild_settings.items()):
33513363
# Skip the tool named '' which is a holder of global settings handled
@@ -3625,7 +3637,7 @@ def _AddSources2(
36253637

36263638
ifprecompiled_source==source:
36273639
condition=_GetConfigurationCondition(
3628-
config_name, configuration
3640+
config_name, configuration, spec
36293641
)
36303642
detail.append(
36313643
["PrecompiledHeader", {"Condition": condition}, "Create"]
@@ -3652,7 +3664,21 @@ def _GetMSBuildProjectReferences(project):
36523664
references= []
36533665
ifproject.dependencies:
36543666
group= ["ItemGroup"]
3667+
added_dependency_set=set()
36553668
fordependencyinproject.dependencies:
3669+
dependency_spec=dependency.spec
3670+
should_skip_dep=False
3671+
ifproject.spec["toolset"] =="target":
3672+
ifdependency_spec["toolset"] =="host":
3673+
ifdependency_spec["type"] =="static_library":
3674+
should_skip_dep=True
3675+
ifdependency.name.startswith("run_"):
3676+
should_skip_dep=False
3677+
ifshould_skip_dep:
3678+
continue
3679+
3680+
canonical_name=dependency.name.replace("_host", "")
3681+
added_dependency_set.add(canonical_name)
36563682
guid=dependency.guid
36573683
project_dir=os.path.split(project.path)[0]
36583684
relative_path=gyp.common.RelativePath(dependency.path, project_dir)
@@ -3675,7 +3701,7 @@ def _GetMSBuildProjectReferences(project):
36753701
returnreferences
36763702

36773703

3678-
def_GenerateMSBuildProject(project, options, version, generator_flags):
3704+
def_GenerateMSBuildProject(project, options, version, generator_flags, spec):
36793705
spec=project.spec
36803706
configurations=spec["configurations"]
36813707
project_dir, project_file_name=os.path.split(project.path)
@@ -3774,7 +3800,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37743800
},
37753801
]
37763802

3777-
content+=_GetMSBuildProjectConfigurations(configurations)
3803+
content+=_GetMSBuildProjectConfigurations(configurations, spec)
37783804
content+=_GetMSBuildGlobalProperties(
37793805
spec, version, project.guid, project_file_name
37803806
)
@@ -3789,7 +3815,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37893815
ifspec.get("msvs_enable_marmasm"):
37903816
content+=import_marmasm_props_section
37913817
content+=_GetMSBuildExtensions(props_files_of_rules)
3792-
content+=_GetMSBuildPropertySheets(configurations)
3818+
content+=_GetMSBuildPropertySheets(configurations, spec)
37933819
content+=macro_section
37943820
content+=_GetMSBuildConfigurationGlobalProperties(
37953821
spec, configurations, project.build_file
@@ -3893,15 +3919,27 @@ def _GenerateActionsForMSBuild(spec, actions_to_add):
38933919
sources_handled_by_action=OrderedSet()
38943920
actions_spec= []
38953921
forprimary_input, actionsinactions_to_add.items():
3922+
ifgenerator_supports_multiple_toolsets:
3923+
primary_input=primary_input.replace(".exe", "_host.exe")
38963924
inputs=OrderedSet()
38973925
outputs=OrderedSet()
38983926
descriptions= []
38993927
commands= []
39003928
foractioninactions:
3929+
3930+
deffixup_host_exe(i):
3931+
if"$(OutDir)"ini:
3932+
i=i.replace(".exe", "_host.exe")
3933+
returni
3934+
3935+
ifgenerator_supports_multiple_toolsets:
3936+
action["inputs"] = [fixup_host_exe(i) foriinaction["inputs"]]
39013937
inputs.update(OrderedSet(action["inputs"]))
39023938
outputs.update(OrderedSet(action["outputs"]))
39033939
descriptions.append(action["description"])
39043940
cmd=action["command"]
3941+
ifgenerator_supports_multiple_toolsets:
3942+
cmd=cmd.replace(".exe", "_host.exe")
39053943
# For most actions, add 'call' so that actions that invoke batch files
39063944
# return and continue executing. msbuild_use_call provides a way to
39073945
# disable this but I have not seen any adverse effect from doing that

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Commit 3baa4e4

Browse files
MarshallOfSoundrvagg
authored andcommitted
gyp: update gyp to 0.4.0
Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> PR-URL: #2165
1 parent f461d56 commit 3baa4e4

10 files changed

Lines changed: 162 additions & 67 deletions

File tree

‎gyp/.github/workflows/Python_tests.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
os: [macos-latest, ubuntu-latest] # , windows-latest]
1515
python-version: [2.7, 3.6, 3.7, 3.8] # 3.5,
1616
steps:
17-
- uses: actions/checkout@v1
17+
- uses: actions/checkout@v2
1818
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v1
19+
uses: actions/setup-python@v2
2020
with:
2121
python-version: ${{ matrix.python-version }}
2222
- name: Install dependencies

‎gyp/CHANGELOG.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6+
7+
## [Unreleased]
8+
9+
## [0.4.0] - 2020-07-14
10+
11+
### Added
12+
- Added support for passing arbitrary architectures to Xcode builds, enables `arm64` builds.
13+
14+
### Fixed
15+
- Fixed a bug on Solaris where copying archives failed.
16+
17+
## [0.3.0] - 2020-06-06
18+
19+
### Added
20+
- Added support for MSVC cross-compilation. This allows compilation on x64 for
21+
a Windows ARM target.
22+
23+
### Fixed
24+
- Fixed XCode CLT version detection on macOS Catalina.
25+
26+
## [0.2.1] - 2020-05-05
27+
28+
### Fixed
29+
- Relicensed to Node.js contributors.
30+
- Fixed Windows bug introduced in v0.2.0.
31+
32+
## [0.2.0] - 2020-04-06
33+
34+
This is the first release of this project, based on https://chromium.googlesource.com/external/gyp
35+
with changes made over the years in Node.js and node-gyp.
36+
37+
[Unreleased]: https://github.com/nodejs/gyp-next/compare/v0.4.0...HEAD
38+
[0.4.0]: https://github.com/nodejs/gyp-next/compare/v0.3.0...v0.4.0
39+
[0.3.0]: https://github.com/nodejs/gyp-next/compare/v0.2.1...v0.3.0
40+
[0.2.1]: https://github.com/nodejs/gyp-next/compare/v0.2.0...v0.2.1
41+
[0.2.0]: https://github.com/nodejs/gyp-next/releases/tag/v0.2.0

‎gyp/pylib/gyp/generator/android.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,9 @@ def WriteList(
981981
"""
982982
values=""
983983
ifvalue_list:
984-
value_list= [quoter(prefix+l) forlinvalue_list]
984+
value_list= [quoter(prefix+value) forvalueinvalue_list]
985985
iflocal_pathify:
986-
value_list= [self.LocalPathify(l) forlinvalue_list]
986+
value_list= [self.LocalPathify(value) forvalueinvalue_list]
987987
values=" \\\n\t"+" \\\n\t".join(value_list)
988988
self.fp.write("%s :=%s\n\n"% (variable, values))
989989

‎gyp/pylib/gyp/generator/make.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ def WriteSources(
13421342
)
13431343

13441344
ifself.flavor=="mac":
1345-
cflags=self.xcode_settings.GetCflags(configname)
1345+
cflags=self.xcode_settings.GetCflags(configname, arch=config.get('xcode_configuration_platform'))
13461346
cflags_c=self.xcode_settings.GetCflagsC(configname)
13471347
cflags_cc=self.xcode_settings.GetCflagsCC(configname)
13481348
cflags_objc=self.xcode_settings.GetCflagsObjC(configname)
@@ -1637,6 +1637,7 @@ def WriteTarget(
16371637
configname,
16381638
generator_default_variables["PRODUCT_DIR"],
16391639
lambdap: Sourceify(self.Absolutify(p)),
1640+
arch=config.get('xcode_configuration_platform')
16401641
)
16411642

16421643
# TARGET_POSTBUILDS_$(BUILDTYPE) is added to postbuilds later on.
@@ -1944,7 +1945,7 @@ def WriteList(self, value_list, variable=None, prefix="", quoter=QuoteIfNecessar
19441945
"""
19451946
values=""
19461947
ifvalue_list:
1947-
value_list= [quoter(prefix+l) forlinvalue_list]
1948+
value_list= [quoter(prefix+value) forvalueinvalue_list]
19481949
values=" \\\n\t"+" \\\n\t".join(value_list)
19491950
self.fp.write("%s :=%s\n\n"% (variable, values))
19501951

@@ -2362,7 +2363,14 @@ def CalculateMakefilePath(build_file, base_name):
23622363
}
23632364
)
23642365
elifflavor=="solaris":
2365-
header_params.update({"flock": "./gyp-flock-tool flock", "flock_index": 2})
2366+
copy_archive_arguments="-pPRf@"
2367+
header_params.update(
2368+
{
2369+
"copy_archive_args": copy_archive_arguments,
2370+
"flock": "./gyp-flock-tool flock",
2371+
"flock_index": 2
2372+
}
2373+
)
23662374
elifflavor=="freebsd":
23672375
# Note: OpenBSD has sysutils/flock. lockf seems to be FreeBSD specific.
23682376
header_params.update({"flock": "lockf"})

‎gyp/pylib/gyp/generator/msvs.py‎

Lines changed: 67 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
# letters.
4040
VALID_MSVS_GUID_CHARS=re.compile(r"^[A-F0-9\-]+$")
4141

42+
generator_supports_multiple_toolsets=gyp.common.CrossCompileRequested()
4243

4344
generator_default_variables= {
4445
"DRIVER_PREFIX": "",
@@ -50,7 +51,7 @@
5051
"STATIC_LIB_SUFFIX": ".lib",
5152
"SHARED_LIB_SUFFIX": ".dll",
5253
"INTERMEDIATE_DIR": "$(IntDir)",
53-
"SHARED_INTERMEDIATE_DIR": "$(OutDir)obj/global_intermediate",
54+
"SHARED_INTERMEDIATE_DIR": "$(OutDir)/obj/global_intermediate",
5455
"OS": "win",
5556
"PRODUCT_DIR": "$(OutDir)",
5657
"LIB_DIR": "$(OutDir)lib",
@@ -1005,7 +1006,7 @@ def _GetMsbuildToolsetOfProject(proj_path, spec, version):
10051006
returntoolset
10061007

10071008

1008-
def_GenerateProject(project, options, version, generator_flags):
1009+
def_GenerateProject(project, options, version, generator_flags, spec):
10091010
"""Generates a vcproj file.
10101011
10111012
Arguments:
@@ -1023,7 +1024,7 @@ def _GenerateProject(project, options, version, generator_flags):
10231024
return []
10241025

10251026
ifversion.UsesVcxproj():
1026-
return_GenerateMSBuildProject(project, options, version, generator_flags)
1027+
return_GenerateMSBuildProject(project, options, version, generator_flags, spec)
10271028
else:
10281029
return_GenerateMSVSProject(project, options, version, generator_flags)
10291030

@@ -1903,6 +1904,8 @@ def _GatherSolutionFolders(sln_projects, project_objects, flat):
19031904
# Convert into a tree of dicts on path.
19041905
forpinsln_projects:
19051906
gyp_file, target=gyp.common.ParseQualifiedTarget(p)[0:2]
1907+
ifp.endswith("#host"):
1908+
target+="_host"
19061909
gyp_dir=os.path.dirname(gyp_file)
19071910
path_dict=_GetPathDict(root, gyp_dir)
19081911
path_dict[target+".vcproj"] =project_objects[p]
@@ -1921,9 +1924,10 @@ def _GetPathOfProject(qualified_target, spec, options, msvs_version):
19211924
default_config=_GetDefaultConfiguration(spec)
19221925
proj_filename=default_config.get("msvs_existing_vcproj")
19231926
ifnotproj_filename:
1924-
proj_filename= (
1925-
spec["target_name"] +options.suffix+msvs_version.ProjectExtension()
1926-
)
1927+
proj_filename=spec["target_name"]
1928+
ifspec["toolset"] =="host":
1929+
proj_filename+="_host"
1930+
proj_filename=proj_filename+options.suffix+msvs_version.ProjectExtension()
19271931

19281932
build_file=gyp.common.BuildFile(qualified_target)
19291933
proj_path=os.path.join(os.path.dirname(build_file), proj_filename)
@@ -1948,6 +1952,8 @@ def _GetPlatformOverridesOfProject(spec):
19481952
_ConfigBaseName(config_name, _ConfigPlatform(c)),
19491953
platform,
19501954
)
1955+
ifspec["toolset"] =="host"andgenerator_supports_multiple_toolsets:
1956+
fixed_config_fullname="%s|x64"% (config_name,)
19511957
config_platform_overrides[config_fullname] =fixed_config_fullname
19521958
returnconfig_platform_overrides
19531959

@@ -1968,21 +1974,19 @@ def _CreateProjectObjects(target_list, target_dicts, options, msvs_version):
19681974
projects= {}
19691975
forqualified_targetintarget_list:
19701976
spec=target_dicts[qualified_target]
1971-
ifspec["toolset"] !="target":
1972-
raiseGypError(
1973-
"Multiple toolsets not supported in msvs build (target %s)"
1974-
%qualified_target
1975-
)
19761977
proj_path, fixpath_prefix=_GetPathOfProject(
19771978
qualified_target, spec, options, msvs_version
19781979
)
19791980
guid=_GetGuidOfProject(proj_path, spec)
19801981
overrides=_GetPlatformOverridesOfProject(spec)
19811982
build_file=gyp.common.BuildFile(qualified_target)
19821983
# Create object for this project.
1984+
target_name=spec["target_name"]
1985+
ifspec["toolset"] =="host":
1986+
target_name+="_host"
19831987
obj=MSVSNew.MSVSProject(
19841988
proj_path,
1985-
name=spec["target_name"],
1989+
name=target_name,
19861990
guid=guid,
19871991
spec=spec,
19881992
build_file=build_file,
@@ -2161,7 +2165,10 @@ def GenerateOutput(target_list, target_dicts, data, params):
21612165
forqualified_targetintarget_list:
21622166
spec=target_dicts[qualified_target]
21632167
forconfig_name, configinspec["configurations"].items():
2164-
configs.add(_ConfigFullName(config_name, config))
2168+
config_name=_ConfigFullName(config_name, config)
2169+
configs.add(config_name)
2170+
ifconfig_name=="Release|arm64":
2171+
configs.add("Release|x64")
21652172
configs=list(configs)
21662173

21672174
# Figure out all the projects that will be generated and their guids
@@ -2174,12 +2181,15 @@ def GenerateOutput(target_list, target_dicts, data, params):
21742181
forprojectinproject_objects.values():
21752182
fixpath_prefix=project.fixpath_prefix
21762183
missing_sources.extend(
2177-
_GenerateProject(project, options, msvs_version, generator_flags)
2184+
_GenerateProject(project, options, msvs_version, generator_flags, spec)
21782185
)
21792186
fixpath_prefix=None
21802187

21812188
forbuild_fileindata:
21822189
# Validate build_file extension
2190+
target_only_configs=configs
2191+
ifgenerator_supports_multiple_toolsets:
2192+
target_only_configs= [iforiinconfigsifi.endswith("arm64")]
21832193
ifnotbuild_file.endswith(".gyp"):
21842194
continue
21852195
sln_path=os.path.splitext(build_file)[0] +options.suffix+".sln"
@@ -2196,7 +2206,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
21962206
sln=MSVSNew.MSVSSolution(
21972207
sln_path,
21982208
entries=root_entries,
2199-
variants=configs,
2209+
variants=target_only_configs,
22002210
websiteProperties=False,
22012211
version=msvs_version,
22022212
)
@@ -2930,22 +2940,24 @@ def _GenerateMSBuildRuleXmlFile(xml_path, msbuild_rules):
29302940
easy_xml.WriteXmlIfChanged(content, xml_path, pretty=True, win32=True)
29312941

29322942

2933-
def_GetConfigurationAndPlatform(name, settings):
2943+
def_GetConfigurationAndPlatform(name, settings, spec):
29342944
configuration=name.rsplit("_", 1)[0]
29352945
platform=settings.get("msvs_configuration_platform", "Win32")
2946+
ifspec["toolset"] =="host"andplatform=="arm64":
2947+
platform="x64"# Host-only tools are always built for x64
29362948
return (configuration, platform)
29372949

29382950

2939-
def_GetConfigurationCondition(name, settings):
2951+
def_GetConfigurationCondition(name, settings, spec):
29402952
returnr"'$(Configuration)|$(Platform)'=='%s|%s'"%_GetConfigurationAndPlatform(
2941-
name, settings
2953+
name, settings, spec
29422954
)
29432955

29442956

2945-
def_GetMSBuildProjectConfigurations(configurations):
2957+
def_GetMSBuildProjectConfigurations(configurations, spec):
29462958
group= ["ItemGroup", {"Label": "ProjectConfigurations"}]
29472959
for (name, settings) insorted(configurations.items()):
2948-
configuration, platform=_GetConfigurationAndPlatform(name, settings)
2960+
configuration, platform=_GetConfigurationAndPlatform(name, settings, spec)
29492961
designation="%s|%s"% (configuration, platform)
29502962
group.append(
29512963
[
@@ -3033,7 +3045,7 @@ def _GetMSBuildConfigurationDetails(spec, build_file):
30333045
properties= {}
30343046
forname, settingsinspec["configurations"].items():
30353047
msbuild_attributes=_GetMSBuildAttributes(spec, settings, build_file)
3036-
condition=_GetConfigurationCondition(name, settings)
3048+
condition=_GetConfigurationCondition(name, settings, spec)
30373049
character_set=msbuild_attributes.get("CharacterSet")
30383050
config_type=msbuild_attributes.get("ConfigurationType")
30393051
_AddConditionalProperty(properties, condition, "ConfigurationType", config_type)
@@ -3064,12 +3076,12 @@ def _GetMSBuildLocalProperties(msbuild_toolset):
30643076
returnproperties
30653077

30663078

3067-
def_GetMSBuildPropertySheets(configurations):
3079+
def_GetMSBuildPropertySheets(configurations, spec):
30683080
user_props=r"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
30693081
additional_props= {}
30703082
props_specified=False
30713083
forname, settingsinsorted(configurations.items()):
3072-
configuration=_GetConfigurationCondition(name, settings)
3084+
configuration=_GetConfigurationCondition(name, settings, spec)
30733085
if"msbuild_props"insettings:
30743086
additional_props[configuration] =_FixPaths(settings["msbuild_props"])
30753087
props_specified=True
@@ -3222,7 +3234,7 @@ def _GetMSBuildConfigurationGlobalProperties(spec, configurations, build_file):
32223234

32233235
properties= {}
32243236
for (name, configuration) insorted(configurations.items()):
3225-
condition=_GetConfigurationCondition(name, configuration)
3237+
condition=_GetConfigurationCondition(name, configuration, spec)
32263238
attributes=_GetMSBuildAttributes(spec, configuration, build_file)
32273239
msbuild_settings=configuration["finalized_msbuild_settings"]
32283240
_AddConditionalProperty(
@@ -3345,7 +3357,7 @@ def _GetMSBuildToolSettingsSections(spec, configurations):
33453357
msbuild_settings=configuration["finalized_msbuild_settings"]
33463358
group= [
33473359
"ItemDefinitionGroup",
3348-
{"Condition": _GetConfigurationCondition(name, configuration)},
3360+
{"Condition": _GetConfigurationCondition(name, configuration, spec)},
33493361
]
33503362
fortool_name, tool_settingsinsorted(msbuild_settings.items()):
33513363
# Skip the tool named '' which is a holder of global settings handled
@@ -3625,7 +3637,7 @@ def _AddSources2(
36253637

36263638
ifprecompiled_source==source:
36273639
condition=_GetConfigurationCondition(
3628-
config_name, configuration
3640+
config_name, configuration, spec
36293641
)
36303642
detail.append(
36313643
["PrecompiledHeader", {"Condition": condition}, "Create"]
@@ -3652,7 +3664,21 @@ def _GetMSBuildProjectReferences(project):
36523664
references= []
36533665
ifproject.dependencies:
36543666
group= ["ItemGroup"]
3667+
added_dependency_set=set()
36553668
fordependencyinproject.dependencies:
3669+
dependency_spec=dependency.spec
3670+
should_skip_dep=False
3671+
ifproject.spec["toolset"] =="target":
3672+
ifdependency_spec["toolset"] =="host":
3673+
ifdependency_spec["type"] =="static_library":
3674+
should_skip_dep=True
3675+
ifdependency.name.startswith("run_"):
3676+
should_skip_dep=False
3677+
ifshould_skip_dep:
3678+
continue
3679+
3680+
canonical_name=dependency.name.replace("_host", "")
3681+
added_dependency_set.add(canonical_name)
36563682
guid=dependency.guid
36573683
project_dir=os.path.split(project.path)[0]
36583684
relative_path=gyp.common.RelativePath(dependency.path, project_dir)
@@ -3675,7 +3701,7 @@ def _GetMSBuildProjectReferences(project):
36753701
returnreferences
36763702

36773703

3678-
def_GenerateMSBuildProject(project, options, version, generator_flags):
3704+
def_GenerateMSBuildProject(project, options, version, generator_flags, spec):
36793705
spec=project.spec
36803706
configurations=spec["configurations"]
36813707
project_dir, project_file_name=os.path.split(project.path)
@@ -3774,7 +3800,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37743800
},
37753801
]
37763802

3777-
content+=_GetMSBuildProjectConfigurations(configurations)
3803+
content+=_GetMSBuildProjectConfigurations(configurations, spec)
37783804
content+=_GetMSBuildGlobalProperties(
37793805
spec, version, project.guid, project_file_name
37803806
)
@@ -3789,7 +3815,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
37893815
ifspec.get("msvs_enable_marmasm"):
37903816
content+=import_marmasm_props_section
37913817
content+=_GetMSBuildExtensions(props_files_of_rules)
3792-
content+=_GetMSBuildPropertySheets(configurations)
3818+
content+=_GetMSBuildPropertySheets(configurations, spec)
37933819
content+=macro_section
37943820
content+=_GetMSBuildConfigurationGlobalProperties(
37953821
spec, configurations, project.build_file
@@ -3893,15 +3919,27 @@ def _GenerateActionsForMSBuild(spec, actions_to_add):
38933919
sources_handled_by_action=OrderedSet()
38943920
actions_spec= []
38953921
forprimary_input, actionsinactions_to_add.items():
3922+
ifgenerator_supports_multiple_toolsets:
3923+
primary_input=primary_input.replace(".exe", "_host.exe")
38963924
inputs=OrderedSet()
38973925
outputs=OrderedSet()
38983926
descriptions= []
38993927
commands= []
39003928
foractioninactions:
3929+
3930+
deffixup_host_exe(i):
3931+
if"$(OutDir)"ini:
3932+
i=i.replace(".exe", "_host.exe")
3933+
returni
3934+
3935+
ifgenerator_supports_multiple_toolsets:
3936+
action["inputs"] = [fixup_host_exe(i) foriinaction["inputs"]]
39013937
inputs.update(OrderedSet(action["inputs"]))
39023938
outputs.update(OrderedSet(action["outputs"]))
39033939
descriptions.append(action["description"])
39043940
cmd=action["command"]
3941+
ifgenerator_supports_multiple_toolsets:
3942+
cmd=cmd.replace(".exe", "_host.exe")
39053943
# For most actions, add 'call' so that actions that invoke batch files
39063944
# return and continue executing. msbuild_use_call provides a way to
39073945
# disable this but I have not seen any adverse effect from doing that

0 commit comments

Comments
 (0)