-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Beef lang bindings generator #496
base: master
Are you sure you want to change the base?
Conversation
Thanks for the PR :) I'll try to give it a whirl soon-ish (I haven't tinkered with beef yet so I first will need to read up on this a bit). One thing: The submodule should be removed, and instead for now the scripts should expect that the bindings git repo has been checked out manually at the right place. I don't know yet if the current directory structure is final, but in any case the sokol git repository shouldn't contain submodules. |
https://www.beeflang.org/ is a new programming language similar to C# but without GC and based on LLVM with many awesome features. I also removed submodule as you requested. |
I'm currently looking into Beef a bit, just tinkering with the Beef IDE and example project. Really impressive stuff :) Is the PR ready for merging or still WIP? As soon as you give the go ahead I can look into it. It would probably also be good to port a few examples from the sokol-samples repository. |
The below video has some info about language. For using sokol in Beef you have to create ether a static library or dynamic library to use them. |
Thanks for the link! If possible we should aim for a "batteries included" bindings repository which contains a snapshot of the sokol headers which match the generated bindings, and a simple way to compile those into a library (I would prefer static, but I don't know what's the preference is in the Beef world). As example, check out how it looks in the Zig and Nim bindings (note the "c" subdirectory): https://github.com/floooh/sokol-zig/tree/master/src/sokol https://github.com/floooh/sokol-nim/tree/master/src/sokol Both Zig and Nim can directly compile C source files though, don't know how this is handled with Beef in a cross-platform way (I guess if the Beef "build system" doesn't support compiling C libraries, then we should add a simple cmake file to the bindings repository which compiles the sokol headers into a library and could look like this snippet: if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
add_library(sokol STATIC sokol/sokol.m ${SOKOL_HEADERS})
target_link_libraries(sokol PUBLIC
"-framework QuartzCore"
"-framework Cocoa"
"-framework MetalKit"
"-framework Metal")
else()
add_library(sokol STATIC sokol/sokol.c ${SOKOL_HEADERS})
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
target_link_libraries(sokol INTERFACE X11 Xi Xcursor GL dl m)
target_link_libraries(sokol PUBLIC Threads::Threads)
endif()
endif() (taken from: https://github.com/floooh/cimgui-sokol-starterkit/blob/main/CMakeLists.txt) |
PS: for porting the samples, it's a good idea to copy-paste the GLSL, HLSL and Metal shader code from the following platform-specific samples, instead of trying to extract the code-generated shader code from the |
Hi @floooh Beef can not compile c files at this time. I don't know if it will support later or not but can work with both static and dynamic libraries so I add a cmake script to compile sokol into the .lib file. I also write a sokol-clear example in Beef and every thing works just fine. below is my example code in Beef
|
I updated my beef generator to the latest sokol version and add triangle sample to see the shaders are working or not. Also fixed a bug in my generator. please check this sample code |
Ah, thanks for brining the Beef generator to my attention again :) Now that the bindings updates are automated I think it's time again to look into the PR :) |
No description provided.