Skip to content

Commit

Permalink
Fix cmaker API and test
Browse files Browse the repository at this point in the history
  • Loading branch information
lm-sousa committed Aug 7, 2024
1 parent b8c2130 commit dddbe30
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 25 deletions.
19 changes: 6 additions & 13 deletions Clava-JS/src-api/clava/cmake/CMaker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,33 +286,26 @@ export default class CMaker extends BenchmarkCompilationEngine {
const builderFolderpath = Io.mkdir(builderFolder).getAbsolutePath();

// Execute CMake
let cmakeCmd =
'cmake "' + cmakeFile.getParentFile().getAbsolutePath() + '"';
let cmakeCmd = ["cmake", `"${cmakeFile.getParentFile().getAbsolutePath()}"`];
if (cmakeFlags !== undefined) {
cmakeCmd += " " + cmakeFlags;
cmakeCmd.push(cmakeFlags);
}

if (this.generator !== undefined) {
cmakeCmd += ` -G "${this.generator}"`;
cmakeCmd.push(`-G "${this.generator}"`);
}

if (this.compiler !== undefined) {
cmakeCmd += " " + this.compiler.getCommandArgs();
cmakeCmd.push(this.compiler.getCommandArgs());
}

debug(
"Executing CMake, calling '" +
cmakeCmd +
"' at ' " +
builderFolderpath +
" '"
);
debug(() =>`Executing CMake, calling '${cmakeCmd.join(" ")}' at '${builderFolderpath}'`);
const cmakeOutput = new ProcessExecutor();

cmakeOutput
.setPrintToConsole(this.printToConsole)
.setWorkingDir(builderFolderpath)
.execute(cmakeCmd);
.execute(...cmakeCmd);

const consoleOutput = cmakeOutput.getConsoleOutput();
if (cmakeOutput.getReturnValue() === 0 && consoleOutput != undefined) {
Expand Down
16 changes: 6 additions & 10 deletions ClavaLaraApi/src-lara/clava/clava/cmake/CMaker.js

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

4 changes: 2 additions & 2 deletions ClavaWeaver/resources/clava/test/api/CMakerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ laraImport("lara.Platforms");
laraImport("clava.cmake.CMaker");
laraImport("clava.Clava");

var cmaker = new CMaker("testapp")
const cmaker = new CMaker("testapp")
.setMinimumVersion("3.0.2")
.addCxxFlags("-O3", "-std=c++11")
.addLibs("stdc++")
Expand All @@ -14,7 +14,7 @@ if (Platforms.isWindows()) {
}

// Build
var executable = cmaker.build();
const executable = cmaker.build();

if (executable !== undefined) {
println("Created executable: " + Io.removeExtension(executable.getName()));
Expand Down

0 comments on commit dddbe30

Please sign in to comment.