aboutsummaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorAsa Zeren <asaizeren@gmail.com>2021-03-23 18:58:24 -0400
committerVeikka Tuominen <git@vexu.eu>2021-06-11 20:18:19 +0300
commit6cc88458029759bbedcb4d949deb887d464cdd60 (patch)
tree1e31fcbe7cd4a2cbb2d1d652d6358825554ad1f0 /build.zig
parent0bde5ce369ba59f7bc33e97cd5b03d69913108c5 (diff)
downloadzig-6cc88458029759bbedcb4d949deb887d464cdd60.tar.gz
zig-6cc88458029759bbedcb4d949deb887d464cdd60.zip
Change defineCMacro to take separate name and value arugments
Before this change, when one or more of name or value are not known at comptime, build.zig files must allocate and do the concatanation, which can be cumbersome, and also adds a redundant allocation when name and value are slices. The new version only does a single allocation directly in the builder's allocator to concatonate name and value. The origional behavior is available in defineCMacroRaw, for use in situations such as parseing c compiler arguments. Additionally, several places have been updated to use the new funtions.
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/build.zig b/build.zig
index 0fccafe766..dcc60e6622 100644
--- a/build.zig
+++ b/build.zig
@@ -117,7 +117,7 @@ pub fn build(b: *Builder) !void {
// of being built by cmake. But when built by zig it's gonna get a compiler_rt so that
// is pointless.
exe.addPackagePath("compiler_rt", "src/empty.zig");
- exe.defineCMacro("ZIG_LINK_MODE=Static");
+ exe.defineCMacro("ZIG_LINK_MODE", "Static");
const softfloat = b.addStaticLibrary("softfloat", null);
softfloat.setBuildMode(.ReleaseFast);