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

The behaviour of addCSourceFile has changed in Windows #16946

Closed
kimmolinna opened this issue Aug 24, 2023 · 1 comment
Closed

The behaviour of addCSourceFile has changed in Windows #16946

kimmolinna opened this issue Aug 24, 2023 · 1 comment
Labels
question No questions on the issue tracker, please.

Comments

@kimmolinna
Copy link

kimmolinna commented Aug 24, 2023

Zig Version

0.11.0

Steps to Reproduce and Observed Behavior

You have to write

shell.addCSourceFile(.{
            .file = std.build.LazyPath.relative("tools/shell/shell.c"), 
            .flags = &.{}
            });

Expected Behavior

shell.addCSourceFile("tools/shell/shell.c", &.{}) should still work. Compare it to behaviour of addCSourceFiles.

@kimmolinna kimmolinna added the bug Observed behavior contradicts documented or intended behavior label Aug 24, 2023
@kimmolinna kimmolinna changed the title The behaviour of addCSourceFile has changed on The behaviour of addCSourceFile has changed in Windows Aug 24, 2023
@rohlem
Copy link
Contributor

rohlem commented Aug 24, 2023

That's not a bug, but an intentional API change introduced in #16446 .
I didn't check, but see no reason to believe this would in any way be related to Windows (as either host or target OS) either.

I think the reason it wasn't done to addCSourceFiles is that it's a convenience wrapper for a list of multiple files that are non-lazy file paths.
If you already have LazyPath objects, looping over them and calling the singular version isn't too much of a burden (as opposed to converting []const []const u8 to []const []std.Build.Step.Compile.CSourceFile or what the exact type is).

Feel free to advocate for, propose, or even PR a utility function accepting a []const u8 instead if you want.
I personally wouldn't mind, but be aware that it might not end up being accepted.

@Vexu Vexu closed this as not planned Won't fix, can't repro, duplicate, stale Nov 29, 2023
@Vexu Vexu added question No questions on the issue tracker, please. and removed bug Observed behavior contradicts documented or intended behavior labels Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question No questions on the issue tracker, please.
Projects
None yet
Development

No branches or pull requests

3 participants