mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 18:17:13 +02:00
Improve LDF C/C++ Preprocessor for conditional syntax // Issue #837
This commit is contained in:
@ -79,9 +79,10 @@ class LibBuilderFactory(object):
|
|||||||
|
|
||||||
class LibBuilderBase(object):
|
class LibBuilderBase(object):
|
||||||
|
|
||||||
|
DEFAULT_LDF_MODE = 1
|
||||||
|
|
||||||
CLASSIC_SCANNER = SCons.Scanner.C.CScanner()
|
CLASSIC_SCANNER = SCons.Scanner.C.CScanner()
|
||||||
INTELLISENSE_SCANNER = SCons.Scanner.C.SConsCPPScannerWrapper("CScanner",
|
ADVANCED_SCANNER = SCons.Scanner.C.CScanner(advanced=True)
|
||||||
"CPPPATH")
|
|
||||||
INC_DIRS_CACHE = None
|
INC_DIRS_CACHE = None
|
||||||
|
|
||||||
def __init__(self, env, path, manifest=None, verbose=False):
|
def __init__(self, env, path, manifest=None, verbose=False):
|
||||||
@ -160,7 +161,7 @@ class LibBuilderBase(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def lib_ldf_mode(self):
|
def lib_ldf_mode(self):
|
||||||
return int(self.env.get("LIB_LDF_MODE", 1))
|
return int(self.env.get("LIB_LDF_MODE", self.DEFAULT_LDF_MODE))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def depbuilders(self):
|
def depbuilders(self):
|
||||||
@ -281,11 +282,8 @@ class LibBuilderBase(object):
|
|||||||
result = []
|
result = []
|
||||||
for path in self._validate_search_paths(search_paths):
|
for path in self._validate_search_paths(search_paths):
|
||||||
try:
|
try:
|
||||||
assert isinstance(self, ProjectAsLibBuilder) or \
|
|
||||||
self.lib_ldf_mode == 2
|
|
||||||
incs = self.env.File(path).get_found_includes(
|
incs = self.env.File(path).get_found_includes(
|
||||||
self.env, LibBuilderBase.INTELLISENSE_SCANNER,
|
self.env, LibBuilderBase.ADVANCED_SCANNER, tuple(inc_dirs))
|
||||||
tuple(inc_dirs))
|
|
||||||
except: # pylint: disable=bare-except
|
except: # pylint: disable=bare-except
|
||||||
incs = self.env.File(path).get_found_includes(
|
incs = self.env.File(path).get_found_includes(
|
||||||
self.env, LibBuilderBase.CLASSIC_SCANNER, tuple(inc_dirs))
|
self.env, LibBuilderBase.CLASSIC_SCANNER, tuple(inc_dirs))
|
||||||
@ -635,7 +633,8 @@ def BuildDependentLibraries(env, src_dir):
|
|||||||
project.env = env
|
project.env = env
|
||||||
project.search_deps_recursive(lib_builders)
|
project.search_deps_recursive(lib_builders)
|
||||||
|
|
||||||
if int(env.get("LIB_LDF_MODE", 1)) == 1 and project.depbuilders:
|
if int(env.get("LIB_LDF_MODE", LibBuilderBase.DEFAULT_LDF_MODE)) == 1 \
|
||||||
|
and project.depbuilders:
|
||||||
correct_found_libs(lib_builders)
|
correct_found_libs(lib_builders)
|
||||||
|
|
||||||
if project.depbuilders:
|
if project.depbuilders:
|
||||||
|
@ -477,7 +477,7 @@ class PlatformBase(PlatformPackagesMixin, PlatformRunMixin):
|
|||||||
}
|
}
|
||||||
if "tool-scons" not in self.packages:
|
if "tool-scons" not in self.packages:
|
||||||
self.packages['tool-scons'] = {
|
self.packages['tool-scons'] = {
|
||||||
"version": "~3.20401.1",
|
"version": "~3.20401.2",
|
||||||
"optional": False
|
"optional": False
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user