Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 6e53164

Browse files
committed
[cmake] Teach the llvm-config program to respect LLVM_LIBDIR_SUFFIX.
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
1 parent 8f94441 commit 6e53164

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

tools/llvm-config/BuildVariables.inc.in

+1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
#define LLVM_LDFLAGS "@LLVM_LDFLAGS@"
2424
#define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
2525
#define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
26+
#define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
2627
#define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
2728
#define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"

tools/llvm-config/Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir
5959
>> temp.sed
6060
$(Verb) $(ECHO) 's/@LLVM_BUILDMODE@/$(subst /,\/,$(BuildMode))/' \
6161
>> temp.sed
62+
$(Verb) $(ECHO) 's/@LLVM_LIBDIR_SUFFIX@//' \
63+
>> temp.sed
6264
$(Verb) $(ECHO) 's/@LLVM_SYSTEM_LIBS@/$(subst /,\/,$(LLVM_SYSTEM_LIBS))/' \
6365
>> temp.sed
6466
$(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \

tools/llvm-config/llvm-config.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,18 @@ int main(int argc, char **argv) {
243243
case MakefileStyle:
244244
ActivePrefix = ActiveObjRoot;
245245
ActiveBinDir = ActiveObjRoot + "/" + build_mode + "/bin";
246-
ActiveLibDir = ActiveObjRoot + "/" + build_mode + "/lib";
246+
ActiveLibDir =
247+
ActiveObjRoot + "/" + build_mode + "/lib" + LLVM_LIBDIR_SUFFIX;
247248
break;
248249
case CMakeStyle:
249250
ActiveBinDir = ActiveObjRoot + "/bin";
250-
ActiveLibDir = ActiveObjRoot + "/lib";
251+
ActiveLibDir = ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX;
251252
break;
252253
case CMakeBuildModeStyle:
253254
ActivePrefix = ActiveObjRoot;
254255
ActiveBinDir = ActiveObjRoot + "/bin/" + build_mode;
255-
ActiveLibDir = ActiveObjRoot + "/lib/" + build_mode;
256+
ActiveLibDir =
257+
ActiveObjRoot + "/lib" + LLVM_LIBDIR_SUFFIX + "/" + build_mode;
256258
break;
257259
}
258260

@@ -263,7 +265,7 @@ int main(int argc, char **argv) {
263265
ActivePrefix = CurrentExecPrefix;
264266
ActiveIncludeDir = ActivePrefix + "/include";
265267
ActiveBinDir = ActivePrefix + "/bin";
266-
ActiveLibDir = ActivePrefix + "/lib";
268+
ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
267269
ActiveIncludeOption = "-I" + ActiveIncludeDir;
268270
}
269271

0 commit comments

Comments
 (0)