Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Myaamori opened this issue Nov 24, 2020 · 3 comments · May be fixed by #12549
Labels
backend:visualstudio Visual Studio project backends bug

Comments

@Myaamori
Copy link

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
@dcbaker dcbaker added backend:visualstudio Visual Studio project backends bug labels Nov 24, 2020
@jmoguillansky-gpsw
Copy link
Contributor

I have a similar issue:
I have various custom_targets defined.
None of the custom_targets work on windows with visual studio backend.

@tristan957
Copy link
Contributor

@Myaamori fyi Meson now supports NASM. cc @xclaesse

@arch1t3cht
Copy link
Contributor

This also happens with targets generated by windows.compile_resources() (which uses a CustomTarget internally).

arch1t3cht added a commit to arch1t3cht/meson that referenced this issue Nov 25, 2023
arch1t3cht pushed a commit to arch1t3cht/meson that referenced this issue Nov 25, 2023
The referenced issue involved the VS backend breaking when custom_targets
where linked, extracted using extract_all_objects, and then linked into
other targets, while in a subproject.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:visualstudio Visual Studio project backends bug
Projects
None yet
5 participants