Skip to content

Commit

Permalink
Add option to setup command allowing it to run without installed tool…
Browse files Browse the repository at this point in the history
…chains
  • Loading branch information
soumeh01 committed Oct 4, 2024
1 parent 798a170 commit 038abb6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/cbuild/commands/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func setUpProject(cmd *cobra.Command, args []string) error {
useContextSet, _ := cmd.Flags().GetBool("context-set")
frozenPacks, _ := cmd.Flags().GetBool("frozen-packs")
useCbuildgen, _ := cmd.Flags().GetBool("cbuildgen")
noDatabase, _ := cmd.Flags().GetBool("no-database")

useCbuild2CMake := true
if useCbuildgen {
Expand Down Expand Up @@ -99,6 +100,7 @@ func setUpProject(cmd *cobra.Command, args []string) error {
Toolchain: toolchain,
FrozenPacks: frozenPacks,
UseCbuild2CMake: useCbuild2CMake,
NoDatabase: noDatabase,
}

configs, err := utils.GetInstallConfigs()
Expand Down Expand Up @@ -152,4 +154,5 @@ func init() {
SetUpCmd.Flags().StringP("log", "", "", "Save output messages in a log file")
SetUpCmd.Flags().StringP("toolchain", "", "", "Input toolchain to be used")
SetUpCmd.Flags().BoolP("cbuildgen", "", false, "Generate legacy *.cprj files and use cbuildgen backend")
SetUpCmd.Flags().BoolP("no-database", "", false, "Do not generate compilation database")
}
6 changes: 6 additions & 0 deletions pkg/builder/cbuildidx/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ func (b CbuildIdxBuilder) build() error {
return nil
}

// no CMake orchestration needed
if b.Options.NoDatabase {
log.Info("build finished successfully!")
return nil
}

if vars.CmakeBin == "" {
err = errutils.New(errutils.ErrBinaryNotFound, "cmake", "")
return err
Expand Down
6 changes: 6 additions & 0 deletions pkg/builder/cproject/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ func (b CprjBuilder) build() error {
}
}

// no CMake orchestration needed
if b.Options.NoDatabase {
log.Info("build finished successfully!")
return nil
}

args = []string{"cmake", b.InputFile, "--outdir=" + dirs.OutDir, "--intdir=" + dirs.IntDir}
if b.Options.Quiet {
args = append(args, "--quiet")
Expand Down
1 change: 1 addition & 0 deletions pkg/builder/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type Options struct {
UseContextSet bool
FrozenPacks bool
UseCbuild2CMake bool
NoDatabase bool
}

type InternalVars struct {
Expand Down

0 comments on commit 038abb6

Please sign in to comment.