Skip to content

Add --libraries flag to compile command #436

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

Merged
merged 2 commits into from
Jan 17, 2020
Merged
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
4 changes: 4 additions & 0 deletions cli/compile/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ var (
port string // Upload port, e.g.: COM10 or /dev/ttyACM0.
verify bool // Upload, verify uploaded binary after the upload.
exportFile string // The compiled binary is written to this file
libraries []string // List of custom libraries paths separated by commas. Or can be used multiple times for multiple libraries paths.
)

// NewCommand created a new `compile` command
Expand Down Expand Up @@ -79,6 +80,8 @@ func NewCommand() *cobra.Command {
command.Flags().StringVarP(&port, "port", "p", "", "Upload port, e.g.: COM10 or /dev/ttyACM0")
command.Flags().BoolVarP(&verify, "verify", "t", false, "Verify uploaded binary after the upload.")
command.Flags().StringVar(&vidPid, "vid-pid", "", "When specified, VID/PID specific build properties are used, if boards supports them.")
command.Flags().StringSliceVar(&libraries, "libraries", []string{},
"List of custom libraries paths separated by commas. Or can be used multiple times for multiple libraries paths.")

return command
}
Expand Down Expand Up @@ -107,6 +110,7 @@ func run(cmd *cobra.Command, args []string) {
Quiet: quiet,
VidPid: vidPid,
ExportFile: exportFile,
Libraries: libraries,
}, os.Stdout, os.Stderr, viper.GetString("logging.level") == "debug")

if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion commands/compile/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W
builderCtx.HardwareDirs = configuration.HardwareDirectories()
builderCtx.BuiltInToolsDirs = configuration.BundleToolsDirectories()

builderCtx.OtherLibrariesDirs = paths.NewPathList()
builderCtx.OtherLibrariesDirs = paths.NewPathList(req.GetLibraries()...)
builderCtx.OtherLibrariesDirs.Add(configuration.LibrariesDir())

if req.GetBuildPath() != "" {
Expand Down
61 changes: 35 additions & 26 deletions rpc/commands/compile.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rpc/commands/compile.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ message CompileReq {
string vidPid = 12; // VID/PID specific build properties.
string exportFile = 13; // The compiled binary is written to this file
int32 jobs = 14; // The max number of concurrent compiler instances to run (as make -jx)
repeated string libraries = 15; // List of custom libraries paths separated by commas. Or can be used multiple times for multiple libraries paths.
}

message CompileResp {
Expand Down