Skip to content

Commit e31027a

Browse files
committed
generate and use cmake snappy config
1 parent 9611eba commit e31027a

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

build.zig

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,14 @@ fn buildRocksDB(
460460

461461
if (enable_snappy) {
462462
libsnappy.linkLibCpp();
463+
librocksdb.linkLibrary(libsnappy);
464+
465+
const flags = .{
466+
"-std=c++11",
467+
"-fno-exceptions",
468+
"-fno-rtti",
469+
"-Wno-sign-compare",
470+
};
463471

464472
libsnappy.addCSourceFiles(.{
465473
.root = snappy_dep.path("."),
@@ -469,15 +477,23 @@ fn buildRocksDB(
469477
"snappy-stubs-internal.cc",
470478
"snappy.cc",
471479
},
472-
.flags = &.{
473-
"-std=c++11",
474-
"-fno-exceptions",
475-
"-fno-rtti",
476-
"-Wno-sign-compare",
477-
},
480+
.flags = &flags,
478481
});
479482

480-
librocksdb.linkLibrary(libsnappy);
483+
const build_version = b.addConfigHeader(.{
484+
.style = .{ .cmake = snappy_dep.path("snappy-stubs-public.h.in") },
485+
.include_path = "snappy-stubs-public.h",
486+
}, .{
487+
.PROJECT_VERSION_MAJOR = 1,
488+
.PROJECT_VERSION_MINOR = 2,
489+
.PROJECT_VERSION_PATCH = 2,
490+
.HAVE_SYS_UIO_H_01 = 1,
491+
});
492+
libsnappy.addCSourceFile(.{
493+
.file = build_version.getOutput(),
494+
.language = .cpp,
495+
.flags = &flags,
496+
});
481497
}
482498

483499
// platform dependent stuff

0 commit comments

Comments
 (0)