Skip to content

h4tr3d/cmakeprojectmanager2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMakeProjectManager2

NOTE: Project are discontinued and repository will be frozen. Use upstream plugin that started to be more usable that this one.

Alternative CMake support for Qt Creator.

Main differents from original CMakeProject plugin:

  • Project file list readed from file system instead of parsing .cbp (CodeBlocks) project file. It can be slow on big projects, but reloading initiating only during open project, run CMake, or user-initiated tree changes (add new files, erase files, rename file)
  • You can add new files from Qt Creator. Note, you can create file outside project tree, but Qt Creator will display only files that present in project tree. Also, you should manualy describe this files in CMakeLists.txt NOTE: done in the more proper way in the upstream.
  • You can rename files in file system from Qt Creator now. NOTE: done in the more proper way in the upstream.
  • You can erase files from files system from Qt Creator now. NOTE: done in the more proper way in the upstream.
  • Classic tree view for CMake Server mode (uses automatically with CMake >= 3.7)

This functionality is not compatible with QtC Project View idea: Project View == Build System view. So, upstream accepts only changes that can be done via build system tools and API. CMake does not provide way to modify CMakeLists.txt and related files, add/remove/rename file to targets and so on. So such changes in plugin (different kinds of work arounds) will be dropped. But in my opinion: usability of IDE must be putted to first place. If some kind of WA that simplify work with CMake cab be implemented - it must be implemented.

Build plugin

This plugin is oriented to latest Git version of Qt Creator, sorry I use it and I have no time to support other stable versions.

Prepare Qt Creator

Commit 9d8a419d107ae8219c84bc9178bfed76b94fa930 of the Qt Creator completely remove build using qmake. So, instruction updated to build plugin with CMake.

If you have QtC binary installation that contains lib/cmake/QtCreator and headers you should not do anything.

Otherwise, you must get full copy of the Qt Creator from the Git, build it and install to some prefix.

For example, all actions runs in directory /tmp/qt-creator

  • Take full Qt Creator source tree from Git:

    git clone https://github.com/qtproject/qt-creator.git qt-creator
  • Create Qt Crator build tree:

     mkdir qt-creator-build
     cd qt-creator-build
  • Create shadow build:

    cmake -DCMAKE_BUILD_TYPE=Release \
          -DCMAKE_INSTALL_PREFIX=/opt/qtcreator-git \
          -DCMAKE_PREFIX_PATH=/usr \
          ..
    # CMAKE_PREFIX_PATH needed to point right location of the LLVM
  • Build and install it

    cmake --build . -j 8 && \
    sudo cmake --install . && \
    sudo cmake --install . --component Devel
    # Devel strongly are needed
    • Latest QtC missed tl_expected packages, copy it manually
      cp -a "$qtc_source/src/libs/3rdparty/tl_expected" "$PREFIX/include/qtcreator/src/libs/3rdparty/"

Also, refer to the next page for more details:

Build plugin

  • Change directory to /tmp/qt-creator

  • Take sources of CMakeProjectManager2 from repository

  • Create directory for shadow build:

    mkdir cmakeprojectmanager2-build
    cd cmakeprojectmanager2-build
  • Configure plugin:

    cmake -DCMAKE_PREFIX_PATH="/opt/qtcreator-git" \
          -DCMAKE_INSTALL_PREFIX="/opt/qtcreator-git" \
          ../cmakeprojectmanager2-git/
    # CMAKE_PREFIX_PATH strogly needed if QtC installed to the non-default CMake prefix (/usr in most cases)

    Build:

    cmake --build . -j 8
  • Install

    sudo cmake --install .

Restart Qt Creator, go to Help -> About plugins and turn off default CMakeProjectManager plugin.

Build plugin from Qt Creator

  • Open cmakeprojectmanager2-git/CMakeLists.txt, go to Projects layout (see left panel)
  • Look to Build Steps section and add next params for CMake:
    -DCMAKE_PREFIX_PATH="/opt/qtcreator-git"

Now you can build plugin from Qt Creator.

Also, refer to the Qt Creator WiKi about plugins development:

Prebuilt binaries

Unsupported anymore. Sorry, just have no a time :-(

TODO & Roadmap

Actual tasks and todo can be looks at the Issue page: https://github.com/h4tr3d/cmakeprojectmanager2/issues

Sync with Qt Creator upstream plugin

  1. Update Qt Creator git repository, moves to the master branch
  2. Create patches for new changes
git format-patch <REVISION_SINCE> -- src/plugins/cmakeprojectmanager

REVISION_SINCE can be found via 'git log' by comments or Change-Id. 3. Go to CMakeProjectManager2 source tree and change branch to the qtc-master 4. Copy patches from the step 2 to the CMakeProjectManager2 source tree root 5. Apply patches:

git am -p4 *.patch
  1. Change branch to the master, merge new changes and resolve conflicts

About

Enhanced CMake Project Manager plugin for Qt Creator

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages