Редактирование: Undocumented qmake

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск
Внимание: Вы не представились системе. Ваш IP-адрес будет записан в историю изменений этой страницы.
Правка может быть отменена. Пожалуйста, просмотрите сравнение версий, чтобы убедиться, что это именно те изменения, которые вас интересуют, и нажмите «Записать страницу», чтобы изменения вступили в силу.
Текущая версия Ваш текст
Строка 112: Строка 112:
This tool simply outputs the contents of the CXXFLAGS variable to a file called "compile.inp". Since this tool is meant to generate a file of a fixed name, the variable passed into .input contains only "." (current directory) which will always exist (but is not used anywhere in the rule). The construct \$(foo) is used in this rule. This construct outputs a GNU Make or NMAKE format variable expansion, basically delaying the expansion of the variable until make or NMAKE is called on the generated makefile.
This tool simply outputs the contents of the CXXFLAGS variable to a file called "compile.inp". Since this tool is meant to generate a file of a fixed name, the variable passed into .input contains only "." (current directory) which will always exist (but is not used anywhere in the rule). The construct \$(foo) is used in this rule. This construct outputs a GNU Make or NMAKE format variable expansion, basically delaying the expansion of the variable until make or NMAKE is called on the generated makefile.
-
== Особенности конфигурации ==
+
== Config features ==
There are also several "switches" which can be added to the CONFIG variable which affect various behaviours of qmake. The ones that I have uncovered are as follows (note that this doesn't include CONFIG features specific to custom tools or installers):
There are also several "switches" which can be added to the CONFIG variable which affect various behaviours of qmake. The ones that I have uncovered are as follows (note that this doesn't include CONFIG features specific to custom tools or installers):
* app_bundle — makes the target into a bundle, instead of a standalone executable (Mac only),
* app_bundle — makes the target into a bundle, instead of a standalone executable (Mac only),
Строка 144: Строка 144:
Another interesting functionality of qmake, at least since Qt4, is that it features an (undocumented) "config" switch that modify the value of the CONFIG variable on run-time without changing the content of the processed file. This is especially useful to replace build targets. Indeed qmake is unable to generate other build targets than the classic "release", "debug", "clean" and "install". As the CONFIG variable is checked when resolving scopes it allows to create complex project structure based on targets which remains human-readable...  
Another interesting functionality of qmake, at least since Qt4, is that it features an (undocumented) "config" switch that modify the value of the CONFIG variable on run-time without changing the content of the processed file. This is especially useful to replace build targets. Indeed qmake is unable to generate other build targets than the classic "release", "debug", "clean" and "install". As the CONFIG variable is checked when resolving scopes it allows to create complex project structure based on targets which remains human-readable...  
-
<source lang="xorg_conf">
+
<source lang="bash">
#sample project
#sample project
Строка 249: Строка 249:
and that compiles in parallel where possible.
and that compiles in parallel where possible.
-
== Недокументированные режимы ==
+
== Undocumented modes ==
Apart from the well known "-project" and "-makefile" modes, qmake support a few other switches that can put it in different modes.
Apart from the well known "-project" and "-makefile" modes, qmake support a few other switches that can put it in different modes.
* -prl turn it into "prl generation mode". Quite honestly I don't know what that means. This is certainly related to the .prl files that are present in the $QTDIR/libs directory...
* -prl turn it into "prl generation mode". Quite honestly I don't know what that means. This is certainly related to the .prl files that are present in the $QTDIR/libs directory...
Строка 280: Строка 280:
User-defined properties are global to the system - they are not per-project. Under Win32, they are stored in the Registry at HKEY_CURRENT_USER\Software\Trolltech\QMake\2.00a.
User-defined properties are global to the system - they are not per-project. Under Win32, they are stored in the Registry at HKEY_CURRENT_USER\Software\Trolltech\QMake\2.00a.
-
You can also get the values of these variables by using $$[varname] (note the use of the square brackets).
+
You can also get the values of these variables by using $$[varname] (note the use of the square brackets).  
-
''Курсивное начертание''
+
-
== Недокументированные функции ==
+
== Undocumented functions ==
There are some very handy functions that do not appear in the Qt4 documentation. Some of these were not added until Qt 4.2, so beware...  
There are some very handy functions that do not appear in the Qt4 documentation. Some of these were not added until Qt 4.2, so beware...  
-
=== Тест-функции ===
+
== Test functions ==
These functions return true or false:
These functions return true or false:
* defined(func, type) — Returns true if func is defined; type must be either "test" or "replace", to match "defineTest" or "defineReplace".
* defined(func, type) — Returns true if func is defined; type must be either "test" or "replace", to match "defineTest" or "defineReplace".
Строка 295: Строка 294:
* lessThan(var1, var2) — Returns true if var1 is less than var2 (as an integer).  
* lessThan(var1, var2) — Returns true if var1 is less than var2 (as an integer).  
-
=== Program flow functions ===
+
== Program flow functions ==
These are test functions as far as qmake is concerned, but I felt they really belong in their own section:
These are test functions as far as qmake is concerned, but I felt they really belong in their own section:
* break() — Acts like a C break statement.
* break() — Acts like a C break statement.
Строка 304: Строка 303:
* unset(var) — Deletes the variable entirely (it will act as if it had never been set).  
* unset(var) — Deletes the variable entirely (it will act as if it had never been set).  
-
=== Replace functions ===
+
== Replace functions ==
These functions return a value:
These functions return a value:
* cat(file) — Returns the contents of the specified file.
* cat(file) — Returns the contents of the specified file.
Строка 325: Строка 324:
MIDPARMS will now contain "bar/dead".  
MIDPARMS will now contain "bar/dead".  
* split(var, sep) — This splits the specified variable at each occurrence of "sep", and returns the result.
* split(var, sep) — This splits the specified variable at each occurrence of "sep", and returns the result.
-
* upper(string) — Converts the string to upper case.
+
* upper(string) — Converts the string to upper case.  
-
== Недокументированные тонкости ==
+
== Undocumented niceties ==
qmake is a really powerful tool, if you were still a bit unsure of that, have a look :
qmake is a really powerful tool, if you were still a bit unsure of that, have a look :
* scopes can be nested but also combined using logical operators. The following lines are equivalent :  
* scopes can be nested but also combined using logical operators. The following lines are equivalent :  

Пожалуйста, обратите внимание, что все ваши добавления могут быть отредактированы или удалены другими участниками. Если вы не хотите, чтобы кто-либо изменял ваши тексты, не помещайте их сюда.
Вы также подтверждаете, что являетесь автором вносимых дополнений, или скопировали их из источника, допускающего свободное распространение и изменение своего содержимого (см. Wiki.crossplatform.ru:Авторское право). НЕ РАЗМЕЩАЙТЕ БЕЗ РАЗРЕШЕНИЯ ОХРАНЯЕМЫЕ АВТОРСКИМ ПРАВОМ МАТЕРИАЛЫ!