Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.
/ swift-llvm Public archive

Commit 88df5b1

Browse files
committed
Fix llvm-config support for CMake build-mode-style builds
At some point we and/or CMake changed our build-mode-style builds from $LLVM_OBJ_ROOT/bin/$CMAKE_CFG_INTDIR/ to $LLVM_OBJ_ROOT/$CMAKE_CFG_INTDIR/bin/ which is way easier to use. But no one updated llvm-config. https://reviews.llvm.org/D66326
1 parent 200186e commit 88df5b1

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tools/llvm-config/llvm-config.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ int main(int argc, char **argv) {
292292
IsInDevelopmentTree = true;
293293
DevelopmentTreeLayout = CMakeStyle;
294294
ActiveObjRoot = LLVM_OBJ_ROOT;
295-
} else if (sys::fs::equivalent(CurrentExecPrefix,
296-
Twine(LLVM_OBJ_ROOT) + "/bin")) {
295+
} else if (sys::fs::equivalent(sys::path::parent_path(CurrentExecPrefix),
296+
LLVM_OBJ_ROOT)) {
297297
IsInDevelopmentTree = true;
298298
DevelopmentTreeLayout = CMakeBuildModeStyle;
299299
ActiveObjRoot = LLVM_OBJ_ROOT;
@@ -320,11 +320,14 @@ int main(int argc, char **argv) {
320320
ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
321321
break;
322322
case CMakeBuildModeStyle:
323+
// FIXME: Should we consider the build-mode-specific path as the prefix?
323324
ActivePrefix = ActiveObjRoot;
324-
ActiveBinDir = ActiveObjRoot + "/bin/" + build_mode;
325+
ActiveBinDir = ActiveObjRoot + "/" + build_mode + "/bin";
325326
ActiveLibDir =
326-
ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX + "/" + build_mode;
327-
ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
327+
ActiveObjRoot + "/" + build_mode + "/lib" + LLVM_LIBDIR_SUFFIX;
328+
// The CMake directory isn't separated by build mode.
329+
ActiveCMakeDir =
330+
ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX + "/cmake/llvm";
328331
break;
329332
}
330333

0 commit comments

Comments
 (0)