summaryrefslogtreecommitdiff
path: root/tools/gyp
diff options
context:
space:
mode:
authorJon Kunkee <jkunkee@microsoft.com>2018-12-31 16:26:22 -0800
committerJoão Reis <reis@janeasystems.com>2019-04-11 17:44:10 +0100
commit06c10cdc4c20e46885e3af94281ec63cda5e7712 (patch)
tree27ff13928621221c72de56e58affd905e376829d /tools/gyp
parentee7daf76c01cdcd4a9ff1a7d1f2591b0886afba3 (diff)
downloadandroid-node-v8-06c10cdc4c20e46885e3af94281ec63cda5e7712.tar.gz
android-node-v8-06c10cdc4c20e46885e3af94281ec63cda5e7712.tar.bz2
android-node-v8-06c10cdc4c20e46885e3af94281ec63cda5e7712.zip
build,win: teach GYP MSVS generator about MARMASM
The toolchain for ARM64 Windows includes support for assembly code, but with a very different syntax from MASM and NASM. This change teaches GYP how to emit the right XML tags in VCXPROJ files to support compiling assembly files with the new tool. PR-URL: https://github.com/nodejs/node/pull/26020 Refs: https://github.com/nodejs/node/issues/25998 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: João Reis <reis@janeasystems.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'tools/gyp')
-rw-r--r--tools/gyp/pylib/gyp/MSVSSettings.py2
-rw-r--r--tools/gyp/pylib/gyp/generator/msvs.py31
2 files changed, 25 insertions, 8 deletions
diff --git a/tools/gyp/pylib/gyp/MSVSSettings.py b/tools/gyp/pylib/gyp/MSVSSettings.py
index 99c53a8570..58ce0bb1ed 100644
--- a/tools/gyp/pylib/gyp/MSVSSettings.py
+++ b/tools/gyp/pylib/gyp/MSVSSettings.py
@@ -539,6 +539,7 @@ _rc = _Tool('VCResourceCompilerTool', 'ResourceCompile')
_lib = _Tool('VCLibrarianTool', 'Lib')
_manifest = _Tool('VCManifestTool', 'Manifest')
_masm = _Tool('MASM', 'MASM')
+_armasm = _Tool('ARMASM', 'ARMASM')
_AddTool(_compile)
@@ -548,6 +549,7 @@ _AddTool(_rc)
_AddTool(_lib)
_AddTool(_manifest)
_AddTool(_masm)
+_AddTool(_armasm)
# Add sections only found in the MSBuild settings.
_msbuild_validators[''] = {}
_msbuild_validators['ProjectReference'] = {}
diff --git a/tools/gyp/pylib/gyp/generator/msvs.py b/tools/gyp/pylib/gyp/generator/msvs.py
index 923e897e48..dbde9e279e 100644
--- a/tools/gyp/pylib/gyp/generator/msvs.py
+++ b/tools/gyp/pylib/gyp/generator/msvs.py
@@ -2076,7 +2076,8 @@ def GenerateOutput(target_list, target_dicts, data, params):
def _GenerateMSBuildFiltersFile(filters_path, source_files,
- rule_dependencies, extension_to_rule_name):
+ rule_dependencies, extension_to_rule_name,
+ platforms):
"""Generate the filters file.
This file is used by Visual Studio to organize the presentation of source
@@ -2090,7 +2091,8 @@ def _GenerateMSBuildFiltersFile(filters_path, source_files,
filter_group = []
source_group = []
_AppendFiltersForMSBuild('', source_files, rule_dependencies,
- extension_to_rule_name, filter_group, source_group)
+ extension_to_rule_name, platforms,
+ filter_group, source_group)
if filter_group:
content = ['Project',
{'ToolsVersion': '4.0',
@@ -2106,7 +2108,7 @@ def _GenerateMSBuildFiltersFile(filters_path, source_files,
def _AppendFiltersForMSBuild(parent_filter_name, sources, rule_dependencies,
- extension_to_rule_name,
+ extension_to_rule_name, platforms,
filter_group, source_group):
"""Creates the list of filters and sources to be added in the filter file.
@@ -2132,11 +2134,12 @@ def _AppendFiltersForMSBuild(parent_filter_name, sources, rule_dependencies,
# Recurse and add its dependents.
_AppendFiltersForMSBuild(filter_name, source.contents,
rule_dependencies, extension_to_rule_name,
- filter_group, source_group)
+ platforms, filter_group, source_group)
else:
# It's a source. Create a source entry.
_, element = _MapFileToMsBuildSourceType(source, rule_dependencies,
- extension_to_rule_name)
+ extension_to_rule_name,
+ platforms)
source_entry = [element, {'Include': source}]
# Specify the filter it is part of, if any.
if parent_filter_name:
@@ -2145,7 +2148,7 @@ def _AppendFiltersForMSBuild(parent_filter_name, sources, rule_dependencies,
def _MapFileToMsBuildSourceType(source, rule_dependencies,
- extension_to_rule_name):
+ extension_to_rule_name, platforms):
"""Returns the group and element type of the source file.
Arguments:
@@ -2172,6 +2175,9 @@ def _MapFileToMsBuildSourceType(source, rule_dependencies,
elif ext in ['.s', '.asm']:
group = 'masm'
element = 'MASM'
+ for platform in platforms:
+ if platform.lower() in ['arm', 'arm64']:
+ element = 'MARMASM'
elif ext == '.idl':
group = 'midl'
element = 'Midl'
@@ -3275,7 +3281,8 @@ def _AddSources2(spec, sources, exclusions, grouped_sources,
detail.append(['ForcedIncludeFiles', ''])
group, element = _MapFileToMsBuildSourceType(source, rule_dependencies,
- extension_to_rule_name)
+ extension_to_rule_name,
+ _GetUniquePlatforms(spec))
grouped_sources[group].append([element, {'Include': source}] + detail)
@@ -3358,7 +3365,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
_GenerateMSBuildFiltersFile(project.path + '.filters', sources,
rule_dependencies,
- extension_to_rule_name)
+ extension_to_rule_name, _GetUniquePlatforms(spec))
missing_sources = _VerifySourcesExist(sources, project_dir)
for configuration in configurations.itervalues():
@@ -3378,6 +3385,12 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
import_masm_targets_section = [
['Import',
{'Project': r'$(VCTargetsPath)\BuildCustomizations\masm.targets'}]]
+ import_marmasm_props_section = [
+ ['Import',
+ {'Project': r'$(VCTargetsPath)\BuildCustomizations\marmasm.props'}]]
+ import_marmasm_targets_section = [
+ ['Import',
+ {'Project': r'$(VCTargetsPath)\BuildCustomizations\marmasm.targets'}]]
macro_section = [['PropertyGroup', {'Label': 'UserMacros'}]]
content = [
@@ -3398,6 +3411,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
content += _GetMSBuildLocalProperties(project.msbuild_toolset)
content += import_cpp_props_section
content += import_masm_props_section
+ content += import_marmasm_props_section
content += _GetMSBuildExtensions(props_files_of_rules)
content += _GetMSBuildPropertySheets(configurations)
content += macro_section
@@ -3410,6 +3424,7 @@ def _GenerateMSBuildProject(project, options, version, generator_flags):
content += _GetMSBuildProjectReferences(project)
content += import_cpp_targets_section
content += import_masm_targets_section
+ content += import_marmasm_targets_section
content += _GetMSBuildExtensionTargets(targets_files_of_rules)
if spec.get('msvs_external_builder'):