summaryrefslogtreecommitdiff
path: root/lua/aotrix/compile.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/aotrix/compile.lua')
-rw-r--r--lua/aotrix/compile.lua27
1 files changed, 25 insertions, 2 deletions
diff --git a/lua/aotrix/compile.lua b/lua/aotrix/compile.lua
index 9b0c58b..e7c9556 100644
--- a/lua/aotrix/compile.lua
+++ b/lua/aotrix/compile.lua
@@ -80,6 +80,28 @@ function compileTarget()
if not (pTarget == nil) and string.len(pTarget) > 0 then
createFloatingTerminal()
local commandTable = {
+ "cmake --build " .. build_dir .. " --target " .. pTarget
+ }
+ local commandConcatenation = ""
+ for i, command in ipairs(commandTable) do
+ commandConcatenation = commandConcatenation .. command
+ if i < #commandTable then
+ commandConcatenation = commandConcatenation .. " && "
+ end
+ end
+ executeCommandInTerminal(commandConcatenation)
+ end
+ end
+
+ defineBuildFolderPath()
+ chooseTarget(compile)
+end
+
+function compileAndExecuteTarget()
+ function compileAndExecute(pTarget)
+ if not (pTarget == nil) and string.len(pTarget) > 0 then
+ createFloatingTerminal()
+ local commandTable = {
"cmake --build " .. build_dir .. " --target " .. pTarget,
build_dir .. "/" .. pTarget
}
@@ -95,7 +117,8 @@ function compileTarget()
end
defineBuildFolderPath()
- chooseTarget(compile)
+ chooseTarget(compileAndExecute)
end
-vim.keymap.set("n", "mt", compileTarget)
+vim.keymap.set("n", "mc", compileTarget)
+vim.keymap.set("n", "mt", compileAndExecuteTarget)