aboutsummaryrefslogtreecommitdiff
path: root/lua/cmake/config.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/cmake/config.lua')
-rw-r--r--lua/cmake/config.lua66
1 files changed, 66 insertions, 0 deletions
diff --git a/lua/cmake/config.lua b/lua/cmake/config.lua
new file mode 100644
index 0000000..9a0e5ba
--- /dev/null
+++ b/lua/cmake/config.lua
@@ -0,0 +1,66 @@
+local default_config = {
+ cmake = {
+ cmake_path = "cmake",
+ environment = {},
+ configure_environment = {},
+ build_directory = "${workspaceFolder}/build-${buildType}",
+ build_environment = {},
+ build_args = {},
+ build_tool_args = {},
+ generator = nil,
+ variants = {
+ {
+ default = "debug",
+ description = "Build type",
+ choices = {
+ debug = { short = "Debug", long = "Long debug", buildType = "Debug" },
+ release = { short = "Release", long = "Long release", buildType = "Release" },
+ },
+ },
+ {
+ default = "static",
+ choices = {
+ static = { short = "Static", long = "Long static", linkage = "static" },
+ shared = { short = "Shared", long = "Long shared", linkage = "shared" },
+ },
+ },
+ },
+ parallel_jobs = 0,
+ save_before_build = true,
+ source_directory = "${workspaceFolder}",
+ },
+ terminal = {
+ direction = "horizontal",
+ display_name = "CMake",
+ close_on_exit = "success",
+ hidden = false,
+ clear_env = false,
+ focus = false,
+ },
+ runner_terminal = {
+ direction = "horizontal",
+ close_on_exit = false,
+ hidden = false,
+ clear_env = false,
+ focus = true,
+ },
+ notification = {
+ after = "success",
+ },
+ variants_display = {
+ short = { sep = " × " },
+ long = { sep = " ❄ " },
+ },
+}
+
+local M = vim.deepcopy(default_config)
+
+M.setup = function(opts)
+ local newconf = vim.tbl_deep_extend("force", default_config, opts or {})
+
+ for k, v in pairs(newconf) do
+ M[k] = v
+ end
+end
+
+return M