summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-01-21 23:03:14 +0800
committerGitHub <[email protected]>2025-01-21 23:03:14 +0800
commite7e33166b1ebfbb67b9a48a581414064a61da9ac (patch)
tree6ba87b37a28215b93ae98fa448a17341fa3324ed
parentc61d7bb40353b161da913bdcbc6fa399e36164a1 (diff)
parent78371cb084abfe3e80e928adae4e55a0df98f34b (diff)
Merge pull request #6101 from xmake-io/ci
fix ci for v3.0
-rw-r--r--tests/test_utils/test_build.lua3
-rw-r--r--xmake/modules/package/tools/cmake.lua14
-rw-r--r--xmake/modules/private/action/require/impl/package.lua8
-rw-r--r--xmake/rules/c++/xmake.lua10
4 files changed, 24 insertions, 11 deletions
diff --git a/tests/test_utils/test_build.lua b/tests/test_utils/test_build.lua
index 8a2b75ce9..cc4111552 100644
--- a/tests/test_utils/test_build.lua
+++ b/tests/test_utils/test_build.lua
@@ -4,8 +4,7 @@ function test_build:build(argv)
os.exec("xmake f -c -D -y")
os.exec("xmake")
os.rm("build")
- --os.exec("xmake f -c -D -y --policies=compatibility.version:3.0")
- os.exec("xmake f -c -D -y --policies=compatibility.version=3.0") -- FIXME
+ os.exec("xmake f -c -D -y --policies=compatibility.version:3.0")
os.exec("xmake -r")
end
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 501b52502..6faac6702 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -601,9 +601,6 @@ function _get_configs_for_mingw(package, configs, opt)
if is_subhost("windows") and opt.cmake_generator ~= "Ninja" then
envs.CMAKE_MAKE_PROGRAM = _get_mingw32_make(package)
end
- if opt.cmake_generator == "Ninja" then
- envs.CMAKE_MAKE_PROGRAM = "ninja"
- end
_fix_cxx_compiler_cmake(package, envs)
_insert_configs_from_envs(configs, envs, opt)
end
@@ -618,12 +615,7 @@ function _get_configs_for_wasm(package, configs, opt)
assert(emscripten_cmakefile, "Emscripten.cmake not found!")
table.insert(configs, "-DCMAKE_TOOLCHAIN_FILE=" .. emscripten_cmakefile)
if is_subhost("windows") then
- if opt.cmake_generator == "Ninja" then
- local ninja = _get_ninja(package)
- if ninja then
- table.insert(configs, "-DCMAKE_MAKE_PROGRAM=" .. ninja)
- end
- else
+ if opt.cmake_generator ~= "Ninja" then
local mingw_make = _get_mingw32_make(package)
if mingw_make then
table.insert(configs, "-DCMAKE_MAKE_PROGRAM=" .. mingw_make)
@@ -783,6 +775,10 @@ function _get_configs_for_generator(package, configs, opt)
table.insert(configs, "-DCMAKE_JOB_POOL_LINK:STRING=link")
table.insert(configs, ("-DCMAKE_JOB_POOLS:STRING=compile=%s;link=%s"):format(jobs, linkjobs))
end
+ local ninja = _get_ninja(package)
+ if ninja then
+ table.insert(configs, "-DCMAKE_MAKE_PROGRAM=" .. ninja)
+ end
end
elseif package:is_plat("mingw") and is_subhost("msys") then
table.insert(configs, "-G")
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua
index 840814040..5335ae73a 100644
--- a/xmake/modules/private/action/require/impl/package.lua
+++ b/xmake/modules/private/action/require/impl/package.lua
@@ -1437,6 +1437,14 @@ function _must_depend_on(package, dep)
local librarydeps = hashset.from(manifest.librarydeps)
return librarydeps:has(dep:name())
end
+ -- If we mark it as public, even if binary package is already installed,
+ -- we need also to install it's public dep and export the it's envs.
+ --
+ -- @see https://github.com/xmake-io/xmake-repo/pull/6207
+ -- https://github.com/xmake-io/xmake/pull/6101
+ if package:is_binary() and package:extraconf("deps", dep:name(), "public") then
+ return true
+ end
end
-- compatible with all previous link dependencies?
diff --git a/xmake/rules/c++/xmake.lua b/xmake/rules/c++/xmake.lua
index 3723b9d71..94bba431e 100644
--- a/xmake/rules/c++/xmake.lua
+++ b/xmake/rules/c++/xmake.lua
@@ -23,6 +23,16 @@ rule("c.build")
add_deps("c.build.pcheader", "c.build.optimization", "c.build.sanitizer")
on_build_files("private.action.build.object", {batch = true, distcc = true})
on_config(function (target)
+ -- enable vs runtime as MD by default
+ if target:is_plat("windows") and not target:get("runtimes") then
+ local vs_runtime_default = target:policy("build.c++.msvc.runtime")
+ if vs_runtime_default and target:has_tool("cc", "cl", "clang_cl") then
+ if is_mode("debug") then
+ vs_runtime_default = vs_runtime_default .. "d"
+ end
+ target:set("runtimes", vs_runtime_default)
+ end
+ end
-- https://github.com/xmake-io/xmake/issues/4621
if target:is_plat("windows") and target:is_static() and target:has_tool("cc", "tcc") then
target:set("extension", ".a")