Title: [165263] trunk/Tools
Revision
165263
Author
[email protected]
Date
2014-03-07 09:00:03 -0800 (Fri, 07 Mar 2014)

Log Message

[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.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (165262 => 165263)


--- trunk/Tools/ChangeLog	2014-03-07 16:49:07 UTC (rev 165262)
+++ trunk/Tools/ChangeLog	2014-03-07 17:00:03 UTC (rev 165263)
@@ -1,3 +1,16 @@
+2014-03-06  Martin Robinson  <[email protected]>
+
+        [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.
+
 2014-03-06  Filip Pizlo  <[email protected]>
 
         If the FTL is build-time enabled then it should be run-time enabled.

Modified: trunk/Tools/Scripts/webkitdirs.pm (165262 => 165263)


--- trunk/Tools/Scripts/webkitdirs.pm	2014-03-07 16:49:07 UTC (rev 165262)
+++ trunk/Tools/Scripts/webkitdirs.pm	2014-03-07 17:00:03 UTC (rev 165263)
@@ -1969,6 +1969,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) = @_;
@@ -1979,7 +1995,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;
     }
 
@@ -1992,6 +2009,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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to