2008-11-04 Cameron Zwarich <zwarich@apple.com>
[webkit/qt.git] / WebKit.pri
bloba8699062886b238374df90dc7e41bc371c8e6bfb
1 # Include file to make it easy to include WebKit into Qt projects
4 isEmpty(OUTPUT_DIR) {
5     CONFIG(release):OUTPUT_DIR=$$PWD/WebKitBuild/Release
6     CONFIG(debug):OUTPUT_DIR=$$PWD/WebKitBuild/Debug
9 DEFINES += BUILDING_QT__=1
10 building-libs {
11     win32-msvc*: INCLUDEPATH += $$PWD/JavaScriptCore/os-win32
12 } else {
13     QMAKE_LIBDIR = $$OUTPUT_DIR/lib $$QMAKE_LIBDIR
14     LIBS += -lQtWebKit
15     DEPENDPATH += $$PWD/WebKit/qt/Api
18 DEFINES += USE_SYSTEM_MALLOC
19 CONFIG(release) {
20     DEFINES += NDEBUG
23 BASE_DIR = $$PWD
24 INCLUDEPATH += $$PWD/WebKit/qt/Api
27 # For builds inside Qt we interpret the output rule and the input of each extra compiler manually
28 # and add the resulting sources to the SOURCES variable, because the build inside Qt contains already
29 # all the generated files. We do not need to generate any extra compiler rules in that case.
31 # In addition this function adds a new target called 'generated_files' that allows manually calling
32 # all the extra compilers to generate all the necessary files for the build using 'make generated_files'
34 defineTest(addExtraCompiler) {
35     CONFIG(QTDIR_build) {
36         outputRule = $$eval($${1}.output)
38         input = $$eval($${1}.input)
39         input = $$eval($$input)
41         for(file,input) {
42             base = $$basename(file)
43             base ~= s/\..+//
44             newfile=$$replace(outputRule,\\$\\{QMAKE_FILE_BASE\\},$$base)
45             SOURCES += $$newfile
46         }
48         export(SOURCES)
49     } else {
50         QMAKE_EXTRA_COMPILERS += $$1
51         generated_files.depends += compiler_$${1}_make_all
52         export(QMAKE_EXTRA_COMPILERS)
53         export(generated_files.depends)
54     }
55     return(true)
58 defineTest(addExtraCompilerWithHeader) {
59     addExtraCompiler($$1)
61     eval(headerFile = $${2})
62     isEmpty(headerFile) {
63         eval($${1}_header.output = $$eval($${1}.output))
64         eval($${1}_header.output ~= s/\.cpp/.h/)
65         eval($${1}_header.output ~= s/\.c/.h/)
66     } else {
67         eval($${1}_header.output = $$headerFile)
68     }
70     eval($${1}_header.input = $$eval($${1}.input))
71     eval($${1}_header.commands = @echo -n '')
72     eval($${1}_header.depends = compiler_$${1}_make_all)
73     eval($${1}_header.variable_out = GENERATED_FILES)
75     export($${1}_header.output)
76     export($${1}_header.input)
77     export($${1}_header.commands)
78     export($${1}_header.depends)
79     export($${1}_header.variable_out)
81     !CONFIG(QTDIR_build): QMAKE_EXTRA_COMPILERS += $${1}_header
83     export(QMAKE_EXTRA_COMPILERS)
84     export(generated_files.depends)
85     export(SOURCES)
87     return(true)