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
|
local default_config = {
cmake_path = "cmake",
environment = {},
configure_environment = {},
build_directory = "${workspaceFolder}/build-${buildType}",
build_environment = {},
build_args = {},
build_tool_args = {},
generator = nil,
default_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" },
},
},
},
variants_display = {
short_sep = " × ",
long_sep = " ❄ ",
},
parallel_jobs = nil,
save_before_build = true,
source_directory = "${workspaceFolder}",
}
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
|