Comments (3)
Yeah, controversial topic I know, but I'll keep sokol header-only.
Some reasons:
- configuration-defines don't spill out into the build system, instead you can put them right before the implementation includes
- when compiling on MacOS, a .c file wouldn't work because the implementation contains Objective-C code, so there would have to be a sokol_gfx.c with just the C code, and another sokol_gfx.m file with just the Obj-C parts
- I consider the STB headers the reference, and those have been working just fine for many projects
- compilation time difference isn't measurable, and will most likely be less when packing all header-only libs of a project into a single implementation source file (similar to a unity build), the implementation code is skipped, not parsed (since there are no inline functions like in many C++ header-only libs), integrating sokol_gfx.h into Oryol has actually reduced compile time by a about 7 seconds
To integrate the sokol headers into a bigger project, you would basically provide the sokol.c / sokol.m file yourself:
https://github.com/floooh/sokol-samples/blob/master/sapp/sokol.c
https://github.com/floooh/sokol-samples/blob/master/sapp/sokol.m
Apologies for closing this issue, but this is one of those topics where both sides have valid arguments and it comes down to endlessly discussing personal preference ;)
from sokol.
No worries :)
these can be baked into one header file, using the same approach as nuklear using a script.
Would you merge a pull request that does that ?
from sokol.
Would you merge a pull request that does that ?
Not at the moment, I need to think more about it. Right now it's not a high priority, but this might change as more headers are added.
I'm aware of the merge-script approach that nuklear uses since quite recently, but I would need to figure out how to automate the merge during the edit/compile/test loop (could be done with a fips/cmake custom build step I guess).
FYI, sokol_gfx.h also started in separate pieces, not C-files, but one header file per 3D-backend which was then included by the top-level sokol_gfx.h.
from sokol.
Related Issues (20)
- Using Sokol_gfx with multiple CAMetalLayers HOT 5
- sokol_app.h: support sapp_toggle_fullscreen with HTML5 HOT 2
- Triple buffering for metal - sokol_gfx.h HOT 1
- set metal resource labels - sokol_gfx.h HOT 5
- What is the best way to add tessellation shader support for OpenGL backend? HOT 2
- Rendering to different default gl framebuffers - sokol_gfx.h
- Compressed data & chunk size fails fetch HOT 7
- Some way to sponsor the project in the readme HOT 1
- Question: Where are mipmaps generated? HOT 2
- The allocator callbacks should not be called alloc/free. HOT 1
- Towards a unified sg_begin_pass()
- sg_make_image crash when Xcode Metal API Validation enabled HOT 7
- sg_begin_default_pass on metal sometimes costs 10+ms HOT 7
- Unify the various _cb, _func, _fn suffixes
- sokol_gfx.h: cubemap filtering is not seamless on GLCORE33 backend HOT 6
- Mipmap sampling of non-square image results in black texture on GL/GLES HOT 4
- Reminder: investigate live object report on D3D11
- sokol_gfx failing to compile on macOS 12.4 with `use of undeclared identifier 'MTLGPUFamilyApple8'` HOT 10
- How to sync graphics with audio? HOT 2
- Misleading error message VALIDATE_ABND_FS_EXPECTED_IMAGE_BINDING HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sokol.