summaryrefslogtreecommitdiff
path: root/xmake/scripts/base
diff options
context:
space:
mode:
authorruki <[email protected]>2015-05-26 10:19:43 +0800
committerruki <[email protected]>2015-05-26 10:19:43 +0800
commitf4562609df7ac3f395e5178e76fcefa2c1ffa980 (patch)
tree526caad47b590de1be57996ee19b28d4e34d082a /xmake/scripts/base
parent49ae120e090b2d4dd15e486ade2dfc2ea1ded440 (diff)
probe configure for macosx
Diffstat (limited to 'xmake/scripts/base')
-rw-r--r--xmake/scripts/base/config.lua21
-rw-r--r--xmake/scripts/base/global.lua19
-rw-r--r--xmake/scripts/base/main.lua58
3 files changed, 59 insertions, 39 deletions
diff --git a/xmake/scripts/base/config.lua b/xmake/scripts/base/config.lua
index 2e64e2430..e6b4dbfdd 100644
--- a/xmake/scripts/base/config.lua
+++ b/xmake/scripts/base/config.lua
@@ -207,6 +207,23 @@ function config.get(name)
return config._CURRENT[name]
end
+-- set the given configure to the current
+function config.set(name, value)
+
+ -- check
+ assert(config._CURRENT and name and value)
+
+ -- get the current target
+ local target = config._target()
+ assert(target)
+
+ -- set it to the current target configure for saving to file
+ target[name] = value
+
+ -- set it to the current configure
+ config._CURRENT[name] = value
+end
+
-- save xmake.xconf
function config.savexconf()
@@ -340,9 +357,7 @@ function config.dump()
assert(config._CURRENT)
-- dump
- if xmake._OPTIONS.verbose then
- utils.dump(config._CURRENT)
- end
+ utils.dump(config._CURRENT)
end
diff --git a/xmake/scripts/base/global.lua b/xmake/scripts/base/global.lua
index c50fa70cf..0a6b93042 100644
--- a/xmake/scripts/base/global.lua
+++ b/xmake/scripts/base/global.lua
@@ -136,6 +136,21 @@ function global.get(name)
return global._CURRENT[name]
end
+-- set the given configure to the current
+function global.set(name, value)
+
+ -- check
+ assert(global._CURRENT and global._CONFIGS)
+ assert(name and value)
+
+ -- set it to the current configure
+ global._CURRENT[name] = value
+
+ -- set it to the configure for saving to file
+ global._CONFIGS[name] = value
+
+end
+
-- save xmake.xconf
function global.savexconf()
@@ -248,9 +263,7 @@ function global.dump()
assert(global._CURRENT)
-- dump
- if xmake._OPTIONS.verbose then
- utils.dump(global._CURRENT)
- end
+ utils.dump(global._CURRENT)
end
diff --git a/xmake/scripts/base/main.lua b/xmake/scripts/base/main.lua
index e983d4da5..d65df8ad9 100644
--- a/xmake/scripts/base/main.lua
+++ b/xmake/scripts/base/main.lua
@@ -67,9 +67,9 @@ local menu =
, {'f', "file", "kv", "xmake.xproj","Read a given xmake.xproj 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" }
+ , " 1. The Given Command Argument"
+ , " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
+ , " 3. The Current Directory" }
, {}
@@ -101,9 +101,9 @@ local menu =
, {'f', "file", "kv", "xmake.xproj","Create a given xmake.xproj 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" }
+ , " 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++"
@@ -190,20 +190,20 @@ local menu =
, {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, "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, "ld", "kv", "ld", "The linker" }
- , {nil, "ldflags", "kv", nil, "The linker flags" }
+ , {nil, "ld", "kv", "ld", "The Linker" }
+ , {nil, "ldflags", "kv", nil, "The Linker Flags" }
, {}
- , {nil, "as", "kv", "as", "The assembler" }
- , {nil, "asflags", "kv", nil, "The assembler flags" }
+ , {nil, "as", "kv", "as", "The Assembler" }
+ , {nil, "asflags", "kv", nil, "The Assembler Flags" }
-- the options for all platforms
, function () return platform.menu("config") end
@@ -212,9 +212,9 @@ local menu =
, {'f', "file", "kv", "xmake.xproj","Read a given xmake.xproj 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" }
+ , " 1. The Given Command Argument"
+ , " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
+ , " 3. The Current Directory" }
, {}
@@ -270,10 +270,9 @@ local menu =
{'f', "file", "kv", "xmake.xproj","Read a given xmake.xproj 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" }
-
+ , " 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." }
@@ -303,10 +302,9 @@ local menu =
{'f', "file", "kv", "xmake.xproj","Read a given xmake.xproj 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" }
-
+ , " 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." }
@@ -400,9 +398,6 @@ function main._done_global()
-- load global configure
global.loadxconf()
- -- dump global
- global.dump()
-
-- done action
return action.done("global")
end
@@ -449,9 +444,6 @@ function main._done_option()
-- dump project
project.dump()
- -- dump config
- config.dump()
-
-- dump platform
platform.dump()