Skip to content

Commit 6e304ac

Browse files
committed
link stb_image
1 parent 999ecae commit 6e304ac

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2025 Ali Cheraghi
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
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 OR COPYRIGHT HOLDERS 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.

build.zig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ pub fn build(b: *Build) void {
1616
const stb_dep = b.dependency("stb", .{});
1717
const tracy_dep = b.dependency("tracy", .{});
1818

19+
// STB
20+
const stb_image_lib = b.addStaticLibrary(.{
21+
.name = "stb_image",
22+
.target = target,
23+
.optimize = .ReleaseFast,
24+
});
25+
stb_image_lib.linkLibC();
26+
stb_image_lib.addIncludePath(stb_dep.path(""));
27+
stb_image_lib.addCSourceFile(.{ .file = b.path("src/stb_image.c") });
28+
1929
// STB Image Translate-C
2030
const stb_image_translate_c = b.addTranslateC(.{
2131
.root_source_file = stb_dep.path("stb_image.h"),
@@ -32,6 +42,7 @@ pub fn build(b: *Build) void {
3242
});
3343
module.addImport("build_options", build_options_module);
3444
module.addImport("stb_image", stb_image_translate_c.createModule());
45+
module.linkLibrary(stb_image_lib);
3546

3647
// Benchmark
3748
const benchmark = b.addExecutable(.{

0 commit comments

Comments
 (0)