Skip to content

Commit 6c83742

Browse files
committed
decompose stb headers into a submodule
1 parent de2b121 commit 6c83742

10 files changed

Lines changed: 37 additions & 14813 deletions

File tree

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[submodule "modules/third-party/stb"]
2+
path = modules/third-party/stb
3+
url = https://github.com/nothings/stb
14
[submodule "third-party/dropbear"]
25
path = modules/third-party/dropbear
36
url = https://github.com/mkj/dropbear

modules/third-party/stb

Submodule stb added at 31c1ad3

src/common/ffi/stb/stb_image.c

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/common/ffi/stb/stb_image.h

Lines changed: 0 additions & 7988 deletions
This file was deleted.

src/common/ffi/stb/stb_image.nim

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
import std/os
22

3-
{.compile("stb_image.c", "-O3").}
4-
{.compile("stb_image_write.c", "-O3").}
5-
{.passC: "-I" & currentSourcePath().splitPath().head.}
3+
const StbDir = currentSourcePath().splitPath().head /
4+
".." / ".." / ".." / ".." /
5+
"modules" / "third-party" / "stb"
6+
7+
{.passC: "-O3 -I" & StbDir.}
8+
9+
{.emit: """
10+
#define STB_IMAGE_IMPLEMENTATION
11+
#define STB_IMAGE_WRITE_IMPLEMENTATION
12+
#include "stb_image.h"
13+
#include "stb_image_write.h"
14+
""".}
615

716
proc stbi_load*(
817
filename: cstring,
918
x: ptr cint,
1019
y: ptr cint,
1120
channels_in_file: ptr cint,
1221
desired_channels: cint
13-
): ptr uint8 {.importc, header: "stb_image.h".}
22+
): ptr uint8 {.importc, header: StbDir / "stb_image.h".}
1423

1524
proc stbi_write_png*(
1625
filename: cstring,
@@ -19,6 +28,6 @@ proc stbi_write_png*(
1928
comp: cint,
2029
data: pointer,
2130
stride_in_bytes: cint
22-
): cint {.importc, header: "stb_image_write.h".}
31+
): cint {.importc, header: StbDir / "stb_image_write.h".}
2332

24-
proc stbi_image_free*(data: pointer) {.importc, header: "stb_image.h".}
33+
proc stbi_image_free*(data: pointer) {.importc, header: StbDir / "stb_image.h".}

src/common/ffi/stb/stb_image_write.c

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)