This commit is contained in:
parent
f40d2912cd
commit
f0bdfbee77
1 changed files with 5 additions and 3 deletions
|
|
@ -281,15 +281,17 @@ ExternalBuildResult Crafter::BuildExternal(
|
||||||
// (runtime-loader). The rpath stays embedded in the produced
|
// (runtime-loader). The rpath stays embedded in the produced
|
||||||
// binary so it picks up shared deps from the cache without any
|
// binary so it picks up shared deps from the cache without any
|
||||||
// LD_LIBRARY_PATH gymnastics. Static deps (.a) ignore the rpath
|
// LD_LIBRARY_PATH gymnastics. Static deps (.a) ignore the rpath
|
||||||
// harmlessly.
|
// harmlessly. PE/COFF targets (mingw, msvc) resolve DLLs via PATH
|
||||||
|
// or adjacency rather than rpath, so lld warns if we pass it.
|
||||||
|
bool isPe = target == "x86_64-w64-mingw32" || target == "x86_64-pc-windows-msvc";
|
||||||
std::string buildDirAbs = fs::absolute(cmakeBuildDir).string();
|
std::string buildDirAbs = fs::absolute(cmakeBuildDir).string();
|
||||||
result.linkFlags.push_back(std::format("-L{}", buildDirAbs));
|
result.linkFlags.push_back(std::format("-L{}", buildDirAbs));
|
||||||
result.linkFlags.push_back(std::format("-Wl,-rpath,{}", buildDirAbs));
|
if (!isPe) result.linkFlags.push_back(std::format("-Wl,-rpath,{}", buildDirAbs));
|
||||||
for (const fs::path& libDir : dep.libDirs) {
|
for (const fs::path& libDir : dep.libDirs) {
|
||||||
fs::path full = libDir.is_absolute() ? libDir : cmakeBuildDir / libDir;
|
fs::path full = libDir.is_absolute() ? libDir : cmakeBuildDir / libDir;
|
||||||
std::string fullAbs = fs::absolute(full).string();
|
std::string fullAbs = fs::absolute(full).string();
|
||||||
result.linkFlags.push_back(std::format("-L{}", fullAbs));
|
result.linkFlags.push_back(std::format("-L{}", fullAbs));
|
||||||
result.linkFlags.push_back(std::format("-Wl,-rpath,{}", fullAbs));
|
if (!isPe) result.linkFlags.push_back(std::format("-Wl,-rpath,{}", fullAbs));
|
||||||
}
|
}
|
||||||
for (const std::string& lib : dep.libs) {
|
for (const std::string& lib : dep.libs) {
|
||||||
result.linkFlags.push_back(std::format("-l{}", lib));
|
result.linkFlags.push_back(std::format("-l{}", lib));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue