CMake Port

From Qt Wiki
Revision as of 09:17, 12 February 2019 by Kkoehne (talk | contribs)
Jump to navigation Jump to search

This is an overview on the port of Qt from qmake to CMake.

Quick Links

Overview

The current port of qtbase can be found in the wip/cmake branch of qt/qtbase.git. See also cmake/README.md in the sources.

This port was announced and discussed on the qt-development mailing list: "Build system for Qt 6" thread on development@qt-project.org

Sub-pages

Non-technical issues

Open Questions

  • Qt development workflows:
    • Documentation and knowledge transfer:
    • Where will the CMake workflow differ from the current qmake one?
  • Document the differences and explain why they exist to reduce friction of devs
    • building Qt with CMake
  • How can we spread the knowledge? In the end everybody needs to work with cmake, so how do we train our devs and contributors to write/update the build system?
  • What is the process to get fixes from Qt 5 into Qt 6? We will need to do that for a long time after all
  • 3rd party code:
    • How do we get external libraries into place -- now that we are getting rid of src/3rdparty? VCPKG? Can we get that decided and into place?
  • Projects *using* Qt
    • How can we ease the transition of current CMake based Qt 5 projects to Qt6 with CMake? Can we introduce changes to Qt 5 right now to make switching between Qt 5/Qt 6 easier?
    • Idea:
      • For Qt5:
        • Status quo: `find_package(Qt5 ...), results in targets: Qt5::Core.
        • In future, also export targets named: Qt::Core (for Qt6 compat)
      • Qt6:
        • Should: `find_package(Qt6 ...)`, results in targets: Qt::Core
  • How can we ease the transition of current qmake based Qt 5 projects to Qt6 with CMake?
    • Idea: Tobias has porting scripts, but they are very Qt specific
      • Probably not useful for the average Qt developer
  • QMake support in Qt6?
    • Customer still need to build QMake projects
    • Idea: Make QMake build outside qtbase.git
      • Do a verbatim copy of mkspecs for Qt6
      • Let CMake generate the QMake module .pri files (via ECM's CMake modules)
  • Qt Community:
    • How do we communicate the progress to our community and get a community decision on the build system for Qt 6?
    • We'll put this document on the wiki, work on it, later turn it into a QUIP

Technical issues

  • Do we need more changes in cmake? We want a released cmake with everything we need in time for the Qt 6 release, so we need to push this through review upstream ASAP!
  • Work on finding all the 3rd-party code we need. E.g. I got a patch for OpenGL in gerrit that needs some work in the find_packages department.
  • Cross compilation: It would be wonderful if somebody with more knowledge in that area could look into this topic.
  • CI: What needs to be done to make our CI build cmake projects? Can we get that sorted to get wider test coverage (and an idea how the switch will effect build times:-).
    • More passing tests in Qt base
    • Better testing of MacOS and Windows.
  • Add one more Qt module and see how that works -- building it stand-alone against an already installed QtBase and from a master build directory.
    • Idea: Test building qtsvg
    • Create a wip/cmake branch on Gerrit (but not necessarily)
  • Creator integration
    • Currently QtCreator needs `qmake -query` to identify Qt kits
    • Needs something similar in the CMake world, basically a Qt description file format (CMake? JSON?)
  • Qt build compiler flags
    • Qt configure's -developer-build builds with warnings-as-errors, how to do it in CMake?
    • Idea: Use ECM code for inspiration? -- will probably still need to enable warnings-as-errors manually
  • Library naming: Qt library names are missing SOVERSION, etc. pp.

Porting Notes

  • Process of getting new CMakeLists.txt files, ideally:
    • Run the conversion script
    • Edit the places which fail by hand, add a comment stating that it was edited by hand
    • When the conversion script was fixed, and it re-run:
      • Either the code next to the comment is fixed automatically
      • Or the hand-edited version needs to be kept