TICS plugin for Qt Creator
This plugin allows you to do a TICS Analysis on your code from within QtCreator.
To learn more about TICS please visit the documentation on TIOBE Software's website
For other supported environments see here
- Download qt offline installer from https://www.qt.io/offline-installers
- Make it executable sudo chmod +x qt-opensource-linux-x64-5.14.2.run
- Run the installer script ./qt-opensource-linux-x64-5.14.2.run
- Once the installation starts, and you get a selection of options, select Qt - u can deselect some of the components but Qt webengine Qt script and compiler gcc are important
-
Get Qt creator sources -git clone https://code.qt.io/cgit/qt-creator/qt-creator.git
-
Checkout the latest or the preffered branch
git checkout -b 4.12.1 v4.12.1
mv qt-creator qt-creator-4.12.1
-
Create the build directory next to the Qt Creator sources (this is important the build may fail if the source and build directories are not next to each other.)
cd ..
mkdir build-qtcreator-Desktop_Qt_5_14_2_GCC_64bit-Debug
Note: the name of the folder is the one that would be assigned if you use the desktop version of qt creator to build with the specific verions of QT, compiler and platform mentioned. Although you are free to use qt-creator-build as mentioned here, this naming scheme can be helpful for identifying multiple builds) -cd build-qtcreator-Desktop_Qt_5_14_2_GCC_64bit-Debug
-
Make sure qmake is in your path
export PATH=$PATH:/home/beza/Qt5.14.2/5.14.2/gcc_64/bin/
-
Build the tool
qmake -r
make
- If you encounter an error with some libs not found, you have to install them using the package manager of your system
- for e.g.
- error with -lGL not found
sudo apt install libglfw3-dev
-
wait about 30 mins
-
when done run
bin/qtcreator
-
Now you have a working build of QtCreator (hopefully)
- For building the plugin you need Qt Creator installed (This Qt creator should be using the same version of Qt and compiler version as the one you build from sources)
- In the plugin's .pro file update the location of the QT Creator source location and the QT Creator build location that you created before
## Either set the IDE_SOURCE_TREE when running qmake, ## or set the QTC_SOURCE environment variable, to override the default setting isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE = $$(QTC_SOURCE) isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE = "../qtcreator-src/qt-creator-4.12.1" ## Either set the IDE_BUILD_TREE when running qmake, ## or set the QTC_BUILD environment variable, to override the default setting isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE = $$(QTC_BUILD) isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE = "../qtcreator-build/build-qtcreator-Desktop_Qt_5_14_2_GCC_64bit-Debug"
- when you build the plugin it will be deployed to the Qt Creator build you specified as IDE_BUILD_TREE
- another (better) option is to set the
QTC_BUILD
and QTC_SOURCE system environment variables - To test, run your Qt Creator build from
<YOUR_QT_CREATOR_BUILD_DIR>/bin/qtcreator
You can use the provided Dockerfile to build and get a working TICS Qt Creator Plugin artifact for a specific target platform. Note that this Dockerfile is written for target platform Qt Creator 4.x.x based on Qt 5.x.x. Target platforms with different major versions than those may require different build steps.
The arguments used for parameterizing specific target platforms and their values are shown below:
DISTRO=ubuntu VERSION=20.04 GCC_VERSION=7 LLVM_ARCHIVE=libclang-release_80-based-linux-Ubuntu16.04-gcc5.3-x86_64.7z QT_ARCHIVE_PKG=qt-everywhere-src-5.12.8 QT_ARCHIVE_URL=https://download.qt.io/archive/qt/5.12/5.12.8/single/qt-everywhere-src-5.12.8.tar.xz QT_CREATOR_VERSION=4.11.0 TICS_QT_GIT_BRANCH=main
You can change the values of these arguments based on your desired target platforms when building the Dockerfile.
Some remarks for building TICS Qt Creator plugin for target platforms Qt creator 4.x.x based on Qt 5.x.x:
- Does not work with Gcc 9 and higher. Seems to work with Gcc 5-7.
- Ubuntu 22.04 onwards only support Gcc 9 and higher. Therefore use Ubuntu 20.04 or lower.
- Does not seem to work with LLVM 10 or higher. Proven to work with LLVM 8.
- For specific
LLVM_ARCHIVE
, you can find here: https://download.qt.io/development_releases/prebuilt/libclang/. - For specific
QT_ARCHIVE_PKG
, andQT_ARCHIVE_URL
you can find here: https://download.qt.io/archive/qt - For specific
QT_CREATOR_VERSION
you can find here: https://download.qt.io/archive/qtcreator/
The following command shows an example of building the TICS Qt Creator plugin for target platform Qt Creator 4.12.2 based on Qt 5.14.2:
docker build --build-arg GCC_VERSION=7 --build-arg QT_ARCHIVE_PKG=qt-everywhere-src-5.14.2 --build-arg QT_ARCHIVE_URL=https://download.qt.io/archive/qt/5.14/5.14.2/single/qt-everywhere-src-5.14.2.tar.xz --build-arg QT_CREATOR_VERSION=4.12.2 -t ticsqtcreator:4-12-2 .
The command above will create an image with the tag ticsqtcreator:4-12-2
.
The TICS Qt Creator plugin artifact will be located in /qt-creator-build/lib/qtcreator/plugins/libTICSQtCreator.so
. To get the artifact from the created image to the host file system, you can first run a container from the created image, then perform a docker copy as shown in the following commands and their examples:
docker run -it -d --name <container_name> <image_id>
docker cp <container_name>:<path_to_plugin_artifact_inside_container> <path_to_target_location_in_host_file_system>
Examples:
docker run -it -d --name ticsqtcreator fddf7a31202a
docker cp ticsqtcreator:/qt-creator-build/lib/qtcreator/plugins/libTICSQtCreator.so /home/leila/Development/QtDocker