building qt-creator from source
Since qt-creator(4.11/4.12) integrated support for cmake's source_groups, headers and sources are split in two separate folders. 'Header-Files','Source-Files' which is a bit annoying (not so annoying as the initial lack of subfolders...). Because of that I downgraded a couple of time ago back to 4.10 till today one qt-creator issue-tracker topic was active again, what triggered me to dive in again.
To make it short, I decided to have a look if I can somehow merge both folders into one. For that I needed to be able to compile qt-creator from source-code. Which actually worked like a charme. Here the steps(hope I can recall all):
My setup: ubuntu mate/bionic
Obviously nothing is older than not maintained build instructions. These steps are valid for qt-creator 4.12 git-hash(91536ae7812e904334b0007445a64aecf3e120ad / 2020/04/23 )
- install qt5.12:
sudo add-apt-repository ppa:beineri/opt-qt-5.12.0-bionic
sudo apt-get update
sudo apt-get install qt512-meta-full
In order for some environment-variables to be set you have to call:
source /opt/qt512/bin/qt512-env.sh
- install llvm/clang-8 ( Important for c++17 features to work... )
sudo apt-get install llvm-8
sudo apt-get install libclang-8-dev
# not sure if clang-tools are needed:
sudo apt-get install clang-8 clang-tools-8
export LLVM_INSTALL_DIR=/usr/lib/llvm-8
- download source from git
git clone --recursive https://code.qt.io/qt-creator/qt-creator.git
# create a build-folder
mkdir qt-creator-build
cd qt-creator-build
qmake -r ../qt-creator
make -j8
- finished! The result is in qt-creator-build/bin
btw, in order to merge "Source-Files" and "Header-Files" you only need to alter: src/plugins/cmakeprojectmanager/fileapidataextractor.cpp (lines at about 421, I copy the whole method, but I added only the marked lines):
FolderNode *createSourceGroupNode(const QString &sourceGroupName,
const FilePath &sourceDirectory,
FolderNode *targetRoot)
{
FolderNode *currentNode = targetRoot;
if (!sourceGroupName.isEmpty()) { // new
QString _srcgrpName = (sourceGroupName=="Header Files" || sourceGroupName=="Source Files") // new
? "Source" // new
: sourceGroupName; // new
const QStringList parts = _srcgrpName.split("\\"); // modified
for (const QString &p : parts) {
FolderNode *existingNode = Utils::findOrDefault(currentNode->folderNodes(),
[&p](const FolderNode *fn) {
return fn->displayName() == p;
});
if (!existingNode) {
auto node = createCMakeVFolder(sourceDirectory, Node::DefaultFolderPriority + 5, p);
node->setListInProject(false);
node->setIcon(QIcon::fromTheme("edit-copy", ::Utils::Icons::COPY.icon()));
existingNode = node.get();
currentNode->addNode(std::move(node));
}
currentNode = existingNode;
}
}
return currentNode;
}
Hope that helps. (As always, this blog is mainly a reminder for myself. :D )