diff options
| author | ruki <[email protected]> | 2017-11-08 00:34:02 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-11-07 21:24:14 +0800 |
| commit | 81a83e903b7e147304490f79dd64b6ee54e9b44f (patch) | |
| tree | 6da99e435d254f8a4282840aaeed5931cd11fbb8 | |
| parent | 1e40eea084e34e3b41b00b43679bb0626e48c7a0 (diff) | |
improve set_config_header
| -rw-r--r-- | core/src/sv/xmake.lua | 3 | ||||
| -rw-r--r-- | core/src/tbox/src/tbox/xmake.lua | 2 | ||||
| -rw-r--r-- | core/src/tbox/xmake.lua | 6 | ||||
| -rw-r--r-- | core/xmake.lua | 2 | ||||
| -rw-r--r-- | xmake/actions/config/configheader.lua | 5 | ||||
| -rw-r--r-- | xmake/core/project/target.lua | 17 |
6 files changed, 23 insertions, 12 deletions
diff --git a/core/src/sv/xmake.lua b/core/src/sv/xmake.lua index d47ff64ce..dce59f136 100644 --- a/core/src/sv/xmake.lua +++ b/core/src/sv/xmake.lua @@ -1,6 +1,3 @@ -set_project("libsv") -set_version("0.0.1") - set_warnings("all", "error") if is_os("macosx") or is_os("ios") then diff --git a/core/src/tbox/src/tbox/xmake.lua b/core/src/tbox/src/tbox/xmake.lua index ceaa27a60..1ad2483c0 100644 --- a/core/src/tbox/src/tbox/xmake.lua +++ b/core/src/tbox/src/tbox/xmake.lua @@ -8,7 +8,7 @@ target("tbox") add_defines("__tb_prefix__=\"tbox\"") -- set the auto-generated config.h - set_config_header("$(buildir)/tbox/tbox.config.h", {prefix = "TB_CONFIG"}) + set_config_header("$(buildir)/tbox/tbox.config.h", {prefix = "TB_CONFIG", version = "1.6.2", build = "%Y%m%d%H%M"}) -- add includes directory add_includedirs("$(buildir)") diff --git a/core/src/tbox/xmake.lua b/core/src/tbox/xmake.lua index 39854828c..8032b2c08 100644 --- a/core/src/tbox/xmake.lua +++ b/core/src/tbox/xmake.lua @@ -1,9 +1,3 @@ --- project -set_project("tbox") - --- version -set_version("2.1.6") - -- set warning all as error set_warnings("all", "error") diff --git a/core/xmake.lua b/core/xmake.lua index 58d9221ef..832889828 100644 --- a/core/xmake.lua +++ b/core/xmake.lua @@ -5,7 +5,7 @@ set_project("xmake") set_version("2.1.8", {build = "%Y%m%d%H%M"}) -- set xmake min version -set_xmakever("2.1.6") +set_xmakever("2.1.8") -- set warning all as error set_warnings("all", "error") diff --git a/xmake/actions/config/configheader.lua b/xmake/actions/config/configheader.lua index df2573341..df6f95433 100644 --- a/xmake/actions/config/configheader.lua +++ b/xmake/actions/config/configheader.lua @@ -47,7 +47,10 @@ function _make_for_target(target) file:print("") -- make version - local version, version_build = project.version() + local version, version_build = target:configversion() + if not version then + version, version_build = project.version() + end if version then file:print("// version") file:print("#define %s_VERSION \"%s\"", configprefix, version) diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index f643834b1..c2f9d852b 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -742,6 +742,23 @@ function target:script(name, generic) return result end +-- get the config header version +function target:configversion() + + -- get the config version and build version + local version = nil + local buildversion = nil + local configheader = self:get("config_header") + local configheader_extra = self:get("__extra_config_header") + if type(configheader_extra) == "table" then + version = table.wrap(configheader_extra[configheader]).version + buildversion = table.wrap(configheader_extra[configheader]).buildversion + end + + -- ok? + return version, buildversion +end + -- get the config header prefix function target:configprefix() |
