diff options
-rw-r--r-- | lua/cmake/autocmds.lua | 2 | ||||
-rw-r--r-- | lua/cmake/config.lua | 10 | ||||
-rw-r--r-- | lua/cmake/variants.lua | 3 |
3 files changed, 9 insertions, 6 deletions
diff --git a/lua/cmake/autocmds.lua b/lua/cmake/autocmds.lua index 4b5b479..deb193d 100644 --- a/lua/cmake/autocmds.lua +++ b/lua/cmake/autocmds.lua @@ -28,7 +28,7 @@ function autocmds.setup() desc = "Generate project after saving CMakeLists.txt", }) end - --NOTE: this autocmd was written only to handle very rarely case when inside directory + --NOTE: this autocmd was written only to handle very rare case when inside directory --without CMakeLists.txt neovim starts like `nvim CMakeLists.txt`. In this case initial --setup will not make the affect and to correctry process the file save, we need to create --this autocommand so it reinitializes the project if it has not been done before. IMHO this diff --git a/lua/cmake/config.lua b/lua/cmake/config.lua index 49dbc50..9f7d04a 100644 --- a/lua/cmake/config.lua +++ b/lua/cmake/config.lua @@ -22,21 +22,21 @@ local default_config = { }, }, }, - parallel_jobs = 0, - source_directory = "${workspaceFolder}", + parallel_jobs = nil, --#(vim.uv or vim.loop).cpu_info(), + -- source_directory = "${workspaceFolder}", --TODO: not used }, save_before_build = true, generate_after_save = true, terminal = { - direction = "vertical", - display_name = "CMake", + direction = "horizontal", + display_name = "CMake", --TODO: not used close_on_exit = "success", hidden = false, clear_env = false, focus = false, }, runner_terminal = { - direction = "vertical", + direction = "horizontal", close_on_exit = false, hidden = false, clear_env = false, diff --git a/lua/cmake/variants.lua b/lua/cmake/variants.lua index 0d54a79..b68ff05 100644 --- a/lua/cmake/variants.lua +++ b/lua/cmake/variants.lua @@ -44,6 +44,9 @@ end local _build_args = function(obj, build_directory) local args = { "--build" } table.insert(args, build_directory) + if config.cmake.parallel_jobs then + table.insert(args, "-j " .. tostring(config.cmake.parallel_jobs)) + end if #obj.buildArgs ~= 0 then for _, v in ipairs(obj.buildArgs) do table.insert(args, v) |