all: cache module() returns to avoid duplicate modules
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
eea7f245e1
commit
1ad2210ab9
1 changed files with 5 additions and 1 deletions
|
@ -69,10 +69,14 @@ pub const Options = struct {
|
|||
install_libs: bool = false,
|
||||
};
|
||||
|
||||
var _module: ?*std.build.Module = null;
|
||||
|
||||
pub fn module(b: *std.Build) *std.build.Module {
|
||||
return b.createModule(.{
|
||||
if (_module) |m| return m;
|
||||
_module = b.createModule(.{
|
||||
.source_file = .{ .path = sdkPath("/src/main.zig") },
|
||||
});
|
||||
return _module.?;
|
||||
}
|
||||
|
||||
pub const LinkError = error{FailedToLinkGPU} || BuildError;
|
||||
|
|
Loading…
Add table
Reference in a new issue