diff options
| author | ruki <[email protected]> | 2015-05-25 11:13:04 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-05-25 11:13:04 +0800 |
| commit | d3afea28dfea3709fde2296a090cf94598271047 (patch) | |
| tree | 954d26f9ffd3ebd29a64cc9ecb585542d9d8d0fa /xmake/scripts/base | |
| parent | 99582c402d5580877247344cca1f708f15e16d7b (diff) | |
custom option menu for platform
Diffstat (limited to 'xmake/scripts/base')
| -rw-r--r-- | xmake/scripts/base/main.lua | 29 | ||||
| -rw-r--r-- | xmake/scripts/base/option.lua | 38 |
2 files changed, 54 insertions, 13 deletions
diff --git a/xmake/scripts/base/main.lua b/xmake/scripts/base/main.lua index 13ce70dfa..d41e24859 100644 --- a/xmake/scripts/base/main.lua +++ b/xmake/scripts/base/main.lua @@ -182,24 +182,29 @@ local menu = , {'k', "packages", "kv", "pkg", "Set the packages directory" } , {} - , {nil, "cc", "kv", nil, "The c compiler" } - , {nil, "cxx", "kv", nil, "The c++ compiler" } - , {nil, "mm", "kv", nil, "The objc compiler" } - , {nil, "mxx", "kv", nil, "The objc++ compiler" } - , {nil, "ld", "kv", nil, "The linker" } - , {nil, "as", "kv", nil, "The assembler" } - , {nil, "ar", "kv", nil, "The library creator" } + , {nil, "cross", "kv", nil, "The cross toolchains prefix" + , ".e.g" + , " - i386-mingw32-" + , " - arm-linux-androideabi-" } + , {nil, "toolchains", "kv", nil, "The cross toolchains directory" } , {} + , {nil, "cc", "kv", "gcc", "The c compiler" } + , {nil, "cx", "kv", "gcc", "The c/c++ compiler" } + , {nil, "cxx", "kv", "gcc", "The c++ compiler" } , {nil, "cflags", "kv", nil, "The c compiler flags" } , {nil, "cxflags", "kv", nil, "The c/c++ compiler flags" } , {nil, "cxxflags", "kv", nil, "The c++ compiler flags" } - , {nil, "mflags", "kv", nil, "The objc compiler flags" } - , {nil, "mxflags", "kv", nil, "The objc/c++ compiler flags" } - , {nil, "mxxflags", "kv", nil, "The objc++ compiler flags" } - , {nil, "asflags", "kv", nil, "The assembler flags" } + + , {} + , {nil, "ld", "kv", "ld", "The linker" } , {nil, "ldflags", "kv", nil, "The linker flags" } - , {nil, "arflags", "kv", nil, "The library creator flags" } + + , {} + , {nil, "as", "kv", "as", "The assembler" } + , {nil, "asflags", "kv", nil, "The assembler flags" } + + , function () return platform.menu("config") end , {} , {'f', "file", "kv", "xmake.xproj","Read a given xmake.xproj file." } diff --git a/xmake/scripts/base/option.lua b/xmake/scripts/base/option.lua index 7e3d963b4..3da4850c0 100644 --- a/xmake/scripts/base/option.lua +++ b/xmake/scripts/base/option.lua @@ -26,6 +26,42 @@ local option = option or {} -- load modules local utils = require("base/utils") +-- save the option menu +function option._save_menu(menu) + + -- translate it if exists function in the option menu + for _, submenu in pairs(menu) do + + -- exits options? + if submenu.options then + + -- translate options + local options_all = {} + for _, option in ipairs(submenu.options) do + + -- this option is function? translate it + if type(option) == "function" then + local _options = option() + if _options then + for _, o in ipairs(_options) do + options_all[table.getn(options_all) + 1] = o + end + end + else + options_all[table.getn(options_all) + 1] = option + end + end + + -- update the options + submenu.options = options_all + end + end + + -- save menu + option._MENU = menu + +end + -- init the option function option.init(argv, menu) @@ -41,7 +77,7 @@ function option.init(argv, menu) xmake._OPTIONS._DEFAULTS = {} -- save menu - option._MENU = menu + option._save_menu(menu) -- parse _ARGV to _OPTIONS local _iter, _s, _k = ipairs(argv) |
