aboutsummaryrefslogtreecommitdiffhomepage
path: root/gn
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2018-06-25 15:35:28 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-26 20:33:29 +0000
commit4f0a011bd6b86c89a2082bc4d569e14ad5d93091 (patch)
tree995c0b88e856c59893bcc2562e403e455f8cfd54 /gn
parent3645bb069d893e8a8be9955485f2b34a19c72994 (diff)
Improve CMakeLists.txt auto regeneration.
Check that the re-generation could actually run ninja. Specify the gn_deps by absolute path names. Depend on the gn_to_cmake.py generator. Change-Id: I5f93031d35f0b239b899fe1716fb1f6a4c67f77e Reviewed-on: https://skia-review.googlesource.com/137397 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'gn')
-rw-r--r--gn/gn_to_cmake.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/gn/gn_to_cmake.py b/gn/gn_to_cmake.py
index eca4c07584..7f2f3642e2 100644
--- a/gn/gn_to_cmake.py
+++ b/gn/gn_to_cmake.py
@@ -637,9 +637,15 @@ def WriteProject(project):
# If a build file has changed, this will update CMakeLists.ext if
# gn gen out/config --ide=json --json-ide-script=../../gn/gn_to_cmake.py
# style was used to create this config.
- out.write('execute_process(COMMAND ninja -C "')
+ out.write('execute_process(COMMAND\n')
+ out.write(' ninja -C "')
out.write(CMakeStringEscape(project.build_path))
- out.write('" build.ninja)\n')
+ out.write('" build.ninja\n')
+ out.write(' RESULT_VARIABLE ninja_result)\n')
+ out.write('if (ninja_result)\n')
+ out.write(' message(WARNING ')
+ out.write('"Regeneration failed running ninja: ${ninja_result}")\n')
+ out.write('endif()\n')
out.write('include("')
out.write(CMakeStringEscape(extName))
@@ -673,9 +679,18 @@ def WriteProject(project):
# but gn doesn't escape spaces here (it generates invalid .d files).
out.write('string(REPLACE " " ";" "gn_deps" ${gn_deps_string})\n')
out.write('foreach("gn_dep" ${gn_deps})\n')
- out.write(' configure_file(${gn_dep} "CMakeLists.devnull" COPYONLY)\n')
+ out.write(' configure_file("')
+ out.write(CMakeStringEscape(project.build_path))
+ out.write('${gn_dep}" "CMakeLists.devnull" COPYONLY)\n')
out.write('endforeach("gn_dep")\n')
+ out.write('list(APPEND other_deps "')
+ out.write(CMakeStringEscape(os.path.abspath(__file__)))
+ out.write('")\n')
+ out.write('foreach("other_dep" ${other_deps})\n')
+ out.write(' configure_file("${other_dep}" "CMakeLists.devnull" COPYONLY)\n')
+ out.write('endforeach("other_dep")\n')
+
for target_name in project.targets.keys():
out.write('\n')
WriteTarget(out, Target(target_name, project), project)