Skip to content

Commit

Permalink
[Qt] Generate convenience headers (QWebView, etc) using qmake
Browse files Browse the repository at this point in the history
Reviewed by Simon Hausmann.

In Qt this is done using syncqt, but we use a pro-file instead
that generates makefile-rules for each of the extra headers.

These extra headers are installed alongside the normal headers.

WebCore:

* WebCore.pro: Use headers.pri based on DerivedSources instead
of the one previously checked in in the source tree.

WebKit/qt:

* Api/DerivedSources.pro: Added. List of headers + pro file magic
* Api/headers.pri: Removed, list of headers is now in the above file

WebKitTools:

* Scripts/webkitdirs.pm: Run qmake and make on new API-DerivedSources

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54420 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
vestbo@webkit.org committed Feb 5, 2010
1 parent c2ae8e7 commit 8cb4b51
Show file tree
Hide file tree
Showing 9 changed files with 189 additions and 52 deletions.
13 changes: 13 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
2010-02-05 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>

Reviewed by Simon Hausmann.

[Qt] Generate convenience headers (QWebView, etc) using qmake

In Qt this is done using syncqt, but we use a pro-file instead
that generates makefile-rules for each of the extra headers.

These extra headers are installed alongside the normal headers.

* DerivedSources.pro: Include API-DerivedSources

2010-02-04 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>

Reviewed by Lars Knoll.
Expand Down
3 changes: 2 additions & 1 deletion DerivedSources.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ CONFIG += ordered

SUBDIRS += \
JavaScriptCore/DerivedSources.pro \
WebCore/DerivedSources.pro
WebCore/DerivedSources.pro \
WebKit/qt/Api/DerivedSources.pro

for(subpro, SUBDIRS) {
subdir = $${dirname(subpro)}
Expand Down
14 changes: 14 additions & 0 deletions WebCore/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
2010-02-05 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>

Reviewed by Simon Hausmann.

[Qt] Generate convenience headers (QWebView, etc) using qmake

In Qt this is done using syncqt, but we use a pro-file instead
that generates makefile-rules for each of the extra headers.

These extra headers are installed alongside the normal headers.

* WebCore.pro: Use headers.pri based on DerivedSources instead
of the one previously checked in in the source tree.

2010-02-05 Mikhail Naganov <mnaganov@chromium.org>

Reviewed by Pavel Feldman.
Expand Down
33 changes: 15 additions & 18 deletions WebCore/WebCore.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2662,24 +2662,24 @@ SOURCES += \
}
}

include($$PWD/../WebKit/qt/Api/headers.pri)
HEADERS += $$WEBKIT_API_HEADERS
CONFIG(standalone_package) {
include($$PWD/../include/headers.pri)
} else {
include($$OUTPUT_DIR/include/headers.pri)
}

!symbian {
target.path = $$[QT_INSTALL_LIBS]
INSTALLS += target
}

include($$PWD/../include/QtWebKit/headers.pri)
headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
headers.path = $$[QT_INSTALL_HEADERS]/QtWebKit
INSTALLS += headers
HEADERS += $$WEBKIT_API_HEADERS $$WEBKIT_CLASS_HEADERS

} else {
!symbian {
target.path = $$[QT_INSTALL_LIBS]
headers.files = $$WEBKIT_API_HEADERS
headers.path = $$[QT_INSTALL_HEADERS]/QtWebKit
INSTALLS += target
}

headers.files = $$WEBKIT_API_HEADERS $$WEBKIT_CLASS_HEADERS $$OUTPUT_DIR/include/headers.pri
headers.path = $$[QT_INSTALL_HEADERS]/QtWebKit
INSTALLS += headers

!CONFIG(standalone_package) {

VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}

Expand All @@ -2692,9 +2692,6 @@ CONFIG(standalone_package) {
INSTALLS += dlltarget
}


INSTALLS += target headers

unix {
CONFIG += create_pc create_prl
QMAKE_PKGCONFIG_LIBDIR = $$target.path
Expand All @@ -2718,7 +2715,7 @@ CONFIG(standalone_package) {

CONFIG += lib_bundle qt_no_framework_direct_includes qt_framework
FRAMEWORK_HEADERS.version = Versions
FRAMEWORK_HEADERS.files = $$WEBKIT_API_HEADERS
FRAMEWORK_HEADERS.files = $${headers.files}
FRAMEWORK_HEADERS.path = Headers
QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS
}
Expand Down
105 changes: 105 additions & 0 deletions WebKit/qt/Api/DerivedSources.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
TEMPLATE = lib
TARGET = dummy

WEBKIT_API_HEADERS = $$PWD/qwebframe.h \
$$PWD/qgraphicswebview.h \
$$PWD/qwebkitglobal.h \
$$PWD/qwebpage.h \
$$PWD/qwebview.h \
$$PWD/qwebsettings.h \
$$PWD/qwebhistoryinterface.h \
$$PWD/qwebdatabase.h \
$$PWD/qwebsecurityorigin.h \
$$PWD/qwebelement.h \
$$PWD/qwebpluginfactory.h \
$$PWD/qwebhistory.h \
$$PWD/qwebinspector.h \
$$PWD/qwebkitversion.h

WEBKIT_PRIVATE_HEADERS = $$PWD/qwebdatabase_p.h \
$$PWD/qwebframe_p.h \
$$PWD/qwebhistory_p.h \
$$PWD/qwebinspector_p.h \
$$PWD/qwebpage_p.h \
$$PWD/qwebplugindatabase_p.h \
$$PWD/qwebsecurityorigin_p.h


CONFIG -= debug_and_release

DESTDIR = ../../../include

qtheader_module.target = $${DESTDIR}/QtWebKit
qtheader_module.depends = $${_PRO_FILE_}
eval(qtheader_module.commands = echo \\\'\$${LITERAL_HASH}ifndef QT_QTWEBKIT_MODULE_H\\\' > $${qtheader_module.target};)
eval(qtheader_module.commands += echo \\\'\$${LITERAL_HASH}define QT_QTWEBKIT_MODULE_H\\\' >> $${qtheader_module.target};)
eval(qtheader_module.commands += echo \\\'\$${LITERAL_HASH}include <QtNetwork/QtNetwork>\\\' >> $${qtheader_module.target};)
WEBKIT_CLASS_HEADERS = ../include/QtWebKit

regex = ".*\sclass\sQWEBKIT_EXPORT\s(\w+)\s(.*)"

for(HEADER, WEBKIT_API_HEADERS) {
qtheader_module.depends += $$HEADER
eval(qtheader_module.commands += echo \\\'\$${LITERAL_HASH}include \\\"$$basename(HEADER)\\\"\\\' >> $${qtheader_module.target};)

HEADER_NAME = $$basename(HEADER)
HEADER_TARGET = $$replace(HEADER_NAME, [^a-zA-Z0-9_], -)
HEADER_TARGET = "qtheader-$${HEADER_TARGET}"

eval($${HEADER_TARGET}.target = $${DESTDIR}/$${HEADER_NAME})
eval($${HEADER_TARGET}.depends = $$HEADER)
eval($${HEADER_TARGET}.commands = echo \\\'\$${LITERAL_HASH}include \\\"$$HEADER\\\"\\\' > $$eval($${HEADER_TARGET}.target))

QMAKE_EXTRA_TARGETS += $$HEADER_TARGET

src_words = $$cat($$HEADER)
# Really make sure we're dealing with words
src_words = $$split(src_words, " ")

src = $$join(src_words, $${LITERAL_WHITESPACE})
for(ever) {
# Looking up by line is faster, so we try that first
res = $$find(src_words, "QWEBKIT_EXPORT")
isEmpty(res):break()

# Then do a slow lookup to ensure we're dealing with an exported class
res = $$find(src, $$regex)
isEmpty(res):break()

exp = $$replace(src, $$regex, "EXPORTED_CLASS = \1")
eval($$exp)

CLASS_TARGET = "qtheader_$${EXPORTED_CLASS}"

eval($${CLASS_TARGET}.target = $${DESTDIR}/$${EXPORTED_CLASS})
eval($${CLASS_TARGET}.depends = $$eval($${HEADER_TARGET}.target))
eval($${CLASS_TARGET}.commands = echo \\\'\$${LITERAL_HASH}include \\\"$$basename(HEADER)\\\"\\\' > $$eval($${CLASS_TARGET}.target))

QMAKE_EXTRA_TARGETS += $$CLASS_TARGET
WEBKIT_CLASS_HEADERS += ../include/$${EXPORTED_CLASS}

generated_files.depends += $$eval($${CLASS_TARGET}.target)
qtheader_pri.depends += $$eval($${CLASS_TARGET}.target)

# Qt's QRegExp does not support inline non-greedy matching,
# so we'll have to work around it by updating the haystack
src = $$replace(src, $$regex, "\2")
src_words = $$join(src, $${LITERAL_WHITESPACE})
}
}

eval(qtheader_module.commands += echo \\\'\$${LITERAL_HASH}endif // QT_QTWEBKIT_MODULE_H\\\' >> $${qtheader_module.target})
QMAKE_EXTRA_TARGETS += qtheader_module

qtheader_pri.target = $${DESTDIR}/headers.pri
qtheader_pri.depends = $${WEBKIT_API_HEADERS} $${WEBKIT_PRIVATE_HEADERS} $${_PRO_FILE_}
eval(qtheader_pri.commands = echo \\\'WEBKIT_API_HEADERS = $${WEBKIT_API_HEADERS}\\\' > $${qtheader_pri.target};)
eval(qtheader_pri.commands += echo \\\'WEBKIT_CLASS_HEADERS = $${WEBKIT_CLASS_HEADERS}\\\' >> $${qtheader_pri.target};)
eval(qtheader_pri.commands += echo \\\'WEBKIT_PRIVATE_HEADERS = $${WEBKIT_PRIVATE_HEADERS}\\\' >> $${qtheader_pri.target};)
QMAKE_EXTRA_TARGETS += qtheader_pri

generated_files.depends += $${qtheader_module.target} $${qtheader_pri.target}
QMAKE_EXTRA_TARGETS += generated_files



14 changes: 0 additions & 14 deletions WebKit/qt/Api/headers.pri

This file was deleted.

14 changes: 14 additions & 0 deletions WebKit/qt/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
2010-02-05 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>

Reviewed by Simon Hausmann.

[Qt] Generate convenience headers (QWebView, etc) using qmake

In Qt this is done using syncqt, but we use a pro-file instead
that generates makefile-rules for each of the extra headers.

These extra headers are installed alongside the normal headers.

* Api/DerivedSources.pro: Added. List of headers + pro file magic
* Api/headers.pri: Removed, list of headers is now in the above file

2010-02-04 No'am Rosenthal <noam.rosenthal@nokia.com>

Reviewed by Ariya Hidayat.
Expand Down
13 changes: 13 additions & 0 deletions WebKitTools/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
2010-02-05 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>

Reviewed by Simon Hausmann.

[Qt] Generate convenience headers (QWebView, etc) using qmake

In Qt this is done using syncqt, but we use a pro-file instead
that generates makefile-rules for each of the extra headers.

These extra headers are installed alongside the normal headers.

* Scripts/webkitdirs.pm: Run qmake and make on new API-DerivedSources

2010-02-05 Andras Becsi <abecsi@webkit.org>

Unreviewed typo fix.
Expand Down
32 changes: 13 additions & 19 deletions WebKitTools/Scripts/webkitdirs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1491,27 +1491,21 @@ sub buildQMakeProject($@)

my $dsMakefile = "Makefile.DerivedSources";

print "Calling '$make $makeargs -f $dsMakefile generated_files' in " . $dir . "/JavaScriptCore\n\n";
if ($make eq "nmake") {
$result = system "pushd JavaScriptCore && $make $makeargs -f $dsMakefile generated_files && popd";
} else {
$result = system "$make $makeargs -C JavaScriptCore -f $dsMakefile generated_files";
}
if ($result ne 0) {
die "Failed to generate JavaScriptCore's derived sources!\n";
}

print "Calling '$make $makeargs -f $dsMakefile generated_files' in " . $dir . "/WebCore\n\n";
if ($make eq "nmake") {
$result = system "pushd WebCore && $make $makeargs -f $dsMakefile generated_files && popd";
} else {
$result = system "$make $makeargs -C WebCore -f $dsMakefile generated_files";
}
if ($result ne 0) {
die "Failed to generate WebCore's derived sources!\n";
# Iterate over different source directories manually to workaround a problem with qmake+extraTargets+s60
for my $subdir ("JavaScriptCore", "WebCore", "WebKit/qt/Api") {
print "Calling '$make $makeargs -f $dsMakefile generated_files' in " . $dir . "/$subdir\n\n";
if ($make eq "nmake") {
my $subdirWindows = $subdir;
$subdirWindows =~ s:/:\\:g;
$result = system "pushd $subdirWindows && $make $makeargs -f $dsMakefile generated_files && popd";
} else {
$result = system "$make $makeargs -C $subdir -f $dsMakefile generated_files";
}
if ($result ne 0) {
die "Failed to generate ${subdir}'s derived sources!\n";
}
}


push @buildArgs, "OUTPUT_DIR=" . baseProductDir() . "/$config";
push @buildArgs, sourceDir() . "/WebKit.pro";
if ($config =~ m/debug/i) {
Expand Down

0 comments on commit 8cb4b51

Please sign in to comment.