Skip to content

Commit d853b7e

Browse files
committed
Add shared option.
1 parent f41d01f commit d853b7e

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ See examples for binding usage and [bgfx](https://github.com/bkaradzic/bgfx) for
7575

7676
| Build option | Default | Description |
7777
|-----------------|---------|------------------------------------------------------|
78+
| `shared` | `false` | Build as shared library. |
7879
| `imgui_include` | `null` | Path to ImGui includes (need for imgui bgfx backend) |
7980
| `multithread` | `true` | Compile with `BGFX_CONFIG_MULTITHREADED` |
8081
| `with_shaderc` | `true` | Compile with `shaderc` |

build.zig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub fn build(b: *std.Build) !void {
1111
//
1212

1313
const options = .{
14+
.shared = b.option(bool, "shared", "Build as shared library.") orelse false,
1415
.imgui_include = b.option([]const u8, "imgui_include", "Path to imgui (need for imgui bgfx backend)"),
1516
.multithread = b.option(bool, "multithread", "Compile with BGFX_CONFIG_MULTITHREADED") orelse true,
1617
.with_shaderc = b.option(bool, "with_shaderc", "Compile with shaderc executable") orelse true,
@@ -129,7 +130,7 @@ pub fn build(b: *std.Build) !void {
129130
//
130131
const bgfx_path = "libs/bgfx/";
131132
const bgfx = b.addLibrary(.{
132-
.linkage = .static,
133+
.linkage = if (options.shared) .dynamic else .static,
133134
.name = "bgfx",
134135
.root_module = b.createModule(.{
135136
.target = target,

build.zig.zon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.{
22
.name = .zbgfx,
33
.fingerprint = 0xc48ed871c4086e4a,
4-
.version = "0.11.0",
4+
.version = "0.12.0",
55
.minimum_zig_version = "0.16.0",
66
.paths = .{
77
"includes",

0 commit comments

Comments
 (0)