aboutsummaryrefslogtreecommitdiff
path: root/lua/cmake/config.lua
blob: 3ce4f98a942ff1e07fad14112d3538c5468d1d30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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" },
				},
			},
		},
		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