Skip to content

Commit 55f9599

Browse files
authored
Add sketch folder to include directories
Because everything is built in another directory than the sketch folder, it is impossible to share common code between sketches or other C++ projects when all of them are in the same repository. Even with the library for Arduino, it would be strange to use one in another C++ project. This commit aims to make the share possible by adding the possibility to specify relative include paths to the sketch file.
1 parent 69b6665 commit 55f9599

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

container_find_includes.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ func (s *ContainerFindIncludes) Run(ctx *types.Context) error {
135135
}
136136

137137
sketch := ctx.Sketch
138+
// Add the folder containing the sketch to the include directories
139+
appendIncludeFolder(ctx, cache, "", "", filepath.Dir(sketch.MainFile.Name))
140+
138141
mergedfile, err := types.MakeSourceFile(ctx, sketch, filepath.Base(sketch.MainFile.Name)+".cpp")
139142
if err != nil {
140143
return i18n.WrapError(err)

0 commit comments

Comments
 (0)