diff options
| -rw-r--r-- | tests/apis/add_configfiles/config.h.in | 2 | ||||
| -rw-r--r-- | xmake/actions/config/configfiles.lua | 13 | ||||
| -rw-r--r-- | xmake/actions/config/main.lua | 2 |
3 files changed, 10 insertions, 7 deletions
diff --git a/tests/apis/add_configfiles/config.h.in b/tests/apis/add_configfiles/config.h.in index c1ea00299..0ea32a623 100644 --- a/tests/apis/add_configfiles/config.h.in +++ b/tests/apis/add_configfiles/config.h.in @@ -1,4 +1,4 @@ -#define HAVE_${module}_H +#define HAVE_${module}_H #define HELLO "${hello} ${ARCH} ${PLAT}" ${define FOO_ENABLE} diff --git a/xmake/actions/config/configfiles.lua b/xmake/actions/config/configfiles.lua index ae3a4f0f1..7784096d1 100644 --- a/xmake/actions/config/configfiles.lua +++ b/xmake/actions/config/configfiles.lua @@ -22,6 +22,7 @@ import("core.base.option") import("core.base.semver") import("core.project.config") +import("core.project.depend") import("core.project.project") import("core.platform.platform") import("lib.detect.find_tool") @@ -311,17 +312,19 @@ function _generate_configfile(srcfile, dstfile, fileinfo, targets) end -- the main entry function -function main() +function main(opt) -- enter project directory + opt = opt or {} local oldir = os.cd(project.directory()) - -- get all configuration files - local configfiles = _get_configfiles() - -- generate all configuration files + local configfiles = _get_configfiles() for dstfile, srcinfo in pairs(configfiles) do - _generate_configfile(srcinfo.srcfile, dstfile, srcinfo.fileinfo, srcinfo.targets) + depend.on_changed(function () + _generate_configfile(srcinfo.srcfile, dstfile, srcinfo.fileinfo, srcinfo.targets) + end, {files = srcinfo.srcfile, + always_changed = opt.force}) end -- leave project directory diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua index 5fe36d443..6a454abe5 100644 --- a/xmake/actions/config/main.lua +++ b/xmake/actions/config/main.lua @@ -432,8 +432,8 @@ force to build in current directory via run `xmake -P .`]], os.projectdir()) _check_targets(targetname) -- update the config files + generate_configfiles({force = recheck}) if recheck then - generate_configfiles() generate_configheader() end |
