-
Notifications
You must be signed in to change notification settings - Fork 1
feat: support forwarding options #9
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| const std = @import("std"); | ||
| const zbuild = @import("zbuild"); | ||
|
|
||
| pub fn build(b: *std.Build) void { | ||
| _ = zbuild.configureBuild(b, @import("build.zig.zon"), .{}) catch |err| { | ||
| std.log.err("zbuild: {}", .{err}); | ||
| return; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| .{ | ||
| .name = .dep_args, | ||
| .version = "0.1.0", | ||
| .fingerprint = 0x6e33b60f1f722c30, | ||
| .minimum_zig_version = "0.16.0", | ||
| .paths = .{ "build.zig", "build.zig.zon", "dep" }, | ||
| .dependencies = .{ | ||
| .zbuild = .{ .path = "../../.." }, | ||
| // No 'target' in args: the dependency inherits the parent's | ||
| // resolved target. The parent is pinned to powerpc64 for distinguishability. | ||
| .dep_inherit = .{ | ||
| .path = "dep", | ||
| .args = .{ | ||
| .optimize = .ReleaseFast, | ||
| .portable = true, | ||
| }, | ||
| }, | ||
| // Explicit string 'target' in args: the dependency preserves it, | ||
| // ignoring the parent's target. Pinned to a mips64 | ||
| // so it is distinguishable on standard hosts. | ||
| .dep_explicit = .{ | ||
| .path = "dep", | ||
| .args = .{ | ||
| .target = "mips64-linux-none", | ||
| .optimize = .ReleaseFast, | ||
| .portable = true, | ||
| }, | ||
| }, | ||
| }, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| const std = @import("std"); | ||
|
|
||
| pub fn build(b: *std.Build) void { | ||
| const target = b.standardTargetOptions(.{}); | ||
| const optimize = b.standardOptimizeOption(.{}); | ||
| const portable = b.option(bool, "portable", "portable mode") orelse false; | ||
|
|
||
| std.debug.print( | ||
| "dep arch={s} os={s} abi={s} optimize={s} portable={}\n", | ||
| .{ | ||
| @tagName(target.result.cpu.arch), | ||
| @tagName(target.result.os.tag), | ||
| @tagName(target.result.abi), | ||
| @tagName(optimize), | ||
| portable, | ||
| }, | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| .{ | ||
| .name = .dep_pkg, | ||
| .version = "0.1.0", | ||
| .fingerprint = 0xd13ef89d724c4dc4, | ||
| .minimum_zig_version = "0.16.0", | ||
| .paths = .{ "build.zig", "build.zig.zon" }, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| const std = @import("std"); | ||
| const zbuild = @import("zbuild"); | ||
|
|
||
| pub fn build(b: *std.Build) !void { | ||
| _ = try zbuild.configureBuild(b, @import("build.zig.zon"), .{}); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| .{ | ||
| .name = .invalid_optimize, | ||
| .version = "0.1.0", | ||
| .fingerprint = 0x92522e2699681d7c, | ||
| .minimum_zig_version = "0.16.0", | ||
| .paths = .{ "build.zig", "build.zig.zon", "src" }, | ||
| .dependencies = .{ | ||
| .zbuild = .{ .path = "../../.." }, | ||
| }, | ||
| .executables = .{ | ||
| .demo = .{ | ||
| .root_module = .{ | ||
| .root_source_file = "src/main.zig", | ||
| // '.Release' is not a valid std.builtin.OptimizeMode; | ||
| // zbuild rejects this at configuration time. | ||
| .optimize = .Release, | ||
| }, | ||
| }, | ||
| }, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| pub fn main() void {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To ensure consistency with the default dependency configuration (which passes
std.Build.ResolvedTargetdirectly) and to avoid unnecessary target re-resolution in the child dependency, we should usestd.Build.ResolvedTargetinstead ofstd.Target.Querywhen forwarding the parent's target.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this case
ResolvedTargetcontainsTarget.Query, which is the native target, it's probably more correct to rely on that instead.