README 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. The qmake build system
  2. ======================
  3. Basic structure
  4. ---------------
  5. The qmake build is split into three different file types:
  6. * .pro files: These files represent top level targets that can be
  7. built individually, or a collection of sub-targets used for
  8. organizing the project.
  9. * .pri files: These files are included from top level targets,
  10. and represent 'implementation details' of how the target is built.
  11. * .prf files: These files take care of generic build rules
  12. that applies to all targets, or specific 'features' that can
  13. be loaded on demand.
  14. The first two file types are spread throughout the source tree, while
  15. the .prf files are located in 'Tools/qmake/mkspecs/features' and will
  16. get loaded by qmake based on setting the QMAKEPATH environment variable.
  17. Root project file
  18. -----------------
  19. The root project file 'WebKit.pro' is handy both for loading WebKit
  20. in Qt Creator, and for building QtWebKit. Normally you will build
  21. using build-webkit, but you can also run qmake directly on the root
  22. project file. Just make sure to set QMAKEPATH first, so that the
  23. custom mkspecs are picked up.
  24. Feature files
  25. -------------
  26. Feature files (.prf files) are used in the following ways:
  27. 1. Every time qmake parses a project file, it will first load
  28. a special feature file called 'defaults_pre.prf', then parse
  29. the project file, and then load another special feature file
  30. called 'defaults_post.prf'. We use these special files to set
  31. default options that all project files use, expose a few handy
  32. functions, and to post-process the build config based on what
  33. the project file did.
  34. 2. Dependencies on other targets (libraries) are declared by
  35. using CONFIG+=othertarget. This will add the correct include
  36. paths and linker options to use the library.
  37. 3. Optional features can be enabled by passing CONFIG+=foo on
  38. the command line when running qmake on the root project file,
  39. (or by passing --make-args="CONFIG+=foo" to build-webkit). For
  40. example 'CONFIG+=valgrind'.
  41. Derived sources
  42. ---------------
  43. Some targets (JavaScriptCore, WebCore, etc) rely on generated files,
  44. (aka. derived sources). These must be generated before the real target
  45. is built. This is achieved by splitting the target up into two sub-
  46. projects, one for the derived sources and one for the real target,
  47. and telling qmake to build them in order using CONFIG += ordered.
  48. The WEBKIT variable
  49. -------------------
  50. The custom qmake variable 'WEBKIT' is used for signaling that a
  51. target depends in some way on other subproject of the WebKit
  52. project. For now this is limited to the set of intermediate
  53. libraries: wtf, javascriptcore, webcore, and webkit2.
  54. Adding a dependency results in additional include paths being
  55. available, and potentially linking to the library. This is
  56. decided by the build system based on conditions such as what
  57. kind of target is being built and the general build config.