Skip to content
Snippets Groups Projects
Commit a6a5db74 authored by Campbell Barton's avatar Campbell Barton
Browse files

Initial commit for qtcreator external tools

parent 0ce3cf7f
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
"""
This script takes 2-3 args: [--browse] <Doxyfile> <sourcefile>
--browse will open the resulting docs in a web browser.
"""
import sys
import os
import subprocess
import tempfile
def find_gitroot(filepath_reference):
path = filepath_reference
path_prev = ""
while not os.path.exists(os.path.join(path, ".git")) and path != path_prev:
path_prev = path
path = os.path.dirname(path)
return path
def find_doxy(filepath_reference):
root = find_gitroot(filepath_reference)
# project specific!
return os.path.join(root, "doc", "doxygen", "Doxyfile")
sourcefile = sys.argv[-1]
doxyfile = find_doxy(sourcefile)
os.chdir(os.path.dirname(doxyfile))
tempfile = tempfile.NamedTemporaryFile(mode='w+b')
doxyfile_tmp = tempfile.name
tempfile.write(open(doxyfile, "r+b").read())
tempfile.write(b'\n\n')
tempfile.write(b'INPUT=' + os.fsencode(sourcefile) + b'\n')
tempfile.flush()
subprocess.call(("doxygen", doxyfile_tmp))
del tempfile
# Maybe handy, but also annoying?
if "--browse" in sys.argv:
import webbrowser
webbrowser.open("html/files.html")
<?xml version="1.0" encoding="UTF-8"?>
<externaltool id="qtc_doxygen_file">
<description>Doxygen a single file</description>
<displayname>Doxygen File</displayname>
<category>Documentation</category>
<executable output="showinpane" error="showinpane" modifiesdocument="no">
<path>qtc_doxy_file.py</path>
<arguments>--browse %{CurrentDocument:FilePath}</arguments>
<workingdirectory>%{CurrentProject:BuildPath}</workingdirectory>
</executable>
</externaltool>
This repository contains utilities to perform various editing operations as well as some utilities to integrate
Uncrustify and Meld.
This is for my own personal use, but I have tried to make the tools generic (where possible) and useful to others.
Installing
==========
All the scripts install to QtCreators ``externaltools`` path:
eg:
``~/.config/QtProject/qtcreator/externaltools/``
Currently QtCreator has no way to reference commands relative to this directory so the ``externaltools`` dir **must**
be added to the systems ``PATH``.
Tools
=====
Here are a list of the tools with some details on how they work.
Assembler Preview
-----------------
``External Tools -> Compiler -> Assembler Preview``
This tool generates the assembly for the current open document,
saving it to a file in the same path with an ".asm" extension.
This can be handy for checking if the compiler is really optimizing out code as expected.
Or if some change really does't change any functionality.
The way it works is to get a list of the build commands that would run, and get those commands for the current file.
Then this command runs, swapping out object creation args for arguments that create the assembly.
.. note:: It would be nice to open this file, but currently this isnt supported. its just created along side the source.
.. note:: Currently only GCC is supported.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment