diff options
| author | ruki <[email protected]> | 2015-06-16 11:38:50 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-16 11:38:50 +0800 |
| commit | b02e5fc9da96945b0be2452bdbbf5b9801e68b69 (patch) | |
| tree | 5e0826167d0b63eea1721fbb17f4fca89525bde1 /xmake/scripts/base | |
| parent | 60bd22effb5664fefafabe69f5023301b6970e7b (diff) | |
modify the compiler and linker command
Diffstat (limited to 'xmake/scripts/base')
| -rw-r--r-- | xmake/scripts/base/compiler.lua | 1 | ||||
| -rw-r--r-- | xmake/scripts/base/makefile.lua | 2 | ||||
| -rw-r--r-- | xmake/scripts/base/project.lua | 43 |
3 files changed, 43 insertions, 3 deletions
diff --git a/xmake/scripts/base/compiler.lua b/xmake/scripts/base/compiler.lua index da1d46d2f..bbbc671b6 100644 --- a/xmake/scripts/base/compiler.lua +++ b/xmake/scripts/base/compiler.lua @@ -350,6 +350,7 @@ function compiler._flagnames(name) elseif name == "mm" then flagnames = { "mxflags", "mflags" } elseif name == "mxx" then flagnames = { "mxflags", "mxxflags" } elseif name == "as" then flagnames = { "asflags" } + else -- error utils.error("unknown compiler: %s", name) return diff --git a/xmake/scripts/base/makefile.lua b/xmake/scripts/base/makefile.lua index 12eb23765..aae7696b0 100644 --- a/xmake/scripts/base/makefile.lua +++ b/xmake/scripts/base/makefile.lua @@ -1,4 +1,4 @@ ---!The Automatic Crmakefiles-platform Build Tool +--!The Automatic Cross-platform Build Tool -- -- XMake is free software; you can redistribute it and/or modify -- it under the terms of the GNU Lesser General Public License as published by diff --git a/xmake/scripts/base/project.lua b/xmake/scripts/base/project.lua index 0d2c465b8..53691e6a5 100644 --- a/xmake/scripts/base/project.lua +++ b/xmake/scripts/base/project.lua @@ -35,6 +35,24 @@ local linker = require("base/linker") local compiler = require("base/compiler") local platform = require("platform/platform") +-- the current os is belong to the given os? +function project._api_os(env, ...) + + -- the configure has been not loaded, only for menu + if not config._CURRENT then return false end + + -- get the current os + local os = platform.os() + if not os then return false end + + -- exists this os? + for _, o in ipairs(table.join(...)) do + if o and type(o) == "string" and o == os then + return true + end + end +end + -- the current mode is belong to the given modes? function project._api_modes(env, ...) @@ -65,7 +83,7 @@ function project._api_plats(env, ...) -- exists this platform? for _, p in ipairs(table.join(...)) do - if p and type(p) == "string" and p == plat then + if p and type(p) == "string" and plat:find(p) then return true end end @@ -83,7 +101,7 @@ function project._api_archs(env, ...) -- exists this architecture? for _, a in ipairs(table.join(...)) do - if a and type(a) == "string" and a == arch then + if a and type(a) == "string" and arch:find(a) then return true end end @@ -709,6 +727,7 @@ function project._load_options(file) setfenv(script, newenv) -- register interfaces for the condition + newenv.os = function (...) return project._api_os(newenv, ...) end newenv.modes = function (...) return project._api_modes(newenv, ...) end newenv.plats = function (...) return project._api_plats(newenv, ...) end newenv.archs = function (...) return project._api_archs(newenv, ...) end @@ -789,6 +808,7 @@ function project._load_targets(file) setfenv(script, newenv) -- register interfaces for the condition + newenv.os = function (...) return project._api_os(newenv, ...) end newenv.modes = function (...) return project._api_modes(newenv, ...) end newenv.plats = function (...) return project._api_plats(newenv, ...) end newenv.archs = function (...) return project._api_archs(newenv, ...) end @@ -938,6 +958,25 @@ function project.makeconf(target_name) return true end +-- check target +function project.checktarget(target_name) + + -- the targets + local targets = project.targets() + + -- invalid target? + if target_name and target_name ~= "all" and targets and not targets[target_name] then + utils.error("invalid target: %s!", target_name) + return false + elseif not target_name then + utils.error("no target!") + return false + end + + -- ok + return true +end + -- get the project menu function project.menu() |
