Open alaurenzi opened 3 years ago
Evaluated conditions (New in d7a2eee807d0e9ff01f93c7a766b7c6c39433b21 !) For more complex use cases, the user might need to set different flags depending on more complex conditions. The first attempt at addressing this is the following:
build:
args_if:
"<python_statement_returning_bool>": -DMY_FLAG=VALUE
"ubuntu_release == 18.04": -DMY_FLAG=VALUE # example
The python statement can include any python's builtins (e.g., the ==
in the example), plus a list of supported attributes that we, as developers, enable my appropriate modification of the forest.common.eval_handler.Locals
class. Right now, we only have ubuntu_release
, but I'd expect to include at least
env()
-> method to retrieve environment variablesshell()
-> method to invoke the shellThe user needs to know which local attributes are supported. Output after 0db7577adaed611150972a709ff4b4a5bb9a2f60
arturo@arturo-iit-desktop ~ $ forest --list-eval-locals
name type
---- ----
ubuntu_release float
shell function(cmd:str) -> str
env function(key:str) -> str
Latest devel now supports (maybe) conditional cmake args.
The first draft is very simple. Given a recipe such as
The cmake arg
-DXBOT2_ENABLE_XENO=ON
is added if calling forest as follows:forest xbot2_examples -m xeno
. More than one "mode" can be specified at command line.@MarcoRuzzon what do you think? Can we test it on your use case scenario? Can you think of a better / more flexible way to do this?