[cfe-commits] r132743 - in /cfe/trunk: CMakeLists.txt include/clang/Config/config.h.cmake lib/Driver/ToolChains.cpp

Chandler Carruth chandlerc at gmail.com
Wed Jun 8 03:28:28 PDT 2011


In case anyone was confused, this was an unintended commit... reverted in
r132745....

On Wed, Jun 8, 2011 at 3:13 AM, Chandler Carruth <chandlerc at gmail.com>wrote:

> Author: chandlerc
> Date: Wed Jun  8 05:13:14 2011
> New Revision: 132743
>
> URL: http://llvm.org/viewvc/llvm-project?rev=132743&view=rev
> Log:
> hack in my new variables for GCC
>
> Modified:
>    cfe/trunk/CMakeLists.txt
>    cfe/trunk/include/clang/Config/config.h.cmake
>    cfe/trunk/lib/Driver/ToolChains.cpp
>
> Modified: cfe/trunk/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=132743&r1=132742&r2=132743&view=diff
>
> ==============================================================================
> --- cfe/trunk/CMakeLists.txt (original)
> +++ cfe/trunk/CMakeLists.txt Wed Jun  8 05:13:14 2011
> @@ -54,6 +54,18 @@
>  set(CLANG_RESOURCE_DIR "" CACHE STRING
>   "Relative directory from the Clang binary to its resource files.")
>
> +set(CLANG_GCC_INSTALL_ROOT "" CACHE STRING
> +  "The GCC install root to use for headers and libraries.")
> +
> +set(CLANG_GCC_LIB_DIR "/lib/gcc" CACHE STRING
> +  "The directory relative to the install root for GCC libraries.")
> +
> +set(CLANG_GCC_ARCH "" CACHE STRING
> +  "The architecture string of the GCC installation.")
> +
> +set(CLANG_GCC_VERSION "" CACHE STRING
> +  "The version of the GCC installation.")
> +
>  set(C_INCLUDE_DIRS "" CACHE STRING
>   "Colon separated list of directories clang will search for headers.")
>
>
> Modified: cfe/trunk/include/clang/Config/config.h.cmake
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Config/config.h.cmake?rev=132743&r1=132742&r2=132743&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Config/config.h.cmake (original)
> +++ cfe/trunk/include/clang/Config/config.h.cmake Wed Jun  8 05:13:14 2011
> @@ -1,6 +1,18 @@
>  /* Relative directory for resource files */
>  #define CLANG_RESOURCE_DIR "${CLANG_RESOURCE_DIR}"
>
> +/* GCC install root */
> +#define CLANG_GCC_INSTALL_ROOT "${CLANG_GCC_INSTALL_ROOT}"
> +
> +/* GCC library directory, relative to the installation root */
> +#define CLANG_GCC_LIB_DIR "${CLANG_GCC_LIB_DIR}"
> +
> +/* GCC architecture */
> +#define CLANG_GCC_ARCH "${CLANG_GCC_ARCH}"
> +
> +/* GCC version */
> +#define CLANG_GCC_VERSION "${CLANG_GCC_VERSION}"
> +
>  /* 32 bit multilib directory. */
>  #define CXX_INCLUDE_32BIT_DIR "${CXX_INCLUDE_32BIT_DIR}"
>
>
> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=132743&r1=132742&r2=132743&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains.cpp Wed Jun  8 05:13:14 2011
> @@ -1334,31 +1334,27 @@
>  }
>
>  static std::string findGCCBaseLibDir(const std::string &GccTriple) {
> -  // FIXME: Using CXX_INCLUDE_ROOT is here is a bit of a hack, but
> -  // avoids adding yet another option to configure/cmake.
> -  // It would probably be cleaner to break it in two variables
> -  // CXX_GCC_ROOT with just /foo/bar
> -  // CXX_GCC_VER with 4.5.2
> -  // Then we would have
> -  // CXX_INCLUDE_ROOT = CXX_GCC_ROOT/include/c++/CXX_GCC_VER
> -  // and this function would return
> -  // CXX_GCC_ROOT/lib/gcc/CXX_INCLUDE_ARCH/CXX_GCC_VER
> -  llvm::SmallString<128> CxxIncludeRoot(CXX_INCLUDE_ROOT);
> -  if (CxxIncludeRoot != "") {
> -    // This is of the form /foo/bar/include/c++/4.5.2/
> -    if (CxxIncludeRoot.back() == '/')
> -      llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the /
> -    llvm::StringRef Version = llvm::sys::path::filename(CxxIncludeRoot);
> -    llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the
> version
> -    llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the c++
> -    llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the
> include
> -    std::string ret(CxxIncludeRoot.c_str());
> -    ret.append("/lib/gcc/");
> -    ret.append(CXX_INCLUDE_ARCH);
> -    ret.append("/");
> -    ret.append(Version);
> -    return ret;
> +  // Check for an explicit configure-time version of GCC.
> +  llvm::SmallString<32> GCCVersion(CLANG_GCC_VERSION);
> +  if (GCCVersion != "") {
> +    // Read the other variables if we have a specific GCC version
> requested at
> +    // configuration time. We provide defaults for them if missing though.
> +    llvm::SmallString<128> InstallRoot(CLANG_GCC_INSTALL_ROOT);
> +    if (InstallRoot == "") InstallRoot = "/usr";
> +    llvm::SmallString<32> GCCLibDir(CLANG_GCC_LIB_DIR);
> +    if (GCCLibDir == "") GCCLibDir = "/lib/gcc";
> +    llvm::SmallString<32> GCCArch(CLANG_GCC_ARCH);
> +    if (GCCArch == "") GCCArch = GccTriple;
> +
> +    InstallRoot += GCCLibDir;
> +    InstallRoot += "/";
> +    InstallRoot += GCCArch;
> +    InstallRoot += "/";
> +    InstallRoot += GCCVersion;
> +    return InstallRoot.str();
>   }
> +
> +  // Otherwise, attempt to detect a system GCC installation.
>   static const char* GccVersions[] = {"4.6.0", "4.6",
>                                       "4.5.2", "4.5.1", "4.5",
>                                       "4.4.5", "4.4.4", "4.4.3", "4.4",
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110608/4f94bafe/attachment.html>


More information about the cfe-commits mailing list