forked from Civitasv/cmake-tools.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_preset.lua
More file actions
49 lines (41 loc) · 1 KB
/
build_preset.lua
File metadata and controls
49 lines (41 loc) · 1 KB
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
local Path = require("plenary.path")
local osys = require("cmake-tools.osys")
---@class BuildPreset: CMakeBuildPreset
local BuildPreset = {}
---@param cwd string
---@param obj CMakeBuildPreset?
---@return BuildPreset
function BuildPreset:new(cwd, obj)
local instance = setmetatable(obj or {}, { __index = self })
instance.__index = self
instance.environment = instance.environment or {}
instance.cwd = cwd
if instance.valid == nil then
instance.valid = true
end
return instance
end
---@return string[]|nil
function BuildPreset:get_build_target()
if self.targets == nil then
return nil
end
if type(self.targets) == "string" then
return { self.targets }
elseif type(self.targets) == "table" then
return self.targets
end
return nil
end
---@return string|nil
function BuildPreset:get_build_type()
if self.configuration == nil then
return nil
end
return self.configuration
end
---@return boolean
function BuildPreset:is_valid()
return self.valid
end
return BuildPreset