mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-21 19:20:50 +00:00
llvm-config: Add support for CMake build trees in which the build
mode does not form part of the path. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149010 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
230cdab220
commit
b56900aa86
@ -169,7 +169,8 @@ int main(int argc, char **argv) {
|
|||||||
// and from an installed path. We try and auto-detect which case we are in so
|
// 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
|
// that we can report the correct information when run from a development
|
||||||
// tree.
|
// tree.
|
||||||
bool IsInDevelopmentTree, DevelopmentTreeLayoutIsCMakeStyle;
|
bool IsInDevelopmentTree;
|
||||||
|
enum { MakefileStyle, CMakeStyle, CMakeBuildModeStyle } DevelopmentTreeLayout;
|
||||||
llvm::SmallString<256> CurrentPath(GetExecutablePath(argv[0]).str());
|
llvm::SmallString<256> CurrentPath(GetExecutablePath(argv[0]).str());
|
||||||
std::string CurrentExecPrefix;
|
std::string CurrentExecPrefix;
|
||||||
std::string ActiveObjRoot;
|
std::string ActiveObjRoot;
|
||||||
@ -185,7 +186,7 @@ int main(int argc, char **argv) {
|
|||||||
// symbolic links, but is good enough.
|
// symbolic links, but is good enough.
|
||||||
if (CurrentExecPrefix == std::string(LLVM_OBJ_ROOT) + "/" + LLVM_BUILDMODE) {
|
if (CurrentExecPrefix == std::string(LLVM_OBJ_ROOT) + "/" + LLVM_BUILDMODE) {
|
||||||
IsInDevelopmentTree = true;
|
IsInDevelopmentTree = true;
|
||||||
DevelopmentTreeLayoutIsCMakeStyle = false;
|
DevelopmentTreeLayout = MakefileStyle;
|
||||||
|
|
||||||
// If we are in a development tree, then check if we are in a BuildTools
|
// 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
|
// directory. This indicates we are built for the build triple, but we
|
||||||
@ -195,9 +196,13 @@ int main(int argc, char **argv) {
|
|||||||
} else {
|
} else {
|
||||||
ActiveObjRoot = LLVM_OBJ_ROOT;
|
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") {
|
} else if (CurrentExecPrefix == std::string(LLVM_OBJ_ROOT) + "/bin") {
|
||||||
IsInDevelopmentTree = true;
|
IsInDevelopmentTree = true;
|
||||||
DevelopmentTreeLayoutIsCMakeStyle = true;
|
DevelopmentTreeLayout = CMakeBuildModeStyle;
|
||||||
ActiveObjRoot = LLVM_OBJ_ROOT;
|
ActiveObjRoot = LLVM_OBJ_ROOT;
|
||||||
} else {
|
} else {
|
||||||
IsInDevelopmentTree = false;
|
IsInDevelopmentTree = false;
|
||||||
@ -213,12 +218,19 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
// CMake organizes the products differently than a normal prefix style
|
// CMake organizes the products differently than a normal prefix style
|
||||||
// layout.
|
// layout.
|
||||||
if (DevelopmentTreeLayoutIsCMakeStyle) {
|
switch (DevelopmentTreeLayout) {
|
||||||
ActiveBinDir = ActiveObjRoot + "/bin/" + LLVM_BUILDMODE;
|
case MakefileStyle:
|
||||||
ActiveLibDir = ActiveObjRoot + "/lib/" + LLVM_BUILDMODE;
|
|
||||||
} else {
|
|
||||||
ActiveBinDir = ActiveObjRoot + "/" + LLVM_BUILDMODE + "/bin";
|
ActiveBinDir = ActiveObjRoot + "/" + LLVM_BUILDMODE + "/bin";
|
||||||
ActiveLibDir = ActiveObjRoot + "/" + LLVM_BUILDMODE + "/lib";
|
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.
|
// We need to include files from both the source and object trees.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user