summaryrefslogtreecommitdiff
path: root/xmake/scripts/base/main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2015-06-09 21:26:04 +0800
committerruki <[email protected]>2015-06-09 21:26:04 +0800
commitd61169b7ea72b22ca89d5a6575865af9148d958e (patch)
tree47d83d2cc74e1762a01b837686d16f2dc41a78d4 /xmake/scripts/base/main.lua
parente18c9d7a5718c80852fab0eb89161b4da28b7a94 (diff)
list action menu automaticlly
Diffstat (limited to 'xmake/scripts/base/main.lua')
-rw-r--r--xmake/scripts/base/main.lua323
1 files changed, 4 insertions, 319 deletions
diff --git a/xmake/scripts/base/main.lua b/xmake/scripts/base/main.lua
index d4945fc6a..8f61b6940 100644
--- a/xmake/scripts/base/main.lua
+++ b/xmake/scripts/base/main.lua
@@ -52,8 +52,8 @@ local menu =
-- description
, description = "Build the project if no given action."
- , -- actions
- actions = {"create", "config", "global", "install", "clean", "run", "lua"}
+ -- actions
+ , actions = action.list
-- options
, options =
@@ -81,324 +81,9 @@ local menu =
}
}
- -- create project: xmake create
-, create =
- {
- -- xmake p
- shortname = 'p'
-
- -- usage
- , usage = "xmake create|p [options] [target]"
-
- -- description
- , description = "Create a new project."
-
- -- options
- , options =
- {
- {'n', "name", "kv", nil, "The project name." }
- , {'f', "file", "kv", "xmake.lua", "Create a given xmake.lua file." }
- , {'P', "project", "kv", nil, "Create from the given project directory."
- , "Search priority:"
- , " 1. The Given Command Argument"
- , " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
- , " 3. The Current Directory" }
- , {'l', "language", "kv", "c", "The project language"
- , " - c"
- , " - c++"
- , " - objc"
- , " - objc++"
- , " - lua" }
- , {'t', "type", "kv", "console", "The project type"
- , " - console"
- , " - library_static"
- , " - library_shared"
- , " - application_empty"
- , " - application_singleview"
- , " - game" }
-
- , {}
- , {'v', "verbose", "k", nil, "Print lots of verbose information." }
- , {nil, "version", "k", nil, "Print the version number and exit." }
- , {'h', "help", "k", nil, "Print this help message and exit." }
-
- , {}
- , {nil, "target", "v", nil, "Create the given target"
- , "Uses the project name as target if not exists." }
- }
- }
-
- -- config project: xmake config
-, config =
- {
- -- xmake f
- shortname = 'f'
-
- -- usage
- , usage = "xmake config|f [options] [target]"
-
- -- description
- , description = "Configure the project."
-
- -- options
- , options =
- {
- {'c', "clean", "k", nil, "Clean the cached configure and configure all again." }
-
- , {}
- , {'p', "plat", "kv", xmake._HOST, "Compile for the given platform."
- , function ()
- local descriptions = {}
- local plats = platform.plats()
- if plats then
- for i, plat in ipairs(plats) do
- descriptions[i] = " - " .. plat
- end
- end
- return descriptions
- end }
- , {'a', "arch", "kv", "auto", "Compile for the given architecture."
- , function ()
- local descriptions = {}
- local plats = platform.plats()
- if plats then
- for i, plat in ipairs(plats) do
- descriptions[i] = " - " .. plat .. ":"
- local archs = platform.archs(plat)
- if archs then
- for _, arch in ipairs(archs) do
- descriptions[i] = descriptions[i] .. " " .. arch
- end
- end
- end
- end
- return descriptions
- end }
- , {'m', "mode", "kv", "release", "Compile for the given mode."
- , " - debug"
- , " - release"
- , " - profile" }
- , {'-', "host", "kv", xmake._HOST, "The current host environment." }
-
- , {}
- , {'o', "buildir", "kv", "build", "Set the build directory." }
- , {'k', "packages", "kv", "pkg", "Set the packages directory." }
-
- , {}
- , {nil, "ccache", "kv", "auto", "Enable or disable the c/c++ compiler cache."
- , " --ccache=[y|n]" }
-
- , {}
- , {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", nil, "The C Compiler" }
- , {nil, "cxx", "kv", nil, "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, "as", "kv", nil, "The Assembler" }
- , {nil, "asflags", "kv", nil, "The Assembler Flags" }
-
- , {}
- , {nil, "ld", "kv", nil, "The Linker" }
- , {nil, "ldflags", "kv", nil, "The Binary Linker Flags" }
-
- , {}
- , {nil, "ar", "kv", nil, "The Static Library Linker" }
- , {nil, "arflags", "kv", nil, "The Static Library Linker Flags" }
-
- , {}
- , {nil, "sh", "kv", nil, "The Shared Library Linker" }
- , {nil, "shflags", "kv", nil, "The Shared Library Linker Flags" }
-
- -- the options for all platforms
- , function () return platform.menu("config") end
-
- , {}
- , {'f', "file", "kv", "xmake.lua", "Read a given xmake.lua file." }
- , {'P', "project", "kv", nil, "Change to the given project directory."
- , "Search priority:"
- , " 1. The Given Command Argument"
- , " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
- , " 3. The Current Directory" }
-
-
- , {}
- , {'v', "verbose", "k", nil, "Print lots of verbose information." }
- , {nil, "version", "k", nil, "Print the version number and exit." }
- , {'h', "help", "k", nil, "Print this help message and exit." }
-
- , {}
- , {nil, "target", "v", "all", "Configure for the given target." }
- }
- }
-
- -- config global: xmake global
-, global =
- {
- -- xmake g
- shortname = 'g'
-
- -- usage
- , usage = "xmake global|g [options] [target]"
-
- -- description
- , description = "Configure the global options for xmake."
-
- -- options
- , options =
- {
- {'c', "clean", "k", nil, "Clean the cached configure and configure all again." }
- , {nil, "ccache", "kv", "auto", "Enable or disable the c/c++ compiler cache."
- , " --ccache=[y|n]" }
-
- , {}
- -- the options for all platforms
- , function () return platform.menu("global") end
-
- , {}
- , {'v', "verbose", "k", nil, "Print lots of verbose information." }
- , {nil, "version", "k", nil, "Print the version number and exit." }
- , {'h', "help", "k", nil, "Print this help message and exit." }
- }
- }
-
- -- install project: xmake install
-, install =
- {
- -- xmake i
- shortname = 'i'
+ -- the actions: xmake [action]
+, action.menu
- -- usage
- , usage = "xmake install|i [options] [target]"
-
- -- description
- , description = "Package and install the project binary files."
-
- -- options
- , options =
- {
- {'f', "file", "kv", "xmake.lua", "Read a given xmake.lua file." }
- , {'P', "project", "kv", nil, "Change to the given project directory."
- , "Search priority:"
- , " 1. The Given Command Argument"
- , " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
- , " 3. The Current Directory" }
-
- , {}
- , {'v', "verbose", "k", nil, "Print lots of verbose information." }
- , {nil, "version", "k", nil, "Print the version number and exit." }
- , {'h', "help", "k", nil, "Print this help message and exit." }
-
- , {}
- , {nil, "target", "v", "all", "Install the given target." }
- }
- }
-
- -- clean project: xmake clean
-, clean =
- {
- -- xmake c
- shortname = 'c'
-
- -- usage
- , usage = "xmake clean|c [options] [target]"
-
- -- description
- , description = "Remove all binary and temporary files."
-
- -- options
- , options =
- {
- {'f', "file", "kv", "xmake.lua", "Read a given xmake.lua file." }
- , {'P', "project", "kv", nil, "Change to the given project directory."
- , "Search priority:"
- , " 1. The Given Command Argument"
- , " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
- , " 3. The Current Directory" }
- , {}
- , {'v', "verbose", "k", nil, "Print lots of verbose information." }
- , {nil, "version", "k", nil, "Print the version number and exit." }
- , {'h', "help", "k", nil, "Print this help message and exit." }
-
- , {}
- , {nil, "target", "v", "all", "Clean for the given target." }
- }
- }
-
- -- run target: xmake run
-, run =
- {
- -- xmake r
- shortname = 'r'
-
- -- usage
- , usage = "xmake run|r [options] [target] [arguments]"
-
- -- description
- , description = "Run the project target."
-
- -- options
- , options =
- {
- {'d', "debug", "k", nil, "Run and debug the given target." }
- , {nil, "debugger", "kv", "auto", "Set the debugger path." }
-
- , {}
- , {'f', "file", "kv", "xmake.lua", "Read a given xmake.lua file." }
- , {'P', "project", "kv", nil, "Change to the given project directory."
- , "Search priority:"
- , " 1. The Given Command Argument"
- , " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
- , " 3. The Current Directory" }
- , {}
- , {'v', "verbose", "k", nil, "Print lots of verbose information." }
- , {nil, "version", "k", nil, "Print the version number and exit." }
- , {'h', "help", "k", nil, "Print this help message and exit." }
-
- , {}
- , {nil, "target", "v", nil, "Run the given target." }
- , {nil, "arguments", "vs", nil, "The target arguments" }
- }
- }
-
- -- run lua: xmake lua
-, lua =
- {
- -- xmake l
- shortname = 'l'
-
- -- usage
- , usage = "xmake lua|l [options] [script] [arguments]"
-
- -- description
- , description = "Run the lua script."
-
- -- options
- , options =
- {
- {'s', "string", "k", nil, "Run the lua string script." }
-
- , {}
- , {'v', "verbose", "k", nil, "Print lots of verbose information." }
- , {nil, "version", "k", nil, "Print the version number and exit." }
- , {'h', "help", "k", nil, "Print this help message and exit." }
-
- , {}
- , {nil, "script", "v", nil, "Run the given lua script."
- , " - The script name from the xmake tool directory"
- , " - The script file"
- , " - The script string" }
- , {nil, "arguments", "vs", nil, "The script arguments" }
- }
- }
}
-- prepare global