Title: [168719] releases/WebKitGTK/webkit-2.4/Tools/Scripts/webkitdirs.pm
Revision
168719
Author
g...@gnome.org
Date
2014-05-13 12:31:22 -0700 (Tue, 13 May 2014)

Log Message

Merge 165263 - [CMake] [GTK] Build with ninja when it is available
https://bugs.webkit.org/show_bug.cgi?id=129805

Reviewed by Philippe Normand.

* Scripts/webkitdirs.pm:
(canUseNinja): Added this helper which tries to execute Ninja, in an effort to determine
if it's available on the system.
(cmakeGeneratedBuildfile): Return the path to the generated build file. Only Unix support ATM.
(generateBuildSystemFromCMakeProject): For GTK+ compile with Ninja when possible.


Conflicts:
	Tools/ChangeLog

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.4/Tools/Scripts/webkitdirs.pm (168718 => 168719)


--- releases/WebKitGTK/webkit-2.4/Tools/Scripts/webkitdirs.pm	2014-05-13 19:31:12 UTC (rev 168718)
+++ releases/WebKitGTK/webkit-2.4/Tools/Scripts/webkitdirs.pm	2014-05-13 19:31:22 UTC (rev 168719)
@@ -1941,6 +1941,22 @@
     }
 }
 
+sub canUseNinja(@)
+{
+    system('ninja --version > /dev/null');
+    return $? == 0;
+}
+
+sub cmakeGeneratedBuildfile(@)
+{
+    my ($willUseNinja) = @_;
+    if ($willUseNinja) {
+        return File::Spec->catfile(baseProductDir(), configuration(), "build.ninja")
+    } else {
+        return File::Spec->catfile(baseProductDir(), configuration(), "Makefile")
+    }
+}
+
 sub generateBuildSystemFromCMakeProject
 {
     my ($port, $prefixPath, @cmakeArgs, $additionalCMakeArgs) = @_;
@@ -1951,7 +1967,8 @@
     chdir($buildPath) or die;
 
     # For GTK+ we try to be smart about when to rerun cmake, so that we can have faster incremental builds.
-    if (isGtk() && -e cmakeCachePath() && -e File::Spec->catfile(baseProductDir(), configuration(), "Makefile")) {
+    my $willUseNinja = isGtk() && canUseNinja();
+    if (isGtk() && -e cmakeCachePath() && -e cmakeGeneratedBuildfile($willUseNinja)) {
         return 0;
     }
 
@@ -1964,6 +1981,12 @@
     } elsif ($config =~ /debug/i) {
         push @args, "-DCMAKE_BUILD_TYPE=Debug";
     }
+
+    if ($willUseNinja) {
+        push @args, "-G";
+        push @args, "Ninja";
+    }
+
     # Don't warn variables which aren't used by cmake ports.
     push @args, "--no-warn-unused-cli";
     push @args, @cmakeArgs if @cmakeArgs;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to