Allow to use extra build options as array for library.json // Issue #289

This commit is contained in:
Ivan Kravets
2016-07-15 18:41:16 +03:00
parent 4997528f6a
commit c7d9ab8474
2 changed files with 35 additions and 11 deletions

View File

@ -426,14 +426,28 @@ A list of example patterns. This field is predefined with default value:
Specify advanced settings, options and flags for the build system. Possible
options:
* ``flags`` - extra flags to control preprocessing, compilation, assembly and
.. list-table::
:header-rows: 1
* - Option
- Type
- Description
* - ``flags``
- ``String`` or ``Array``
- Extra flags to control preprocessing, compilation, assembly and
linking processes. More details :ref:`projectconf_build_flags`
* ``unflags`` - remove base/initial flags which were set by development
* - ``unflags``
- ``String`` or ``Array``
- Remove base/initial flags which were set by development
platform. More details :ref:`projectconf_build_unflags`
* ``srcFilter`` - specify which source files should be included/excluded
* - ``srcFilter``
- ``String`` or ``Array``
- Specify which source files should be included/excluded
from build process. More details :ref:`projectconf_src_filter`
* ``extraScript`` - launch extra script before build process.
More details :ref:`projectconf_extra_script`.
* - ``extraScript``
- ``String``
- Launch extra script before build process.
More details :ref:`projectconf_extra_script`
**Examples**
@ -450,7 +464,10 @@ options:
.. code-block:: javascript
"build": {
"flags": "-I inc -I inc/target_x13"
"flags": [
"-I inc",
"-I inc/target_x13"
]
}
3. Force to use ``C99`` standard instead ``C11``
@ -487,7 +504,11 @@ options:
.. code-block:: python
# Import('env')
Import('env')
# print env.Dump()
env.Append(
CPPDEFINES=["HELLO=WORLD", "TAG=1.2.3", "DEBUG"],
CPPPATH=["inc", "inc/devices"]
)
# some python code that generates headers files "on-the-fly"

View File

@ -114,7 +114,9 @@ def BuildProgram(env):
def ProcessFlags(env, flags):
if not flags:
return
parsed_flags = env.ParseFlags(str(flags))
if isinstance(flags, list):
flags = " ".join(flags)
parsed_flags = env.ParseFlags(flags)
for flag in parsed_flags.pop("CPPDEFINES"):
if not isinstance(flag, list):
env.Append(CPPDEFINES=flag)
@ -147,6 +149,7 @@ def ProcessFlags(env, flags):
def ProcessUnFlags(env, flags):
if not flags:
return
flags = " ".join(flags)
parsed_flags = env.ParseFlags(flags)
all_flags = []
for items in parsed_flags.values():