mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 18:17:13 +02:00
Allow to use extra build options as array for library.json // Issue #289
This commit is contained in:
@ -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
|
Specify advanced settings, options and flags for the build system. Possible
|
||||||
options:
|
options:
|
||||||
|
|
||||||
* ``flags`` - extra flags to control preprocessing, compilation, assembly and
|
.. list-table::
|
||||||
linking processes. More details :ref:`projectconf_build_flags`
|
:header-rows: 1
|
||||||
* ``unflags`` - remove base/initial flags which were set by development
|
|
||||||
platform. More details :ref:`projectconf_build_unflags`
|
* - Option
|
||||||
* ``srcFilter`` - specify which source files should be included/excluded
|
- Type
|
||||||
from build process. More details :ref:`projectconf_src_filter`
|
- Description
|
||||||
* ``extraScript`` - launch extra script before build process.
|
* - ``flags``
|
||||||
More details :ref:`projectconf_extra_script`.
|
- ``String`` or ``Array``
|
||||||
|
- Extra flags to control preprocessing, compilation, assembly and
|
||||||
|
linking processes. More details :ref:`projectconf_build_flags`
|
||||||
|
* - ``unflags``
|
||||||
|
- ``String`` or ``Array``
|
||||||
|
- Remove base/initial flags which were set by development
|
||||||
|
platform. More details :ref:`projectconf_build_unflags`
|
||||||
|
* - ``srcFilter``
|
||||||
|
- ``String`` or ``Array``
|
||||||
|
- Specify which source files should be included/excluded
|
||||||
|
from build process. More details :ref:`projectconf_src_filter`
|
||||||
|
* - ``extraScript``
|
||||||
|
- ``String``
|
||||||
|
- Launch extra script before build process.
|
||||||
|
More details :ref:`projectconf_extra_script`
|
||||||
|
|
||||||
**Examples**
|
**Examples**
|
||||||
|
|
||||||
@ -450,7 +464,10 @@ options:
|
|||||||
.. code-block:: javascript
|
.. code-block:: javascript
|
||||||
|
|
||||||
"build": {
|
"build": {
|
||||||
"flags": "-I inc -I inc/target_x13"
|
"flags": [
|
||||||
|
"-I inc",
|
||||||
|
"-I inc/target_x13"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
3. Force to use ``C99`` standard instead ``C11``
|
3. Force to use ``C99`` standard instead ``C11``
|
||||||
@ -487,7 +504,11 @@ options:
|
|||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
# Import('env')
|
Import('env')
|
||||||
# print env.Dump()
|
# 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"
|
# some python code that generates headers files "on-the-fly"
|
||||||
|
@ -114,7 +114,9 @@ def BuildProgram(env):
|
|||||||
def ProcessFlags(env, flags):
|
def ProcessFlags(env, flags):
|
||||||
if not flags:
|
if not flags:
|
||||||
return
|
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"):
|
for flag in parsed_flags.pop("CPPDEFINES"):
|
||||||
if not isinstance(flag, list):
|
if not isinstance(flag, list):
|
||||||
env.Append(CPPDEFINES=flag)
|
env.Append(CPPDEFINES=flag)
|
||||||
@ -147,6 +149,7 @@ def ProcessFlags(env, flags):
|
|||||||
def ProcessUnFlags(env, flags):
|
def ProcessUnFlags(env, flags):
|
||||||
if not flags:
|
if not flags:
|
||||||
return
|
return
|
||||||
|
flags = " ".join(flags)
|
||||||
parsed_flags = env.ParseFlags(flags)
|
parsed_flags = env.ParseFlags(flags)
|
||||||
all_flags = []
|
all_flags = []
|
||||||
for items in parsed_flags.values():
|
for items in parsed_flags.values():
|
||||||
|
Reference in New Issue
Block a user