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

Modularizing config.h #475

Merged
merged 2 commits into from
Oct 31, 2017
Merged

Conversation

damienmarchal
Copy link
Contributor

@damienmarchal damienmarchal commented Oct 14, 2017

Currently config.h is a all-in-one configuration file that is generated by CMakeLists and included nearly everywhere. The problem is that it contains also very specific options that very few files are using. But, each time any of these specific option is changed sofa needs to be recompiled entirely.

This PR is a implementing a more modular approach in which each .cpp that specifically requires a given define include a dedicated file.
Eg:
#include<config/build_option_opengl.h> // to do #if(SOFA_WITH_OPENGL==1)
or
#include<config/build_option_experimental.h> // to do #if(SOFA_WITH_EXPERIMENTALFATURE==1)
or
#include<config/sharedlibrary_defines.h>

It is still possible to use the old file but by being more specific we will reduce the amount of file to recompile when we will changed something.


This PR:

  • builds with SUCCESS for all platforms on the CI.
  • does not generate new warnings.
  • does not generate new unit test failures.
  • does not generate new scene test failures.
  • does not break API compatibility.
  • is more than 1 week old (or has fast-merge label).

Reviewers will merge only if all these checks are true.

Currently config.h is a all-in-one configuration file that is generated by
CMakeLists and included nearly everywhere. The problem is that it contains
also very specific options that very few files are using. But, each time any of these specific
option is changed sofa needs to be recompiled entirely.

This PR is a implementing a more specific approach in which each .cpp that
specifically requires a given define a dedicated file.
Eg:
#include<config/build_option_opengl.h>  // to do #if(SOFA_WITH_OPENGL==1)
or
#include<config/build_option_experimental.h>  // to do #if(SOFA_WITH_EXPERIMENTALFATURE==1)
or
#include<config/sharedlibrary_defines.h>

... it is still possible to use the old file but by being more specific we will
reduce the amount of file to recompile when we will changed something.
@damienmarchal damienmarchal added pr: fast merge Minor change that can be merged without waiting for the 7 review days refactoring Refactor code pr: status to review To notify reviewers to review this pull-request and removed pr: fast merge Minor change that can be merged without waiting for the 7 review days labels Oct 15, 2017
@guparan
Copy link
Contributor

guparan commented Oct 23, 2017

👍 for this work

#include <sofa/config/sharedlibrary_defines.h>
#include <sofa/config/build_option_dump_visitor.h>
#include <sofa/config/build_option_opengl.h>
#include <sofa/config/build_option_threading.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we should deprecate this? When?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. But would prefer to focus of task with more added value :)

@guparan guparan mentioned this pull request Oct 23, 2017
6 tasks
@guparan guparan added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Oct 25, 2017
@guparan guparan merged commit 89e3d4d into sofa-framework:master Oct 31, 2017
@guparan guparan added this to the v17.12 milestone Dec 14, 2017
@damienmarchal damienmarchal deleted the modularizeConfig_h branch December 20, 2017 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: status ready Approved a pull-request, ready to be squashed refactoring Refactor code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants