refactor: rm @cImport usage
This commit is contained in:
parent
25dda6b31e
commit
ef5d7ebaad
3 changed files with 29 additions and 25 deletions
|
|
@ -67,15 +67,20 @@ pub fn build(b: *std.Build) !void {
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add Headers
|
const temporal_rs = b.dependency("temporal_rs", .{
|
||||||
const temporal_rs_git = b.dependency("temporal_rs", .{
|
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.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);
|
mod.addObjectFile(selected_lib_file);
|
||||||
|
|
||||||
// --- Rust Misc Deps --- //
|
// --- Rust Misc Deps --- //
|
||||||
|
|
|
||||||
18
pkg/temporal/src/lib.h
Normal file
18
pkg/temporal/src/lib.h
Normal file
|
|
@ -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"
|
||||||
|
|
@ -1,20 +1 @@
|
||||||
pub const c = @cImport({
|
pub const c = @import("lib");
|
||||||
@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");
|
|
||||||
});
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue