mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Improved handling of a library root based on "Conan" or "CMake" build systems // Resolve #3887
This commit is contained in:
@ -12,7 +12,8 @@ PlatformIO Core 5
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- Allowed to override a default library builder via a new ``builder`` field in a ``build`` group of `library.json <https://docs.platformio.org/page/librarymanager/config.html#build>`__ manifest (`issue #3957 <https://github.com/platformio/platformio-core/issues/3957>`_)
|
||||
- Handle "test" folder as a part of CLion project (`issue #4005 <https://github.com/platformio/platformio-core/issues/4005>`_)
|
||||
- Handle the "test" folder as a part of CLion project (`issue #4005 <https://github.com/platformio/platformio-core/issues/4005>`_)
|
||||
- Improved handling of a library root based on "Conan" or "CMake" build systems (`issue #3887 <https://github.com/platformio/platformio-core/issues/3887>`_)
|
||||
- Fixed a "KeyError: Invalid board option 'build.cpu'" when using a precompiled library with a board that does not have a CPU field in the manifest (`issue #4056 <https://github.com/platformio/platformio-core/issues/4056>`_)
|
||||
- Fixed a "FileExist" error when the `platformio ci <https://docs.platformio.org/en/latest/userguide/cmd_ci.html>`__ command is used in pair with the ``--keep-build-dir`` option (`issue #4011 <https://github.com/platformio/platformio-core/issues/4011>`_)
|
||||
- Fixed an issue with draft values of C++ language standards that broke static analysis via Cppcheck (`issue #3944 <https://github.com/platformio/platformio-core/issues/3944>`_)
|
||||
|
@ -184,11 +184,11 @@ class LibBuilderBase(object):
|
||||
|
||||
@property
|
||||
def include_dir(self):
|
||||
if not all(
|
||||
os.path.isdir(os.path.join(self.path, d)) for d in ("include", "src")
|
||||
):
|
||||
return None
|
||||
return os.path.join(self.path, "include")
|
||||
return (
|
||||
os.path.join(self.path, "include")
|
||||
if os.path.isdir(os.path.join(self.path, "include"))
|
||||
else None
|
||||
)
|
||||
|
||||
@property
|
||||
def src_dir(self):
|
||||
@ -501,6 +501,14 @@ class ArduinoLibBuilder(LibBuilderBase):
|
||||
return {}
|
||||
return ManifestParserFactory.new_from_file(manifest_path).as_dict()
|
||||
|
||||
@property
|
||||
def include_dir(self):
|
||||
if not all(
|
||||
os.path.isdir(os.path.join(self.path, d)) for d in ("include", "src")
|
||||
):
|
||||
return None
|
||||
return os.path.join(self.path, "include")
|
||||
|
||||
def get_include_dirs(self):
|
||||
include_dirs = LibBuilderBase.get_include_dirs(self)
|
||||
if os.path.isdir(os.path.join(self.path, "src")):
|
||||
|
@ -61,6 +61,12 @@ class LibraryPackageManager(BasePackageManager): # pylint: disable=too-many-anc
|
||||
@staticmethod
|
||||
def find_library_root(path):
|
||||
for root, dirs, files in os.walk(path):
|
||||
# check if Conan-based library
|
||||
if os.path.isfile(os.path.join(root, "conanfile.py")):
|
||||
return root
|
||||
# check if CMake-based library
|
||||
if os.path.isfile(os.path.join(root, "CMakeLists.txt")):
|
||||
return root
|
||||
if not files and len(dirs) == 1:
|
||||
continue
|
||||
for fname in files:
|
||||
|
Reference in New Issue
Block a user