Skip to content

Conversation

@der-teufel-programming
Copy link
Contributor

Closes #17410

@andrewrk
Copy link
Member

andrewrk commented Oct 6, 2023

Can you show the --verbose output for a build.zig script that uses this API with several C files and several flags? Edit: sorry not the --verbose-cc output, the --verbose output - I want to see the zig command.

@der-teufel-programming
Copy link
Contributor Author

https://gist.github.com/der-teufel-programming/546a8f228c7374dd2ac8f85c615f143a
This gist contains slightly formatted --verbose output for https://github.com/andrewrk/orca-ui-hello-zig with this small diff applied to the build.zig

-    for (libc_shim_files) |libc_shim_file| {
-        app.addCSourceFile(.{
-            .file = orca_dep.path(libc_shim_file),
-            .flags = cflags,
-        });
-    }
+    app.addCSourceFiles(.{
+        .dependency = orca_dep,
+        .files = libc_shim_files,
+        .flags = cflags,
+    });

@andrewrk
Copy link
Member

andrewrk commented Oct 7, 2023

This is not a good example because it has only 1 flag.

EDIT: never mind, I see your "BEFORE" file in the gist, and this does what I was hoping. Thanks!

@andrewrk
Copy link
Member

Nice work, thank you!

@andrewrk andrewrk merged commit 7abf9b3 into ziglang:master Oct 10, 2023
@glingy
Copy link

glingy commented Oct 25, 2023

I realize this is closed, but this is a breaking change that makes the build.zig file not compatible with 0.11.0, and also makes 0.12.0 not able to use old build.zig files which is going to potentially cause issues if using packages set up to build for 0.11.0 with a new zig project in the near future using 0.12.0. Can I request that the build.zig file be backwards compatible in the future so this isn't an issue and packages can slowly adopt the new syntax without breaking compatibility?

@glingy
Copy link

glingy commented Oct 25, 2023

The reason being I just ran across a build.zig file that wasn't building on 0.12.0-dev, but was on my local computer (running 0.11.0), and discovered this change.

@InKryption
Copy link
Contributor

The build system is still in development and incomplete; backwards compatibility is a non-goal, as being tied to the current state of affairs would mean being tied to an incomplete build system. There are likely a good few more breaking changes to come become before backwards compatibility is even a real consideration.

@andrewrk
Copy link
Member

You can check the zig version in your build script and call the older API.

krichprollsch added a commit to lightpanda-io/browser that referenced this pull request Dec 4, 2023
krichprollsch added a commit to lightpanda-io/browser that referenced this pull request Dec 4, 2023
krichprollsch added a commit to lightpanda-io/browser that referenced this pull request Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

change addCSourceFiles to be future proof by taking an options struct and add dependency option

5 participants