[PATCH] D66326: Fix llvm-config support for CMake build-mode-style builds
Jordan Rose via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 15 17:27:16 PDT 2019
jordan_rose created this revision.
jordan_rose added reviewers: beanz, jfb.
Herald added subscribers: llvm-commits, dexonsmith.
Herald added a project: LLVM.
jordan_rose marked an inline comment as done.
jordan_rose added inline comments.
jordan_rose marked an inline comment as not done.
================
Comment at: tools/llvm-config/llvm-config.cpp:330
+ ActiveCMakeDir =
+ ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX + "/cmake/llvm";
break;
----------------
I'm not actually sure if `LLVM_LIBDIR_SUFFIX` is used here either, but it's not //more// wrong than it was before.
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.
Discovered when attempting to build libcxx with Xcode via Swift's build script, something that's probably not an interesting configuration to LLVM (or even so much to Swift). But it's good to be correct, right?
Repository:
rL LLVM
https://reviews.llvm.org/D66326
Files:
tools/llvm-config/llvm-config.cpp
Index: tools/llvm-config/llvm-config.cpp
===================================================================
--- tools/llvm-config/llvm-config.cpp
+++ tools/llvm-config/llvm-config.cpp
@@ -292,8 +292,8 @@
IsInDevelopmentTree = true;
DevelopmentTreeLayout = CMakeStyle;
ActiveObjRoot = LLVM_OBJ_ROOT;
- } else if (sys::fs::equivalent(CurrentExecPrefix,
- Twine(LLVM_OBJ_ROOT) + "/bin")) {
+ } else if (sys::fs::equivalent(sys::path::parent_path(CurrentExecPrefix),
+ LLVM_OBJ_ROOT)) {
IsInDevelopmentTree = true;
DevelopmentTreeLayout = CMakeBuildModeStyle;
ActiveObjRoot = LLVM_OBJ_ROOT;
@@ -320,11 +320,14 @@
ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
break;
case CMakeBuildModeStyle:
+ // FIXME: Should we consider the build-mode-specific path as the prefix?
ActivePrefix = ActiveObjRoot;
- ActiveBinDir = ActiveObjRoot + "/bin/" + build_mode;
+ ActiveBinDir = ActiveObjRoot + "/" + build_mode + "/bin";
ActiveLibDir =
- ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX + "/" + build_mode;
- ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
+ ActiveObjRoot + "/" + build_mode + "/lib" + LLVM_LIBDIR_SUFFIX;
+ // The CMake directory isn't separated by build mode.
+ ActiveCMakeDir =
+ ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX + "/cmake/llvm";
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66326.215515.patch
Type: text/x-patch
Size: 1452 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190816/60de735a/attachment.bin>
More information about the llvm-commits
mailing list