|
|
@ -39,6 +39,7 @@ class Vs2010Backend(backends.Backend): |
|
|
|
super().__init__(build) |
|
|
|
super().__init__(build) |
|
|
|
self.project_file_version = '10.0.30319.1' |
|
|
|
self.project_file_version = '10.0.30319.1' |
|
|
|
self.sources_conflicts = {} |
|
|
|
self.sources_conflicts = {} |
|
|
|
|
|
|
|
self.platform_toolset = None |
|
|
|
|
|
|
|
|
|
|
|
def object_filename_from_source(self, target, source): |
|
|
|
def object_filename_from_source(self, target, source): |
|
|
|
basename = os.path.basename(source.fname) |
|
|
|
basename = os.path.basename(source.fname) |
|
|
@ -309,6 +310,8 @@ class Vs2010Backend(backends.Backend): |
|
|
|
ET.SubElement(type_config, 'ConfigurationType') |
|
|
|
ET.SubElement(type_config, 'ConfigurationType') |
|
|
|
ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte' |
|
|
|
ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte' |
|
|
|
ET.SubElement(type_config, 'UseOfMfc').text = 'false' |
|
|
|
ET.SubElement(type_config, 'UseOfMfc').text = 'false' |
|
|
|
|
|
|
|
if self.platform_toolset: |
|
|
|
|
|
|
|
ET.SubElement(type_config, 'PlatformToolset').text = self.platform_toolset |
|
|
|
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.props') |
|
|
|
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.props') |
|
|
|
direlem = ET.SubElement(root, 'PropertyGroup') |
|
|
|
direlem = ET.SubElement(root, 'PropertyGroup') |
|
|
|
fver = ET.SubElement(direlem, '_ProjectFileVersion') |
|
|
|
fver = ET.SubElement(direlem, '_ProjectFileVersion') |
|
|
@ -385,6 +388,18 @@ class Vs2010Backend(backends.Backend): |
|
|
|
lang = Vs2010Backend.lang_from_source_file(source_file) |
|
|
|
lang = Vs2010Backend.lang_from_source_file(source_file) |
|
|
|
ET.SubElement(parent_node, "AdditionalOptions").text = ' '.join(extra_args[lang]) + ' %(AdditionalOptions)' |
|
|
|
ET.SubElement(parent_node, "AdditionalOptions").text = ' '.join(extra_args[lang]) + ' %(AdditionalOptions)' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
|
|
def has_objects(objects, additional_objects, generated_objects): |
|
|
|
|
|
|
|
# Ignore generated objects, those are automatically used by MSBuild for VS2010, because they are part of |
|
|
|
|
|
|
|
# the CustomBuildStep Outputs. |
|
|
|
|
|
|
|
return len(objects) + len(additional_objects) > 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
|
|
def add_generated_objects(node, generated_objects): |
|
|
|
|
|
|
|
# Do not add generated objects to project file. Those are automatically used by MSBuild for VS2010, because |
|
|
|
|
|
|
|
# they are part of the CustomBuildStep Outputs. |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
@classmethod |
|
|
|
def quote_define_cmdline(cls, arg): |
|
|
|
def quote_define_cmdline(cls, arg): |
|
|
|
return re.sub(r'^([-/])D(.*?)="(.*)"$', r'\1D\2=\"\3\"', arg) |
|
|
|
return re.sub(r'^([-/])D(.*?)="(.*)"$', r'\1D\2=\"\3\"', arg) |
|
|
@ -441,6 +456,8 @@ class Vs2010Backend(backends.Backend): |
|
|
|
type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration') |
|
|
|
type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration') |
|
|
|
ET.SubElement(type_config, 'ConfigurationType').text = conftype |
|
|
|
ET.SubElement(type_config, 'ConfigurationType').text = conftype |
|
|
|
ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte' |
|
|
|
ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte' |
|
|
|
|
|
|
|
if self.platform_toolset: |
|
|
|
|
|
|
|
ET.SubElement(type_config, 'PlatformToolset').text = self.platform_toolset |
|
|
|
ET.SubElement(type_config, 'WholeProgramOptimization').text = 'false' |
|
|
|
ET.SubElement(type_config, 'WholeProgramOptimization').text = 'false' |
|
|
|
ET.SubElement(type_config, 'UseDebugLibraries').text = 'true' |
|
|
|
ET.SubElement(type_config, 'UseDebugLibraries').text = 'true' |
|
|
|
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.props') |
|
|
|
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.props') |
|
|
@ -641,15 +658,15 @@ class Vs2010Backend(backends.Backend): |
|
|
|
pch_file.text = os.path.split(header)[1] |
|
|
|
pch_file.text = os.path.split(header)[1] |
|
|
|
self.add_additional_options(impl, inc_cl, extra_args, additional_options_set) |
|
|
|
self.add_additional_options(impl, inc_cl, extra_args, additional_options_set) |
|
|
|
|
|
|
|
|
|
|
|
if len(objects) + len(additional_objects) > 0: |
|
|
|
if self.has_objects(objects, additional_objects, gen_objs): |
|
|
|
# Do not add gen_objs to project file. Those are automatically used by MSBuild, because they are part of |
|
|
|
|
|
|
|
# the CustomBuildStep Outputs. |
|
|
|
|
|
|
|
inc_objs = ET.SubElement(root, 'ItemGroup') |
|
|
|
inc_objs = ET.SubElement(root, 'ItemGroup') |
|
|
|
for s in objects: |
|
|
|
for s in objects: |
|
|
|
relpath = s.rel_to_builddir(proj_to_src_root) |
|
|
|
relpath = s.rel_to_builddir(proj_to_src_root) |
|
|
|
ET.SubElement(inc_objs, 'Object', Include=relpath) |
|
|
|
ET.SubElement(inc_objs, 'Object', Include=relpath) |
|
|
|
for s in additional_objects: |
|
|
|
for s in additional_objects: |
|
|
|
ET.SubElement(inc_objs, 'Object', Include=s) |
|
|
|
ET.SubElement(inc_objs, 'Object', Include=s) |
|
|
|
|
|
|
|
self.add_generated_objects(inc_objs, gen_objs) |
|
|
|
|
|
|
|
|
|
|
|
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.targets') |
|
|
|
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.targets') |
|
|
|
# Reference the regen target. |
|
|
|
# Reference the regen target. |
|
|
|
ig = ET.SubElement(root, 'ItemGroup') |
|
|
|
ig = ET.SubElement(root, 'ItemGroup') |
|
|
@ -691,6 +708,8 @@ class Vs2010Backend(backends.Backend): |
|
|
|
ET.SubElement(type_config, 'ConfigurationType').text = "Utility" |
|
|
|
ET.SubElement(type_config, 'ConfigurationType').text = "Utility" |
|
|
|
ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte' |
|
|
|
ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte' |
|
|
|
ET.SubElement(type_config, 'UseOfMfc').text = 'false' |
|
|
|
ET.SubElement(type_config, 'UseOfMfc').text = 'false' |
|
|
|
|
|
|
|
if self.platform_toolset: |
|
|
|
|
|
|
|
ET.SubElement(type_config, 'PlatformToolset').text = self.platform_toolset |
|
|
|
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.props') |
|
|
|
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.props') |
|
|
|
direlem = ET.SubElement(root, 'PropertyGroup') |
|
|
|
direlem = ET.SubElement(root, 'PropertyGroup') |
|
|
|
fver = ET.SubElement(direlem, '_ProjectFileVersion') |
|
|
|
fver = ET.SubElement(direlem, '_ProjectFileVersion') |
|
|
@ -768,6 +787,8 @@ if %%errorlevel%% neq 0 goto :VCEnd''' |
|
|
|
ET.SubElement(type_config, 'ConfigurationType') |
|
|
|
ET.SubElement(type_config, 'ConfigurationType') |
|
|
|
ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte' |
|
|
|
ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte' |
|
|
|
ET.SubElement(type_config, 'UseOfMfc').text = 'false' |
|
|
|
ET.SubElement(type_config, 'UseOfMfc').text = 'false' |
|
|
|
|
|
|
|
if self.platform_toolset: |
|
|
|
|
|
|
|
ET.SubElement(type_config, 'PlatformToolset').text = self.platform_toolset |
|
|
|
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.props') |
|
|
|
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.props') |
|
|
|
direlem = ET.SubElement(root, 'PropertyGroup') |
|
|
|
direlem = ET.SubElement(root, 'PropertyGroup') |
|
|
|
fver = ET.SubElement(direlem, '_ProjectFileVersion') |
|
|
|
fver = ET.SubElement(direlem, '_ProjectFileVersion') |
|
|
|