I receive many questions about using an IDE to build VLC.
Usually, the answer is VIM. But I will try to introduce something else today.
Needs
Yeah, VIM is TEH awesome, but sometimes we would like more. But usually, more is slow, incomplete and boring…
Would you want an editor with:
- VIM syntax and command,
- Completion that is faster than the one from Eclipse
- Git inclusion
- Doesn’t eat all your RAM
- Debuggueur and step-by-step+breakpoints integration like MSVC?
I guess so!
Believe it or not, there is a solution: QtCreator from Nokia/QtSoftware that I have tested to work with VLC.
Even if you don’t think this will be useful for you, at least read in diagonale the following post.
Installation
- Take QtCreator 1.1 (don’t take older versions, they won’t fit for VLC, or the VIM part will suck…)
`apt-get install qtcreator` in Debian/Sid
- Take Qt4.5.1 (I mean it, Qt 4.5.0 is buggy!)
Setup
General Setup
-
Run QtCreator and launch Tools->options
- Activate FakeVim and set ShiftWidth to 4
- Text Editor->Behaviour, set Tab size at 4
- Text Editor->Display, enable Text Wrapping and display right margin, and if you like Alexis’ vim, Visualize whitespace
- Text Editor, change the colour schemes to match you old editor ;)
-
Save options.
VLC Setup
For the example, I assume that you build your vlc in a “build” subdir of the source (as xtophe usually gives advice)
* File->New
Select 'Import of Makefile-based Project'
-
Project Name 'VLC'
Location '/home/you/vlc' and Choose, Next
-
Let it process... It should take around 1minute
Finish.
- EXIT QtCreator… I MEAN it.
Setup Indexation
QtCreator will have done VLC.includes VLC.creator, VLC.files and a VLC.config in your vlc/ folder.
Overwrite the VLC.includes and the VLC.files with the one you can find:
- http://people.videolan.org/~jb/QtCreator/VLC.files
- http://people.videolan.org/~jb/QtCreator/VLC.includes
Doing this will gain you some time. Those could be auto-generated one day, I guess…
Setup Build
Relaunch QtCreator
- Select Projects (on the left) and select VLC on the list
- Build Settings,
- Change Build directory to /home/you/vlc/build, using browse
- Run Settings,
- Add a custom Executable with the blue ‘+’
- Name it VLC, browse to /home/you/vlc/build/vlc for Executable
- Put -Iqt in Arguments
- Click on Edit on the left. You should see VLC with most useful files.
Build VLC and launch it.
- In the Menu, Build and Build All, you should see the Compilation output on the bottom (or by clicking on the left build progressbar)
- In the same menu, Build and Run it, and VLC will launch directly, outputting everything in the Application output.
Cool. But that was just a minimum…
Using it like VIM: Good!
Open modules/codec/avcodec/audio.c from the file browser and see… You are using VIM commands to control. You have Visual, Edit and all usual VIM modes!
-
Completion is triggered with Ctrl+Space and will give you a list. If there is no ambiguition, it is filled.
-
. and -> triggers the list of the members of the struct or the class by default.
-
After function completions, it will give the type of the arguments.
-
F2 will give you access to the function definition where your mouse is.
Debugging it: awesome!
-
You can put breakpoints in the margins near the line numbers. (Like in modules/gui/qt4/main_interface.cpp:100 and 108)
-
Now re run it using debug running.
It will stop at your breakpoint and you will have the function call lists (and line numbers) but also pointers values (like p_intf, and this in main_interface.cpp)
You can, of course Step In, Step Into and Step Out, resume or stop the code
More coolness:
Locate
Use the locate search box to find quick declarations:
'm vlc_object_act'
will help you to go quickly to the method declaration, etc…
Git
Use the Git menu to checkout from within QtCreator.
Nota Bene
The indexing shouldn’t be too long, but could be a bit longer the first time you launch the project!
Have fun!