diff options
| author | ruki <[email protected]> | 2025-04-24 13:57:17 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-04-24 13:57:17 +0800 |
| commit | 175b91c0dbd964499e1049db5c70991deb87123c (patch) | |
| tree | 39ecbed07b5fa2356fe7fe60fc091ab8718c33d3 | |
| parent | f1a41602879db55520c92458d1d52b494df66976 (diff) | |
| parent | 9108b57e4b61bf41a4c5c05072f809db9540d8b4 (diff) | |
Merge pull request #6361 from xmake-io/builddir
Rename buildir to builddir
58 files changed, 244 insertions, 199 deletions
@@ -23,7 +23,7 @@ # some constants # xmake_sh_projectdir=$(X= cd -- "$(dirname -- "$0")" && pwd -P) -xmake_sh_buildir="build" +xmake_sh_builddir="build" xmake_sh_version="1.0.5" xmake_sh_verbose=false xmake_sh_diagnosis=false @@ -1499,7 +1499,7 @@ _get_targetdir() { local name="${1}" _get_target_item "${name}" "targetdir"; local targetdir="${_ret}" if test_z "${targetdir}"; then - targetdir="${xmake_sh_buildir}/${_target_plat}/${_target_arch}/${_target_mode}" + targetdir="${xmake_sh_builddir}/${_target_plat}/${_target_arch}/${_target_mode}" fi _ret="${targetdir}" } @@ -1509,7 +1509,7 @@ _get_target_objectdir() { local name="${1}" _get_target_item "${name}" "objectdir"; local objectdir="${_ret}" if test_z "${objectdir}"; then - objectdir="${xmake_sh_buildir}/.objs/${name}/${_target_plat}/${_target_arch}/${_target_mode}" + objectdir="${xmake_sh_builddir}/.objs/${name}/${_target_plat}/${_target_arch}/${_target_mode}" fi _ret="${objectdir}" } @@ -2786,7 +2786,7 @@ Common options: - emcc - tinycc - cosmocc - --buildir=DIR Set build directory. (default: '"${xmake_sh_buildir}"') + --builddir=DIR Set build directory. (default: '"${xmake_sh_builddir}"') Autoconf options: --build=BUILD Configure for building on BUILD [guessed] @@ -2882,8 +2882,8 @@ _handle_option() { elif test_eq "${name}" "includedir"; then _install_includedir_default="${value}" return 0 - elif test_eq "${name}" "buildir"; then - xmake_sh_buildir="${value}" + elif test_eq "${name}" "builddir" || test_eq "${name}" "buildir"; then + xmake_sh_builddir="${value}" return 0 elif test_eq "${name}" "build"; then _autoconf_build_type="${value}" @@ -3780,14 +3780,15 @@ _check_all() { _check_all #----------------------------------------------------------------------------- -# init builtin variables, e.g. add_headerfiles "${buildir}/config.h" +# init builtin variables, e.g. add_headerfiles "${builddir}/config.h" # projectdir="${xmake_sh_projectdir}" -if path_is_absolute "${xmake_sh_buildir}"; then - buildir="${xmake_sh_buildir}" +if path_is_absolute "${xmake_sh_builddir}"; then + builddir="${xmake_sh_builddir}" else - buildir="${xmake_sh_projectdir}/${xmake_sh_buildir}" + builddir="${xmake_sh_projectdir}/${xmake_sh_builddir}" fi +buildir=${builddir} # deprecated plat="${_target_plat}" arch="${_target_arch}" mode="${_target_mode}" diff --git a/core/src/cli/xmake.sh b/core/src/cli/xmake.sh index 845e14163..e2b388213 100755 --- a/core/src/cli/xmake.sh +++ b/core/src/cli/xmake.sh @@ -4,7 +4,7 @@ target "cli" add_deps "xmake" set_kind "binary" set_basename "xmake" - set_targetdir "${buildir}" + set_targetdir "${builddir}" # add definitions add_defines "__tb_prefix__=\"xmake\"" @@ -71,6 +71,6 @@ xmake_after_install() { print "\t@cp ${projectdir}/scripts/msys/xmake.sh ${installdir}/bin/xmake" >> "${xmake_sh_makefile}" print "\t@cp ${projectdir}/scripts/msys/xmake.cmd ${installdir}/bin/xmake.cmd" >> "${xmake_sh_makefile}" print "\t@cp ${projectdir}/scripts/msys/xmake.ps1 ${installdir}/bin/xmake.ps1" >> "${xmake_sh_makefile}" - print "\t@cp ${buildir}/xmake.exe ${installdir}/share/xmake" >> "${xmake_sh_makefile}" + print "\t@cp ${builddir}/xmake.exe ${installdir}/share/xmake" >> "${xmake_sh_makefile}" fi } diff --git a/core/src/tbox/tbox b/core/src/tbox/tbox -Subproject dfb2793c06782de3f1a315bf8de97f89397da1e +Subproject 5916ef2b601e49b8b0f49044f5e319761b4e3e7 diff --git a/core/src/xmake/xmake.sh b/core/src/xmake/xmake.sh index 8bcc60632..6c45b6fa0 100755 --- a/core/src/xmake/xmake.sh +++ b/core/src/xmake/xmake.sh @@ -43,12 +43,12 @@ target "xmake" fi # set the auto-generated config.h - set_configdir "${buildir}/${plat}/${arch}/${mode}" + set_configdir "${builddir}/${plat}/${arch}/${mode}" add_configfiles "xmake.config.h.in" # add includes directory add_includedirs ".." "{public}" - add_includedirs "${buildir}/${plat}/${arch}/${mode}" "{public}" + add_includedirs "${builddir}/${plat}/${arch}/${mode}" "{public}" add_includedirs "../xxhash" add_includedirs "${projectdir}/xmake/scripts/module" diff --git a/tests/apis/add_configfiles/xmake.lua b/tests/apis/add_configfiles/xmake.lua index 22da0dcf6..1d36d0cc7 100644 --- a/tests/apis/add_configfiles/xmake.lua +++ b/tests/apis/add_configfiles/xmake.lua @@ -23,7 +23,7 @@ target("test") add_files("main.c") set_configvar("module", "test") - set_configdir("$(buildir)/config") + set_configdir("$(builddir)/config") add_configfiles("test.c.in", {filename = "mytest.c"}) add_configfiles("config.h.in", {variables = {hello = "xmake"}, prefixdir = "header", preprocessor = function (preprocessor_name, name, value, opt) @@ -32,7 +32,7 @@ target("test") end end}) add_configfiles("*.man", {onlycopy = true, prefixdir = "man"}) - add_includedirs("$(buildir)/config/header") + add_includedirs("$(builddir)/config/header") target("test2") @@ -40,10 +40,10 @@ target("test2") add_files("main2.c") set_configvar("module", "test2") - set_configdir("$(buildir)/config2") + set_configdir("$(builddir)/config2") add_configfiles("test.c.in", {filename = "mytest.c"}) add_configfiles("config2.h.in", {variables = {hello = "xmake2"}, pattern = "@([^\n]-)@", prefixdir = "header"}) add_configfiles("*.man", {onlycopy = true, prefixdir = "man"}) - add_includedirs("$(buildir)/config2/header") + add_includedirs("$(builddir)/config2/header") add_options("foo2") diff --git a/tests/apis/check_xxx/xmake.lua b/tests/apis/check_xxx/xmake.lua index a72b575ae..3643100ce 100644 --- a/tests/apis/check_xxx/xmake.lua +++ b/tests/apis/check_xxx/xmake.lua @@ -3,7 +3,7 @@ includes("@builtin/check") target("foo") set_kind("static") add_files("foo.c") - add_includedirs("$(buildir)") + add_includedirs("$(builddir)") add_configfiles("config.h.in") check_bigendian("IS_BIG_ENDIAN") diff --git a/tests/projects/other/autogen/autogen_code/xmake.lua b/tests/projects/other/autogen/autogen_code/xmake.lua index 9bfe25d9f..9e6185ebe 100644 --- a/tests/projects/other/autogen/autogen_code/xmake.lua +++ b/tests/projects/other/autogen/autogen_code/xmake.lua @@ -2,9 +2,9 @@ add_rules("mode.debug", "mode.release") target("test") set_kind("binary") - add_files("$(buildir)/autogen.cpp", {always_added = true}) + add_files("$(builddir)/autogen.cpp", {always_added = true}) before_build(function (target) - io.writefile("$(buildir)/autogen.cpp", [[ + io.writefile("$(builddir)/autogen.cpp", [[ #include <iostream> using namespace std; int main(int argc, char** argv) { diff --git a/tests/projects/other/merge_archive/xmake.lua b/tests/projects/other/merge_archive/xmake.lua index 7cf74471d..83b60351a 100644 --- a/tests/projects/other/merge_archive/xmake.lua +++ b/tests/projects/other/merge_archive/xmake.lua @@ -4,21 +4,21 @@ target("add") set_kind("static") add_files("src/add.c") set_policy("build.fence", true) - set_targetdir("$(buildir)/merge_archive") + set_targetdir("$(builddir)/merge_archive") target("sub") set_kind("static") add_files("src/sub.c") set_policy("build.fence", true) - set_targetdir("$(buildir)/merge_archive") + set_targetdir("$(builddir)/merge_archive") target("mul") set_kind("static") add_deps("add", "sub") add_files("src/mul.c") if is_plat("windows") then - add_files("$(buildir)/merge_archive/*.lib") + add_files("$(builddir)/merge_archive/*.lib") else - add_files("$(buildir)/merge_archive/*.a") + add_files("$(builddir)/merge_archive/*.a") end diff --git a/tests/projects/other/merge_object/xmake.lua b/tests/projects/other/merge_object/xmake.lua index bbd7c1f98..0aece6849 100644 --- a/tests/projects/other/merge_object/xmake.lua +++ b/tests/projects/other/merge_object/xmake.lua @@ -5,7 +5,7 @@ target("merge_object") add_files("src/interface.c") set_policy("build.fence", true) after_build_file(function (target, sourcefile) - os.cp(target:objectfile(sourcefile), "$(buildir)/merge_object/") + os.cp(target:objectfile(sourcefile), "$(builddir)/merge_object/") end) target("test") @@ -13,8 +13,8 @@ target("test") add_deps("merge_object") add_files("src/test.c") if is_plat("windows") then - add_files("$(buildir)/merge_object/interface.c.obj") + add_files("$(builddir)/merge_object/interface.c.obj") else - add_files("$(buildir)/merge_object/interface.c.o") + add_files("$(builddir)/merge_object/interface.c.o") end diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua index 899748d2e..4ebbbe406 100644 --- a/xmake/actions/config/main.lua +++ b/xmake/actions/config/main.lua @@ -372,9 +372,12 @@ force to build in current directory via run `xmake -P .`]], os.projectdir()) end -- translate the build directory - local buildir = config.get("buildir") - if buildir and path.is_absolute(buildir) then - config.set("buildir", path.relative(buildir, project.directory()), {readonly = true, force = true}) + local builddir = config.get("builddir") or config.get("buildir") + if config.get("buildir") then + wprint("`xmake f --buildir=` has been deprecated, please use `xmake f -o/--builddir=`") + end + if builddir and path.is_absolute(builddir) then + config.set("builddir", path.relative(builddir, project.directory()), {readonly = true, force = true}) end -- only config for building project using third-party buildsystem diff --git a/xmake/actions/config/xmake.lua b/xmake/actions/config/xmake.lua index 59f53a170..2ee150b4c 100644 --- a/xmake/actions/config/xmake.lua +++ b/xmake/actions/config/xmake.lua @@ -244,7 +244,8 @@ task("config") {nil, "tryconfigs", "kv", nil , "Set the extra configurations of the third-party buildsystem for the try-build mode.", "e.g.", " - xmake f --trybuild=autoconf --tryconfigs='--enable-shared=no'"}, - {'o', "buildir", "kv", "build" , "Set build directory."}, + {'o', "builddir", "kv", "build" , "Set build directory."}, + {nil, "buildir", "kv", nil , "Set build directory. (deprecated)"}, {}, {category = "Project Configuration"}, _project_menu_options}} diff --git a/xmake/actions/package/oldpkg/main.lua b/xmake/actions/package/oldpkg/main.lua index 0f094ff2f..d0e6e4b88 100644 --- a/xmake/actions/package/oldpkg/main.lua +++ b/xmake/actions/package/oldpkg/main.lua @@ -30,7 +30,7 @@ import("private.detect.check_targetname") function _package_library(target) -- the output directory - local outputdir = option.get("outputdir") or config.buildir() + local outputdir = option.get("outputdir") or config.builddir() -- the target name local targetname = target:name() diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 61837ad00..df2be796c 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -824,19 +824,25 @@ function _instance:sourcedir() end -- get the build directory -function _instance:buildir() - local buildir = self._BUILDIR - if not buildir then +function _instance:builddir() + local builddir = self._BUILDDIR + if not builddir then if self:is_local() then local name = self:name():lower():gsub("::", "_") - local rootdir = path.join(config.buildir({absolute = true}), ".packages", name:sub(1, 1):lower(), name, self:version_str()) - buildir = path.join(rootdir, "cache", "build_" .. self:buildhash():sub(1, 8)) + local rootdir = path.join(config.builddir({absolute = true}), ".packages", name:sub(1, 1):lower(), name, self:version_str()) + builddir = path.join(rootdir, "cache", "build_" .. self:buildhash():sub(1, 8)) else - buildir = "build_" .. self:buildhash():sub(1, 8) + builddir = "build_" .. self:buildhash():sub(1, 8) end - self._BUILDIR = buildir + self._BUILDDIR = builddir end - return buildir + return builddir +end + +-- get the build directory (deprecated) +function _instance:buildir() + utils.warning("package:buildir() has been deprecated, please use package:builddir()") + return self:builddir() end -- get the cached directory of this package @@ -863,7 +869,7 @@ function _instance:cachedir() version_str = version_str:gsub("[>=<|%*]", "") end if self:is_local() then - cachedir = path.join(config.buildir({absolute = true}), ".packages", name:sub(1, 1):lower(), name, version_str, "cache") + cachedir = path.join(config.builddir({absolute = true}), ".packages", name:sub(1, 1):lower(), name, version_str, "cache") else cachedir = path.join(package.cachedir(), name:sub(1, 1):lower(), name, version_str) end @@ -881,7 +887,7 @@ function _instance:installdir(...) if not installdir then local name = self:name():lower():gsub("::", "_") if self:is_local() then - installdir = path.join(config.buildir({absolute = true}), ".packages", name:sub(1, 1):lower(), name) + installdir = path.join(config.builddir({absolute = true}), ".packages", name:sub(1, 1):lower(), name) else installdir = path.join(package.installdir(), name:sub(1, 1):lower(), name) end diff --git a/xmake/core/project/config.lua b/xmake/core/project/config.lua index 35ccd9145..1c03fe871 100644 --- a/xmake/core/project/config.lua +++ b/xmake/core/project/config.lua @@ -140,9 +140,9 @@ function config.options() return configs end --- get the buildir +-- get the builddir -- we can use `{absolute = true}` to force to get absolute path -function config.buildir(opt) +function config.builddir(opt) -- get the absolute path first opt = opt or {} @@ -160,16 +160,22 @@ function config.buildir(opt) if not rootdir then rootdir = os.projectdir() end - local buildir = config.get("buildir") or "build" - if not path.is_absolute(buildir) then - buildir = path.absolute(buildir, rootdir) + local builddir = config.get("builddir") or config.get("buildir") or "build" + if not path.is_absolute(builddir) then + builddir = path.absolute(builddir, rootdir) end -- adjust path for the current directory if not opt.absolute then - buildir = path.relative(buildir, os.curdir()) + builddir = path.relative(builddir, os.curdir()) end - return buildir + return builddir +end + +-- get build directory (deprecated) +function config.buildir(opt) + utils.warning("config.buildir() has been deprecated, please use config.builddir()") + return config.builddir(opt) end -- get the configure file diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua index 956e3c41d..697b64c7f 100644 --- a/xmake/core/project/project.lua +++ b/xmake/core/project/project.lua @@ -734,9 +734,12 @@ function project.interpreter() -- check assert(variable) - -- hack buildir first - if variable == "buildir" then - return config.buildir() + -- hack builddir first + if variable == "builddir" or variable == "buildir" then + if variable == "buildir" then + utils.warning("$(buildir) has been deprecated, please use $(builddir)") + end + return config.builddir() end -- attempt to get it directly from the configure diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index b861d2223..974b0c9cc 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -1418,7 +1418,7 @@ function _instance:objectdir(opt) -- the object directory local objectdir = self:get("objectdir") if not objectdir then - objectdir = path.join(config.buildir(), ".objs") + objectdir = path.join(config.builddir(), ".objs") end local namespace = self:namespace() if namespace then @@ -1455,7 +1455,7 @@ function _instance:dependir(opt) -- init the dependent directory local dependir = self:get("dependir") if not dependir then - dependir = path.join(config.buildir(), ".deps") + dependir = path.join(config.builddir(), ".deps") end local namespace = self:namespace() if namespace then @@ -1492,7 +1492,7 @@ function _instance:autogendir(opt) -- init the autogen directory local autogendir = self:get("autogendir") if not autogendir then - autogendir = path.join(config.buildir(), ".gens") + autogendir = path.join(config.builddir(), ".gens") end local namespace = self:namespace() if namespace then @@ -1572,7 +1572,7 @@ end -- get the default target directory function _instance:_default_targetdir() - local targetdir = config.buildir() + local targetdir = config.builddir() -- get root directory of target local intermediate_directory = self:policy("build.intermediate_directory") @@ -1729,7 +1729,7 @@ end -- get configuration output directory function _instance:configdir() - return self:get("configdir") or config.buildir() + return self:get("configdir") or config.builddir() end -- get run directory @@ -1792,7 +1792,7 @@ end -- get package directory function _instance:packagedir() -- get the output directory - local outputdir = baseoption.get("outputdir") or config.buildir() + local outputdir = baseoption.get("outputdir") or config.builddir() local packagename = self:name():lower() if #packagename > 1 and bit.band(packagename:byte(2), 0xc0) == 0x80 then utils.warning("package(%s): cannot generate package, becauese it contains unicode characters!", packagename) @@ -2229,9 +2229,9 @@ function _instance:dependfile(objectfile) -- get relative directory in the build directory if not relativedir then - local buildir = path.absolute(config.buildir()) - if origindir:startswith(buildir) then - relativedir = path.join("build", path.relative(origindir, buildir)) + local builddir = path.absolute(config.builddir()) + if origindir:startswith(builddir) then + relativedir = path.join("build", path.relative(origindir, builddir)) end end diff --git a/xmake/core/sandbox/modules/import/core/project/config.lua b/xmake/core/sandbox/modules/import/core/project/config.lua index 21eefa453..1fde9e76f 100644 --- a/xmake/core/sandbox/modules/import/core/project/config.lua +++ b/xmake/core/sandbox/modules/import/core/project/config.lua @@ -28,7 +28,8 @@ local platform = require("platform/platform") local raise = require("sandbox/modules/raise") -- inherit some builtin interfaces -sandbox_core_project_config.buildir = config.buildir +sandbox_core_project_config.builddir = config.builddir +sandbox_core_project_config.buildir = config.buildir -- deprecated sandbox_core_project_config.plat = config.plat sandbox_core_project_config.arch = config.arch sandbox_core_project_config.mode = config.mode diff --git a/xmake/core/sandbox/modules/import/core/sandbox/module.lua b/xmake/core/sandbox/modules/import/core/sandbox/module.lua index df1d31240..7c8a77735 100644 --- a/xmake/core/sandbox/modules/import/core/sandbox/module.lua +++ b/xmake/core/sandbox/modules/import/core/sandbox/module.lua @@ -204,21 +204,21 @@ function core_sandbox_module._native_moduleinfo(module_fullpath, modulekind) local programdir = path.normalize(os.programdir()) local modulename = path.basename(module_fullpath) local modulehash = hash.strhash32(projectdir) - local buildir + local builddir local is_global = false local modulepath if projectdir:startswith(programdir) then is_global = true - buildir = path.join(global.directory(), "cache", "modules", modulehash) + builddir = path.join(global.directory(), "cache", "modules", modulehash) modulepath = path.join("@programdir", path.relative(projectdir, programdir)) elseif os.isfile(os.projectfile()) then - buildir = path.join(config.directory(), "cache", "modules", modulehash) + builddir = path.join(config.directory(), "cache", "modules", modulehash) modulepath = path.relative(projectdir, os.projectdir()) else - buildir = path.join(projectdir, "cache", "modules", modulehash) + builddir = path.join(projectdir, "cache", "modules", modulehash) modulepath = projectdir end - return {buildir = buildir, projectdir = projectdir, is_global = is_global, modulename = modulename, modulekind = modulekind, modulepath = modulepath} + return {builddir = builddir, projectdir = projectdir, is_global = is_global, modulename = modulename, modulekind = modulekind, modulepath = modulepath} end -- build module @@ -232,10 +232,10 @@ function core_sandbox_module._build_module(moduleinfo) return nil, "unknown module kind!" end utils.cprint("${color.build.target}building native %s module(%s) in %s ...", modulekind_str, moduleinfo.modulename, moduleinfo.modulepath) - local buildir = moduleinfo.buildir + local builddir = moduleinfo.builddir local projectdir = moduleinfo.projectdir - local envs = {XMAKE_CONFIGDIR = buildir} - local argv = {"config", "-o", buildir, "-a", xmake.arch()} + local envs = {XMAKE_CONFIGDIR = builddir} + local argv = {"config", "-o", builddir, "-a", xmake.arch()} core_sandbox_module._add_builtin_argv(argv, projectdir) local ok, errors = os.execv(os.programfile(), argv, {envs = envs, curdir = projectdir}) if ok ~= 0 then @@ -254,7 +254,7 @@ end function core_sandbox_module._load_from_binary(module_fullpath, opt) opt = opt or {} local moduleinfo = core_sandbox_module._native_moduleinfo(module_fullpath, MODULE_KIND_BINARY) - local binaryfiles = os.files(path.join(moduleinfo.buildir, "module_*")) + local binaryfiles = os.files(path.join(moduleinfo.builddir, "module_*")) if #binaryfiles == 0 or (not moduleinfo.is_global and opt.always_build) then local ok, errors = core_sandbox_module._build_module(moduleinfo) if not ok then @@ -264,7 +264,7 @@ function core_sandbox_module._load_from_binary(module_fullpath, opt) end local module if #binaryfiles == 0 then - binaryfiles = os.files(path.join(moduleinfo.buildir, "module_*")) + binaryfiles = os.files(path.join(moduleinfo.builddir, "module_*")) end if #binaryfiles > 0 then module = {} @@ -297,7 +297,7 @@ end function core_sandbox_module._load_from_shared(module_fullpath, opt) opt = opt or {} local moduleinfo = core_sandbox_module._native_moduleinfo(module_fullpath, MODULE_KIND_SHARED) - local libraryfiles = os.files(path.join(moduleinfo.buildir, "*module_*")) + local libraryfiles = os.files(path.join(moduleinfo.builddir, "*module_*")) if #libraryfiles == 0 or (not moduleinfo.is_global and opt.always_build) then local ok, errors = core_sandbox_module._build_module(moduleinfo) if not ok then @@ -307,7 +307,7 @@ function core_sandbox_module._load_from_shared(module_fullpath, opt) end local module if #libraryfiles == 0 then - libraryfiles = os.files(path.join(moduleinfo.buildir, "*module_*")) + libraryfiles = os.files(path.join(moduleinfo.builddir, "*module_*")) end if #libraryfiles > 0 then local script, errors1, errors2 diff --git a/xmake/modules/cli/amalgamate.lua b/xmake/modules/cli/amalgamate.lua index d0a5ba40c..547ca54d1 100644 --- a/xmake/modules/cli/amalgamate.lua +++ b/xmake/modules/cli/amalgamate.lua @@ -158,7 +158,7 @@ function main(...) task.run("config") -- generate amalgamate code - args.outputdir = args.outputdir or config.buildir() + args.outputdir = args.outputdir or config.builddir() if args.target then local target = assert(check_targetname(args.target)) _generate_amalgamate_code(target, args) diff --git a/xmake/modules/core/tools/gcc/parse_deps.lua b/xmake/modules/core/tools/gcc/parse_deps.lua index b4b5cba7f..dd8a3c00f 100644 --- a/xmake/modules/core/tools/gcc/parse_deps.lua +++ b/xmake/modules/core/tools/gcc/parse_deps.lua @@ -51,7 +51,7 @@ end -- load module mapper function _load_module_mapper(target) local mapper = {} - local mapperfile = path.join(config.buildir(), target:name(), "mapper.txt") + local mapperfile = path.join(config.builddir(), target:name(), "mapper.txt") for line in io.lines(mapperfile) do local moduleinfo = line:split(" ", {plain = true}) if #moduleinfo == 2 then diff --git a/xmake/modules/package/manager/conan/find_package.lua b/xmake/modules/package/manager/conan/find_package.lua index d732b06c2..5d8d8c353 100644 --- a/xmake/modules/package/manager/conan/find_package.lua +++ b/xmake/modules/package/manager/conan/find_package.lua @@ -28,7 +28,7 @@ function _conan_get_buildinfo_file(name, dep_name) if dep_name then filename = "conanbuildinfo_" .. dep_name .. ".xmake.lua" end - return path.absolute(path.join(config.buildir() or os.tmpdir(), ".conan", name, filename)) + return path.absolute(path.join(config.builddir() or os.tmpdir(), ".conan", name, filename)) end -- get conan platform diff --git a/xmake/modules/package/manager/conan/v1/install_package.lua b/xmake/modules/package/manager/conan/v1/install_package.lua index 3475a21b3..37fdaa856 100644 --- a/xmake/modules/package/manager/conan/v1/install_package.lua +++ b/xmake/modules/package/manager/conan/v1/install_package.lua @@ -46,7 +46,7 @@ end -- get build directory function _conan_get_build_directory(name) - return path.absolute(path.join(config.buildir() or os.tmpdir(), ".conan", name)) + return path.absolute(path.join(config.builddir() or os.tmpdir(), ".conan", name)) end -- generate conanfile.txt @@ -128,16 +128,16 @@ function main(conan, name, opt) local configs = opt.configs or {} -- get build directory - local buildir = _conan_get_build_directory(name) + local builddir = _conan_get_build_directory(name) -- clean the build directory - os.tryrm(buildir) - if not os.isdir(buildir) then - os.mkdir(buildir) + os.tryrm(builddir) + if not os.isdir(builddir) then + os.mkdir(builddir) end -- enter build directory - local oldir = os.cd(buildir) + local oldir = os.cd(builddir) -- install xmake generator _conan_install_xmake_generator(conan) diff --git a/xmake/modules/package/manager/conan/v2/install_package.lua b/xmake/modules/package/manager/conan/v2/install_package.lua index f4a8de9e5..d3d109a7e 100644 --- a/xmake/modules/package/manager/conan/v2/install_package.lua +++ b/xmake/modules/package/manager/conan/v2/install_package.lua @@ -46,7 +46,7 @@ end -- get build directory function _conan_get_build_directory(name) - return path.absolute(path.join(config.buildir() or os.tmpdir(), ".conan", name)) + return path.absolute(path.join(config.builddir() or os.tmpdir(), ".conan", name)) end -- generate conanfile.txt @@ -287,16 +287,16 @@ function main(conan, name, opt) local configs = opt.configs or {} -- get build directory - local buildir = _conan_get_build_directory(name) + local builddir = _conan_get_build_directory(name) -- clean the build directory - os.tryrm(buildir) - if not os.isdir(buildir) then - os.mkdir(buildir) + os.tryrm(builddir) + if not os.isdir(builddir) then + os.mkdir(builddir) end -- enter build directory - local oldir = os.cd(buildir) + local oldir = os.cd(builddir) -- install xmake generator _conan_install_xmake_generator(conan) diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 8fd001d71..d0055422d 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -983,10 +983,13 @@ function _fix_pdbdir_for_ninja(package) end -- enter build directory -function _enter_buildir(package, opt) - local buildir = opt.buildir or package:buildir() - os.mkdir(path.join(buildir, "install")) - return os.cd(buildir) +function _enter_builddir(package, opt) + local builddir = opt.builddir or opt.buildir or package:builddir() + if opt.buildir then + wprint("{buildir = } has been deprecated, please use {builddir = } in cmake.install") + end + os.mkdir(path.join(builddir, "install")) + return os.cd(builddir) end -- get build environments @@ -1305,7 +1308,7 @@ end function configure(package, configs, opt) opt = opt or {} - local oldir = _enter_buildir(package, opt) + local oldir = _enter_builddir(package, opt) -- pass configurations local argv = {} @@ -1339,7 +1342,7 @@ function build(package, configs, opt) configure(package, configs, opt) -- do build - local oldir = _enter_buildir(package, opt) + local oldir = _enter_builddir(package, opt) if opt.cmake_build then _build_for_cmakebuild(package, configs, opt) elseif cmake_generator then @@ -1371,7 +1374,7 @@ function install(package, configs, opt) configure(package, configs, opt) -- do build and install - local oldir = _enter_buildir(package, opt) + local oldir = _enter_builddir(package, opt) if opt.cmake_build then _install_for_cmakebuild(package, configs, opt) elseif cmake_generator then diff --git a/xmake/modules/package/tools/gn.lua b/xmake/modules/package/tools/gn.lua index 568b881bb..1a34b3085 100644 --- a/xmake/modules/package/tools/gn.lua +++ b/xmake/modules/package/tools/gn.lua @@ -25,12 +25,15 @@ import("lib.detect.find_tool") import("package.tools.ninja") -- get build directory -function _get_buildir(opt) - if opt and opt.buildir then - return opt.buildir +function _get_builddir(opt) + if opt and (opt.builddir or opt.buildir) then + if opt.buildir then + wprint("{buildir = } has been deprecated, please use {builddir = } in gn.install") + end + return opt.builddir or opt.buildir else - _g.buildir = _g.buildir or ("build_" .. hash.uuid4():split('%-')[1]) - return _g.buildir + _g.builddir = _g.builddir or ("build_" .. hash.uuid4():split('%-')[1]) + return _g.builddir end end @@ -98,7 +101,7 @@ function generate(package, configs, opt) local argv = {} local args = {} table.insert(argv, "gen") - table.insert(argv, _get_buildir(opt)) + table.insert(argv, _get_builddir(opt)) for name, value in pairs(_get_configs(package, configs, opt)) do if type(value) == "string" then table.insert(args, name .. "=\"" .. value .. "\"") @@ -123,9 +126,9 @@ function build(package, configs, opt) generate(package, configs, opt) -- do build - local buildir = _get_buildir(opt) + local builddir = _get_builddir(opt) local targets = table.wrap(opt.target) - ninja.build(package, targets, {buildir = buildir, envs = opt.envs or buildenvs(package, opt)}) + ninja.build(package, targets, {builddir = builddir, envs = opt.envs or buildenvs(package, opt)}) end -- install package @@ -136,7 +139,7 @@ function install(package, configs, opt) generate(package, configs, opt) -- do build and install - local buildir = _get_buildir(opt) + local builddir = _get_builddir(opt) local targets = table.wrap(opt.target) - ninja.install(package, targets, {buildir = buildir, envs = opt.envs or buildenvs(package, opt)}) + ninja.install(package, targets, {builddir = builddir, envs = opt.envs or buildenvs(package, opt)}) end diff --git a/xmake/modules/package/tools/meson.lua b/xmake/modules/package/tools/meson.lua index 7f3260682..3a26d355c 100644 --- a/xmake/modules/package/tools/meson.lua +++ b/xmake/modules/package/tools/meson.lua @@ -27,12 +27,15 @@ import("private.utils.executable_path") import("private.utils.toolchain", {alias = "toolchain_utils"}) -- get build directory -function _get_buildir(package, opt) - if opt and opt.buildir then - return opt.buildir +function _get_builddir(package, opt) + if opt and (opt.builddir or opt.buildir) then + if opt.buildir then + wprint("{buildir = } has been deprecated, please use {builddir = } in meson.install") + end + return opt.builddir or opt.buildir else - _g.buildir = _g.buildir or package:buildir() - return _g.buildir + _g.builddir = _g.builddir or package:builddir() + return _g.builddir end end @@ -203,7 +206,7 @@ end -- get cross file function _get_configs_file(package, opt) opt = opt or {} - local configsfile = path.join(_get_buildir(package, opt), "configs_file.txt") + local configsfile = path.join(_get_builddir(package, opt), "configs_file.txt") if not os.isfile(configsfile) then local file = io.open(configsfile, "w") -- binaries @@ -370,7 +373,7 @@ function _get_configs(package, configs, opt) end -- add build directory - table.insert(configs, _get_buildir(package, opt)) + table.insert(configs, _get_builddir(package, opt)) return configs end @@ -567,9 +570,9 @@ function build(package, configs, opt) generate(package, configs, opt) -- configurate build - local buildir = _get_buildir(package, opt) + local builddir = _get_builddir(package, opt) local njob = opt.jobs or option.get("jobs") or tostring(os.default_njob()) - local argv = {"compile", "-C", buildir} + local argv = {"compile", "-C", builddir} if option.get("diagnosis") then table.insert(argv, "-v") end @@ -589,8 +592,8 @@ function install(package, configs, opt) build(package, configs, opt) -- configure install - local buildir = _get_buildir(package, opt) - local argv = {"install", "-C", buildir} + local builddir = _get_builddir(package, opt) + local argv = {"install", "-C", builddir} -- do install local meson = assert(find_tool("meson"), "meson not found!") diff --git a/xmake/modules/package/tools/ninja.lua b/xmake/modules/package/tools/ninja.lua index 2d2fb734d..1afc6056e 100644 --- a/xmake/modules/package/tools/ninja.lua +++ b/xmake/modules/package/tools/ninja.lua @@ -24,8 +24,11 @@ import("lib.detect.find_tool") function _default_argv(package, configs, opt) opt = opt or {} - local buildir = opt.buildir or os.curdir() + local builddir = opt.builddir or opt.buildir or os.curdir() local njob = opt.jobs or option.get("jobs") or tostring(os.default_njob()) + if opt.buildir then + wprint("{buildir = } has been deprecated, please use {builddir = } in ninja.install") + end local argv = {} local targets = table.wrap(opt.target) @@ -33,7 +36,7 @@ function _default_argv(package, configs, opt) table.join2(argv, targets) end table.insert(argv, "-C") - table.insert(argv, buildir) + table.insert(argv, builddir) if option.get("diagnosis") then table.insert(argv, "-v") end diff --git a/xmake/modules/package/tools/scons.lua b/xmake/modules/package/tools/scons.lua index f9208042d..e0aac7e7b 100644 --- a/xmake/modules/package/tools/scons.lua +++ b/xmake/modules/package/tools/scons.lua @@ -100,10 +100,13 @@ end -- build package function build(package, configs, opt) opt = opt or {} - local buildir = opt.buildir or os.curdir() + local builddir = opt.builddir or opt.buildir or os.curdir() + if opt.buildir then + wprint("{buildir = } has been deprecated, please use {builddir = } in scons.install") + end local njob = opt.jobs or option.get("jobs") or tostring(os.default_njob()) local scons = assert(find_tool("scons"), "scons not found!") - local argv = {"-C", buildir, "-j", njob} + local argv = {"-C", builddir, "-j", njob} configs = _get_configs(package, configs) if configs then table.join2(argv, configs) diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua index 25bc0f021..35ed6fd23 100644 --- a/xmake/modules/package/tools/xmake.lua +++ b/xmake/modules/package/tools/xmake.lua @@ -315,9 +315,12 @@ function _get_configs(package, configs, opt) if shflags and #shflags > 0 then table.insert(configs, "--shflags=" .. table.concat(shflags, ' ')) end - local buildir = opt.buildir or package:buildir() - if buildir then - table.insert(configs, "--buildir=" .. buildir) + local builddir = opt.builddir or opt.buildir or package:builddir() + if builddir then + table.insert(configs, "--builddir=" .. builddir) + end + if opt.buildir then + wprint("{buildir = } has been deprecated, please use {builddir = } in xmake.install") end return configs end diff --git a/xmake/modules/private/action/trybuild/autoconf.lua b/xmake/modules/private/action/trybuild/autoconf.lua index d2f968018..9e12a9be5 100644 --- a/xmake/modules/private/action/trybuild/autoconf.lua +++ b/xmake/modules/private/action/trybuild/autoconf.lua @@ -44,7 +44,7 @@ end -- get build directory function _get_buildir() - return config.buildir() or "build" + return config.builddir() or "build" end -- get artifacts directory diff --git a/xmake/modules/private/action/trybuild/cmake.lua b/xmake/modules/private/action/trybuild/cmake.lua index 747ab9c94..c2ca3610b 100644 --- a/xmake/modules/private/action/trybuild/cmake.lua +++ b/xmake/modules/private/action/trybuild/cmake.lua @@ -28,13 +28,13 @@ import("lib.detect.find_tool") import("private.utils.toolchain", {alias = "toolchain_utils"}) -- get build directory -function _get_buildir() - return config.buildir() or "build" +function _get_builddir() + return config.builddir() or "build" end -- get artifacts directory function _get_artifacts_dir() - return path.absolute(path.join(_get_buildir(), "artifacts")) + return path.absolute(path.join(_get_builddir(), "artifacts")) end -- get the build environment @@ -515,11 +515,11 @@ end -- do clean function clean() - local buildir = _get_buildir() - if os.isdir(buildir) then - local configfile = find_file("[mM]akefile", buildir) or (is_plat("windows") and find_file("*.sln", buildir)) + local builddir = _get_builddir() + if os.isdir(builddir) then + local configfile = find_file("[mM]akefile", builddir) or (is_plat("windows") and find_file("*.sln", builddir)) if configfile then - local oldir = os.cd(buildir) + local oldir = os.cd(builddir) if is_plat("windows") then local runenvs = _get_msvc_runenvs() local msbuild = find_tool("msbuild", {envs = runenvs}) @@ -544,7 +544,7 @@ function build() if not os.isdir(artifacts_dir) then os.mkdir(artifacts_dir) end - os.cd(_get_buildir()) + os.cd(_get_builddir()) opt.artifacts_dir = artifacts_dir -- exists $CMAKE_GENERATOR? use it diff --git a/xmake/modules/private/action/trybuild/meson.lua b/xmake/modules/private/action/trybuild/meson.lua index 2e0d7cb20..1896653c6 100644 --- a/xmake/modules/private/action/trybuild/meson.lua +++ b/xmake/modules/private/action/trybuild/meson.lua @@ -26,13 +26,13 @@ import("lib.detect.find_file") import("lib.detect.find_tool") -- get build directory -function _get_buildir() - return config.buildir() or "build" +function _get_builddir() + return config.builddir() or "build" end -- get artifacts directory function _get_artifacts_dir() - return path.absolute(path.join(_get_buildir(), "artifacts")) + return path.absolute(path.join(_get_builddir(), "artifacts")) end -- is cross compilation? @@ -73,8 +73,8 @@ function _get_buildenv(key) end -- get cross file -function _get_cross_file(buildir) - local crossfile = path.join(buildir, "cross_file.txt") +function _get_cross_file(builddir) + local crossfile = path.join(builddir, "cross_file.txt") if not os.isfile(crossfile) then local file = io.open(crossfile, "w") -- binaries @@ -209,7 +209,7 @@ function _get_cross_file(buildir) end -- get configs -function _get_configs(artifacts_dir, buildir) +function _get_configs(artifacts_dir, builddir) -- add prefix local configs = {"--prefix=" .. artifacts_dir} @@ -227,11 +227,11 @@ function _get_configs(artifacts_dir, buildir) -- add cross file if _is_cross_compilation() then - table.insert(configs, "--cross-file=" .. _get_cross_file(buildir)) + table.insert(configs, "--cross-file=" .. _get_cross_file(builddir)) end -- add build directory - table.insert(configs, buildir) + table.insert(configs, builddir) return configs end @@ -242,12 +242,12 @@ end -- do clean function clean() - local buildir = _get_buildir() - if os.isdir(buildir) then - local configfile = find_file("build.ninja", buildir) + local builddir = _get_builddir() + if os.isdir(builddir) then + local configfile = find_file("build.ninja", builddir) if configfile then local ninja = assert(find_tool("ninja"), "ninja not found!") - local ninja_argv = {"-C", buildir} + local ninja_argv = {"-C", builddir} if option.get("verbose") or option.get("diagnosis") then table.insert(ninja_argv, "-v") end @@ -255,7 +255,7 @@ function clean() table.insert(ninja_argv, "clean") os.vexecv(ninja.program, ninja_argv) if option.get("all") then - os.tryrm(buildir) + os.tryrm(builddir) end end end @@ -271,16 +271,16 @@ function build() end -- generate makefile - local buildir = _get_buildir() + local builddir = _get_builddir() local meson = assert(find_tool("meson"), "meson not found!") - local configfile = find_file("build.ninja", buildir) + local configfile = find_file("build.ninja", builddir) if not configfile or os.mtime(config.filepath()) > os.mtime(configfile) then - os.vexecv(meson.program, _get_configs(artifacts_dir, buildir)) + os.vexecv(meson.program, _get_configs(artifacts_dir, builddir)) end -- do build local ninja = assert(find_tool("ninja"), "ninja not found!") - local ninja_argv = {"-C", buildir} + local ninja_argv = {"-C", builddir} if option.get("verbose") then table.insert(ninja_argv, "-v") end diff --git a/xmake/modules/private/action/trybuild/xrepo.lua b/xmake/modules/private/action/trybuild/xrepo.lua index 31d866d58..3770f49ed 100644 --- a/xmake/modules/private/action/trybuild/xrepo.lua +++ b/xmake/modules/private/action/trybuild/xrepo.lua @@ -28,7 +28,7 @@ import("private.action.require.impl.search_packages") -- get build directory function _get_buildir() - return config.buildir() or "build" + return config.builddir() or "build" end -- get artifacts directory diff --git a/xmake/modules/private/cache/build_cache.lua b/xmake/modules/private/cache/build_cache.lua index 5ca833dde..f0f40e0d3 100644 --- a/xmake/modules/private/cache/build_cache.lua +++ b/xmake/modules/private/cache/build_cache.lua @@ -140,7 +140,7 @@ function rootdir() cachedir = path.join(global.directory(), ".build_cache") end if not cachedir then - cachedir = path.join(config.buildir(), ".build_cache") + cachedir = path.join(config.builddir(), ".build_cache") end _g.cachedir = path.absolute(cachedir) end diff --git a/xmake/modules/private/service/distcc_build/server_session.lua b/xmake/modules/private/service/distcc_build/server_session.lua index 8e373d254..57f13a3a7 100644 --- a/xmake/modules/private/service/distcc_build/server_session.lua +++ b/xmake/modules/private/service/distcc_build/server_session.lua @@ -80,7 +80,7 @@ end -- do clean function server_session:clean() vprint("%s: clean files in %s ..", self, self:workdir()) - os.tryrm(self:buildir()) + os.tryrm(self:builddir()) os.tryrm(self:cachedir()) vprint("%s: clean files ok", self) end @@ -93,7 +93,7 @@ function server_session:compile(respmsg) local stream = self:stream() local cachekey = body.cachekey local sourcename = body.sourcename - local sourcedir = path.join(self:buildir(), (hash.uuid4():gsub("-", ""))) + local sourcedir = path.join(self:builddir(), (hash.uuid4():gsub("-", ""))) local sourcefile = path.join(sourcedir, sourcename) local objectfile = (cachekey and path.join(self:cachedir(), cachekey:sub(1, 2), cachekey) or sourcefile) .. ".o" local objectfile_infofile = objectfile .. ".txt" @@ -192,7 +192,7 @@ function server_session:workdir() end -- get build directory -function server_session:buildir() +function server_session:builddir() return path.join(self:workdir(), "build") end diff --git a/xmake/plugins/doxygen/main.lua b/xmake/plugins/doxygen/main.lua index cf65cacbc..c0448a508 100644 --- a/xmake/plugins/doxygen/main.lua +++ b/xmake/plugins/doxygen/main.lua @@ -52,7 +52,7 @@ function _generate_doxyfile(doxygen) -- -- OUTPUT_DIRECTORY = -- - local outputdir = option.get("outputdir") or config.buildir() + local outputdir = option.get("outputdir") or config.builddir() if outputdir then io.gsub(doxyfile, "OUTPUT_DIRECTORY%s-=.-\n", format("OUTPUT_DIRECTORY = %s\n", outputdir)) os.mkdir(outputdir) @@ -116,7 +116,7 @@ function main() os.vrunv(doxygen.program, {doxyfile}, {curdir = project.directory()}) -- done - local outputdir = option.get("outputdir") or config.buildir() + local outputdir = option.get("outputdir") or config.builddir() cprint("${bright green}result: ${default green}%s/html/index.html", outputdir) cprint("${color.success}doxygen ok!") os.setenvs(oldenvs) diff --git a/xmake/plugins/macro/macros/package.lua b/xmake/plugins/macro/macros/package.lua index 64ea352de..14a7992c0 100644 --- a/xmake/plugins/macro/macros/package.lua +++ b/xmake/plugins/macro/macros/package.lua @@ -88,7 +88,7 @@ function main(argv) config.load() os.cd(project.directory()) - local outputdir = args.outputdir or config.get("buildir") + local outputdir = args.outputdir or config.builddir() local targets = {} if option.get("target") then local target = project.target(option.get("target")) diff --git a/xmake/plugins/pack/main.lua b/xmake/plugins/pack/main.lua index b108be790..dd599a61d 100644 --- a/xmake/plugins/pack/main.lua +++ b/xmake/plugins/pack/main.lua @@ -52,7 +52,7 @@ end function _load_package(package) -- ensure build and output directories - os.tryrm(package:buildir()) + os.tryrm(package:builddir()) os.mkdir(package:outputdir()) -- load it diff --git a/xmake/plugins/pack/nsis/main.lua b/xmake/plugins/pack/nsis/main.lua index 64c002042..d252d5e4f 100644 --- a/xmake/plugins/pack/nsis/main.lua +++ b/xmake/plugins/pack/nsis/main.lua @@ -254,7 +254,7 @@ end function _pack_nsis(makensis, package) -- install the initial specfile - local specfile = path.join(package:buildir(), package:basename() .. ".nsi") + local specfile = path.join(package:builddir(), package:basename() .. ".nsi") if not os.isfile(specfile) then local specfile_template = package:get("specfile") or path.join(os.programdir(), "scripts", "xpack", "nsis", "makensis.nsi") os.cp(specfile_template, specfile) diff --git a/xmake/plugins/pack/runself/main.lua b/xmake/plugins/pack/runself/main.lua index 91284edc0..47ab74eee 100644 --- a/xmake/plugins/pack/runself/main.lua +++ b/xmake/plugins/pack/runself/main.lua @@ -108,7 +108,7 @@ end function _pack_runself(makeself, package) -- install the initial specfile - local specfile = path.join(package:buildir(), package:basename() .. ".lsm") + local specfile = path.join(package:builddir(), package:basename() .. ".lsm") if not os.isfile(specfile) then local specfile_template = package:get("specfile") or path.join(os.programdir(), "scripts", "xpack", "runself", "makeself.lsm") os.cp(specfile_template, specfile, {writeable = true}) diff --git a/xmake/plugins/pack/srpm/main.lua b/xmake/plugins/pack/srpm/main.lua index 72b76563e..e8600427a 100644 --- a/xmake/plugins/pack/srpm/main.lua +++ b/xmake/plugins/pack/srpm/main.lua @@ -57,7 +57,7 @@ end -- get archive file function _get_archivefile(package) - return path.absolute(path.join(package:buildir(), package:basename() .. ".tar.gz")) + return path.absolute(path.join(package:builddir(), package:basename() .. ".tar.gz")) end -- translate the file path @@ -202,7 +202,7 @@ function _pack_srpm(rpmbuild, package) end -- install the initial specfile - local specfile = path.join(package:buildir(), package:basename() .. ".spec") + local specfile = path.join(package:builddir(), package:basename() .. ".spec") if not os.isfile(specfile) then local specfile_template = package:get("specfile") or path.join(os.programdir(), "scripts", "xpack", "srpm", "srpm.spec") os.cp(specfile_template, specfile, {writeable = true}) @@ -263,8 +263,8 @@ function _pack_srpm(rpmbuild, package) -- pack srpm package os.vrunv(rpmbuild, {"-bs", specfile, - "--define", "_topdir " .. package:buildir(), - "--define", "_sourcedir " .. package:buildir(), + "--define", "_topdir " .. package:builddir(), + "--define", "_sourcedir " .. package:builddir(), "--define", "_srcrpmdir " .. package:outputdir()}) -- pack rpm package diff --git a/xmake/plugins/pack/wix/main.lua b/xmake/plugins/pack/wix/main.lua index a99070def..5d04eb7f5 100644 --- a/xmake/plugins/pack/wix/main.lua +++ b/xmake/plugins/pack/wix/main.lua @@ -240,7 +240,7 @@ function _get_specvars(package) rtf_string = _to_rtf_string(io.readfile(licensefile)) end - local rtf_file = path.join(package:buildir(), "license.rtf") + local rtf_file = path.join(package:builddir(), "license.rtf") io.writefile(rtf_file, rtf_string) return rtf_file end @@ -258,7 +258,7 @@ end function _pack_wix(wix, package) -- install the initial specfile - local specfile = path.join(package:buildir(), package:basename() .. ".wxs") + local specfile = path.join(package:builddir(), package:basename() .. ".wxs") if not os.isfile(specfile) then local specfile_template = package:get("specfile") or path.join(os.programdir(), "scripts", "xpack", "wix", "msi.wxs") os.cp(specfile_template, specfile) diff --git a/xmake/plugins/pack/xpack.lua b/xmake/plugins/pack/xpack.lua index 5cd3431a5..780d6ca36 100644 --- a/xmake/plugins/pack/xpack.lua +++ b/xmake/plugins/pack/xpack.lua @@ -256,15 +256,21 @@ function xpack:with_binary() end -- get the build directory +function xpack:builddir() + return path.join(config.builddir(), ".xpack", self:name()) +end + +-- get the build directory (deprecated) function xpack:buildir() - return path.join(config.buildir(), ".xpack", self:name()) + wprint("xpack:buildir() has been deprecated, please use xpack:builddir()") + return self:builddir() end -- get the output directory function xpack:outputdir() local outputdir = option.get("outputdir") if outputdir == nil then - outputdir = path.join(config.buildir(), "xpack", self:name()) + outputdir = path.join(config.builddir(), "xpack", self:name()) end return outputdir end @@ -420,7 +426,7 @@ end -- get the installed root directory, this is just a temporary sandbox installation path, -- we may replace it with the actual installation path in the specfile function xpack:install_rootdir() - return path.join(self:buildir(), "installed", self:format()) + return path.join(self:builddir(), "installed", self:format()) end -- get the installed directory @@ -440,7 +446,7 @@ end -- get the source root directory function xpack:source_rootdir() - return path.join(self:buildir(), "source", self:format()) + return path.join(self:builddir(), "source", self:format()) end -- get the source directory diff --git a/xmake/plugins/project/vsxmake/getinfo.lua b/xmake/plugins/project/vsxmake/getinfo.lua index 12d6497c0..ae69fbb58 100644 --- a/xmake/plugins/project/vsxmake/getinfo.lua +++ b/xmake/plugins/project/vsxmake/getinfo.lua @@ -131,7 +131,7 @@ function _make_targetinfo(mode, arch, target) -- save dirs targetinfo.targetdir = _make_dirs(target:get("targetdir")) - targetinfo.buildir = _make_dirs(config.get("buildir")) + targetinfo.builddir = _make_dirs(config.get("builddir") or config.get("buildir")) targetinfo.rundir = _make_dirs(target:get("rundir")) targetinfo.configdir = _make_dirs(os.getenv("XMAKE_CONFIGDIR")) targetinfo.configfiledir = _make_dirs(target:get("configdir")) @@ -425,7 +425,7 @@ function main(outputdir, vsinfo) -- init config flags local flags = {} for k, v in table.orderpairs(localcache.get("config", "options")) do - if k ~= "plat" and k ~= "mode" and k ~= "arch" and k ~= "clean" and k ~= "buildir" then + if k ~= "plat" and k ~= "mode" and k ~= "arch" and k ~= "clean" and k ~= "builddir" and k ~= "buildir" then table.insert(flags, "--" .. k .. "=" .. tostring(v)) end end diff --git a/xmake/plugins/show/info/basic.lua b/xmake/plugins/show/info/basic.lua index 697f0da29..46840b55e 100644 --- a/xmake/plugins/show/info/basic.lua +++ b/xmake/plugins/show/info/basic.lua @@ -60,8 +60,8 @@ function main() if config.mode() then cprint(" ${color.dump.string}mode${clear}: %s", config.mode()) end - if config.buildir() then - cprint(" ${color.dump.string}buildir${clear}: %s", config.buildir()) + if config.builddir() then + cprint(" ${color.dump.string}builddir${clear}: %s", config.builddir()) end cprint(" ${color.dump.string}configdir${clear}: %s", config.directory()) cprint(" ${color.dump.string}projectdir${clear}: %s", os.projectdir()) diff --git a/xmake/plugins/watch/main.lua b/xmake/plugins/watch/main.lua index cbef811ae..f7269caf9 100644 --- a/xmake/plugins/watch/main.lua +++ b/xmake/plugins/watch/main.lua @@ -52,8 +52,8 @@ function _add_watchdirs() elseif os.isfile(os.projectfile()) then watchdirs = os.dirs(path.join(os.projectdir(), "*|.*")) for _, watchdir in ipairs(watchdirs) do - local buildir = path.absolute(config.buildir()) - if path.absolute(watchdir) ~= buildir then + local builddir = path.absolute(config.builddir()) + if path.absolute(watchdir) ~= builddir then _add_watchdir(watchdir, {recursion = true}) end end diff --git a/xmake/rules/go/env/xmake.lua b/xmake/rules/go/env/xmake.lua index f85577907..8639bac38 100644 --- a/xmake/rules/go/env/xmake.lua +++ b/xmake/rules/go/env/xmake.lua @@ -33,7 +33,7 @@ rule("go.env") local goos = goenv.GOOS(target:plat()) local goarch = goenv.GOARCH(target:arch()) if goroot and goos and goarch then - local goroot_local = path.join(config.buildir(), ".goenv", path.filename(goroot)) + local goroot_local = path.join(config.builddir(), ".goenv", path.filename(goroot)) local gopkgdir = path.join(os.isdir(goroot_local) and goroot_local or goroot, "pkg", goos .. "_" .. goarch) if not os.isdir(gopkgdir) or os.emptydir(gopkgdir) then local gosrcdir = path.join(goroot, "src") diff --git a/xmake/rules/module/xmake.lua b/xmake/rules/module/xmake.lua index 0515bd842..c42ee4092 100644 --- a/xmake/rules/module/xmake.lua +++ b/xmake/rules/module/xmake.lua @@ -23,7 +23,7 @@ rule("module.binary") import("core.project.config") target:set("kind", "binary") target:set("basename", "module_" .. target:name()) - target:set("targetdir", config.buildir()) + target:set("targetdir", config.builddir()) end) rule("module.shared") @@ -32,7 +32,7 @@ rule("module.shared") import("core.project.config") target:set("kind", "shared") target:set("basename", "module_" .. target:name()) - target:set("targetdir", config.buildir()) + target:set("targetdir", config.builddir()) target:set("strip", "none") target:add("includedirs", path.join(os.programdir(), "scripts", "module")) target:add("includedirs", path.join(os.programdir(), "scripts", "module", "luawrap")) diff --git a/xmake/rules/plugin/compile_commands/xmake.lua b/xmake/rules/plugin/compile_commands/xmake.lua index 06e7e67a1..d2f83fc95 100644 --- a/xmake/rules/plugin/compile_commands/xmake.lua +++ b/xmake/rules/plugin/compile_commands/xmake.lua @@ -43,7 +43,7 @@ rule("plugin.compile_commands.autoupdate") end -- run only once for all xmake process - local tmpfile = path.join(config.buildir(), ".gens", "rules", "plugin.compile_commands.autoupdate") + local tmpfile = path.join(config.builddir(), ".gens", "rules", "plugin.compile_commands.autoupdate") local dependfile = tmpfile .. ".d" local lockfile = io.openlock(tmpfile .. ".lock") if lockfile:trylock() then diff --git a/xmake/rules/plugin/vsxmake/xmake.lua b/xmake/rules/plugin/vsxmake/xmake.lua index 421f98cc1..f114665db 100644 --- a/xmake/rules/plugin/vsxmake/xmake.lua +++ b/xmake/rules/plugin/vsxmake/xmake.lua @@ -39,7 +39,7 @@ rule("plugin.vsxmake.autoupdate") import("core.base.task") -- run only once for all xmake process in vs - local tmpfile = path.join(config.buildir(), ".gens", "rules", "plugin.vsxmake.autoupdate") + local tmpfile = path.join(config.builddir(), ".gens", "rules", "plugin.vsxmake.autoupdate") local dependfile = tmpfile .. ".d" local lockfile = io.openlock(tmpfile .. ".lock") local kind = localcache.get("vsxmake", "kind") diff --git a/xmake/rules/qt/deploy/android.lua b/xmake/rules/qt/deploy/android.lua index 524afe533..453e0d2f5 100644 --- a/xmake/rules/qt/deploy/android.lua +++ b/xmake/rules/qt/deploy/android.lua @@ -78,7 +78,7 @@ function main(target, opt) assert(os.isexec(androiddeployqt), "androiddeployqt not found!") -- get working directory - local workdir = path.join(config.buildir(), ".qt", "app", "android", target:name()) + local workdir = path.join(config.builddir(), ".qt", "app", "android", target:name()) -- get android-build directory local android_buildir = path.join(workdir, "android-build") diff --git a/xmake/rules/qt/load.lua b/xmake/rules/qt/load.lua index 7bf4ecac6..0c7b68d71 100644 --- a/xmake/rules/qt/load.lua +++ b/xmake/rules/qt/load.lua @@ -277,7 +277,7 @@ function main(target, opt) end local plugins = target:values("qt.plugins") if plugins then - local importfile = path.join(config.buildir(), ".qt", "plugin", target:name(), "static_import.cpp") + local importfile = path.join(config.builddir(), ".qt", "plugin", target:name(), "static_import.cpp") local file = io.open(importfile, "w") if file then file:print("#include <QtPlugin>") diff --git a/xmake/rules/wdk/package/xmake.lua b/xmake/rules/wdk/package/xmake.lua index 2b8673aac..a640380bd 100644 --- a/xmake/rules/wdk/package/xmake.lua +++ b/xmake/rules/wdk/package/xmake.lua @@ -30,7 +30,7 @@ rule("wdk.package.cab") import("lib.detect.find_program") -- the output directory - local outputdir = path.join(option.get("outputdir") or config.buildir(), "drivers", target:name()) + local outputdir = path.join(option.get("outputdir") or config.builddir(), "drivers", target:name()) local mode = config.mode() if mode then outputdir = path.join(outputdir, mode) diff --git a/xmake/scripts/vsxmake/vsproj/Xmake.props b/xmake/scripts/vsxmake/vsproj/Xmake.props index 301a13fd5..6c46bc5e1 100644 --- a/xmake/scripts/vsxmake/vsproj/Xmake.props +++ b/xmake/scripts/vsxmake/vsproj/Xmake.props @@ -29,9 +29,9 @@ </PropertyGroup> <PropertyGroup Label="XmakePathsFallback"> - <XmakeBuilDir Condition="'$(XmakeBuilDir)' == ''">$(XmakeProjectDir)\build</XmakeBuilDir> - <XmakeTargetDir Condition="'$(XmakeTargetDir)' == ''">$(XmakeBuilDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeTargetDir> - <XmakeConfigFileDir Condition="'$(XmakeConfigFileDir)' == ''">$(XmakeBuilDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeConfigFileDir> + <XmakeBuilDDir Condition="'$(XmakeBuilDDir)' == ''">$(XmakeProjectDir)\build</XmakeBuilDDir> + <XmakeTargetDir Condition="'$(XmakeTargetDir)' == ''">$(XmakeBuilDDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeTargetDir> + <XmakeConfigFileDir Condition="'$(XmakeConfigFileDir)' == ''">$(XmakeBuilDDir)\$(XmakePlat)\$(XmakeArch)\$(XmakeMode)</XmakeConfigFileDir> <XmakeConfigDir Condition="'$(XmakeConfigDir)' == ''">$(XMAKE_CONFIGDIR)</XmakeConfigDir> <XmakeConfigDir Condition="'$(XmakeConfigDir)' == ''">$(XmakeProjectDir)</XmakeConfigDir> @@ -170,7 +170,7 @@ <PropertyGroup Label="Path"> <LibraryPath>$(XmakeLinkDirs);$(LibraryPath)</LibraryPath> <OutDir>$(XmakeTargetDir)\</OutDir> - <IntDir>$(XmakeBuilDir)\.vs\$(TargetName)\$(XmakeArch)\$(XmakeMode)\</IntDir> + <IntDir>$(XmakeBuilDDir)\.vs\$(TargetName)\$(XmakeArch)\$(XmakeMode)\</IntDir> <SourcePath>$(XmakeSourceDirs);$(SourcePath)</SourcePath> </PropertyGroup> diff --git a/xmake/scripts/vsxmake/vsproj/Xmake.targets b/xmake/scripts/vsxmake/vsproj/Xmake.targets index fd4da234e..ec7ea3532 100644 --- a/xmake/scripts/vsxmake/vsproj/Xmake.targets +++ b/xmake/scripts/vsxmake/vsproj/Xmake.targets @@ -8,21 +8,21 @@ </ImportGroup> <PropertyGroup Label="XmakePathsResolve"> - <XmakeBuilDirResolved>$(XmakeBuilDir)</XmakeBuilDirResolved> + <XmakeBuilDDirResolved>$(XmakeBuilDDir)</XmakeBuilDDirResolved> <XmakeTargetDirResolved>$(XmakeTargetDir)</XmakeTargetDirResolved> <XmakeConfigDirResolved>$(XmakeConfigDir)</XmakeConfigDirResolved> <XmakeConfigFileDirResolved>$(XmakeConfigFileDir)</XmakeConfigFileDirResolved> <XmakeRunDirResolved>$(XmakeRunDir)</XmakeRunDirResolved> <!-- resolve if they are relative paths --> - <XmakeBuilDirResolved Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeBuilDirResolved)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeBuilDirResolved)'))</XmakeBuilDirResolved> + <XmakeBuilDDirResolved Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeBuilDDirResolved)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeBuilDDirResolved)'))</XmakeBuilDDirResolved> <XmakeTargetDirResolved Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeTargetDirResolved)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeTargetDirResolved)'))</XmakeTargetDirResolved> <XmakeConfigDirResolved Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeConfigDirResolved)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigDirResolved)'))</XmakeConfigDirResolved> <XmakeConfigFileDirResolved Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeConfigFileDirResolved)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeConfigFileDirResolved)'))</XmakeConfigFileDirResolved> <XmakeRunDirResolved Condition="!$([System.IO.Path]::IsPathRooted('$(XmakeRunDirResolved)'))">$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\$(XmakeRunDirResolved)'))</XmakeRunDirResolved> <!-- normalize paths --> - <XmakeBuilDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeBuilDirResolved)/'))</XmakeBuilDirResolved> + <XmakeBuilDDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeBuilDDirResolved)/'))</XmakeBuilDDirResolved> <XmakeTargetDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeTargetDirResolved)/'))</XmakeTargetDirResolved> <XmakeConfigDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeConfigDirResolved)/'))</XmakeConfigDirResolved> <XmakeConfigFileDirResolved>$([System.IO.Path]::GetFullPath('$(XmakeConfigFileDirResolved)/'))</XmakeConfigFileDirResolved> @@ -44,7 +44,7 @@ <_XmakeCommonFlags Condition="$(XmakeDiagnosis)">-D $(_XmakeCommonFlags.Trim())</_XmakeCommonFlags> <_XmakeCommonFlags>-y $(_XmakeCommonFlags.Trim()) $(_XmakeProjectFlag)</_XmakeCommonFlags> - <_XmakeOutFlag>-o "$([MSBuild]::MakeRelative('$(XmakeProjectDirResolved)', '$(XmakeBuilDirResolved)').TrimEnd('\').TrimEnd('/'))"</_XmakeOutFlag> + <_XmakeOutFlag>-o "$([MSBuild]::MakeRelative('$(XmakeProjectDirResolved)', '$(XmakeBuilDDirResolved)').TrimEnd('\').TrimEnd('/'))"</_XmakeOutFlag> <_XmakeConfigFlags>$(XmakeConfigFlags.Trim())</_XmakeConfigFlags> <_XmakeConfigFlags>-p $(XmakePlat) -m $(XmakeMode) -a $(XmakeArch) $(_XmakeOutFlag) $(_XmakeConfigFlags.Trim())</_XmakeConfigFlags> @@ -156,7 +156,7 @@ MSBuild Properties: XmakeProgramFile: $(XmakeProgramFile) XmakeProjectDir: $(XmakeProjectDir) XmakeScriptDir: $(XmakeScriptDir) - XmakeBuilDir: $(XmakeBuilDir) + XmakeBuilDDir: $(XmakeBuilDDir) XmakeTargetDir: $(XmakeTargetDir) XmakeConfigDir: $(XmakeConfigDir) XmakeConfigFileDir: $(XmakeConfigFileDir) @@ -166,7 +166,7 @@ MSBuild Properties: XmakeProgramFile: $(XmakeProgramFileResolved) XmakeProjectDir: $(XmakeProjectDirResolved) XmakeScriptDir: $(XmakeScriptDirResolved) - XmakeBuilDir: $(XmakeBuilDirResolved) + XmakeBuilDDir: $(XmakeBuilDDirResolved) XmakeTargetDir: $(XmakeTargetDirResolved) XmakeConfigDir: $(XmakeConfigDirResolved) XmakeConfigFileDir: $(XmakeConfigFileDirResolved) diff --git a/xmake/scripts/vsxmake/vsproj/Xmake.xml b/xmake/scripts/vsxmake/vsproj/Xmake.xml index 2b7fea645..3f5600ba6 100644 --- a/xmake/scripts/vsxmake/vsproj/Xmake.xml +++ b/xmake/scripts/vsxmake/vsproj/Xmake.xml @@ -66,7 +66,7 @@ Description="Set environment XMAKE_CONFIGDIR for xmake tasks" Subtype="folder" /> <StringProperty - Name="XmakeBuilDir" + Name="XmakeBuilDDir" DisplayName="Build dir" Category="Paths" Description="Set output dir for xmake tasks" diff --git a/xmake/scripts/vsxmake/vsproj/templates/Xmake.Custom.props b/xmake/scripts/vsxmake/vsproj/templates/Xmake.Custom.props index 0018c3134..22e84fc46 100644 --- a/xmake/scripts/vsxmake/vsproj/templates/Xmake.Custom.props +++ b/xmake/scripts/vsxmake/vsproj/templates/Xmake.Custom.props @@ -9,7 +9,7 @@ <!-- <XmakeConfigDir Condition="'$(XmakeMode)|$(XmakeArch)' == 'release|x86'">$(XmakeProjectDir)\.xmake</XmakeConfigDir> --> <!-- set output dir for xmake tasks --> - <!-- <XmakeBuilDir>$(XmakeProjectDir)\build</XmakeBuilDir> --> + <!-- <XmakeBuilDDir>$(XmakeProjectDir)\build</XmakeBuilDDir> --> </PropertyGroup> <PropertyGroup Label="XmakeFlags"> diff --git a/xmake/scripts/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) b/xmake/scripts/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) index 9afa8460f..f724ee28c 100644 --- a/xmake/scripts/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) +++ b/xmake/scripts/vsxmake/vsproj/templates/vcxproj/XmakePath(mode,arch) @@ -1,5 +1,5 @@ <PropertyGroup Label="XmakePath" Condition="'$(Configuration)|$(Platform)'=='#mode#|#vsarch#'"> - <XmakeBuilDir>#buildir#</XmakeBuilDir> + <XmakeBuilDDir>#builddir#</XmakeBuilDDir> <XmakeConfigDir>#configdir#</XmakeConfigDir> <XmakeConfigFileDir>#configfiledir#</XmakeConfigFileDir> <XmakeTargetDir>#targetdir#</XmakeTargetDir> |
