Skip to content

Commit 2ffbe85

Browse files
committed
Add support for additional_include_paths library property
Fixes arduino#501
1 parent 2791756 commit 2ffbe85

File tree

4 files changed

+29
-14
lines changed

4 files changed

+29
-14
lines changed

arduino/libraries/libraries.go

+15-14
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,21 @@ type Library struct {
5555

5656
Types []string `json:"types,omitempty"`
5757

58-
InstallDir *paths.Path
59-
SourceDir *paths.Path
60-
UtilityDir *paths.Path
61-
Location LibraryLocation
62-
ContainerPlatform *cores.PlatformRelease `json:""`
63-
Layout LibraryLayout
64-
RealName string
65-
DotALinkage bool
66-
Precompiled bool
67-
LDflags string
68-
IsLegacy bool
69-
Version *semver.Version
70-
License string
71-
Properties *properties.Map
58+
InstallDir *paths.Path
59+
SourceDir *paths.Path
60+
UtilityDir *paths.Path
61+
Location LibraryLocation
62+
ContainerPlatform *cores.PlatformRelease `json:""`
63+
Layout LibraryLayout
64+
RealName string
65+
DotALinkage bool
66+
Precompiled bool
67+
LDflags string
68+
IsLegacy bool
69+
Version *semver.Version
70+
License string
71+
AdditionalIncludePaths []*paths.Path
72+
Properties *properties.Map
7273
}
7374

7475
func (library *Library) String() string {

arduino/libraries/loader.go

+8
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ func makeNewLibrary(libraryDir *paths.Path, location LibraryLocation) (*Library,
105105
library.DotALinkage = libProperties.GetBoolean("dot_a_linkage")
106106
library.Precompiled = libProperties.GetBoolean("precompiled")
107107
library.LDflags = strings.TrimSpace(libProperties.Get("ldflags"))
108+
additionalIncludePathsList := libProperties.Get("additional_include_paths")
109+
if additionalIncludePathsList != "" {
110+
temp := strings.Split(additionalIncludePathsList, ",")
111+
for _, el := range temp {
112+
dir := paths.New(libraryDir.Join(el).String())
113+
library.AdditionalIncludePaths = append(library.AdditionalIncludePaths, dir)
114+
}
115+
}
108116
library.Properties = libProperties
109117

110118
return library, nil

legacy/builder/phases/libraries_builder.go

+5
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ func compileLibrary(ctx *types.Context, library *libraries.Library, buildPath *p
192192
}
193193

194194
if library.Layout == libraries.RecursiveLayout {
195+
if library.AdditionalIncludePaths != nil {
196+
for _, el := range library.AdditionalIncludePaths {
197+
includes = append(includes, utils.WrapWithHyphenI(el.String()))
198+
}
199+
}
195200
libObjectFiles, err := builder_utils.CompileFilesRecursive(ctx, library.SourceDir, libraryBuildPath, buildProperties, includes)
196201
if err != nil {
197202
return nil, i18n.WrapError(err)

rpc/commands/lib.proto

+1
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ message Library {
160160
string version = 21;
161161
string license = 22;
162162
map<string, string> properties = 23;
163+
string additional_include_paths = 24;
163164
}
164165

165166
enum LibraryLayout {

0 commit comments

Comments
 (0)