This patch is some minor prep work for merging the flang(f18) project into the monorepo. This patch adds "flang" as a supported target for the LLVM_ENABLE_PROJECTS option.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
It helps if you use tags in the title of commits (and reviews), e.g., [Flang] .... Maybe we can make the commit message a bit more specific: "[Flang] Add Flang as subproject in cmake"
IIUC this is only needed after the flang merge, right? It will break things before the merge. The change is fine, after flang gets merged. IIUC this is not required as preparation for the merge, rather a follow up. Unless I am missing something, it would be good to clarify the title/commit message.
Hmm. Yes, it seems this isn't exactly the "prep" patch I wanted w.r.t llvm/CMakeLists.txt. We made the "all" change locally, but it does not appear to be required. Removed it.
We're not going to want f18 to be picked up by the buildbots, since it requires everything get built with C++ 17.
Ideally, this ought to go in around the same time that the flang sources get merged into the monorepo. It's not necessary until that time.
My current plan is to add this as the first commit on top of the flang merge and push that all together. That way although there will be commits that don't build in the history (which is unavoidable) there won't actually be a time at which this causes build issues. Does that sound reasonable?
This doesn't seem to be sufficient to build Flang for me. My process was as follows:
git clone https://github.com/llvm/llvm-project cd llvm-project arc patch D72416 git clone https://github.com/pmccormick/f18 flang # The f18 branch with LLVM cmake infrastructure changes mkdir build && cd build cmake -GNinja -DLLVM_ENABLE_PROJECTS="mlir;flang" ../llvm ninja
after which I get a correct build of llvm with no errors in the cmake step, but the flang binaries are not present.
My cursory reading of the cmake files suggests to me that we _do_ need flang in LLVM_ALL_PROJECTS, as it seems that LLVM_ENABLE_PROJECTS only affects things that are in LLVM_ALL_PROJECTS. If I add flang to LLVM_ALL_PROJECTS and run the above commands I get a correct in-tree build of flang.
The other option is to special case flang in the handling for LLVM_ENABLE_PRIOJECTS, but I think this is a less nice solution.
Hmm. Interesting. Thanks for testing it again. I can add it back to ALL. No problem. (Locally, I already have, which may explain why I don't see any problem.)
@hfinkel suggested we make an LLVM_EXTRA_PROJECTS and add that to the logic to search for projects. I have a patch to do that, I'll just link it here when I work out how to!
I agree with Hal. It makes sense to separate the "what's a valid project" logic from the "let's build everything" option.
https://reviews.llvm.org/differential/diff/249126/ this works for me
Although I just spotted I've left an OR ${proj} in there which shouldn't be there. If you ignore that then it works!