[cmake] Teach the llvm-config program to respect LLVM_LIBDIR_SUFFIX.
authorChandler Carruth <chandlerc@gmail.com>
Mon, 29 Dec 2014 11:16:25 +0000 (11:16 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 29 Dec 2014 11:16:25 +0000 (11:16 +0000)
For this to work, we have to encode it in the build variables and use it
from llvm-config.cpp. I've tried to do this reasonably cleanly, but the
code for llvm-config.cpp is pretty strange. However, with this,
llvm-config stops giving the wrong answer when using LLVM_LIBDIR_SUFFIX.

Note that the configure+make build just sets this to an empty string as
that build system has zero support for multilib of any form. I'm not
planning to add support there either, but this should leave a path for
anyone that wanted to.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224921 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-config/BuildVariables.inc.in
tools/llvm-config/Makefile
tools/llvm-config/llvm-config.cpp

index 2ec019ba622f9687ed3a75c05eed1823489bca8b..3f51f491a7a4eb6b9beceaacc7193cae0c8eb05a 100644 (file)
@@ -23,5 +23,6 @@
 #define LLVM_LDFLAGS "@LLVM_LDFLAGS@"
 #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
 #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+#define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
 #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
 #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
index b78551e68a796af31ef6b6c15471a9468a290e77..1ff8b6f04063353f987adb8e01bd8777f2315282 100644 (file)
@@ -59,6 +59,8 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir
          >> temp.sed
        $(Verb) $(ECHO) 's/@LLVM_BUILDMODE@/$(subst /,\/,$(BuildMode))/' \
          >> temp.sed
+       $(Verb) $(ECHO) 's/@LLVM_LIBDIR_SUFFIX@//' \
+         >> temp.sed
        $(Verb) $(ECHO) 's/@LLVM_SYSTEM_LIBS@/$(subst /,\/,$(LLVM_SYSTEM_LIBS))/' \
          >> temp.sed
        $(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \
index ed1c8c3b2ae781d50600301437ff86412e1f4f88..224035ac497b720d301fc42e107f5c85a803560d 100644 (file)
@@ -243,16 +243,18 @@ int main(int argc, char **argv) {
     case MakefileStyle:
       ActivePrefix = ActiveObjRoot;
       ActiveBinDir = ActiveObjRoot + "/" + build_mode + "/bin";
-      ActiveLibDir = ActiveObjRoot + "/" + build_mode + "/lib";
+      ActiveLibDir =
+          ActiveObjRoot + "/" + build_mode + "/lib" + LLVM_LIBDIR_SUFFIX;
       break;
     case CMakeStyle:
       ActiveBinDir = ActiveObjRoot + "/bin";
-      ActiveLibDir = ActiveObjRoot + "/lib";
+      ActiveLibDir = ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX;
       break;
     case CMakeBuildModeStyle:
       ActivePrefix = ActiveObjRoot;
       ActiveBinDir = ActiveObjRoot + "/bin/" + build_mode;
-      ActiveLibDir = ActiveObjRoot + "/lib/" + build_mode;
+      ActiveLibDir =
+          ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX + "/" + build_mode;
       break;
     }
 
@@ -263,7 +265,7 @@ int main(int argc, char **argv) {
     ActivePrefix = CurrentExecPrefix;
     ActiveIncludeDir = ActivePrefix + "/include";
     ActiveBinDir = ActivePrefix + "/bin";
-    ActiveLibDir = ActivePrefix + "/lib";
+    ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
     ActiveIncludeOption = "-I" + ActiveIncludeDir;
   }