[llvm-commits] [llvm] r149010 - /llvm/trunk/tools/llvm-config/llvm-config.cpp
Peter Collingbourne
peter at pcc.me.uk
Wed Jan 25 17:31:38 PST 2012
Author: pcc
Date: Wed Jan 25 19:31:38 2012
New Revision: 149010
URL: http://llvm.org/viewvc/llvm-project?rev=149010&view=rev
Log:
llvm-config: Add support for CMake build trees in which the build
mode does not form part of the path.
Modified:
llvm/trunk/tools/llvm-config/llvm-config.cpp
Modified: llvm/trunk/tools/llvm-config/llvm-config.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-config/llvm-config.cpp?rev=149010&r1=149009&r2=149010&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-config/llvm-config.cpp (original)
+++ llvm/trunk/tools/llvm-config/llvm-config.cpp Wed Jan 25 19:31:38 2012
@@ -169,7 +169,8 @@
// and from an installed path. We try and auto-detect which case we are in so
// that we can report the correct information when run from a development
// tree.
- bool IsInDevelopmentTree, DevelopmentTreeLayoutIsCMakeStyle;
+ bool IsInDevelopmentTree;
+ enum { MakefileStyle, CMakeStyle, CMakeBuildModeStyle } DevelopmentTreeLayout;
llvm::SmallString<256> CurrentPath(GetExecutablePath(argv[0]).str());
std::string CurrentExecPrefix;
std::string ActiveObjRoot;
@@ -185,7 +186,7 @@
// symbolic links, but is good enough.
if (CurrentExecPrefix == std::string(LLVM_OBJ_ROOT) + "/" + LLVM_BUILDMODE) {
IsInDevelopmentTree = true;
- DevelopmentTreeLayoutIsCMakeStyle = false;
+ DevelopmentTreeLayout = MakefileStyle;
// If we are in a development tree, then check if we are in a BuildTools
// directory. This indicates we are built for the build triple, but we
@@ -195,9 +196,13 @@
} else {
ActiveObjRoot = LLVM_OBJ_ROOT;
}
+ } else if (CurrentExecPrefix == std::string(LLVM_OBJ_ROOT)) {
+ IsInDevelopmentTree = true;
+ DevelopmentTreeLayout = CMakeStyle;
+ ActiveObjRoot = LLVM_OBJ_ROOT;
} else if (CurrentExecPrefix == std::string(LLVM_OBJ_ROOT) + "/bin") {
IsInDevelopmentTree = true;
- DevelopmentTreeLayoutIsCMakeStyle = true;
+ DevelopmentTreeLayout = CMakeBuildModeStyle;
ActiveObjRoot = LLVM_OBJ_ROOT;
} else {
IsInDevelopmentTree = false;
@@ -213,12 +218,19 @@
// CMake organizes the products differently than a normal prefix style
// layout.
- if (DevelopmentTreeLayoutIsCMakeStyle) {
- ActiveBinDir = ActiveObjRoot + "/bin/" + LLVM_BUILDMODE;
- ActiveLibDir = ActiveObjRoot + "/lib/" + LLVM_BUILDMODE;
- } else {
+ switch (DevelopmentTreeLayout) {
+ case MakefileStyle:
ActiveBinDir = ActiveObjRoot + "/" + LLVM_BUILDMODE + "/bin";
ActiveLibDir = ActiveObjRoot + "/" + LLVM_BUILDMODE + "/lib";
+ break;
+ case CMakeStyle:
+ ActiveBinDir = ActiveObjRoot + "/bin";
+ ActiveLibDir = ActiveObjRoot + "/lib";
+ break;
+ case CMakeBuildModeStyle:
+ ActiveBinDir = ActiveObjRoot + "/bin/" + LLVM_BUILDMODE;
+ ActiveLibDir = ActiveObjRoot + "/lib/" + LLVM_BUILDMODE;
+ break;
}
// We need to include files from both the source and object trees.
More information about the llvm-commits
mailing list