Intro
“Mixxx has everything you need to start making DJ mixes in a tight, integrated package.”
We’ll try to compile it and by the way, understand how to make QtCreator use scons
build system instead of qmake
. Why not use qmake? SCons is implemented as a Python script and set of modules, and SCons “configuration files” are actually executed as Python scripts. This gives SCons many powerful capabilities not found in other software build tools. Here is SCons vs other build tools.
Preparation
First of all, we must install all build Mixxx dependencies (read about it here).
Keep in mind, that SCons is written to work with any Python version >= 2.4 and < 3.0. So, you must have one installed in your system.
Of course, you must have your favorite QtCreator (can get here).
Now, easiest way to get Mixxx sources is to download it (http://downloads.mixxx.org/mixxx-1.10.1/mixxx-1.10.1-src.tar.gz), but also, if you like, you can download sources from trunk, using bzr
from Launchpad:
bzr branch lp:mixxx
If you downloaded .tar.gz
-file, you can use the tar
command from the shell to unpack it.
tar -xzf rebol.tar.gz
The result will be a new directory containing the files. Also, on many systems, when you download the tar.gz
from a web browser, an unpacker will open, and you can just use that.
Make QtCreator and SCons be friends
Creating project
In QtCreator you must:
- File -> New file or project -> Import Project -> Import Existing Project.
Click the Choose button. - Enter a name for the project and navigate to the source directory.
Where you unpack or get all Mixxx sources and choosemixxx/
directory. - Verify that the File selection is as you want or fine-tune it. Click the Continue button.
- Optional: choose if you want to add the files to a version control system.
- Click the “Finish” button.
After this, QtCreator will add four files to the top-level directory:
$PROJECT_NAME.files $PROJECT_NAME.includes $PROJECT_NAME.config $PROJECT_NAME.creator
The most important one is $PROJECT_NAME.files
, which is just a list of all the files you want to show in the IDE. Here you can exclude unwanted files. I’ve done that this way: http://pastebin.com/EbHpi0s4.
See Setting Up a Generic Project (in QtCreator 2.5) for details.
Now you have to add the SConstruct
and SConscript
files to the IDE. Either edit by hand the $PROJECT_NAME.files
or, in the IDE project browser, right click on the top-level directory and select “Add existing files”, and then select SConstruct
from the list. Do the same for the SConscripts
.
Adding a build and a clean target
On the left pane, click “Projects”. Verify that the tab name is actually your project. Click on “Build Settings”. The “build directory” field is a bit misleading with scons. Don’t modify the default, it will use the source top-level directory. Same for the “Tool chain” pull-down menu, leave the default, it is not used by scons.
Under “Build Steps”, remove the “Make” item by hovering on “Details” and clicking the x that appears.
Click “Add Build Step”, select “Custom process step”, tick the “Enable custom process step”, under “Command” enter the full path to scons (or just “scons” if it is in your $PATH
). Leave the other fields as they are. Eventually pass a -jN
in the “Commands arguments”, where N
— is number of your real cores.
Under “Clean Steps”, do the same thing as for “Add Build Step”, only difference is that you will add “-c” to “Commands arguments”.
On the tab “Run” of “Projects” you can manually specify where will be your mixxx-build, and what executable to start (“Command”). Also, I recommend add next text if “Argument field”: --resourcePath res/
(as described here http://mixxx.org/wiki/doku.php/compiling_on_linux)
P.S. Got here http://www.scons.org/wiki/IDEIntegration#Qt_Creator
I was unable to find the file “Sconscripts”. I followed the others steps to the letter but I get this error while buidling: 13:24:33: Could not start process “sudo scons” -j2
Error while building project Mixxx (target: Desktop)
When executing build step ‘Custom Process Step’
QtCreator seems to be linking correctly (as in ctrl+click is working fine) but it is unable to find Qt library library headers (#include is undefined).
Hi, vedant1811!
SConscript
is insrc
folder.Why do you build it with sudo privileges? Do it as unprivileged user.
P.S. Please, don’t forget comment here after applying changes.
Sorry for replying so late.
I found SConscript but this is the error in Qt creator when I click on build:
17:08:18: Starting: “/usr/bin/scons” -j2
scons: Reading SConscript files …
INFO:root:Target Platform: linux
INFO:root:Target Machine: i686
INFO:root:Build: debug
INFO:root:Toolchain: gnu
INFO:root:Crosscompile: NO
INFO:root:Qt path: /usr/share/qt4
Loading qt4 tool…
IOError: [Errno 13] Permission denied: ‘build.h’:
File “/home/vedant/kde/src/mixxx/mixxx/SConstruct”, line 73:
SConscript(File(‘src/SConscript.env’), variant_dir=Dir(build.build_dir), duplicate=0)
File “/usr/lib/scons/SCons/Script/SConscript.py”, line 614:
return method(*args, **kw)
File “/usr/lib/scons/SCons/Script/SConscript.py”, line 551:
return _SConscript(self.fs, *files, **subst_kw)
File “/usr/lib/scons/SCons/Script/SConscript.py”, line 260:
exec _file_ in call_stack[-1].globals
File “/home/vedant/kde/src/mixxx/mixxx/src/SConscript.env”, line 34:
util.write_build_header(‘build.h’)
File “/home/vedant/kde/src/mixxx/mixxx/build/util.py”, line 118:
f = open(path, ‘w’)
I had run the command “sudo scons -c” but got the same error
Hi Nazar,
Thank you for this usefull blog.
Which version of QtCreator have you used? I am just on a fresh ubuntu raring installation and QtCreator 2.7.0 behaves slightly different:
1. File -> New file or project -> Import Project -> Import Existing Project.
..
5. Click “Finish” Button
In addition:
Tools -> Options -> Build & Run
checked “Save all files befor build”
unchecked “Allways deploy project befor running it”
Compared to Eclipse it is a fast IDE with everything build in by default.
But I am missing some important feature.
* auto expansion of class members when hitting . or ->
* Display call tree
* Code beautifier
* Hover function when debugging
@vedant1811
sudo rm lin32_build/build.h helps.
just filed https://bugs.launchpad.net/mixxx/+bug/1189210
Hi, Daniel!
Thanks for your comment. I updated article according to your advice.
Now I’m also using Qt Creator 2.7 (on Debian Wheezy and on Windows 7) and really saw difference in label’s text.
About your addition, As I think, all that parameters are Qt Creator-wide, so developers who use it know what is better for them.
In my example, we don’t make any deploy steps, so un-checking “Allways deploy…” doesn’t matter in our particular case.
About Qt Creator. I can give you some advises on howto make Qt Creator your favorite IDE 🙂
.
Hope that helps!
Hi Nazar,
autoexpansion: Yes, Qt does not find the Qt headers With the mixxx classes auto expansion works. Could you point out where I can setup the Qt include paths?
After some test I see a little chance to make make eclipse to your favorite IDE. 😉
* Eclipse can show a call tree based on its C++ Indexer. Not only the backtrace when debugging. That is very usefull, when you want to find out from where a specific function is called. You can also do this with variables. You get a nice treewiew with R/W marking that are showing the type of variable access. It is similar to QtCreators “Find Usage” but combined with a call tree.
* The Code beautifier of Eclipse is advanced compared to QtCreator, you can set the code style very detailed and Eclipse tries its best to use it during editing the QtCreator Ctrl-i seems to be on TAB while there is ctrl+shift+f to reformat the with all rules.
* Eclipse has a nice git / bzr diff side by side view and the annotate view is also much nicer with colored marks for the age of specific code lines.
Unfortunately Eclipse is based in Java and feels slow compared to QtCreator.