VisualGDB and property sheets

Sysprogs forums Forums VisualGDB VisualGDB and property sheets

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #27608
    victor_s
    Participant

    Hello.

    We work with large Visual studio 2017 solution (around 30 vcxproj) with a few thousands files. Our project is multiplatform and one of the platforms is VisualGDB (Linux, MsBuild). For maintaining large amount of vcxproj, we use property page sheets (It can be added by “Property Manager” tab). Somehow it doesn’t work with VisualGDB (it can be added, but doesn’t allow configuration). Is it something that can be done?

    #27612
    support
    Keymaster

    Hi,

    The property sheets would still work with VisualGDB (as long as you are using MSBuild), however the VS GUI for editing them may indeed not work, as it appears to be specific to the regular MSBuild backend.

    The easiest way to add meaningful settings to a property sheet would be to first set them on a specific project, and then copy the <ItemDefinitionGroup> items from the project to the property sheet (do not forget to remove the conditions).

    For a quick example, please consider creating an embedded project (e.g. MSP432) and check the .props file created in the project directory. It will be a property sheet containing device-specific settings imported into the project.

    #27641
    victor_s
    Participant

    Thank you, it works for common Visual Studio properties, like <Outdir> or <ClCompile>

    But I didn’t succeed to define VisualGDB specific properties like <GNUConfigurationType>, <GNUToolchainPrefix>, <GNUCompilerType>.  Can it be done?

    #27642
    support
    Keymaster

    Those settings are defined inside the <PropertyGroup> statements and can also be copied into the property sheet files. Simply copy the <PropertyGroup> statement from the .vcxproj file (removing the Condition attribute) into the property sheet file, and the properties will get applied as if they were defined in the .vcxproj file.

    #27643
    victor_s
    Participant

    Thank you.

    I found that VisualGDB specific properties do change from the property sheet. It just can’t be seen and controlled from the project property page, like other properties, so it is sort of hidden properties. No matter what written in the project property page – settings always taken from property sheet.

    In some situations it can be misleading, like you define something in the property page and it doesn’t work, because property sheet redefined it.

    #27672
    support
    Keymaster

    No problem, we will explain what is going on.

    The VS property sheets have similar semantics to the #include and #define directives of the C/C++ compiler:

    • The <Import> tag in a .vcxproj file (or in a .props file) is a rough equivalent of the #include directive.
    • The <PropertyGroup> tag is a rough equivalent of a group of #define-s
    • The Condition attribute on <PropertyGroup>, or a specific property, is equivalent to wrapping the #define-s with #ifdef/#endif

    In order to understand why some properties get overridden, please locate all locations where they are defined (including the VisualGDB’s MSBuild directory and toolchain.props) and reconstruct their order by tracking the <Import> tags. E.g. if the project first imports a property sheet, and then defines the same property in a property group, the project’s property group will override the value from the property sheet. If the property sheet is imported after the definition in the .vcxproj file, it will override the regular definition.

    You can also work around this by using the following syntax in the property sheet file:

    <PropertyGroup>
        <MyProperty Condition="'$(MyProperty)' == ''">NewValue</MyProperty>
    </PropertyGroup>

    This will only set MyProperty to NewValue if it was unset at the time when the corresponding PropertyGroup was parsed.

     

    The default values shown in the VS GUI are taken from the Microsoft.Cpp.Default.props file that in turn includes the SysprogsPlatform.default.props. If you would like to modify them, consider importing your own property sheet right after (or before) Microsoft.Cpp.Default.props.

    #27676
    victor_s
    Participant

    Thank you very much for this detailed explanation. Moving import right after Microsoft.Cpp.Default.props made everything work as expected.

    #27817
    support
    Keymaster

    Just wanted to share an updated that we have published detailed documentation on MSBuild property sheets with VisualGDB projects here: https://visualgdb.com/documentation/projects/msbuild/propertysheets/

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.