Improve docs for "build_flags"

This commit is contained in:
Ivan Kravets
2023-04-21 11:40:54 +03:00
parent 9344f3cd81
commit 82d380d895
4 changed files with 16 additions and 3 deletions

2
docs

Submodule docs updated: 437b1175bd...890d8e20fe

View File

@ -200,7 +200,7 @@ def ParseFlagsExtended(env, flags): # pylint: disable=too-many-branches
# fix relative CPPPATH & LIBPATH
for k in ("CPPPATH", "LIBPATH"):
for i, p in enumerate(result.get(k, [])):
if os.path.isdir(p):
if not os.path.isabs(p):
result[k][i] = os.path.abspath(p)
# fix relative path for "-include"

View File

@ -134,7 +134,7 @@ class ProjectGenerator:
for root, _, files in os.walk(self.config.get("platformio", "src_dir")):
for f in files:
result.append(
os.path.relpath(os.path.join(os.path.realpath(root), f))
os.path.relpath(os.path.join(os.path.abspath(root), f))
)
return result

View File

@ -22,6 +22,7 @@ def test_generic_build(clirunner, validate_cliresult, tmpdir):
("-D TEST_INT=13", "-DTEST_INT=13"),
("-DTEST_SINGLE_MACRO", "-DTEST_SINGLE_MACRO"),
('-DTEST_STR_SPACE="Andrew Smith"', '"-DTEST_STR_SPACE=Andrew Smith"'),
("-Iextra_inc", "-Iextra_inc"),
]
tmpdir.join("platformio.ini").write(
@ -58,8 +59,20 @@ projenv.Append(CPPDEFINES="POST_SCRIPT_MACRO")
"""
)
tmpdir.mkdir("extra_inc").join("foo.h").write(
"""
#define FOO
"""
)
tmpdir.mkdir("src").join("main.cpp").write(
"""
#include "foo.h"
#ifndef FOO
#error "FOO"
#endif
#ifdef I_AM_ONLY_SRC_FLAG
#include <component.h>
#else