commit
e5d1a3ffd8
8 changed files with 103 additions and 0 deletions
@ -0,0 +1,11 @@ |
||||
root = true |
||||
|
||||
[*] |
||||
charset = utf-8 |
||||
end_of_line = lf |
||||
|
||||
indent_style = space |
||||
indent_size = 4 |
||||
|
||||
trim_trailing_whitespace = true |
||||
insert_final_newline = true |
@ -0,0 +1,2 @@ |
||||
/zig-cache/ |
||||
/zig-out/ |
@ -0,0 +1,3 @@ |
||||
[submodule "flecs"] |
||||
path = libs/flecs |
||||
url = https://github.com/SanderMertens/flecs.git |
@ -0,0 +1,19 @@ |
||||
This is free and unencumbered software released into the public domain. |
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or distribute |
||||
this software, either in source code form or as a compiled binary, for any |
||||
purpose, commercial or non-commercial, and by any means. |
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors of this |
||||
software dedicate any and all copyright interest in the software to the public |
||||
domain. We make this dedication for the benefit of the public at large and to |
||||
the detriment of our heirs and successors. We intend this dedication to be an |
||||
overt act of relinquishment in perpetuity of all present and future rights to |
||||
this software under copyright law. |
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
@ -0,0 +1,63 @@ |
||||
const std = @import("std"); |
||||
|
||||
pub fn build(b: *std.Build) !void { |
||||
const target = b.standardTargetOptions(.{}); |
||||
const optimize = b.standardOptimizeOption(.{}); |
||||
|
||||
const module = b.createModule(.{ |
||||
.source_file = .{ .path = "src/main.zig" }, |
||||
}); |
||||
|
||||
try b.modules.put(b.dupe("flecs-zig-ble"), module); |
||||
|
||||
const lib = b.addStaticLibrary(.{ |
||||
.name = "flecs-zig-ble", |
||||
.root_source_file = .{ .path = "src/main.zig" }, |
||||
.target = target, |
||||
.optimize = optimize, |
||||
}); |
||||
|
||||
lib.linkLibC(); |
||||
lib.addIncludePath(.{ .path = thisDir() ++ "/flecs" }); |
||||
lib.addCSourceFile(.{ |
||||
.file = .{ .path = thisDir() ++ "/flecs/flecs.c" }, |
||||
.flags = &.{"-fno-sanitize=undefined"}, |
||||
}); |
||||
lib.defineCMacro("FLECS_NO_CPP", null); |
||||
lib.defineCMacro("FLECS_USE_OS_ALLOC", null); |
||||
if (@import("builtin").mode == .Debug) |
||||
lib.defineCMacro("FLECS_SANITIZE", null); |
||||
|
||||
if (lib.target.isWindows()) |
||||
lib.linkSystemLibraryName("ws2_32"); |
||||
|
||||
b.installArtifact(lib); |
||||
|
||||
const main_tests = b.addTest(.{ |
||||
.root_source_file = .{ .path = "src/main.zig" }, |
||||
.target = target, |
||||
.optimize = optimize, |
||||
}); |
||||
|
||||
main_tests.linkLibC(); |
||||
main_tests.addIncludePath(.{ .path = thisDir() ++ "/flecs" }); |
||||
main_tests.addCSourceFile(.{ |
||||
.file = .{ .path = thisDir() ++ "/flecs/flecs.c" }, |
||||
.flags = &.{"-fno-sanitize=undefined"}, |
||||
}); |
||||
main_tests.defineCMacro("FLECS_NO_CPP", null); |
||||
main_tests.defineCMacro("FLECS_USE_OS_ALLOC", null); |
||||
main_tests.defineCMacro("FLECS_SANITIZE", null); |
||||
|
||||
if (main_tests.target.isWindows()) |
||||
main_tests.linkSystemLibraryName("ws2_32"); |
||||
|
||||
const run_main_tests = b.addRunArtifact(main_tests); |
||||
|
||||
const test_step = b.step("test", "Run library tests"); |
||||
test_step.dependOn(&run_main_tests.step); |
||||
} |
||||
|
||||
inline fn thisDir() []const u8 { |
||||
return comptime std.fs.path.dirname(@src().file) orelse "."; |
||||
} |
@ -0,0 +1,4 @@ |
||||
.{ |
||||
.name = "flecs-zig-ble", |
||||
.version = "0.1.0", |
||||
} |
@ -0,0 +1 @@ |
||||
Subproject commit 74a7f74a2835d3946f05502ef44ba1d5d8b48eff |
Loading…
Reference in new issue