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

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 3 11:12:17 PST 2020


ctetreau marked an inline comment as done.
ctetreau added inline comments.


================
Comment at: polly/cmake/polly_macros.cmake:102
+
+  file(GLOB to_add ${pwd}/${glob_expr})
+  source_group(${prefix} FILES ${to_add})
----------------
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.


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