-
Notifications
You must be signed in to change notification settings - Fork 833
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
build(bazel): introduce tflm_cc_* macros, refactoring away micro_copts #2765
Conversation
Remove micro_copts() by replacing every cc_* target that used them with a tflm_cc_* equivalent, and setting those common copts in one place, inside the tflm_cc_* macro. This is the first of several commits introducing tflm_cc_* macros in place of cc_binary, cc_library, and cc_test. Motivated by the upcoming need to support conditional compilation, the objective is to centralize build configuration rather than requiring (and remembering that) each cc_* target in the project add the same common attributes such as compiler options and select()ed Alternatives such as setting global options on the command line or in .bazelrc, even if simplified with a --config option, fail to preserve flags and hooks for configuration in the case TFLM is used as an external repository by an application project. Nor is it easy in that case for individual targets to override an otherwise global setting. BUG=tensorflow#2636
Could you expand on the conditional compilations? Will we have different tflm_copts and the idea is the user will just change that rather than change all micro_copts? |
Yes. Looking ahead, the conditional complication will be implemented through these macros by a change like 884a234. There's a central place to make a change like that once the macros in this commit (
|
I see. Unfortunately theres some internal code that use |
The original If this internal code needs to build with compression turned on---yes, ultimately it needs to have USE_TFLM_COMPRESSION defined somehow. If they don't want to adopt our tflm_cc_* macros wholesale, they could use the upcoming |
Add a deprecated alias for tflm_copts(), for the benefit of code outside the open-source TFLM repository.
After talking in person, we have decided to resurrect micro_copts() as an alias for out-of-tree code. |
Do we need to keep |
I'm inclined to leave them both, because:
|
Remove micro_copts() by replacing every cc_* target that used
them with a tflm_cc_* equivalent, and setting those common copts
in one place, inside the tflm_cc_* macro.
This is the first of several commits introducing tflm_cc_* macros
in place of cc_binary, cc_library, and cc_test. Motivated by the
upcoming need to support conditional compilation, the objective
is to centralize build configuration rather than requiring (and
remembering that) each cc_* target in the project add the same
common attributes such as compiler options and select()ed
Alternatives such as setting global options on the command line
or in .bazelrc, even if simplified with a --config option, fail
to preserve flags and hooks for configuration in the case TFLM is
used as an external repository by an application project. Nor is
it easy in that case for individual targets to override an
otherwise global setting.
BUG=#2636