floooh / sokol

minimal cross-platform standalone C headers
https://floooh.github.io/sokol-html5
zlib License
7.12k stars 501 forks source link

Added emscripten support for the Nim's gen script #1086

Closed Nazariglez closed 4 months ago

Nazariglez commented 4 months ago

Related to https://github.com/floooh/sokol-nim/pull/31

floooh commented 4 months ago

Thanks for the PRs! I'm a bit busy atm with this Chrome WebGL2 regressions thingy (there goes the weekend lol), but I'll try to focus on those PRs some time next week.

floooh commented 4 months ago

NOTE: the CI tests are expected to break because they don't have the changes in sokol-nim, don't worry about that.

Nazariglez commented 4 months ago

There is not rush at all, thanks @floooh!

floooh commented 4 months ago

...checking now whether the CI runs through with the changes in sokol-nim merged, this will take a little bit...

floooh commented 4 months ago

...ok actually got a real error in the CI pipeline now:

sokol/gfx.nim(2032, 5) Error: expected: ':', but got: 'keyword when'

...I'll have a look locally...

floooh commented 4 months ago

There's this difference between the generated version and sokol-nim:

diff --git a/src/sokol/gfx.nim b/src/sokol/gfx.nim
index bc8f184..b4758a0 100644
--- a/src/sokol/gfx.nim
+++ b/src/sokol/gfx.nim
@@ -2006,7 +2006,7 @@ when defined emscripten:
   const d3d11* = false
   const metal* = false
   const emscripten* = true
-elif defined gl:
+elif when defined gl:
   const gl*    = true
   const d3d11* = false
   const metal* = false

I guess that when shouldn't be there, I'll try to fix that locally.

floooh commented 4 months ago

Ok, I did this minor fix and then merged: https://github.com/floooh/sokol/commit/b073c61c6e1d27d3e8e40ad83ebca3bad62a9b01

I didn't actually try to build for Emscripten, only for native macOS.

I'll add a little blurb to the changelog next.

Thanks for the PR!