diff options
| author | ruki <[email protected]> | 2020-05-14 23:13:17 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-05-14 13:19:43 +0800 |
| commit | 2e838f7c9db7f0cfaff1e15d41821ee9235c1b3a (patch) | |
| tree | 700e83487b15610c91cd699d50b29590a1e03dd2 | |
| parent | 46abd569d127f5d77735cc2071018970d34bcd37 (diff) | |
add build.across_targets_in_parallel policy
| -rw-r--r-- | tests/projects/other/merge_archive/xmake.lua | 2 | ||||
| -rw-r--r-- | xmake/actions/build/kinds/binary.lua | 4 | ||||
| -rw-r--r-- | xmake/actions/build/kinds/shared.lua | 4 | ||||
| -rw-r--r-- | xmake/actions/build/kinds/static.lua | 4 | ||||
| -rw-r--r-- | xmake/core/project/policy.lua | 8 | ||||
| -rw-r--r-- | xmake/rules/go/xmake.lua | 2 |
6 files changed, 14 insertions, 10 deletions
diff --git a/tests/projects/other/merge_archive/xmake.lua b/tests/projects/other/merge_archive/xmake.lua index 07be717b8..11092dec9 100644 --- a/tests/projects/other/merge_archive/xmake.lua +++ b/tests/projects/other/merge_archive/xmake.lua @@ -14,7 +14,7 @@ target("mul") set_kind("static") add_deps("add", "sub") add_files("src/mul.c") - set_values("build.across_targets_in_parallel", false) + set_policy("build.across_targets_in_parallel", false) if is_plat("windows") then add_files("$(buildir)/merge_archive/*.lib") else diff --git a/xmake/actions/build/kinds/binary.lua b/xmake/actions/build/kinds/binary.lua index 5525d84cc..800faeb1f 100644 --- a/xmake/actions/build/kinds/binary.lua +++ b/xmake/actions/build/kinds/binary.lua @@ -159,8 +159,8 @@ function main(batchjobs, rootjob, target) -- we need only return and depend the link job for each target, -- so we can compile the source files for each target in parallel -- - -- unless call set_values("build.across_targets_in_parallel") to disable to build across targets in parallel. + -- unless call set_policy("build.across_targets_in_parallel", false) to disable to build across targets in parallel. -- local job_objects = add_batchjobs_for_object(batchjobs, job_link, target) - return target:values("build.across_targets_in_parallel") == false and job_objects or job_link, job_objects + return target:policy("build.across_targets_in_parallel") == false and job_objects or job_link, job_objects end diff --git a/xmake/actions/build/kinds/shared.lua b/xmake/actions/build/kinds/shared.lua index b4d0f208a..9df138c09 100644 --- a/xmake/actions/build/kinds/shared.lua +++ b/xmake/actions/build/kinds/shared.lua @@ -172,8 +172,8 @@ function main(batchjobs, rootjob, target) -- we need only return and depend the link job for each target, -- so we can compile the source files for each target in parallel -- - -- unless call set_values("build.across_targets_in_parallel") to disable to build across targets in parallel. + -- unless call set_policy("build.across_targets_in_parallel", false) to disable to build across targets in parallel. -- local job_objects = add_batchjobs_for_object(batchjobs, job_link, target) - return target:values("build.across_targets_in_parallel") == false and job_objects or job_link, job_objects + return target:policy("build.across_targets_in_parallel") == false and job_objects or job_link, job_objects end diff --git a/xmake/actions/build/kinds/static.lua b/xmake/actions/build/kinds/static.lua index 432863bf2..bf6856ae1 100644 --- a/xmake/actions/build/kinds/static.lua +++ b/xmake/actions/build/kinds/static.lua @@ -168,8 +168,8 @@ function main(batchjobs, rootjob, target) -- we need only return and depend the link job for each target, -- so we can compile the source files for each target in parallel -- - -- unless call set_values("build.across_targets_in_parallel") to disable to build across targets in parallel. + -- unless call set_policy("build.across_targets_in_parallel", false) to disable to build across targets in parallel. -- local job_objects = add_batchjobs_for_object(batchjobs, job_link, target) - return target:values("build.across_targets_in_parallel") == false and job_objects or job_link, job_objects + return target:policy("build.across_targets_in_parallel") == false and job_objects or job_link, job_objects end diff --git a/xmake/core/project/policy.lua b/xmake/core/project/policy.lua index 4f70aa92c..415ca4a31 100644 --- a/xmake/core/project/policy.lua +++ b/xmake/core/project/policy.lua @@ -35,8 +35,12 @@ function policy.policies() if not policies then policies = { - ["check.auto_ignore_flags"] = { description = "Enable check and ignore unsupported flags automatically.", default = true, type = "boolean"}, - ["check.auto_map_flags"] = { description = "Enable map gcc flags to the current compiler and linker automatically.", default = true, type = "boolean"} + -- we will check and ignore all unsupported flags by default, but we can also pass `{force = true}` to force to set flags, e.g. add_ldflags("-static", {force = true}) + ["check.auto_ignore_flags"] = {description = "Enable check and ignore unsupported flags automatically.", default = true, type = "boolean"}, + -- we will map gcc flags to the current compiler and linker by default. + ["check.auto_map_flags"] = {description = "Enable map gcc flags to the current compiler and linker automatically.", default = true, type = "boolean"}, + -- we can compile the source files for each target in parallel + ["build.across_targets_in_parallel"] = {description = "Enable compile the source files for each target in parallel.", default = true, type = "boolean"} } policy._POLICIES = policies end diff --git a/xmake/rules/go/xmake.lua b/xmake/rules/go/xmake.lua index e32dbe95e..19b819626 100644 --- a/xmake/rules/go/xmake.lua +++ b/xmake/rules/go/xmake.lua @@ -23,7 +23,7 @@ rule("go.build") set_sourcekinds("gc") on_load(function (target) -- we disable to build across targets in parallel, because the source files may depend on other target modules - target:set("values.build.across_targets_in_parallel", false) + target:set("policy", "build.across_targets_in_parallel", false) end) on_build_files("build.object") |
