Skip to content

Commit

Permalink
Add support for additional_include_paths library property
Browse files Browse the repository at this point in the history
  • Loading branch information
facchinm committed Mar 11, 2020
1 parent 2791756 commit 2ffbe85
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
29 changes: 15 additions & 14 deletions arduino/libraries/libraries.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,21 @@ type Library struct {

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

InstallDir *paths.Path
SourceDir *paths.Path
UtilityDir *paths.Path
Location LibraryLocation
ContainerPlatform *cores.PlatformRelease `json:""`
Layout LibraryLayout
RealName string
DotALinkage bool
Precompiled bool
LDflags string
IsLegacy bool
Version *semver.Version
License string
Properties *properties.Map
InstallDir *paths.Path
SourceDir *paths.Path
UtilityDir *paths.Path
Location LibraryLocation
ContainerPlatform *cores.PlatformRelease `json:""`
Layout LibraryLayout
RealName string
DotALinkage bool
Precompiled bool
LDflags string
IsLegacy bool
Version *semver.Version
License string
AdditionalIncludePaths []*paths.Path
Properties *properties.Map
}

func (library *Library) String() string {
Expand Down
8 changes: 8 additions & 0 deletions arduino/libraries/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ func makeNewLibrary(libraryDir *paths.Path, location LibraryLocation) (*Library,
library.DotALinkage = libProperties.GetBoolean("dot_a_linkage")
library.Precompiled = libProperties.GetBoolean("precompiled")
library.LDflags = strings.TrimSpace(libProperties.Get("ldflags"))
additionalIncludePathsList := libProperties.Get("additional_include_paths")
if additionalIncludePathsList != "" {
temp := strings.Split(additionalIncludePathsList, ",")
for _, el := range temp {
dir := paths.New(libraryDir.Join(el).String())
library.AdditionalIncludePaths = append(library.AdditionalIncludePaths, dir)
}
}
library.Properties = libProperties

return library, nil
Expand Down
5 changes: 5 additions & 0 deletions legacy/builder/phases/libraries_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ func compileLibrary(ctx *types.Context, library *libraries.Library, buildPath *p
}

if library.Layout == libraries.RecursiveLayout {
if library.AdditionalIncludePaths != nil {
for _, el := range library.AdditionalIncludePaths {
includes = append(includes, utils.WrapWithHyphenI(el.String()))
}
}
libObjectFiles, err := builder_utils.CompileFilesRecursive(ctx, library.SourceDir, libraryBuildPath, buildProperties, includes)
if err != nil {
return nil, i18n.WrapError(err)
Expand Down
1 change: 1 addition & 0 deletions rpc/commands/lib.proto
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ message Library {
string version = 21;
string license = 22;
map<string, string> properties = 23;
string additional_include_paths = 24;
}

enum LibraryLayout {
Expand Down

0 comments on commit 2ffbe85

Please sign in to comment.