Skip to content

Commit c1cddc3

Browse files
committed
Add support for adding user-specified C/C++ source files to the joltc library
1 parent eeb6905 commit c1cddc3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

build.zig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ pub fn build(b: *std.Build) void {
3737
) orelse true,
3838
};
3939

40+
const user_extensions = b.option(
41+
[]const std.Build.LazyPath,
42+
"user_extensions",
43+
"List of user source files to add to the joltc library",
44+
) orelse &.{};
45+
4046
const options_step = b.addOptions();
4147
inline for (std.meta.fields(@TypeOf(options))) |field| {
4248
options_step.addOption(field.type, field.name, @field(options, field.name));
@@ -233,6 +239,13 @@ pub fn build(b: *std.Build) void {
233239
.flags = c_flags,
234240
});
235241

242+
for (user_extensions) |user_extension| {
243+
joltc.addCSourceFile(.{
244+
.file = user_extension,
245+
.flags = c_flags,
246+
});
247+
}
248+
236249
if (target.result.abi != .msvc or optimize != .Debug) {
237250
joltc.addCSourceFiles(.{
238251
.files = &.{

0 commit comments

Comments
 (0)