Skip to content
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

Fix CMake args for esp-idf lower than 4.4 #1266

Merged
merged 3 commits into from
Aug 6, 2024
Merged
Changes from 1 commit
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
Next Next commit
Fix CMake args for esp-idf lower than 4.4
  • Loading branch information
radurentea committed Jul 31, 2024
commit 44aeb1284a9a56d8f45fca331847751d1726b2e7
45 changes: 36 additions & 9 deletions src/build/buildTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ import { join } from "path";
import { Logger } from "../logger/logger";
import * as vscode from "vscode";
import * as idfConf from "../idfConfiguration";
import { appendIdfAndToolsToPath, isBinInPath } from "../utils";
import {
appendIdfAndToolsToPath,
isBinInPath,
getEspIdfFromCMake,
compareVersion,
} from "../utils";
import { TaskManager } from "../taskManager";
import { selectedDFUAdapterId } from "../flash/dfu";

Expand Down Expand Up @@ -121,14 +126,36 @@ export class BuildTask {
: vscode.TaskRevealKind.Silent;

if (!cmakeCacheExists) {
let compilerArgs = (idfConf.readParameter(
"idf.cmakeCompilerArgs",
this.currentWorkspace
) as Array<string>) || [
"-G=Ninja",
"-DPYTHON_DEPS_CHECKED=1",
"-DESP_PLATFORM=1",
];
const espIdfVersion = await getEspIdfFromCMake(this.idfPathDir);
let defaultCompilerArgs;
if (espIdfVersion === "x.x") {
Logger.warn(
"Could not determine ESP-IDF version. Using default compiler arguments for the latest known version."
);
defaultCompilerArgs = [
"-G=Ninja",
"-DPYTHON_DEPS_CHECKED=1",
"-DESP_PLATFORM=1",
];
} else if (compareVersion(espIdfVersion, "4.4") >= 0) {
defaultCompilerArgs = [
"-G=Ninja",
"-DPYTHON_DEPS_CHECKED=1",
"-DESP_PLATFORM=1",
];
} else {
defaultCompilerArgs = [
"-G",
"Ninja",
"-DPYTHON_DEPS_CHECKED=1",
"-DESP_PLATFORM=1",
];
}
let compilerArgs =
(idfConf.readParameter(
"idf.cmakeCompilerArgs",
this.currentWorkspace
) as Array<string>) || defaultCompilerArgs;
let buildPathArgsIndex = compilerArgs.indexOf("-B");
if (buildPathArgsIndex !== -1) {
compilerArgs.splice(buildPathArgsIndex, 2);
Expand Down
Loading