Skip to content

Commit

Permalink
[CMAKE] include Arduino.h in main sketch file
Browse files Browse the repository at this point in the history
  • Loading branch information
facchinm authored and cmaglie committed Jan 10, 2018
1 parent 15baf78 commit e7600b5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sketch_source_merger.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
package builder

import (
"regexp"

"github.com/arduino/arduino-builder/types"
"github.com/arduino/arduino-builder/utils"
"regexp"
)

type SketchSourceMerger struct{}
Expand All @@ -43,12 +44,12 @@ func (s *SketchSourceMerger) Run(ctx *types.Context) error {

lineOffset := 0
includeSection := ""
includeSection += "#line 1 " + utils.QuoteCppString(sketch.MainFile.Name) + "\n"
lineOffset++
if !sketchIncludesArduinoH(&sketch.MainFile) {
includeSection += "#include <Arduino.h>\n"
lineOffset++
}
includeSection += "#line 1 " + utils.QuoteCppString(sketch.MainFile.Name) + "\n"
lineOffset++
ctx.IncludeSection = includeSection

source := includeSection
Expand Down

0 comments on commit e7600b5

Please sign in to comment.