diff options
author | Kevin Lubick <kjlubick@google.com> | 2019-02-01 13:32:44 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2019-02-01 18:58:46 +0000 |
commit | 9a2bb09202fbf4169dac9e57acc4729e7dc7e03f (patch) | |
tree | 09741133560d3257e77188ac698aa85abdbec907 /gn | |
parent | 3ed198faf93ad040b4d5a55e3efdbf1b9b2a227c (diff) | |
download | skqp-9a2bb09202fbf4169dac9e57acc4729e7dc7e03f.tar.gz |
CMake: distinguish between file and dir copies by presence of '.' in src path
ANGLE's build requires a file copy. Nema's build requires a dir copy. CMake
uses a different command for each. gn does not distinguish which. We make
a guess that happens to work for these two use cases based on the whether
the base file name of the src contains a '.'
Change-Id: I3503fd9d632abda3f8f952d0eef964019d932bea
Reviewed-on: https://skia-review.googlesource.com/c/188626
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'gn')
-rw-r--r-- | gn/gn_to_cmake.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gn/gn_to_cmake.py b/gn/gn_to_cmake.py index 77680643a9..50b021c2cb 100644 --- a/gn/gn_to_cmake.py +++ b/gn/gn_to_cmake.py @@ -372,8 +372,15 @@ def WriteCopy(out, target, project, sources, synthetic_dependencies): out.write('\n') for src, dst in zip(inputs, outputs): - out.write(' COMMAND ${CMAKE_COMMAND} -E copy_directory "') - out.write(CMakeStringEscape(project.GetAbsolutePath(src))) + abs_src_path = CMakeStringEscape(project.GetAbsolutePath(src)) + # CMake distinguishes between copying files and copying directories but + # gn does not. We assume if the src has a period in its name then it is + # a file and otherwise a directory. + if "." in os.path.basename(abs_src_path): + out.write(' COMMAND ${CMAKE_COMMAND} -E copy "') + else: + out.write(' COMMAND ${CMAKE_COMMAND} -E copy_directory "') + out.write(abs_src_path) out.write('" "') out.write(CMakeStringEscape(dst)) out.write('"\n') |