[2] | 1 | /****************************************************************************
|
---|
| 2 | **
|
---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
[561] | 4 | ** All rights reserved.
|
---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
---|
[2] | 6 | **
|
---|
| 7 | ** This file is part of the qmake application of the Qt Toolkit.
|
---|
| 8 | **
|
---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
| 10 | ** Commercial Usage
|
---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
| 14 | ** a written agreement between you and Nokia.
|
---|
| 15 | **
|
---|
| 16 | ** GNU Lesser General Public License Usage
|
---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
| 20 | ** packaging of this file. Please review the following information to
|
---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
| 23 | **
|
---|
[561] | 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
[2] | 27 | **
|
---|
| 28 | ** GNU General Public License Usage
|
---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 32 | ** packaging of this file. Please review the following information to
|
---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
| 35 | **
|
---|
[561] | 36 | ** If you have questions regarding the use of this file, please contact
|
---|
| 37 | ** Nokia at [email protected].
|
---|
[2] | 38 | ** $QT_END_LICENSE$
|
---|
| 39 | **
|
---|
| 40 | ****************************************************************************/
|
---|
| 41 |
|
---|
| 42 | #ifndef OPTION_H
|
---|
| 43 | #define OPTION_H
|
---|
| 44 |
|
---|
| 45 | #include "project.h"
|
---|
| 46 | #include <qstring.h>
|
---|
| 47 | #include <qstringlist.h>
|
---|
| 48 | #include <qfile.h>
|
---|
| 49 |
|
---|
| 50 | QT_BEGIN_NAMESPACE
|
---|
| 51 |
|
---|
| 52 | #define QMAKE_VERSION_MAJOR 2
|
---|
| 53 | #define QMAKE_VERSION_MINOR 1
|
---|
| 54 | #define QMAKE_VERSION_PATCH 0
|
---|
| 55 | const char *qmake_version();
|
---|
| 56 |
|
---|
| 57 | QString qmake_getpwd();
|
---|
| 58 | bool qmake_setpwd(const QString &p);
|
---|
| 59 |
|
---|
| 60 | #define debug_msg if(Option::debug_level) debug_msg_internal
|
---|
| 61 | void debug_msg_internal(int level, const char *fmt, ...); //don't call directly, use debug_msg
|
---|
| 62 | enum QMakeWarn {
|
---|
| 63 | WarnNone = 0x00,
|
---|
| 64 | WarnParser = 0x01,
|
---|
| 65 | WarnLogic = 0x02,
|
---|
| 66 | WarnAll = 0xFF
|
---|
| 67 | };
|
---|
| 68 | void warn_msg(QMakeWarn t, const char *fmt, ...);
|
---|
| 69 |
|
---|
| 70 | struct Option
|
---|
| 71 | {
|
---|
| 72 | //simply global convenience
|
---|
| 73 | static QString js_ext;
|
---|
| 74 | static QString libtool_ext;
|
---|
| 75 | static QString pkgcfg_ext;
|
---|
| 76 | static QString prf_ext;
|
---|
| 77 | static QString prl_ext;
|
---|
| 78 | static QString ui_ext;
|
---|
| 79 | static QStringList h_ext;
|
---|
| 80 | static QStringList cpp_ext;
|
---|
| 81 | static QStringList c_ext;
|
---|
| 82 | static QString h_moc_ext;
|
---|
| 83 | static QString cpp_moc_ext;
|
---|
| 84 | static QString obj_ext;
|
---|
| 85 | static QString lex_ext;
|
---|
| 86 | static QString yacc_ext;
|
---|
| 87 | static QString h_moc_mod;
|
---|
| 88 | static QString cpp_moc_mod;
|
---|
| 89 | static QString lex_mod;
|
---|
| 90 | static QString yacc_mod;
|
---|
| 91 | static QString dir_sep;
|
---|
| 92 | static QString dirlist_sep;
|
---|
| 93 | static QString sysenv_mod;
|
---|
| 94 | static QString pro_ext;
|
---|
[561] | 95 | static QString mmp_ext;
|
---|
[2] | 96 | static QString res_ext;
|
---|
| 97 | static char field_sep;
|
---|
| 98 | static const char *application_argv0;
|
---|
| 99 |
|
---|
| 100 | enum CmdLineFlags {
|
---|
| 101 | QMAKE_CMDLINE_SUCCESS = 0x00,
|
---|
| 102 | QMAKE_CMDLINE_SHOW_USAGE = 0x01,
|
---|
| 103 | QMAKE_CMDLINE_BAIL = 0x02,
|
---|
| 104 | QMAKE_CMDLINE_ERROR = 0x04
|
---|
| 105 | };
|
---|
| 106 |
|
---|
| 107 | //both of these must be called..
|
---|
| 108 | static int init(int argc=0, char **argv=0); //parse cmdline
|
---|
| 109 | static bool postProcessProject(QMakeProject *);
|
---|
| 110 |
|
---|
| 111 | enum StringFixFlags {
|
---|
| 112 | FixNone = 0x00,
|
---|
| 113 | FixEnvVars = 0x01,
|
---|
| 114 | FixPathCanonicalize = 0x02,
|
---|
| 115 | FixPathToLocalSeparators = 0x04,
|
---|
| 116 | FixPathToTargetSeparators = 0x08
|
---|
| 117 | };
|
---|
| 118 | static QString fixString(QString string, uchar flags);
|
---|
| 119 |
|
---|
| 120 | //and convenience functions
|
---|
| 121 | inline static QString fixPathToLocalOS(const QString &in, bool fix_env=true, bool canonical=true)
|
---|
| 122 | {
|
---|
| 123 | uchar flags = FixPathToLocalSeparators;
|
---|
| 124 | if(fix_env)
|
---|
| 125 | flags |= FixEnvVars;
|
---|
| 126 | if(canonical)
|
---|
| 127 | flags |= FixPathCanonicalize;
|
---|
| 128 | return fixString(in, flags);
|
---|
| 129 | }
|
---|
| 130 | inline static QString fixPathToTargetOS(const QString &in, bool fix_env=true, bool canonical=true)
|
---|
| 131 | {
|
---|
| 132 | uchar flags = FixPathToTargetSeparators;
|
---|
| 133 | if(fix_env)
|
---|
| 134 | flags |= FixEnvVars;
|
---|
| 135 | if(canonical)
|
---|
| 136 | flags |= FixPathCanonicalize;
|
---|
| 137 | return fixString(in, flags);
|
---|
| |
---|