diff options
| author | ruki <[email protected]> | 2022-06-09 21:00:06 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-06-09 21:00:06 +0800 |
| commit | 9345be39a6dfd3b6302d3580a459c186826af756 (patch) | |
| tree | 57c47232e1d6dc0a4f818a1f0c59847ff169bf2a | |
| parent | 19a36ec61750f52b57a5180b4a8ae13a271053fd (diff) | |
improve options
| -rw-r--r-- | xmake/actions/config/menuconf.lua | 2 | ||||
| -rw-r--r-- | xmake/core/project/option.lua | 22 | ||||
| -rw-r--r-- | xmake/core/project/project.lua | 2 |
3 files changed, 19 insertions, 7 deletions
diff --git a/xmake/actions/config/menuconf.lua b/xmake/actions/config/menuconf.lua index 3d5d29123..5cd22859f 100644 --- a/xmake/actions/config/menuconf.lua +++ b/xmake/actions/config/menuconf.lua @@ -302,7 +302,7 @@ function app:_project_configs(cache) local keys = table.orderkeys(options) for _, key in ipairs(keys) do local opt = options[key] - if opt:get("showmenu") ~= false then + if opt:showmenu() ~= false then local category = "." if opt:get("category") then category = table.unwrap(opt:get("category")) end options_by_category[category] = options_by_category[category] or {} diff --git a/xmake/core/project/option.lua b/xmake/core/project/option.lua index abe1ace93..531f295db 100644 --- a/xmake/core/project/option.lua +++ b/xmake/core/project/option.lua @@ -475,10 +475,8 @@ end -- get xxx_script function _instance:script(name) - -- get script - local script = self:get(name) - -- imports some modules first + local script = self:get(name) if script then local scope = getfenv(script) if scope then @@ -487,11 +485,25 @@ function _instance:script(name) end end end - - -- ok return script end +-- show menu? +function _instance:showmenu() + local showmenu = self:get("showmenu") + if showmenu == nil then + -- auto check mode? we hidden menu by default + if self:get("ctypes") or self:get("cxxtypes") or + self:get("cfuncs") or self:get("cxxfuncs") or + self:get("cincludes") or self:get("cxxincludes") or + self:get("links") or self:get("syslinks") or + self:get("csnippets") or self:get("cxxsnippets") then + showmenu = false + end + end + return showmenu +end + -- get cache function option._cache() return localcache.cache("option") diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua index 66f696bbb..f48a45205 100644 --- a/xmake/core/project/project.lua +++ b/xmake/core/project/project.lua @@ -1174,7 +1174,7 @@ function project.menu() for name, opt in pairs(opts) do -- show menu? - if opt:get("showmenu") ~= false then + if opt:showmenu() ~= false then -- the default value local default = "auto" |
