diff options
| -rw-r--r-- | xmake/scripts/base/config.lua | 11 | ||||
| -rw-r--r-- | xmake/scripts/base/main.lua | 9 | ||||
| -rw-r--r-- | xmake/scripts/base/project.lua | 44 |
3 files changed, 43 insertions, 21 deletions
diff --git a/xmake/scripts/base/config.lua b/xmake/scripts/base/config.lua index 4badef0b7..2d5bcdc37 100644 --- a/xmake/scripts/base/config.lua +++ b/xmake/scripts/base/config.lua @@ -118,7 +118,7 @@ function config.get(name) -- the value local value = config._CURRENT[name] - if value and value == "auto" then + if type(value) == "string" and value == "auto" then value = nil end @@ -132,11 +132,6 @@ function config.set(name, value) -- check assert(config._CURRENT and name) - -- invalid value - if value and type(value) == "table" then - assert(false) - end - -- get the current target local target = config._target() assert(target) @@ -322,7 +317,7 @@ function config.clearup() local current = config._CURRENT if current then for k, v in pairs(current) do - if v and type(v) and v == "auto" then + if type(v) == "string" and v == "auto" then current[k] = nil end end @@ -332,7 +327,7 @@ function config.clearup() local target = config._target() if target then for k, v in pairs(target) do - if v and type(v) and v == "auto" then + if type(v) == "string" and v == "auto" then target[k] = nil end end diff --git a/xmake/scripts/base/main.lua b/xmake/scripts/base/main.lua index 8fed356c2..0cc3ecd1d 100644 --- a/xmake/scripts/base/main.lua +++ b/xmake/scripts/base/main.lua @@ -129,9 +129,12 @@ function main._prepare_project() -- xmake config or marked as "reconfig"? if options._ACTION == "config" or config._RECONFIG then - -- probe the current platform configure + -- probe the current platform platform.probe(false) + -- probe the current project + project.probe() + -- clear up the configure config.clearup() @@ -142,8 +145,8 @@ function main._prepare_project() if nil == options[k] then options[k] = v end end - -- load xmake.lua file - return project.load(xmake._PROJECT_FILE) + -- load the project + return project.load() end -- done help diff --git a/xmake/scripts/base/project.lua b/xmake/scripts/base/project.lua index 4fd325f02..a42028e29 100644 --- a/xmake/scripts/base/project.lua +++ b/xmake/scripts/base/project.lua @@ -321,8 +321,8 @@ function project._makeconf_for_target_and_deps(target_name) return true end --- make the project configure -function project._make(configs) +-- make targets from the project file +function project._make_targets(configs) -- check assert(configs) @@ -373,6 +373,18 @@ function project._make(configs) end end +-- make options from the project file +function project._make_options(configs) + + -- check + assert(configs) + + -- init + project._OPTIONS = project._OPTIONS or {} + local options = project._OPTIONS + +end + -- only load options from the the project file function project._load_options(file) @@ -534,18 +546,30 @@ function project.targets() return project._TARGETS end --- load the project file -function project.load(file) +-- probe the project +function project.probe() + + -- load the options from the the project file + local configs, errors = project._load_options(xmake._PROJECT_FILE) + if not configs then + return errors + end + + -- make the options from the the project file + project._make_options(configs) +end + +-- load the project +function project.load() - -- load the targets from the the project configure - local configs, errors = project._load_targets(file) + -- load the targets from the the project file + local configs, errors = project._load_targets(xmake._PROJECT_FILE) if not configs then - utils.error(errors) - return + return errors end - -- load and make targets from the the project configure - project._make(configs) + -- make the targets from the the project file + project._make_targets(configs) end -- dump the current configure |
