source: trunk/qmake/option.h@ 564

Last change on this file since 564 was 561, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.1 sources.

File size: 6.8 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
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**
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.
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**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
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
50QT_BEGIN_NAMESPACE
51
52#define QMAKE_VERSION_MAJOR 2
53#define QMAKE_VERSION_MINOR 1
54#define QMAKE_VERSION_PATCH 0
55const char *qmake_version();
56
57QString qmake_getpwd();
58bool qmake_setpwd(const QString &p);
59
60#define debug_msg if(Option::debug_level) debug_msg_internal
61void debug_msg_internal(int level, const char *fmt, ...); //don't call directly, use debug_msg
62enum QMakeWarn {
63 WarnNone = 0x00,
64 WarnParser = 0x01,
65 WarnLogic = 0x02,
66 WarnAll = 0xFF
67};
68void warn_msg(QMakeWarn t, const char *fmt, ...);
69
70struct 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;
95 static QString mmp_ext;
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);
138 }
139
140 //global qmake mode, can only be in one mode per invocation!
141 enum QMAKE_MODE { QMAKE_GENERATE_NOTHING, QMAKE_GENERATE_PROJECT, QMAKE_GENERATE_MAKEFILE,
142 QMAKE_GENERATE_PRL, QMAKE_SET_PROPERTY, QMAKE_QUERY_PROPERTY };
143 static QMAKE_MODE qmake_mode;
144
145 //all modes
146 static QString qmake_abslocation;
147 static QFile output;
148 static QString output_dir;
149 static int debug_level;
150 static int warn_level;
151 static bool recursive;
152 static QStringList before_user_vars, after_user_vars, user_configs, after_user_configs;
153 enum TARG_MODE { TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE, TARG_MAC9_MODE, TARG_OS2_MODE };
154 static TARG_MODE target_mode;
155 static QString user_template, user_template_prefix;
156 static QStringList shellPath;
157
158 //QMAKE_*_PROPERTY options
159 struct prop {
160 static QStringList properties;
161 };
162
163 //QMAKE_GENERATE_PROJECT options
164 struct projfile {
165 static bool do_pwd;
166 static QStringList project_dirs;
167 };
168
169 //QMAKE_GENERATE_MAKEFILE options
170 struct mkfile {
171 static QString qmakespec;
172 static bool do_cache;
173 static bool do_deps;
174 static bool do_mocs;
175 static bool do_dep_heuristics;
176 static bool do_preprocess;
177 static bool do_stub_makefile;
178 static QString cachefile;
179 static int cachefile_depth;
180 static QStringList project_files;
181 static QString qmakespec_commandline;
182 };
183
184private:
185 static int parseCommandLine(int, char **, int=0);
186};
187
188inline QString fixEnvVariables(const QString &x) { return Option::fixString(x, Option::FixEnvVars); }
189inline QStringList splitPathList(const QString &paths) { return paths.split(Option::dirlist_sep); }
190
191
192// this is a stripped down version of the one found in QtCore
193class QLibraryInfo
194{
195public:
196 enum LibraryLocation
197 {
198 PrefixPath,
199 DocumentationPath,
200 HeadersPath,
201 LibrariesPath,
202 BinariesPath,
203 PluginsPath,
204 DataPath,
205 TranslationsPath,
206 SettingsPath,
207 DemosPath,
208 ExamplesPath
209 };
210 static QString location(LibraryLocation);
211};
212
213QT_END_NAMESPACE
214
215#endif // OPTION_H
Note: See TracBrowser for help on using the repository browser.