From 3c93417fee81b7d9b0a7b49a616c6cd081737cea Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Mon, 20 Nov 2023 21:41:17 +0700 Subject: [PATCH] feat: parse and pass `options` input --- main/index.mjs | 4 ++++ src/main.mts | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/main/index.mjs b/main/index.mjs index 77c8c8b..e403fdc 100644 --- a/main/index.mjs +++ b/main/index.mjs @@ -27259,6 +27259,10 @@ async function main() { const cxxFlags = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getMultilineInput("cxx-flags").join(" "); if (cxxFlags) configureArgs.push("-DCMAKE_CXX_FLAGS=" + cxxFlags); + const options = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getMultilineInput("options") + .flatMap((opts) => opts.split(" ")) + .map((opt) => "-D" + opt); + configureArgs.push(...options); await _actions_exec__WEBPACK_IMPORTED_MODULE_1__.exec("cmake", configureArgs); _actions_core__WEBPACK_IMPORTED_MODULE_0__.setOutput("build-dir", buildDir || "build"); const runBuild = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getBooleanInput("run-build"); diff --git a/src/main.mts b/src/main.mts index de4b42e..bac7479 100644 --- a/src/main.mts +++ b/src/main.mts @@ -22,6 +22,12 @@ async function main() { const cxxFlags = core.getMultilineInput("cxx-flags").join(" "); if (cxxFlags) configureArgs.push("-DCMAKE_CXX_FLAGS=" + cxxFlags); + const options = core + .getMultilineInput("options") + .flatMap((opts) => opts.split(" ")) + .map((opt) => "-D" + opt); + configureArgs.push(...options); + await exec.exec("cmake", configureArgs); core.setOutput("build-dir", buildDir || "build");