@@ -26,6 +26,21 @@ inline std::string payload_toolchain(std::string_view compiler) {
2626 return clang ? " mcpp-clang" : " mcpp-gcc" ;
2727}
2828
29+ // The LLVM root a payload driver lives under: `…/xim-x-llvm/<ver>/bin/clang++`
30+ // → `…/xim-x-llvm/<ver>`. Empty for anything that is not a payload clang.
31+ inline std::string payload_sdk_root (std::string_view compiler) {
32+ if (compiler.find (" /registry/data/xpkgs/" ) == std::string_view::npos &&
33+ compiler.find (" \\ registry\\ data\\ xpkgs\\ " ) == std::string_view::npos)
34+ return {};
35+ if (compiler.find (" clang" ) == std::string_view::npos) return {};
36+ const auto slash = compiler.find_last_of (" /\\ " );
37+ if (slash == std::string_view::npos) return {};
38+ const auto bin = compiler.substr (0 , slash); // …/<ver>/bin
39+ const auto up = bin.find_last_of (" /\\ " );
40+ if (up == std::string_view::npos) return {};
41+ return std::string (bin.substr (0 , up)); // …/<ver>
42+ }
43+
2944class XmakeEngine : public Engine {
3045public:
3146 std::string_view name () const override { return " xmake" ; }
@@ -63,6 +78,24 @@ public:
6378 // it cannot be turned off without also discarding the toolchain.
6479 " --ccache=n" ,
6580 };
81+ // ── Tell xmake where libc++ lives, or `import std;` has no provider ──
82+ //
83+ // The payload SHIPS the std module (share/libc++/v1/std.cppm), but xmake
84+ // looks for it under its own notion of an LLVM SDK and otherwise says
85+ // warning: std and std.compat modules not found!
86+ // maybe try to add --sdk=<PATH/TO/LLVM> or install libc++
87+ // error: <mcpp> missing std dependency for module mcpp.build.provisions
88+ // — a message naming a module of the project under test, so it reads as
89+ // "this project is broken" rather than "the engine was not told where
90+ // its standard library is". Every scenario in the windows/clang cell
91+ // failed that way.
92+ //
93+ // Derived from the resolved driver (…/bin/clang++), which is the same
94+ // path the toolchain pin already produced, so there is nothing to keep
95+ // in step by hand.
96+ if (const auto sdk = payload_sdk_root (job.compiler ); !sdk.empty ())
97+ argv.push_back (" --sdk=" + sdk);
98+
6699 // ── How the payload driver is pinned, and why it is not always CXX ──
67100 //
68101 // A real project's description (bench/projects/*/xmake.lua) DEFINES the
0 commit comments