diff options
| author | ruki <[email protected]> | 2019-02-02 18:00:20 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-02-02 18:00:20 +0800 |
| commit | d77202df60259b1da178b824c82cb9cf13715e5c (patch) | |
| tree | fd523f7e9316d82925919f886be7b99fc8c8fe22 | |
| parent | 0566e24964765535bd2f81c1132164e0f4e1272e (diff) | |
improve configfiles
| -rw-r--r-- | tests/apis/add_configfiles/config.h.in | 2 | ||||
| -rw-r--r-- | xmake/actions/config/configfiles.lua | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/tests/apis/add_configfiles/config.h.in b/tests/apis/add_configfiles/config.h.in index bfc3542bb..b9f406bbd 100644 --- a/tests/apis/add_configfiles/config.h.in +++ b/tests/apis/add_configfiles/config.h.in @@ -1,3 +1,3 @@ #define HAVE_${module}_H -#define HELLO "${hello}" +#define HELLO "${hello} ${ARCH} ${PLAT}" #define HELLO2 "@hello2@" diff --git a/xmake/actions/config/configfiles.lua b/xmake/actions/config/configfiles.lua index 7c4152199..fd3311266 100644 --- a/xmake/actions/config/configfiles.lua +++ b/xmake/actions/config/configfiles.lua @@ -92,6 +92,14 @@ function _generate_configfile(srcfile, dstfile, fileinfo, targets) local pattern = fileinfo.pattern or "%${(.-)}" io.gsub(dstfile_tmp, "(" .. pattern .. ")", function(_, variable) + -- to lower + variable = variable:trim():lower() + + -- hack buildir first + if variable == "buildir" then + return config.buildir() + end + -- attempt to get it directly from the configure local result = variables[variable] or config.get(variable) if not result or type(result) ~= "string" then @@ -99,8 +107,8 @@ function _generate_configfile(srcfile, dstfile, fileinfo, targets) -- init maps local maps = { - os = platform.os() - , host = os.host() + host = os.host() + , projectdir = os.projectdir() } result = maps[variable] |
