mirror of
https://codeberg.org/fairyglade/ly.git
synced 2026-08-20 20:44:19 +02:00
Use translate-c Git dependency
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
parent
a91b538236
commit
de948a08ce
2 changed files with 18 additions and 9 deletions
|
|
@ -1,4 +1,5 @@
|
|||
const std = @import("std");
|
||||
const Translator = @import("translate_c").Translator;
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
|
|
@ -17,26 +18,30 @@ pub fn build(b: *std.Build) void {
|
|||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const translate_c = b.addTranslateC(.{
|
||||
.root_source_file = termbox_dep.path("termbox2.h"),
|
||||
const translate_c_dep = b.dependency("translate_c", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
translate_c.defineCMacroRaw("TB_IMPL");
|
||||
|
||||
const termbox2: Translator = .init(translate_c_dep, .{
|
||||
.c_source_file = termbox_dep.path("termbox2.h"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
termbox2.defineCMacro("TB_IMPL", null);
|
||||
// TODO 0.16.0: Workaround until Aro gets better...
|
||||
// https://codeberg.org/ziglang/translate-c/issues/319
|
||||
translate_c.defineCMacro("_XOPEN_SOURCE", "700");
|
||||
translate_c.defineCMacro("TB_OPT_ATTR_W", "32"); // Enable 24-bit color support + styling (32-bit)
|
||||
termbox2.defineCMacro("_XOPEN_SOURCE", "700");
|
||||
termbox2.defineCMacro("TB_OPT_ATTR_W", "32"); // Enable 24-bit color support + styling (32-bit)
|
||||
// TODO 0.16.0: Including <fcntl.h> with -OReleaseSafe causes
|
||||
// __attribute__(__error__()) to be called. Below
|
||||
// is the workaround.
|
||||
translate_c.defineCMacro("_FORTIFY_SOURCE", "0");
|
||||
termbox2.defineCMacro("_FORTIFY_SOURCE", "0");
|
||||
// TODO 0.16.0: Needed for now
|
||||
if (target.result.os.tag == .freebsd) {
|
||||
translate_c.defineCMacro("__BSD_VISIBLE", "1");
|
||||
termbox2.defineCMacro("__BSD_VISIBLE", "1");
|
||||
}
|
||||
const termbox2 = translate_c.addModule("termbox2");
|
||||
mod.addImport("termbox2", termbox2);
|
||||
mod.addImport("termbox2", termbox2.mod);
|
||||
|
||||
const mod_tests = b.addTest(.{
|
||||
.root_module = mod,
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@
|
|||
.url = "git+https://github.com/AnErrupTion/termbox2?ref=master#c7f241e8888ce243e1748b05c26a42fcfaaad936",
|
||||
.hash = "N-V-__8AAAUXBQD6Fwpi9m0MBqWXFFaqW5l1lVrJC2Ynj7a-",
|
||||
},
|
||||
.translate_c = .{
|
||||
.url = "git+https://codeberg.org/ziglang/translate-c#7a1a9fdc4ab00835748a6657ecbb835e3d5d45f7",
|
||||
.hash = "translate_c-0.0.0-Q_BUWvP1BgCjAk6PWv5286tOlvzD9-X-NkuTzh0KxY0Q",
|
||||
},
|
||||
},
|
||||
.paths = .{
|
||||
"build.zig",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue