[PATCH] D72117: [cmake] Use source-groups in Polly

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 7 09:37:08 PST 2020


Meinersbur accepted this revision.
Meinersbur added a comment.

Please add another comment for if you need someone else to do the commit.



================
Comment at: polly/cmake/polly_macros.cmake:102
+
+  file(GLOB to_add ${pwd}/${glob_expr})
+  source_group(${prefix} FILES ${to_add})
----------------
ctetreau wrote:
> Meinersbur wrote:
> > Why not using `GLOB_RECURSE` such that `setup_polly_source_groups_helper` does not need to call itself?
> Suppose we have this directory structure:
> 
> ```
> root
> |-------outer
> |       |-------inner
> |-a.cpp |-c.cpp |-e.cpp
> |-b.cpp |-d.cpp |-f.cpp
> ```
> 
> file with GLOB_RECURSE would return a list similar to this:
> 
> 
> ```
> [ root\outer\inner\e.cpp, root\outer\inner\f.cpp, root\outer\c.cpp, root\outer\d.cpp, root\a.cpp, root\b.cpp ]
> ```
> 
> However, if we were to pass this list to source_group, we'd be in the same situation that we started in. What we need to do is to have three lists:
> 
> 
> ```
> [ root\outer\inner\e.cpp, root\outer\inner\f.cpp ]
> [ root\outer\c.cpp, root\outer\d.cpp ]
> [ root\a.cpp, root\b.cpp ]
> ```
> 
> We also need three calls to source_group. If ${prefix} = "src", we need:
> 
> 
> ```
> source_group("src\\outer\\inner" FILES root\outer\inner\e.cpp, root\outer\inner\f.cpp)
> source_group("src\\outer" FIELS root\outer\c.cpp, root\outer\d.cpp)
> source_group("src" FILES root\a.cpp, root\b.cpp)
> ```
> 
> Splitting the lists and computing the first argument to source group are the complicating factors. We could derive this information from the result of the recursive glob, that wouldn't be any simpler than just recursing and doing the non-recursive glob.
Thank you for the detailed explanation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72117/new/

https://reviews.llvm.org/D72117





More information about the llvm-commits mailing list