Skip to content

Commit

Permalink
build: use cmake --build instead of invoking ninja
Browse files Browse the repository at this point in the history
  • Loading branch information
Chilledheart committed Dec 28, 2023
1 parent ed0887a commit 0345c69
Showing 1 changed file with 15 additions and 42 deletions.
57 changes: 15 additions & 42 deletions tools/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -1014,33 +1014,17 @@ func renameByUnlink(src string, dst string) error {
func buildStageExecuteBuildScript() {
glog.Info("BuildStage -- Execute Build Script")
glog.Info("======================================================================")
if systemNameFlag == "ios" {
xcodeCmd := []string{"xcodebuild", "build",
"-configuration", cmakeBuildTypeFlag,
"-jobs", fmt.Sprintf("%d", cmakeBuildConcurrencyFlag),
"-target", APPNAME}
cmdRun(xcodeCmd, true)
} else {
ninjaCmd := []string{"ninja", "-j", fmt.Sprintf("%d", cmakeBuildConcurrencyFlag), APPNAME}
cmdRun(ninjaCmd, true)
}
cmakeCmd := []string{"cmake", "--build", ".",
"--config", cmakeBuildTypeFlag,
"--parallel", fmt.Sprintf("%d", cmakeBuildConcurrencyFlag),
"--target", APPNAME}
cmdRun(cmakeCmd, true)
if buildBenchmarkFlag || runBenchmarkFlag {
if systemNameFlag == "ios" && subSystemNameFlag == "simulator" {
xcodeCmd := []string{"xcodebuild", "build", "-configuration", cmakeBuildTypeFlag,
"-jobs", fmt.Sprintf("%d", cmakeBuildConcurrencyFlag), "-target", "yass_benchmark"}
if (!runBenchmarkFlag) {
cmdRun(xcodeCmd, true)
}
} else if systemNameFlag == "ios" {
xcodeCmd := []string{"xcodebuild", "build", "-configuration", cmakeBuildTypeFlag,
"-jobs", fmt.Sprintf("%d", cmakeBuildConcurrencyFlag), "-target", "yass_benchmark"}
if (!runBenchmarkFlag) {
cmdRun(xcodeCmd, true)
}
} else {
ninjaCmd := []string{"ninja", "-j", fmt.Sprintf("%d", cmakeBuildConcurrencyFlag), "yass_benchmark"}
cmdRun(ninjaCmd, true)
}
cmakeCmd := []string{"cmake", "--build", ".",
"--config", cmakeBuildTypeFlag,
"--parallel", fmt.Sprintf("%d", cmakeBuildConcurrencyFlag),
"--target", "yass_benchmark"}
cmdRun(cmakeCmd, true)
}
if runBenchmarkFlag {
if systemNameFlag == "ios" && subSystemNameFlag == "simulator" {
Expand All @@ -1066,22 +1050,11 @@ func buildStageExecuteBuildScript() {
}
}
if buildTestFlag || runTestFlag {
if systemNameFlag == "ios" && subSystemNameFlag == "simulator" {
xcodeCmd := []string{"xcodebuild", "build", "-configuration", cmakeBuildTypeFlag,
"-jobs", fmt.Sprintf("%d", cmakeBuildConcurrencyFlag), "-target", "yass_test"}
if (!runTestFlag) {
cmdRun(xcodeCmd, true)
}
} else if systemNameFlag == "ios" {
xcodeCmd := []string{"xcodebuild", "build", "-configuration", cmakeBuildTypeFlag,
"-jobs", fmt.Sprintf("%d", cmakeBuildConcurrencyFlag), "-target", "yass_test"}
if (!runTestFlag) {
cmdRun(xcodeCmd, true)
}
} else {
ninjaCmd := []string{"ninja", "-j", fmt.Sprintf("%d", cmakeBuildConcurrencyFlag), "yass_test"}
cmdRun(ninjaCmd, true)
}
cmakeCmd := []string{"cmake", "--build", ".",
"--config", cmakeBuildTypeFlag,
"--parallel", fmt.Sprintf("%d", cmakeBuildConcurrencyFlag),
"--target", "yass_test"}
cmdRun(cmakeCmd, true)
}
if runTestFlag {
if systemNameFlag == "ios" && subSystemNameFlag == "simulator" {
Expand Down

0 comments on commit 0345c69

Please sign in to comment.