mirror of
https://github.com/electron/node-gyp.git
synced 2025-08-15 12:58:19 +02:00
gyp: teach MSVS generator about MARMASM Items
This change allows MSVS projects generated for ARM64 to include ASM files. PR-URL: https://github.com/nodejs/node-gyp/pull/1679 Reviewed-By: João Reis <reis@janeasystems.com>
This commit is contained in:
parent
91744bfecc
commit
721eb691cf
2 changed files with 25 additions and 8 deletions
|
@ -543,6 +543,7 @@ _rc = _Tool('VCResourceCompilerTool', 'ResourceCompile')
|
|||
_lib = _Tool('VCLibrarianTool', 'Lib')
|
||||
_manifest = _Tool('VCManifestTool', 'Manifest')
|
||||
_masm = _Tool('MASM', 'MASM')
|
||||
_armasm = _Tool('ARMASM', 'ARMASM')
|
||||
|
||||
|
||||
_AddTool(_compile)
|
||||
|
@ -552,6 +553,7 @@ _AddTool(_rc)
|
|||
_AddTool(_lib)
|
||||
_AddTool(_manifest)
|
||||
_AddTool(_masm)
|
||||
_AddTool(_armasm)
|
||||
# Add sections only found in the MSBuild settings.
|
||||
_msbuild_validators[''] = {}
|
||||
_msbuild_validators['ProjectReference'] = {}
|
||||
|
|
|
@ -2039,7 +2039,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
|
||||
|
@ -2053,7 +2054,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',
|
||||
|
@ -2069,7 +2071,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.
|
||||
|
||||
|
@ -2095,11 +2097,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:
|
||||
|
@ -2108,7 +2111,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:
|
||||
|
@ -2134,6 +2137,9 @@ def _MapFileToMsBuildSourceType(source, rule_dependencies,
|
|||
elif ext == '.asm':
|
||||
group = 'masm'
|
||||
element = 'MASM'
|
||||
for platform in platforms:
|
||||
if platform.lower() in ['arm', 'arm64']:
|
||||
element = 'MARMASM'
|
||||
elif ext == '.idl':
|
||||
group = 'midl'
|
||||
element = 'Midl'
|
||||
|
@ -3227,7 +3233,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)
|
||||
|
||||
|
||||
|
@ -3310,7 +3317,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():
|
||||
|
@ -3330,6 +3337,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 = [
|
||||
|
@ -3349,6 +3362,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
|
||||
|
@ -3361,6 +3375,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'):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue