mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-13 06:29:59 +00:00
[llvm-config] Add --cmakedir to obtain CMake module location
Add a --cmakedir option to llvm-config that returns the correct path to built/installed CMake modules (i.e. lib/cmake/llvm). This is mostly intended as a convenience option for stand-alone builds of other LLVM projects that frequently reconstruct LLVM_CMAKE_PATH after querying llvm-config. Differential Revision: https://reviews.llvm.org/D26894 llvm-svn: 291218
This commit is contained in:
parent
6a7892269d
commit
4ec5e892f8
@ -196,6 +196,7 @@ Options:\n\
|
|||||||
--bindir Directory containing LLVM executables.\n\
|
--bindir Directory containing LLVM executables.\n\
|
||||||
--includedir Directory containing LLVM headers.\n\
|
--includedir Directory containing LLVM headers.\n\
|
||||||
--libdir Directory containing LLVM libraries.\n\
|
--libdir Directory containing LLVM libraries.\n\
|
||||||
|
--cmakedir Directory containing LLVM cmake modules.\n\
|
||||||
--cppflags C preprocessor flags for files that include LLVM headers.\n\
|
--cppflags C preprocessor flags for files that include LLVM headers.\n\
|
||||||
--cflags C compiler flags for files that include LLVM headers.\n\
|
--cflags C compiler flags for files that include LLVM headers.\n\
|
||||||
--cxxflags C++ compiler flags for files that include LLVM headers.\n\
|
--cxxflags C++ compiler flags for files that include LLVM headers.\n\
|
||||||
@ -302,7 +303,8 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
// Compute various directory locations based on the derived location
|
// Compute various directory locations based on the derived location
|
||||||
// information.
|
// information.
|
||||||
std::string ActivePrefix, ActiveBinDir, ActiveIncludeDir, ActiveLibDir;
|
std::string ActivePrefix, ActiveBinDir, ActiveIncludeDir, ActiveLibDir,
|
||||||
|
ActiveCMakeDir;
|
||||||
std::string ActiveIncludeOption;
|
std::string ActiveIncludeOption;
|
||||||
if (IsInDevelopmentTree) {
|
if (IsInDevelopmentTree) {
|
||||||
ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include";
|
ActiveIncludeDir = std::string(LLVM_SRC_ROOT) + "/include";
|
||||||
@ -314,12 +316,14 @@ int main(int argc, char **argv) {
|
|||||||
case CMakeStyle:
|
case CMakeStyle:
|
||||||
ActiveBinDir = ActiveObjRoot + "/bin";
|
ActiveBinDir = ActiveObjRoot + "/bin";
|
||||||
ActiveLibDir = ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX;
|
ActiveLibDir = ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX;
|
||||||
|
ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
|
||||||
break;
|
break;
|
||||||
case CMakeBuildModeStyle:
|
case CMakeBuildModeStyle:
|
||||||
ActivePrefix = ActiveObjRoot;
|
ActivePrefix = ActiveObjRoot;
|
||||||
ActiveBinDir = ActiveObjRoot + "/bin/" + build_mode;
|
ActiveBinDir = ActiveObjRoot + "/bin/" + build_mode;
|
||||||
ActiveLibDir =
|
ActiveLibDir =
|
||||||
ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX + "/" + build_mode;
|
ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX + "/" + build_mode;
|
||||||
|
ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,6 +335,7 @@ int main(int argc, char **argv) {
|
|||||||
ActiveIncludeDir = ActivePrefix + "/include";
|
ActiveIncludeDir = ActivePrefix + "/include";
|
||||||
ActiveBinDir = ActivePrefix + "/bin";
|
ActiveBinDir = ActivePrefix + "/bin";
|
||||||
ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
|
ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
|
||||||
|
ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
|
||||||
ActiveIncludeOption = "-I" + ActiveIncludeDir;
|
ActiveIncludeOption = "-I" + ActiveIncludeDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,6 +362,7 @@ int main(int argc, char **argv) {
|
|||||||
std::replace(ActivePrefix.begin(), ActivePrefix.end(), '/', '\\');
|
std::replace(ActivePrefix.begin(), ActivePrefix.end(), '/', '\\');
|
||||||
std::replace(ActiveBinDir.begin(), ActiveBinDir.end(), '/', '\\');
|
std::replace(ActiveBinDir.begin(), ActiveBinDir.end(), '/', '\\');
|
||||||
std::replace(ActiveLibDir.begin(), ActiveLibDir.end(), '/', '\\');
|
std::replace(ActiveLibDir.begin(), ActiveLibDir.end(), '/', '\\');
|
||||||
|
std::replace(ActiveCMakeDir.begin(), ActiveCMakeDir.end(), '/', '\\');
|
||||||
std::replace(ActiveIncludeOption.begin(), ActiveIncludeOption.end(), '/',
|
std::replace(ActiveIncludeOption.begin(), ActiveIncludeOption.end(), '/',
|
||||||
'\\');
|
'\\');
|
||||||
}
|
}
|
||||||
@ -475,6 +481,8 @@ int main(int argc, char **argv) {
|
|||||||
OS << ActiveIncludeDir << '\n';
|
OS << ActiveIncludeDir << '\n';
|
||||||
} else if (Arg == "--libdir") {
|
} else if (Arg == "--libdir") {
|
||||||
OS << ActiveLibDir << '\n';
|
OS << ActiveLibDir << '\n';
|
||||||
|
} else if (Arg == "--cmakedir") {
|
||||||
|
OS << ActiveCMakeDir << '\n';
|
||||||
} else if (Arg == "--cppflags") {
|
} else if (Arg == "--cppflags") {
|
||||||
OS << ActiveIncludeOption << ' ' << LLVM_CPPFLAGS << '\n';
|
OS << ActiveIncludeOption << ' ' << LLVM_CPPFLAGS << '\n';
|
||||||
} else if (Arg == "--cflags") {
|
} else if (Arg == "--cflags") {
|
||||||
|
Loading…
Reference in New Issue
Block a user