Skip to content

Commit d0f1d70

Browse files
committed
Cross compiling fix & compiler options
1 parent 7891cd1 commit d0f1d70

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

build.zig

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
const std = @import("std");
2+
const builtin = @import("builtin");
23

34
pub fn build(b: *std.Build) !void {
45
const target = b.standardTargetOptions(.{});
56
const optimize = b.standardOptimizeOption(.{});
67

78
const tcc_dep = b.dependency("tinycc", .{});
89

10+
const build_native_target: std.Build.ResolvedTarget = .{
11+
.query = try std.Target.Query.parse(.{}),
12+
.result = builtin.target,
13+
};
14+
915
const c2str_step = b.step("config-tcc", "Generate tccdefs_.h");
1016
{
1117
const c2str_exe = b.addExecutable(.{
1218
.name = "config-tcc",
13-
.target = target,
19+
.target = build_native_target,
1420
.optimize = .Debug,
1521
});
1622

@@ -52,6 +58,10 @@ pub fn build(b: *std.Build) !void {
5258
var FLAGS = std.ArrayList([]const u8).init(b.allocator);
5359
var C_SOURCES = std.ArrayList(std.Build.LazyPath).init(b.allocator);
5460

61+
try FLAGS.append("-Wall");
62+
try FLAGS.append("-fno-strict-aliasing");
63+
try FLAGS.append("-O3");
64+
5565
try FLAGS.append("-DCONFIG_TCC_PREDEFS");
5666
try FLAGS.append("-DONE_SOURCE=0");
5767
try FLAGS.append("-DTCC_LIBTCC1=\"\\0\"");

0 commit comments

Comments
 (0)