diff --git a/pkg/temporal/build.zig b/pkg/temporal/build.zig index 8e98fa3..2bcd767 100644 --- a/pkg/temporal/build.zig +++ b/pkg/temporal/build.zig @@ -67,15 +67,20 @@ pub fn build(b: *std.Build) !void { .optimize = optimize, }); - // Add Headers - const temporal_rs_git = b.dependency("temporal_rs", .{ + const temporal_rs = b.dependency("temporal_rs", .{ .target = target, .optimize = optimize, }); - mod.addIncludePath(temporal_rs_git.path("temporal_capi/bindings/c")); - mod.addIncludePath(b.path("src/stubs/c_headers")); - // Add Object/Library + const translated = b.addTranslateC(.{ + .root_source_file = b.path("src/lib.h"), + .target = target, + .optimize = optimize, + .link_libc = false, + }); + translated.addIncludePath(temporal_rs.path("temporal_capi/bindings/c")); + translated.addIncludePath(b.path("src/stubs/c_headers")); + mod.addImport("lib", translated.createModule()); mod.addObjectFile(selected_lib_file); // --- Rust Misc Deps --- // diff --git a/pkg/temporal/src/lib.h b/pkg/temporal/src/lib.h new file mode 100644 index 0000000..47d8815 --- /dev/null +++ b/pkg/temporal/src/lib.h @@ -0,0 +1,18 @@ +#include "AnyCalendarKind.h" +#include "Calendar.h" +#include "Duration.h" +#include "ErrorKind.h" +#include "I128Nanoseconds.h" +#include "Instant.h" +#include "OwnedRelativeTo.h" +#include "ParsedDate.h" +#include "ParsedDateTime.h" +#include "ParsedZonedDateTime.h" +#include "PlainDate.h" +#include "PlainDateTime.h" +#include "PlainMonthDay.h" +#include "PlainTime.h" +#include "PlainYearMonth.h" +#include "RelativeTo.h" +#include "TimeZone.h" +#include "ZonedDateTime.h" diff --git a/pkg/temporal/src/root.zig b/pkg/temporal/src/root.zig index 1103436..2051306 100644 --- a/pkg/temporal/src/root.zig +++ b/pkg/temporal/src/root.zig @@ -1,20 +1 @@ -pub const c = @cImport({ - @cInclude("AnyCalendarKind.h"); - @cInclude("Calendar.h"); - @cInclude("Duration.h"); - @cInclude("ErrorKind.h"); - @cInclude("I128Nanoseconds.h"); - @cInclude("Instant.h"); - @cInclude("OwnedRelativeTo.h"); - @cInclude("ParsedDate.h"); - @cInclude("ParsedDateTime.h"); - @cInclude("ParsedZonedDateTime.h"); - @cInclude("PlainDate.h"); - @cInclude("PlainDateTime.h"); - @cInclude("PlainMonthDay.h"); - @cInclude("PlainTime.h"); - @cInclude("PlainYearMonth.h"); - @cInclude("RelativeTo.h"); - @cInclude("TimeZone.h"); - @cInclude("ZonedDateTime.h"); -}); +pub const c = @import("lib");