Skip to content
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

Improve odin bindings, DLL support #1023

Merged
merged 7 commits into from
Apr 13, 2024

Conversation

jakubtomsu
Copy link
Contributor

This PR does a number of modifications to the Odin binding generator, and the project structure:

  • Add support for DLLs, using unity builds to compile all sokol libs into a single DLL (Windows only)
    • the primary reason for this is hot reloading
    • added sokol.c for unity builds
  • Define the #config values as constants, so they can be easily used elsewhere
  • Use a custom debug constant instead of ODIN_DEBUG (which is still used by default), which can override either all sokol libs or individual modules
  • Add some empty lines to the generated bindings to improve readability :) (this is my personal preference, doesn't have anything to do with the rest of this PR)
  • move the c folder which contains all C files and the build scripts into the sokol folder with odin packages. This means the sokol folder is now completely standalone and can be easily copied into the source directory of any project.

Most of these changes are what I used in my game Solar Storm. Sometimes it's just what I personally prefer, but I think it ultimately does make the bindings easier to work with.

Note: these changes are still a bit experimental as I couldn't test 100% everything before submitting the PR (like the automatic uploading of bindings on each commit).

@jakubtomsu
Copy link
Contributor Author

Linked PR from the sokol-odin repo: floooh/sokol-odin#11

@jakubtomsu
Copy link
Contributor Author

It's a pretty big PR, so in case you don't like something let me know

@floooh
Copy link
Owner

floooh commented Apr 11, 2024

Looks good! I'll try to give it a whirl on the weekend before merging.

I was wondering why you moved the top-level scripts to build the C libraries into a subdirectory (because I preferred to have them visible at the top level), but this is a good reason:

This means the sokol folder is now completely standalone and can be easily copied into the source directory of any project.

PS: don't worry about the failed CI, I guess that's because the PR expects the new directory structure in sokol-odin.

@floooh floooh self-assigned this Apr 11, 2024
@jakubtomsu
Copy link
Contributor Author

Thank you! I agree the build scripts look nicer in the top-level folder, but this way just fits the odin workflow a bit better...

@floooh floooh merged commit dcde6a9 into floooh:master Apr 13, 2024
17 of 18 checks passed
@floooh
Copy link
Owner

floooh commented Apr 13, 2024

And merged. Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants