Merge branch 'org.openembedded.dev' of new.openembedded.org:openembedded into org...
[openembedded.git] / recipes / webkit / webkit-gtk / WebKit.pri
1 # Include file to make it easy to include WebKit into Qt projects
2
3
4 isEmpty(OUTPUT_DIR) {
5     CONFIG(debug, debug|release) {
6         OUTPUT_DIR=$$PWD/WebKitBuild/Debug
7     } else { # Release
8         OUTPUT_DIR=$$PWD/WebKitBuild/Release
9     }
10 }
11
12 DEFINES += BUILDING_QT__=1
13 building-libs {
14     win32-msvc*: INCLUDEPATH += $$PWD/JavaScriptCore/os-win32
15 } else {
16     CONFIG(QTDIR_build) {
17         QT += webkit
18     } else {
19         QMAKE_LIBDIR = $$OUTPUT_DIR/lib $$QMAKE_LIBDIR
20         mac:!static:contains(QT_CONFIG, qt_framework):!CONFIG(webkit_no_framework) {
21             LIBS += -framework QtWebKit
22             QMAKE_FRAMEWORKPATH = $$OUTPUT_DIR/lib $$QMAKE_FRAMEWORKPATH
23         } else {
24             win32-*|wince* {
25                 LIBS += -lQtWebKit$${QT_MAJOR_VERSION}
26             } else {
27                 LIBS += -lQtWebKit
28             }
29         }
30     }
31     DEPENDPATH += $$PWD/WebKit/qt/Api
32 }
33
34 DEFINES += USE_SYSTEM_MALLOC
35 CONFIG(release, debug|release) {
36     DEFINES += NDEBUG
37 }
38
39 BASE_DIR = $$PWD
40 INCLUDEPATH += $$PWD/WebKit/qt/Api
41
42 #
43 # For builds inside Qt we interpret the output rule and the input of each extra compiler manually
44 # and add the resulting sources to the SOURCES variable, because the build inside Qt contains already
45 # all the generated files. We do not need to generate any extra compiler rules in that case.
46 #
47 # In addition this function adds a new target called 'generated_files' that allows manually calling
48 # all the extra compilers to generate all the necessary files for the build using 'make generated_files'
49 #
50 defineTest(addExtraCompiler) {
51     CONFIG(QTDIR_build) {
52         outputRule = $$eval($${1}.output)
53         outVariable = $$eval($${1}.variable_out)
54         !isEqual(outVariable,GENERATED_SOURCES):return(true)
55
56         input = $$eval($${1}.input)
57         input = $$eval($$input)
58
59         for(file,input) {
60             base = $$basename(file)
61             base ~= s/\..+//
62             newfile=$$replace(outputRule,\\$\\{QMAKE_FILE_BASE\\},$$base)
63             SOURCES += $$newfile
64         }
65
66         export(SOURCES)
67     } else {
68         QMAKE_EXTRA_COMPILERS += $$1
69         generated_files.depends += compiler_$${1}_make_all
70         export(QMAKE_EXTRA_COMPILERS)
71         export(generated_files.depends)
72     }
73     return(true)
74 }
75
76 defineTest(addExtraCompilerWithHeader) {
77     addExtraCompiler($$1)
78
79     eval(headerFile = $${2})
80     isEmpty(headerFile) {
81         eval($${1}_header.output = $$eval($${1}.output))
82         eval($${1}_header.output ~= s/\.cpp/.h/)
83         eval($${1}_header.output ~= s/\.c/.h/)
84     } else {
85         eval($${1}_header.output = $$headerFile)
86     }
87
88     eval($${1}_header.input = $$eval($${1}.input))
89     eval($${1}_header.commands = @echo -n '')
90     eval($${1}_header.depends = compiler_$${1}_make_all)
91     eval($${1}_header.variable_out = GENERATED_FILES)
92
93     export($${1}_header.output)
94     export($${1}_header.input)
95     export($${1}_header.commands)
96     export($${1}_header.depends)
97     export($${1}_header.variable_out)
98
99     !CONFIG(QTDIR_build): QMAKE_EXTRA_COMPILERS += $${1}_header
100
101     export(QMAKE_EXTRA_COMPILERS)
102     export(generated_files.depends)
103     export(SOURCES)
104
105     return(true)
106 }
107