Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional include paths libs #502

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 4 additions & 0 deletions legacy/builder/container_find_includes.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,10 @@ func findIncludesUntilDone(ctx *types.Context, cache *includeCache, sourceFile t
return i18n.WrapError(preproc_err)
}

for _, el := range library.AdditionalIncludePaths {
appendIncludeFolder(ctx, cache, sourcePath, include, el)
}

// Add this library to the list of libraries, the
// include path and queue its source files for further
// include scanning
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