qtcreator scons

本文档详细介绍了如何在QtCreator中配置SCons作为构建系统,并提供了具体步骤来创建项目、添加构建与清理目标等。SCons作为一种强大的构建工具,能够通过Python脚本提供灵活的定制选项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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:

1
bzr branch lp:mixxx

If you downloaded .tar.gz-file, you can use the tar command from the shell to unpack it.

1
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:

  1. File -> New file or project -> Import Project -> Import Existing Project.
    Click the Choose button.
  2. Enter a name for the project and navigate to the source directory.
    Where you unpack or get all Mixxx sources and choose mixxx/ directory.
  3. Verify that the File selection is as you want or fine-tune it. Click the Continue button.
  4. Optional: choose if you want to add the files to a version control system.
  5. Click the “Finish” button.

After this, QtCreator will add four files to the top-level directory:

1
2
3
4
$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”.

mixxx_creator_build

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)

mixxx_creator_run

P.S. Got here http://www.scons.org/wiki/IDEIntegration#Qt_Creator

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值