forked from platformio/platformio-core
Allowe to unflag(remove) base/initial flags using build_unflags
// Resolve #559
This commit is contained in:
12
HISTORY.rst
12
HISTORY.rst
@ -16,23 +16,27 @@ PlatformIO 2.0
|
|||||||
* Added support for `Microchip PIC32 <http://docs.platformio.org/en/latest/platforms/microchippic32.html>`__
|
* Added support for `Microchip PIC32 <http://docs.platformio.org/en/latest/platforms/microchippic32.html>`__
|
||||||
development platform
|
development platform
|
||||||
(`issue #438 <https://github.com/platformio/platformio/issues/438>`_)
|
(`issue #438 <https://github.com/platformio/platformio/issues/438>`_)
|
||||||
* Updated Arduino core for Espressif platform to 2.2.0
|
|
||||||
(`issue #627 <https://github.com/platformio/platformio/issues/627>`_)
|
|
||||||
* New boards for `ARM mbed <http://docs.platformio.org/en/latest/frameworks/mbed.html>`__
|
* New boards for `ARM mbed <http://docs.platformio.org/en/latest/frameworks/mbed.html>`__
|
||||||
framework: ST Nucleo F410RB, ST Nucleo L073RZ and BBC micro:bit
|
framework: ST Nucleo F410RB, ST Nucleo L073RZ and BBC micro:bit
|
||||||
* Added support for Generic ATTiny boards: ATTiny24, ATTiny25, ATTiny45 and
|
* Added support for Generic ATTiny boards: ATTiny24, ATTiny25, ATTiny45 and
|
||||||
ATTiny85
|
ATTiny85
|
||||||
* Added support for `TI MSP430 <http://docs.platformio.org/en/latest/platforms/timsp430.html>`__
|
* Added support for `TI MSP430 <http://docs.platformio.org/en/latest/platforms/timsp430.html>`__
|
||||||
boards: TI LaunchPad w/ msp430fr4133 and TI LaunchPad w/ msp430fr6989
|
boards: TI LaunchPad w/ msp430fr4133 and TI LaunchPad w/ msp430fr6989
|
||||||
|
* Updated Arduino core for Espressif platform to 2.2.0
|
||||||
|
(`issue #627 <https://github.com/platformio/platformio/issues/627>`_)
|
||||||
|
* Updated native SDK for ESP8266 to 1.5
|
||||||
|
(`issue #366 <https://github.com/platformio/platformio/issues/366>`_)
|
||||||
* PlatformIO Library Registry in JSON format! Implemented
|
* PlatformIO Library Registry in JSON format! Implemented
|
||||||
``--json-output`` and ``--page`` options for
|
``--json-output`` and ``--page`` options for
|
||||||
`platformio lib search <http://docs.platformio.org/en/latest/userguide/lib/cmd_search.html>`__
|
`platformio lib search <http://docs.platformio.org/en/latest/userguide/lib/cmd_search.html>`__
|
||||||
command
|
command
|
||||||
(`issue #604 <https://github.com/platformio/platformio/issues/604>`_)
|
(`issue #604 <https://github.com/platformio/platformio/issues/604>`_)
|
||||||
|
* Allowed to unflag(remove) base/initial flags using
|
||||||
|
`build_unflags <http://docs.platformio.org/en/latest/projectconf.html#build-unflags>`__
|
||||||
|
option
|
||||||
|
(`issue #559 <https://github.com/platformio/platformio/issues/559>`_)
|
||||||
* Allowed multiple VID/PID pairs when detecting serial ports
|
* Allowed multiple VID/PID pairs when detecting serial ports
|
||||||
(`issue #632 <https://github.com/platformio/platformio/issues/632>`_)
|
(`issue #632 <https://github.com/platformio/platformio/issues/632>`_)
|
||||||
* Updated native SDK for ESP8266 to 1.5
|
|
||||||
(`issue #366 <https://github.com/platformio/platformio/issues/366>`_)
|
|
||||||
* Automatically add ``-DUSB_MANUFACTURER`` with vendor's name
|
* Automatically add ``-DUSB_MANUFACTURER`` with vendor's name
|
||||||
(`issue #631 <https://github.com/platformio/platformio/issues/631>`_)
|
(`issue #631 <https://github.com/platformio/platformio/issues/631>`_)
|
||||||
* Automatically reboot Teensy board after upload when Teensy Loader GUI is used
|
* Automatically reboot Teensy board after upload when Teensy Loader GUI is used
|
||||||
|
@ -341,6 +341,17 @@ but will be applied only for the project source code from
|
|||||||
This option can be set by global environment variable
|
This option can be set by global environment variable
|
||||||
:envvar:`PLATFORMIO_SRC_BUILD_FLAGS`.
|
:envvar:`PLATFORMIO_SRC_BUILD_FLAGS`.
|
||||||
|
|
||||||
|
``build_unflags``
|
||||||
|
^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Remove base/initial flags which were set by development platform.
|
||||||
|
|
||||||
|
.. code-block:: ini
|
||||||
|
|
||||||
|
[env:unflags]
|
||||||
|
build_unflags = -Os -std=gnu++11
|
||||||
|
build_flags = -O2
|
||||||
|
|
||||||
.. _projectconf_src_filter:
|
.. _projectconf_src_filter:
|
||||||
|
|
||||||
``src_filter``
|
``src_filter``
|
||||||
|
@ -42,6 +42,7 @@ commonvars.AddVariables(
|
|||||||
("FRAMEWORK",),
|
("FRAMEWORK",),
|
||||||
("BUILD_FLAGS",),
|
("BUILD_FLAGS",),
|
||||||
("SRC_BUILD_FLAGS",),
|
("SRC_BUILD_FLAGS",),
|
||||||
|
("BUILD_UNFLAGS",),
|
||||||
("SRC_FILTER",),
|
("SRC_FILTER",),
|
||||||
("LIB_DFCYCLIC",),
|
("LIB_DFCYCLIC",),
|
||||||
("LIB_IGNORE",),
|
("LIB_IGNORE",),
|
||||||
|
@ -42,10 +42,14 @@ def BuildProgram(env):
|
|||||||
ASCOM="$ASPPCOM"
|
ASCOM="$ASPPCOM"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# process extra flags from board
|
||||||
env.ProcessFlags([
|
env.ProcessFlags([
|
||||||
env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags"),
|
env.get("BOARD_OPTIONS", {}).get("build", {}).get("extra_flags")
|
||||||
env.get("BUILD_FLAGS")
|
|
||||||
])
|
])
|
||||||
|
# remove base flags
|
||||||
|
env.ProcessUnFlags(env.get("BUILD_UNFLAGS"))
|
||||||
|
# apply user flags
|
||||||
|
env.ProcessFlags([env.get("BUILD_FLAGS")])
|
||||||
|
|
||||||
if env.get("FRAMEWORK"):
|
if env.get("FRAMEWORK"):
|
||||||
env.BuildFrameworks([
|
env.BuildFrameworks([
|
||||||
@ -128,6 +132,15 @@ def ProcessFlags(env, flags):
|
|||||||
env.Append(_CPPDEFFLAGS=" %s" % " ".join(undefines))
|
env.Append(_CPPDEFFLAGS=" %s" % " ".join(undefines))
|
||||||
|
|
||||||
|
|
||||||
|
def ProcessUnFlags(env, flags):
|
||||||
|
if not flags:
|
||||||
|
return
|
||||||
|
for var, values in env.ParseFlags(flags).items():
|
||||||
|
for v in values:
|
||||||
|
if v in env[var]:
|
||||||
|
env[var].remove(v)
|
||||||
|
|
||||||
|
|
||||||
def IsFileWithExt(env, file_, ext): # pylint: disable=W0613
|
def IsFileWithExt(env, file_, ext): # pylint: disable=W0613
|
||||||
if basename(file_).startswith("."):
|
if basename(file_).startswith("."):
|
||||||
return False
|
return False
|
||||||
@ -371,6 +384,7 @@ def exists(_):
|
|||||||
def generate(env):
|
def generate(env):
|
||||||
env.AddMethod(BuildProgram)
|
env.AddMethod(BuildProgram)
|
||||||
env.AddMethod(ProcessFlags)
|
env.AddMethod(ProcessFlags)
|
||||||
|
env.AddMethod(ProcessUnFlags)
|
||||||
env.AddMethod(IsFileWithExt)
|
env.AddMethod(IsFileWithExt)
|
||||||
env.AddMethod(VariantDirWrap)
|
env.AddMethod(VariantDirWrap)
|
||||||
env.AddMethod(LookupSources)
|
env.AddMethod(LookupSources)
|
||||||
|
Reference in New Issue
Block a user