Yggdrasil icon indicating copy to clipboard operation
Yggdrasil copied to clipboard

Add sokol

Open VarLad opened this issue 10 months ago • 12 comments

Currently only compiles on Linux. Not sure whats the issue on Windows, on Apple I believe the lld-macos: error: undefined symbol: ___isPlatformVersionAtLeast issue can be fixed by linking to libclang_rt.osx but I'm not sure how to do that... any help would be appreciated! Also, Apple and Windows are having the same issue of undefined reference to sokol_main, not sure what that means....

VarLad avatar Jan 31 '25 10:01 VarLad

on Apple I believe the lld-macos: error: undefined symbol: ___isPlatformVersionAtLeast issue can be fixed by linking to libclang_rt.osx but I'm not sure how to do that... any help would be appreciated!

When else fails, use the search functionality

giordano avatar Jan 31 '25 14:01 giordano

When else fails, use the search functionality

That issue is solved, thanks! :) All thats left is the undefined reference to sokol_main issue in both Windows and Apple...

VarLad avatar Jan 31 '25 17:01 VarLad

@giordano Any idea on the issue that is occurring for Windows and Apple builds? Looks like its the same issue for both :upside_down_face:

VarLad avatar Feb 03 '25 13:02 VarLad

All required builds pass, except rv64 since it lacks a dependency, which I disabled! Should be ready for review now.

VarLad avatar Feb 06 '25 00:02 VarLad

I'm confused by exactly what you are trying to package here. According to the upstream git repo (https://github.com/floooh/sokol), sokol is a header library, meaning it should just be packaging headers that the dependencies include. You seem to be adding a C file that has an empty main function and compiling a shared library - why is this needed? If this is truly just a header only library, then this library just needs to install the headers and have an AllPlatforms tag.

imciner2 avatar Feb 06 '25 11:02 imciner2

@imciner2 I share similar concerns so I looked up previous instances of something similar

  • I found https://github.com/Gnimuc/STBImage.jl which was doing something similar with https://github.com/Gnimuc/STBImageBuilder/tree/master/src
  • I believe the official bindings like https://github.com/floooh/sokol-nim/ do something similar

So I thought building it as a library and wrapping it with Clang.jl is the best way forward.

has an empty main function

Windows and Apple demand this :)

VarLad avatar Feb 06 '25 11:02 VarLad

Maybe the question is: what do you want to do exactly with this?

giordano avatar Feb 06 '25 11:02 giordano

Maybe the question is: what do you want to do exactly with this?

Generate bindings with Clang.jl and use its functions

VarLad avatar Feb 06 '25 12:02 VarLad

@giordano Given that I want to use the functions from this library in Julia, if not this, what is the best way to do this in your opinion. The first example I've posted is doing exactly this I believe. The second one I suspect is doing something similar too, and those are the official bindings from the developer.

Although, I looked for something similar in JuliaBinaryWrappers and couldn't find anything similar to my case. There's stb but its simply packaged as headers and I don't see a julia package which uses them or expose them to someone using it to write a Julia library.

VarLad avatar Feb 06 '25 12:02 VarLad

Ok, if you want to actually use these functions in Julia, then you probably do need to compile this into a library. Usually we see header only libraries used as dependencies for other packages instead of from Julia itself.

As for the wrapper, it looks more complicated and confusing than it really needs to be. It references emscripten in the CMake, you don't need to give the headers to the target, and also the main function isn't needed (libraries don't have main functions).

imciner2 avatar Feb 06 '25 18:02 imciner2

@imciner2 Thanks for the comment! I made some changes accordingly :)

VarLad avatar Feb 07 '25 02:02 VarLad

Merge?

ViralBShah avatar May 09 '25 03:05 ViralBShah