Enable building lld as a standalone project. This is motivated by the desire to package lld for inclusion in a linux distribution. This allows building lld against an existing paired llvm installation. Now that lld is usable on x86_64, it makes sense to revive this configuration to allow distributions to package it.
Diff Detail
- Repository
- rL LLVM
Event Timeline
I'm not very familiar with the build system. Can Clang be built as a standalone project?
I think the use of llvm-config would be outdated. (Clang's should be rewritten)
That said, I have no idea what would be better as modern CMake.
I implemented such a snippet to clang before Brad King started to advise us.
That said, I think this may be fed to trunk atm if this just works. Delegating to Chris.
Can you please update again with context? @Bigcheese/@beanz are probably in a good position to review this.
CMakeLists.txt | ||
---|---|---|
156 | Is there a reason for an additional conditional like this? find_program makes LLVM_CONFIG_PATH a cache variable, so I think this would be cleaner without the outer conditional. |
Mostly this patch LGTM, but I'd like to make a few minor tweaks to modernize it a bit. Comments below.
CMakeLists.txt | ||
---|---|---|
172 | I think this is the only variable from llvm-config that you need. The others can all be read from LLVMConfig.cmake. Even this one we could potentially get rid of if we made use of CMake's find_package mechanism. | |
173 | This is equivalent to LLVM_TOOLS_BINARY_DIR which is set in LLVMConfig.cmake. | |
174 | If you're building against a build tree, instead of an install, this is exposed as LLVM_BUILD_MAIN_SRC_DIR in LLVMConfig.cmake. If you're not building against a build tree, we actually don't know if you have a source dir, so there is no path. | |
175 | This is equivalent to LLVM_INCLUDE_DIRS which is set in LLVMConfig.cmake. | |
176 | This is equivalent to LLVM_LIBRARY_DIRS which is set in LLVMConfig.cmake. |
One minor nit below, and a question. Otherwise LGTM!
CMakeLists.txt | ||
---|---|---|
16 | Since you're only outputting one field now you should be able to just write the result directly into OBJ_ROOT. Then you can get rid of the string processing below. | |
44 | Do you need to define LLVM_LIBRARY_OUTPUT_INTDIR or LLVM_SHLIB_OUTPUT_INTDIR? |
Thanks for the review!
CMakeLists.txt | ||
---|---|---|
16 | Sure, Ill simplify it. I thought keeping it generic would be good. But, given that we want to modernise the usage here, it makes sense to simplify and then replace it across all the projects. | |
44 | It wouldnt hurt to define them, however, they are not currently used by the lld build afaik. |
SVN r289421.
Had to undo the simplification because the include dir needs to be added (as discussed offline with @beanz).
Since you're only outputting one field now you should be able to just write the result directly into OBJ_ROOT. Then you can get rid of the string processing below.