forked from platformio/platformio-core
Automatically append -DPLATFORMIO to builder // Resolve #105
This commit is contained in:
@@ -20,6 +20,8 @@ Release History
|
|||||||
development platform
|
development platform
|
||||||
* Created new `Frameworks <http://docs.platformio.org/en/latest/frameworks/index.html>`__
|
* Created new `Frameworks <http://docs.platformio.org/en/latest/frameworks/index.html>`__
|
||||||
page in documentation
|
page in documentation
|
||||||
|
* Automatically append define ``-DPLATFORMIO=%version%`` to builder
|
||||||
|
(`issue #105 <https://github.com/ivankravets/platformio/issues/105>`_)
|
||||||
* Renamed ``stm32`` development platform to
|
* Renamed ``stm32`` development platform to
|
||||||
`ststm32 <http://docs.platformio.org/en/latest/platforms/ststm32.html>`__
|
`ststm32 <http://docs.platformio.org/en/latest/platforms/ststm32.html>`__
|
||||||
|
|
||||||
|
@@ -9,8 +9,19 @@ from os.path import basename, dirname, isdir, isfile, join, normpath
|
|||||||
from SCons.Script import Exit, SConscript, SConscriptChdir
|
from SCons.Script import Exit, SConscript, SConscriptChdir
|
||||||
from SCons.Util import case_sensitive_suffixes
|
from SCons.Util import case_sensitive_suffixes
|
||||||
|
|
||||||
|
from platformio import __version__
|
||||||
|
|
||||||
|
|
||||||
def BuildFirmware(env):
|
def BuildFirmware(env):
|
||||||
|
|
||||||
|
def _append_pioversion():
|
||||||
|
vermatch = re.match(r"^([\d\.]+)", __version__)
|
||||||
|
assert vermatch
|
||||||
|
intparts = [int(i) for i in vermatch.group(1).split(".")[:3]]
|
||||||
|
firmenv.Append(
|
||||||
|
CPPDEFINES=["PLATFORMIO={:02d}{:02d}{:02d}".format(*intparts)]
|
||||||
|
)
|
||||||
|
|
||||||
# fix ASM handling under non-casitive OS
|
# fix ASM handling under non-casitive OS
|
||||||
if not case_sensitive_suffixes('.s', '.S'):
|
if not case_sensitive_suffixes('.s', '.S'):
|
||||||
env.Replace(
|
env.Replace(
|
||||||
@@ -52,6 +63,8 @@ def BuildFirmware(env):
|
|||||||
if _srcbuild_flags:
|
if _srcbuild_flags:
|
||||||
firmenv.MergeFlags(_srcbuild_flags)
|
firmenv.MergeFlags(_srcbuild_flags)
|
||||||
|
|
||||||
|
_append_pioversion()
|
||||||
|
|
||||||
return firmenv.Program(
|
return firmenv.Program(
|
||||||
join("$BUILD_DIR", "firmware"),
|
join("$BUILD_DIR", "firmware"),
|
||||||
[firmenv.GlobCXXFiles(vdir) for vdir in vdirs],
|
[firmenv.GlobCXXFiles(vdir) for vdir in vdirs],
|
||||||
|
Reference in New Issue
Block a user