Skip to content

extract_all_objects() with custom target results in invalid paths for subproject with Visual Studio backend #8020

@Myaamori

Description

@Myaamori

Describe the bug

I have a build script where the input to one target is the output of extract_all_objects(), with some of the original object files being the output of a custom target (generator):

nasm = find_program('nasm')
asm_sources = ['my_test.asm']
asm_gen = generator(nasm,
                    output: '@BASENAME@.o',
                    arguments: ['-f', 'win64', '@INPUT@', '-o', '@OUTPUT@'])
gen_objects = asm_gen.process(asm_sources)

static_lib = static_library('my_subproject-static', ['my_subproject.c', gen_objects])

lib = library('my_subproject', objects: static_lib.extract_all_objects())

When generating a Visual Studio solution with this project as a subproject on Windows, the paths to the object files generated by the generator are incorrect:

        <ItemGroup>
                <Object Include="subprojects\my_subproject\c490a2a@@my_subproject-static@sta\my_test.o"/>
                <Object Include="..\..\subprojects\my_subproject\c490a2a@@my_subproject-static@sta\my_subproject.c.obj"/>
        </ItemGroup>

To Reproduce

A minimal working example can be found here.

Generate the solution using

meson build --backend=vs2019

and inspect build/subprojects/my_subproject/[HASH]@@my_subproject@sha.vcxproj.

nasm must be available.

Expected behavior

The paths should look like

        <ItemGroup>
                <Object Include="..\..\subprojects\my_subproject\c490a2a@@my_subproject-static@sta\my_test.o"/>
                <Object Include="..\..\subprojects\my_subproject\c490a2a@@my_subproject-static@sta\my_subproject.c.obj"/>
        </ItemGroup>

system parameters

  • Native build
  • Windows 10
  • Python 3.8.6
  • Meson 0.56.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions