openFrameworks icon indicating copy to clipboard operation
openFrameworks copied to clipboard

More .h work - splitting ofConstants in more files

Open dimitre opened this issue 2 years ago • 4 comments

here the idea is splitting ofConstants.h in different smaller .h files

ofConstants.h - calls internally every other smaller .h file and include the specific platform includes. ofFS.h - all about of::filesystem ofDeprecated.h - only the definitions to make functions deprecated ofPlatforms.h - all about platforms definitions only.

This is a first idea, so feel free to give suggestions, file naming and paths.

motivation: with this we can add to .h files only the needed functionality without having to include the entire ofConstants.h This one can potentially improve compile time of OF project.

Only some ofConstants.h were replaced in this PR. if approved further work will be done

dimitre avatar Mar 21 '23 22:03 dimitre

If we go this route I wonder if we should include glm via ofMathConstants.h or another similar way. So we don't need a ton of #define GLM_FORCE_CTOR_INIT all over the place?

eg: https://github.com/openframeworks/openFrameworks/commit/312ad3cee094a6d689591dd3385267b6c2fbd1a7

I know that it undoes some of the untangling, but it feels more elegant to have that defined in one place, so it could be commented out and/or removed if required easily.

ofTheo avatar Mar 22 '23 17:03 ofTheo

Yeah I agree. For me it is the same. I don't mind having GLM_FORCE_CTOR_INIT all over too. If someday we decide to zero initialize everything we can incrementally cleaning GLM_FORCE_CTOR_INIT for each file too

dimitre avatar Mar 23 '23 16:03 dimitre

Would GLM_FORCE_CTOR_INIT be better suited in a PCH if it's everywhere?

danoli3 avatar Aug 22 '23 05:08 danoli3

@danoli3 exactly. somebody suggested using project generator to add this to all projects. I can help with that once we know what to add and where (I suppose it is addDefine function on PG but not sure)

dimitre avatar Aug 22 '23 16:08 dimitre