<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[206972] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/206972">206972</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-10-09 17:38:06 -0700 (Sun, 09 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[CMake] CMake does not support the dep files for implicit dependency
https://bugs.webkit.org/show_bug.cgi?id=161433

Patch by Fujii Hironori &lt;Hironori.Fujii@sony.com&gt; on 2016-10-09
Reviewed by Brent Fulgham.

Created a Perl script to generate all IDL bindings for CMake.
This script can regenerate outdated bindings by based on the
supplemental dependency and dep files created by
'--write-dependencies' switch of generate-bindings.pl.

add_custom_target is used to invoke the script instead of
add_custom_command because Ninja deletes all output files before
executing the command in case of add_custom_command.

USES_TERMINAL option of add_custom_target has two effects:
1) Not buffering output of the command
2) Invoking the command in the special Ninja pool which inhibits parallel build
One needs to use CMake 3.2 or later to enable this feature.

.:

* Source/cmake/WebKitMacros.cmake (GENERATE_BINDINGS): Included
ProcessorCount.  Added a new argument 'target'.  Use
add_custom_target instead of add_custom_command.  Invoke the new
script.

Source/WebCore:

* CMakeLists.txt: Specified target names for
GENERATE_BINDINGS. Added dependency for the targets.
* bindings/scripts/generate-bindings-all.pl: Added.

Tools:

* DumpRenderTree/CMakeLists.txt: Specified a target name for
GENERATE_BINDINGS. Added dependency for the target.
* WebKitTestRunner/CMakeLists.txt: Ditto.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkChangeLog">trunk/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourcecmakeWebKitMacroscmake">trunk/Source/cmake/WebKitMacros.cmake</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeCMakeListstxt">trunk/Tools/DumpRenderTree/CMakeLists.txt</a></li>
<li><a href="#trunkToolsWebKitTestRunnerCMakeListstxt">trunk/Tools/WebKitTestRunner/CMakeLists.txt</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorebindingsscriptsgeneratebindingsallpl">trunk/Source/WebCore/bindings/scripts/generate-bindings-all.pl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/ChangeLog (206971 => 206972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ChangeLog        2016-10-09 23:11:56 UTC (rev 206971)
+++ trunk/ChangeLog        2016-10-10 00:38:06 UTC (rev 206972)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2016-10-09  Fujii Hironori  &lt;Hironori.Fujii@sony.com&gt;
+
+        [CMake] CMake does not support the dep files for implicit dependency
+        https://bugs.webkit.org/show_bug.cgi?id=161433
+
+        Reviewed by Brent Fulgham.
+
+        Created a Perl script to generate all IDL bindings for CMake.
+        This script can regenerate outdated bindings by based on the
+        supplemental dependency and dep files created by
+        '--write-dependencies' switch of generate-bindings.pl.
+
+        add_custom_target is used to invoke the script instead of
+        add_custom_command because Ninja deletes all output files before
+        executing the command in case of add_custom_command.
+
+        USES_TERMINAL option of add_custom_target has two effects:
+        1) Not buffering output of the command
+        2) Invoking the command in the special Ninja pool which inhibits parallel build
+        One needs to use CMake 3.2 or later to enable this feature.
+
+        * Source/cmake/WebKitMacros.cmake (GENERATE_BINDINGS): Included
+        ProcessorCount.  Added a new argument 'target'.  Use
+        add_custom_target instead of add_custom_command.  Invoke the new
+        script.
+
</ins><span class="cx"> 2016-10-07  Fujii Hironori  &lt;Hironori.Fujii@sony.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use 'use lib $FindBin::Bin' to append Perl module include path
</span></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (206971 => 206972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-10-09 23:11:56 UTC (rev 206971)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-10-10 00:38:06 UTC (rev 206972)
</span><span class="lines">@@ -3630,7 +3630,7 @@
</span><span class="cx"> set(FEATURE_DEFINES_JAVASCRIPT &quot;LANGUAGE_JAVASCRIPT ${FEATURE_DEFINES_WITH_SPACE_SEPARATOR}&quot;)
</span><span class="cx"> list(APPEND WebCoreTestSupport_IDL_FILES ${DERIVED_SOURCES_WEBCORE_DIR}/InternalSettingsGenerated.idl)
</span><span class="cx"> 
</span><del>-GENERATE_BINDINGS(
</del><ins>+GENERATE_BINDINGS(WebCoreBindings
</ins><span class="cx">     OUTPUT_SOURCE WebCore_DERIVED_SOURCES
</span><span class="cx">     INPUT_FILES ${WebCore_IDL_FILES}
</span><span class="cx">     BASE_DIR ${WEBCORE_DIR}
</span><span class="lines">@@ -3646,7 +3646,7 @@
</span><span class="cx">         --workerGlobalScopeConstructorsFile ${WORKERGLOBALSCOPE_CONSTRUCTORS_FILE}
</span><span class="cx">         --dedicatedWorkerGlobalScopeConstructorsFile ${DEDICATEDWORKERGLOBALSCOPE_CONSTRUCTORS_FILE})
</span><span class="cx"> 
</span><del>-GENERATE_BINDINGS(
</del><ins>+GENERATE_BINDINGS(WebCoreTestSupportBindings
</ins><span class="cx">     OUTPUT_SOURCE WebCoreTestSupport_SOURCES
</span><span class="cx">     INPUT_FILES ${WebCoreTestSupport_IDL_FILES}
</span><span class="cx">     BASE_DIR ${WEBCORE_DIR}
</span><span class="lines">@@ -3655,6 +3655,9 @@
</span><span class="cx">     DESTINATION ${DERIVED_SOURCES_WEBCORE_DIR}
</span><span class="cx">     GENERATOR JS)
</span><span class="cx"> 
</span><ins>+# WebCoreTestSupportBindings needs InternalSettingsGenerated.idl
+add_dependencies(WebCoreTestSupportBindings WebCoreDerivedSources)
+
</ins><span class="cx"> # WebCore JS Builtins
</span><span class="cx"> 
</span><span class="cx"> set(WebCore_BUILTINS_SOURCES
</span><span class="lines">@@ -3800,7 +3803,7 @@
</span><span class="cx"> # files on OS X.
</span><span class="cx"> add_library(WebCoreDerivedSources STATIC ${WebCore_DERIVED_SOURCES})
</span><span class="cx"> set_target_properties(WebCoreDerivedSources PROPERTIES OUTPUT_NAME WebCoreDerivedSources${DEBUG_SUFFIX})
</span><del>-add_dependencies(WebCoreDerivedSources JavaScriptCore)
</del><ins>+add_dependencies(WebCoreDerivedSources JavaScriptCore WebCoreBindings)
</ins><span class="cx"> if (NOT WIN32)
</span><span class="cx">     list(APPEND WebCore_LIBRARIES WebCoreDerivedSources)
</span><span class="cx"> endif ()
</span><span class="lines">@@ -3831,7 +3834,7 @@
</span><span class="cx"> 
</span><span class="cx"> include_directories(${WebCoreTestSupport_INCLUDE_DIRECTORIES})
</span><span class="cx"> add_library(WebCoreTestSupport ${WebCoreTestSupport_LIBRARY_TYPE} ${WebCoreTestSupport_SOURCES})
</span><del>-add_dependencies(WebCoreTestSupport WebCore)
</del><ins>+add_dependencies(WebCoreTestSupport WebCore WebCoreTestSupportBindings)
</ins><span class="cx"> target_link_libraries(WebCoreTestSupport ${WebCoreTestSupport_LIBRARIES})
</span><span class="cx"> 
</span><span class="cx"> if (WebCoreTestSupport_OUTPUT_NAME)
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (206971 => 206972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-09 23:11:56 UTC (rev 206971)
+++ trunk/Source/WebCore/ChangeLog        2016-10-10 00:38:06 UTC (rev 206972)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2016-10-09  Fujii Hironori  &lt;Hironori.Fujii@sony.com&gt;
+
+        [CMake] CMake does not support the dep files for implicit dependency
+        https://bugs.webkit.org/show_bug.cgi?id=161433
+
+        Reviewed by Brent Fulgham.
+
+        Created a Perl script to generate all IDL bindings for CMake.
+        This script can regenerate outdated bindings by based on the
+        supplemental dependency and dep files created by
+        '--write-dependencies' switch of generate-bindings.pl.
+
+        add_custom_target is used to invoke the script instead of
+        add_custom_command because Ninja deletes all output files before
+        executing the command in case of add_custom_command.
+
+        USES_TERMINAL option of add_custom_target has two effects:
+        1) Not buffering output of the command
+        2) Invoking the command in the special Ninja pool which inhibits parallel build
+        One needs to use CMake 3.2 or later to enable this feature.
+
+        * CMakeLists.txt: Specified target names for
+        GENERATE_BINDINGS. Added dependency for the targets.
+        * bindings/scripts/generate-bindings-all.pl: Added.
+
</ins><span class="cx"> 2016-10-09  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event]
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsgeneratebindingsallpl"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/bindings/scripts/generate-bindings-all.pl (0 => 206972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/generate-bindings-all.pl                                (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/generate-bindings-all.pl        2016-10-10 00:38:06 UTC (rev 206972)
</span><span class="lines">@@ -0,0 +1,199 @@
</span><ins>+#!/usr/bin/perl -w
+#
+# Copyright (C) 2016 Sony Interactive Entertainment Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+use strict;
+use FindBin;
+use lib $FindBin::Bin;
+
+use File::Basename;
+use File::Spec;
+use File::Find;
+use Getopt::Long;
+use threads;
+use threads::shared;
+use Thread::Queue;
+
+my $perl = $^X;
+my $scriptDir = $FindBin::Bin;
+my @idlDirectories;
+my $outputDirectory;
+my $idlFilesList;
+my $generator;
+my @generatorDependency;
+my $defines;
+my $preprocessor;
+my $supplementalDependencyFile;
+my @ppExtraOutput;
+my @ppExtraArgs;
+my $numOfJobs = 1;
+my $idlAttributesFile;
+
+GetOptions('include=s@' =&gt; \@idlDirectories,
+           'outputDir=s' =&gt; \$outputDirectory,
+           'idlFilesList=s' =&gt; \$idlFilesList,
+           'generator=s' =&gt; \$generator,
+           'generatorDependency=s@' =&gt; \@generatorDependency,
+           'defines=s' =&gt; \$defines,
+           'preprocessor=s' =&gt; \$preprocessor,
+           'supplementalDependencyFile=s' =&gt; \$supplementalDependencyFile,
+           'ppExtraOutput=s@' =&gt; \@ppExtraOutput,
+           'ppExtraArgs=s@' =&gt; \@ppExtraArgs,
+           'idlAttributesFile=s' =&gt; \$idlAttributesFile,
+           'numOfJobs=i' =&gt; \$numOfJobs);
+
+my @idlFiles;
+open(my $fh, '&lt;', $idlFilesList) or die &quot;Cannot open $idlFilesList&quot;;
+@idlFiles = &lt;$fh&gt;;
+close($fh) or die;
+s/\r?\n?$// for @idlFiles;
+
+my %supplementedIdlFiles;
+if ($supplementalDependencyFile) {
+    my @output = ($supplementalDependencyFile, @ppExtraOutput);
+    my @deps = (@idlFiles, @generatorDependency);
+    if (needsUpdate(\@output, \@deps)) {
+        my @args = ('--defines', $defines,
+                    '--idlFilesList', $idlFilesList,
+                    '--supplementalDependencyFile', $supplementalDependencyFile,
+                    @ppExtraArgs);
+        print(&quot;Preprocess IDL\n&quot;);
+        system($perl, &quot;$scriptDir/preprocess-idls.pl&quot;, @args) == 0 or die;
+    }
+    open(my $fh, '&lt;', $supplementalDependencyFile) or die &quot;Cannot open $supplementalDependencyFile&quot;;
+    while (&lt;$fh&gt;) {
+        my ($idlFile, @followingIdlFiles) = split(/\s+/);
+        $supplementedIdlFiles{$idlFile} = \@followingIdlFiles;
+    }
+    close($fh) or die;
+}
+
+my @args = ('--defines', $defines,
+            '--generator', $generator,
+            '--outputDir', $outputDirectory,
+            '--preprocessor', quoteCommand($preprocessor),
+            '--idlAttributesFile', $idlAttributesFile,
+            '--write-dependencies');
+push @args, map { ('--include', $_) } @idlDirectories;
+push @args, '--supplementalDependencyFile', $supplementalDependencyFile if $supplementalDependencyFile;
+
+my %directoryCache;
+buildDirectoryCache();
+
+my $queue = Thread::Queue-&gt;new(@idlFiles);
+my $abort :shared = 0;
+
+my @threadPool = map { threads-&gt;create(\&amp;worker) } (1 .. $numOfJobs);
+$_-&gt;join for @threadPool;
+exit $abort;
+
+sub needsUpdate
+{
+    my ($objects, $depends) = @_;
+    my $oldestObject;
+    my $oldestObjectTime;
+    for (@$objects) {
+        return 1 if !-f;
+        my $m = mtime($_);
+        if (!defined $oldestObjectTime || $m &lt; $oldestObjectTime) {
+            $oldestObject = $_;
+            $oldestObjectTime = $m;
+        }
+    }
+    for (@$depends) {
+        die &quot;Missing required dependency: $_&quot; if !-f;
+        my $m = mtime($_);
+        if ($oldestObjectTime &lt; $m) {
+            # print &quot;$_ is newer than $oldestObject\n&quot;;
+            return 1;
+        }
+    }
+    return 0;
+}
+
+sub mtime
+{
+    my ($file) = @_;
+    return (stat $file)[9];
+}
+
+sub worker {
+    while (my $file = $queue-&gt;dequeue_nb()) {
+        last if $abort;
+        eval {
+            my ($filename, $dirs, $suffix) = fileparse($file, '.idl');
+            my $sourceFile = File::Spec-&gt;catfile($outputDirectory, &quot;JS$filename.cpp&quot;);
+            my $headerFile = File::Spec-&gt;catfile($outputDirectory, &quot;JS$filename.h&quot;);
+            my $depFile = File::Spec-&gt;catfile($outputDirectory, &quot;JS$filename.dep&quot;);
+            my @output = ($sourceFile, $headerFile);
+            my @deps = ($file,
+                        $idlAttributesFile,
+                        @generatorDependency,
+                        @{$supplementedIdlFiles{$file} or []},
+                        implicitDependencies($depFile));
+            if (needsUpdate(\@output, \@deps)) {
+                print &quot;$filename$suffix\n&quot;;
+                system($perl, &quot;$scriptDir/generate-bindings.pl&quot;, @args, $file) == 0 or die;
+            }
+        };
+        if ($@) {
+            $abort = 1;
+            die;
+        }
+    }
+}
+
+sub buildDirectoryCache
+{
+    my $wanted = sub {
+        $directoryCache{$_} = $File::Find::name;
+        $File::Find::prune = 1 unless ~/\./;
+    };
+    find($wanted, @idlDirectories);
+}
+
+sub implicitDependencies
+{
+    my ($depFile) = @_;
+    return () unless -f $depFile;
+    open(my $fh, '&lt;', $depFile) or die &quot;Cannot open $depFile&quot;;
+    my $firstLine = &lt;$fh&gt;;
+    close($fh) or die;
+    my (undef, $deps) = split(/ : /, $firstLine);
+    my @deps = split(/\s+/, $deps);
+    return map { $directoryCache{$_} or () } @deps;
+}
+
+sub quoteCommand
+{
+    use Config;
+    if ($Config::Config{osname} eq 'MSWin32') {
+        return map {
+            s/\\/\\\\/g;
+            s/\&quot;/\\\&quot;/g;
+            &quot;\&quot;$_\&quot;&quot;;
+        } @_;
+    }
+    return @_;
+}
</ins><span class="cx">Property changes on: trunk/Source/WebCore/bindings/scripts/generate-bindings-all.pl
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<ins>+*
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourcecmakeWebKitMacroscmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/cmake/WebKitMacros.cmake (206971 => 206972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/cmake/WebKitMacros.cmake        2016-10-09 23:11:56 UTC (rev 206971)
+++ trunk/Source/cmake/WebKitMacros.cmake        2016-10-10 00:38:06 UTC (rev 206972)
</span><span class="lines">@@ -1,4 +1,6 @@
</span><span class="cx"> include(CMakeParseArguments)
</span><ins>+include(ProcessorCount)
+ProcessorCount(PROCESSOR_COUNT)
</ins><span class="cx"> 
</span><span class="cx"> macro(WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS)
</span><span class="cx">     set(_file ${CMAKE_CURRENT_SOURCE_DIR}/Platform${PORT}.cmake)
</span><span class="lines">@@ -43,7 +45,8 @@
</span><span class="cx">     #FIXME: Add support for Xcode.
</span><span class="cx"> endmacro()
</span><span class="cx"> 
</span><del>-# Helper macro which wraps preprocess-idls.pl and generate-bindings.pl scripts.
</del><ins>+# Helper macro which wraps generate-bindings-all.pl script.
+#   target is a new target name to be added
</ins><span class="cx"> #   OUTPUT_SOURCE is a list name which will contain generated sources.(eg. WebCore_SOURCES)
</span><span class="cx"> #   INPUT_FILES are IDL files to generate.
</span><span class="cx"> #   BASE_DIR is base directory where script is called.
</span><span class="lines">@@ -54,15 +57,14 @@
</span><span class="cx"> #   SUPPLEMENTAL_DEPFILE is a value of --supplementalDependencyFile. (optional)
</span><span class="cx"> #   PP_EXTRA_OUTPUT is extra outputs of preprocess-idls.pl. (optional)
</span><span class="cx"> #   PP_EXTRA_ARGS is extra arguments for preprocess-idls.pl. (optional)
</span><del>-function(GENERATE_BINDINGS)
</del><ins>+function(GENERATE_BINDINGS target)
</ins><span class="cx">     set(options)
</span><span class="cx">     set(oneValueArgs OUTPUT_SOURCE BASE_DIR FEATURES DESTINATION GENERATOR SUPPLEMENTAL_DEPFILE)
</span><span class="cx">     set(multiValueArgs INPUT_FILES IDL_INCLUDES PP_EXTRA_OUTPUT PP_EXTRA_ARGS)
</span><span class="cx">     cmake_parse_arguments(arg &quot;${options}&quot; &quot;${oneValueArgs}&quot; &quot;${multiValueArgs}&quot; ${ARGN})
</span><del>-    set(binding_generator ${WEBCORE_DIR}/bindings/scripts/generate-bindings.pl)
</del><ins>+    set(binding_generator ${WEBCORE_DIR}/bindings/scripts/generate-bindings-all.pl)
</ins><span class="cx">     set(idl_attributes_file ${WEBCORE_DIR}/bindings/scripts/IDLAttributes.txt)
</span><del>-    set(id ${arg_OUTPUT_SOURCE})
-    set(idl_files_list ${CMAKE_CURRENT_BINARY_DIR}/idl_files_${id}.tmp)
</del><ins>+    set(idl_files_list ${CMAKE_CURRENT_BINARY_DIR}/idl_files_${target}.tmp)
</ins><span class="cx">     set(_supplemental_dependency)
</span><span class="cx"> 
</span><span class="cx">     set(content)
</span><span class="lines">@@ -74,34 +76,37 @@
</span><span class="cx">     endforeach ()
</span><span class="cx">     file(WRITE ${idl_files_list} ${content})
</span><span class="cx"> 
</span><ins>+    set(args
+        --defines ${arg_FEATURES}
+        --generator ${arg_GENERATOR}
+        --outputDir ${arg_DESTINATION}
+        --idlFilesList ${idl_files_list}
+        --preprocessor ${CODE_GENERATOR_PREPROCESSOR}
+        --idlAttributesFile ${idl_attributes_file})
</ins><span class="cx">     if (arg_SUPPLEMENTAL_DEPFILE)
</span><del>-        set(_supplemental_dependency --supplementalDependencyFile ${arg_SUPPLEMENTAL_DEPFILE})
-
-        add_custom_command(
-            OUTPUT ${arg_SUPPLEMENTAL_DEPFILE} ${arg_PP_EXTRA_OUTPUT}
-            DEPENDS ${WEBCORE_DIR}/bindings/scripts/preprocess-idls.pl ${arg_INPUT_FILES}
-            COMMAND ${PERL_EXECUTABLE} ${WEBCORE_DIR}/bindings/scripts/preprocess-idls.pl --defines ${arg_FEATURES} --idlFilesList ${idl_files_list} --supplementalDependencyFile ${arg_SUPPLEMENTAL_DEPFILE} ${arg_PP_EXTRA_ARGS}
-            VERBATIM)
</del><ins>+        list(APPEND args --supplementalDependencyFile ${arg_SUPPLEMENTAL_DEPFILE})
</ins><span class="cx">     endif ()
</span><del>-
-    set(idl_includes)
-    foreach (dir ${arg_IDL_INCLUDES})
-        if (IS_ABSOLUTE ${dir})
-            list(APPEND idl_includes --include=${dir})
</del><ins>+    if (PROCESSOR_COUNT)
+        list(APPEND args --numOfJobs ${PROCESSOR_COUNT})
+    endif ()
+    foreach (i IN LISTS arg_IDL_INCLUDES)
+        if (IS_ABSOLUTE ${i})
+            list(APPEND args --include ${i})
</ins><span class="cx">         else ()
</span><del>-            list(APPEND idl_includes --include=${CMAKE_CURRENT_SOURCE_DIR}/${dir})
</del><ins>+            list(APPEND args --include ${CMAKE_CURRENT_SOURCE_DIR}/${i})
</ins><span class="cx">         endif ()
</span><span class="cx">     endforeach ()
</span><ins>+    foreach (i IN LISTS arg_PP_EXTRA_OUTPUT)
+        list(APPEND args --ppExtraOutput ${i})
+    endforeach ()
+    foreach (i IN LISTS arg_PP_EXTRA_ARGS)
+        list(APPEND args --ppExtraArgs ${i})
+    endforeach ()
</ins><span class="cx"> 
</span><span class="cx">     set(common_generator_dependencies
</span><del>-        ${binding_generator}
-        ${WEBCORE_DIR}/bindings/scripts/CodeGenerator.pm
</del><ins>+        ${WEBCORE_DIR}/bindings/scripts/generate-bindings.pl
</ins><span class="cx">         ${SCRIPTS_BINDINGS}
</span><del>-        ${arg_SUPPLEMENTAL_DEPFILE}
-        ${idl_attributes_file}
</del><span class="cx">     )
</span><del>-    list(APPEND common_generator_dependencies ${arg_PP_EXTRA_OUTPUT})
-
</del><span class="cx">     if (EXISTS ${WEBCORE_DIR}/bindings/scripts/CodeGenerator${arg_GENERATOR}.pm)
</span><span class="cx">         list(APPEND common_generator_dependencies ${WEBCORE_DIR}/bindings/scripts/CodeGenerator${arg_GENERATOR}.pm)
</span><span class="cx">     endif ()
</span><span class="lines">@@ -108,21 +113,32 @@
</span><span class="cx">     if (EXISTS ${arg_BASE_DIR}/CodeGenerator${arg_GENERATOR}.pm)
</span><span class="cx">         list(APPEND common_generator_dependencies ${arg_BASE_DIR}/CodeGenerator${arg_GENERATOR}.pm)
</span><span class="cx">     endif ()
</span><ins>+    foreach (i IN LISTS common_generator_dependencies)
+        list(APPEND args --generatorDependency ${i})
+    endforeach ()
</ins><span class="cx"> 
</span><span class="cx">     set(gen_sources)
</span><ins>+    set(gen_headers)
</ins><span class="cx">     foreach (_file ${arg_INPUT_FILES})
</span><span class="cx">         get_filename_component(_name ${_file} NAME_WE)
</span><del>-
-        add_custom_command(
-            OUTPUT ${arg_DESTINATION}/JS${_name}.cpp ${arg_DESTINATION}/JS${_name}.h
-            MAIN_DEPENDENCY ${_file}
-            DEPENDS ${common_generator_dependencies}
-            COMMAND ${PERL_EXECUTABLE} ${binding_generator} --defines ${arg_FEATURES} --generator ${arg_GENERATOR} ${idl_includes} --outputDir ${arg_DESTINATION} --preprocessor ${CODE_GENERATOR_PREPROCESSOR} --idlAttributesFile ${idl_attributes_file} ${_supplemental_dependency} ${_file}
-            WORKING_DIRECTORY ${arg_BASE_DIR}
-            VERBATIM)
</del><span class="cx">         list(APPEND gen_sources ${arg_DESTINATION}/JS${_name}.cpp)
</span><ins>+        list(APPEND gen_headers ${arg_DESTINATION}/JS${_name}.h)
</ins><span class="cx">     endforeach ()
</span><span class="cx">     set(${arg_OUTPUT_SOURCE} ${${arg_OUTPUT_SOURCE}} ${gen_sources} PARENT_SCOPE)
</span><ins>+    set(act_args)
+    if (${CMAKE_VERSION} VERSION_LESS 3.2)
+        set_source_files_properties(${gen_sources} ${gen_headers} PROPERTIES GENERATED 1)
+    else ()
+        list(APPEND act_args
+            BYPRODUCTS ${gen_sources} ${gen_headers}
+            USES_TERMINAL
+        )
+    endif ()
+    add_custom_target(${target}
+        COMMAND ${PERL_EXECUTABLE} ${binding_generator} ${args}
+        WORKING_DIRECTORY ${arg_BASE_DIR}
+        COMMENT &quot;Generate bindings (${target})&quot;
+        VERBATIM ${act_args})
</ins><span class="cx"> endfunction()
</span><span class="cx"> 
</span><span class="cx"> macro(GENERATE_FONT_NAMES _infile)
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (206971 => 206972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-10-09 23:11:56 UTC (rev 206971)
+++ trunk/Tools/ChangeLog        2016-10-10 00:38:06 UTC (rev 206972)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2016-10-09  Fujii Hironori  &lt;Hironori.Fujii@sony.com&gt;
+
+        [CMake] CMake does not support the dep files for implicit dependency
+        https://bugs.webkit.org/show_bug.cgi?id=161433
+
+        Reviewed by Brent Fulgham.
+
+        Created a Perl script to generate all IDL bindings for CMake.
+        This script can regenerate outdated bindings by based on the
+        supplemental dependency and dep files created by
+        '--write-dependencies' switch of generate-bindings.pl.
+
+        add_custom_target is used to invoke the script instead of
+        add_custom_command because Ninja deletes all output files before
+        executing the command in case of add_custom_command.
+
+        USES_TERMINAL option of add_custom_target has two effects:
+        1) Not buffering output of the command
+        2) Invoking the command in the special Ninja pool which inhibits parallel build
+        One needs to use CMake 3.2 or later to enable this feature.
+
+        * DumpRenderTree/CMakeLists.txt: Specified a target name for
+        GENERATE_BINDINGS. Added dependency for the target.
+        * WebKitTestRunner/CMakeLists.txt: Ditto.
+
</ins><span class="cx"> 2016-10-09  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add support for canonicalizing contributors.json, and have check-webkit-style check the format.
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/CMakeLists.txt (206971 => 206972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/CMakeLists.txt        2016-10-09 23:11:56 UTC (rev 206971)
+++ trunk/Tools/DumpRenderTree/CMakeLists.txt        2016-10-10 00:38:06 UTC (rev 206972)
</span><span class="lines">@@ -120,7 +120,7 @@
</span><span class="cx">     &quot;${WEBKIT_TESTRUNNER_UISCRIPTCONTEXT_DIR}/Bindings/UIScriptController.idl&quot;
</span><span class="cx"> )
</span><span class="cx"> 
</span><del>-GENERATE_BINDINGS(
</del><ins>+GENERATE_BINDINGS(DumpRenderTreeBindings
</ins><span class="cx">     OUTPUT_SOURCE DumpRenderTree_SOURCES
</span><span class="cx">     INPUT_FILES ${DumpRenderTree_IDL_FILES}
</span><span class="cx">     BASE_DIR ${DUMP_RENDER_TREE_BINDINGS_DIR}
</span><span class="lines">@@ -135,6 +135,7 @@
</span><span class="cx"> 
</span><span class="cx"> add_executable(DumpRenderTree ${DumpRenderTree_SOURCES})
</span><span class="cx"> target_link_libraries(DumpRenderTree ${DumpRenderTree_LIBRARIES})
</span><ins>+add_dependencies(DumpRenderTree DumpRenderTreeBindings)
</ins><span class="cx"> 
</span><span class="cx"> if (ENABLE_NETSCAPE_PLUGIN_API)
</span><span class="cx">     add_library(TestNetscapePlugin SHARED ${TestNetscapePlugin_SOURCES})
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/CMakeLists.txt (206971 => 206972)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/CMakeLists.txt        2016-10-09 23:11:56 UTC (rev 206971)
+++ trunk/Tools/WebKitTestRunner/CMakeLists.txt        2016-10-10 00:38:06 UTC (rev 206972)
</span><span class="lines">@@ -97,7 +97,7 @@
</span><span class="cx">     &quot;${WEBKIT_TESTRUNNER_UISCRIPTCONTEXT_DIR}/Bindings/UIScriptController.idl&quot;
</span><span class="cx"> )
</span><span class="cx"> 
</span><del>-GENERATE_BINDINGS(
</del><ins>+GENERATE_BINDINGS(WebKitTestRunnerInjectedBundleBindings
</ins><span class="cx">     OUTPUT_SOURCE WebKitTestRunnerInjectedBundle_SOURCES
</span><span class="cx">     INPUT_FILES ${WebKitTestRunnerInjectedBundle_IDL_FILES}
</span><span class="cx">     BASE_DIR ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx">     DESTINATION ${DERIVED_SOURCES_DIR}/InjectedBundle
</span><span class="cx">     GENERATOR TestRunner)
</span><span class="cx"> 
</span><del>-GENERATE_BINDINGS(
</del><ins>+GENERATE_BINDINGS(WebKitTestRunnerBindings
</ins><span class="cx">     OUTPUT_SOURCE WebKitTestRunner_SOURCES
</span><span class="cx">     INPUT_FILES ${WebKitTestRunner_IDL_FILES}
</span><span class="cx">     BASE_DIR ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings
</span><span class="lines">@@ -122,9 +122,11 @@
</span><span class="cx"> 
</span><span class="cx"> add_library(TestRunnerInjectedBundle SHARED ${WebKitTestRunnerInjectedBundle_SOURCES})
</span><span class="cx"> target_link_libraries(TestRunnerInjectedBundle ${WebKitTestRunner_LIBRARIES})
</span><ins>+add_dependencies(TestRunnerInjectedBundle WebKitTestRunnerInjectedBundleBindings)
</ins><span class="cx"> 
</span><span class="cx"> add_executable(WebKitTestRunner ${WebKitTestRunner_SOURCES})
</span><span class="cx"> target_link_libraries(WebKitTestRunner ${WebKitTestRunner_LIBRARIES})
</span><ins>+add_dependencies(WebKitTestRunner WebKitTestRunnerBindings)
</ins><span class="cx"> 
</span><span class="cx"> if (NOT APPLE)
</span><span class="cx">     add_dependencies(WebKit2 ${ForwardingHeadersForWebKitTestRunner_NAME})
</span></span></pre>
</div>
</div>

</body>
</html>