summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/actions/run/main.lua5
-rw-r--r--xmake/core/project/policy.lua2
2 files changed, 7 insertions, 0 deletions
diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua
index 22748b388..c51825d8c 100644
--- a/xmake/actions/run/main.lua
+++ b/xmake/actions/run/main.lua
@@ -208,6 +208,11 @@ function main()
-- load config first
config.load()
+ -- Automatically build before running
+ if project.policy("run.autobuild") then
+ task.run("build")
+ end
+
-- load targets
project.load_targets()
diff --git a/xmake/core/project/policy.lua b/xmake/core/project/policy.lua
index 3ce75ca27..8bda6cded 100644
--- a/xmake/core/project/policy.lua
+++ b/xmake/core/project/policy.lua
@@ -78,6 +78,8 @@ function policy.policies()
["build.c++.gcc.modules.cxx11abi"] = {description = "Force to enable new cxx11 abi in C++ modules for gcc.", type = "boolean"},
-- Enable cuda device link
["build.cuda.devlink"] = {description = "Enable Cuda devlink.", type = "boolean"},
+ -- Automatically build before running
+ ["run.autobuild"] = {description = "Automatically build before running.", type = "boolean"},
-- Preprocessor configuration for ccache/distcc, we can disable linemarkers to speed up preprocess
["preprocessor.linemarkers"] = {description = "Enable linemarkers for preprocessor.", default = true, type = "boolean"},
-- Preprocessor configuration for ccache/distcc, we can disable it to avoid cache object file with __DATE__, __TIME__