Skip to content

Commit

Permalink
add setupOptions configuration, useful for passing --cross-file to me…
Browse files Browse the repository at this point in the history
…son setup

Partial fix for #46
  • Loading branch information
chris-laplante authored and dcbaker committed Aug 4, 2022
1 parent 14ad37e commit ba953c1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@
],
"description": "Specify the list of configuration options used for Meson configuration."
},
"mesonbuild.setupOptions": {
"type": "array",
"default": [],
"description": "Specify the list of setup options used for Meson setup. Can be used to specify a cross file (use --cross-file=FILE)."
},
"mesonbuild.mesonPath": {
"type": "string",
"default": "meson",
Expand Down
5 changes: 3 additions & 2 deletions src/meson/runners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export async function runMesonConfigure(source: string, build: string) {
});

const configureOpts = extensionConfiguration("configureOptions");
const setupOpts = extensionConfiguration("setupOptions");

if (await checkMesonIsConfigured(build)) {
progress.report({
Expand All @@ -40,15 +41,15 @@ export async function runMesonConfigure(source: string, build: string) {
progress.report({ message: "Reconfiguring build...", increment: 60 });

// Note "setup --reconfigure" needs to be run from the root.
await exec(extensionConfiguration("mesonPath"), ["setup", "--reconfigure", build],
await exec(extensionConfiguration("mesonPath"), ["setup", "--reconfigure", ...setupOpts, build],
{ cwd: source });
} else {
progress.report({
message: `Configuring Meson into ${relative(source, build)}...`
});

const { stdout, stderr } = await exec(
extensionConfiguration("mesonPath"), ["setup", ...configureOpts, build],
extensionConfiguration("mesonPath"), ["setup", ...configureOpts, ...setupOpts, build],
{ cwd: source });

getOutputChannel().appendLine(stdout);
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type LinterConfiguration = {
export interface ExtensionConfiguration {
configureOnOpen: boolean | "ask";
configureOptions: string[];
setupOptions: string[];
buildFolder: string;
mesonPath: string;
muonPath: string;
Expand Down

0 comments on commit ba953c1

Please sign in to comment.