source: trunk/qmake/option.h@ 507

Last change on this file since 507 was 27, checked in by Dmitry A. Kuminov, 16 years ago

qmake: Added os2 mode (default on OS/2).

File size: 6.8 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the qmake application of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** 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 are unsure which license is appropriate for your use, please
37** contact the sales department 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 res_ext;
96 static char field_sep;
97 static const char *application_argv0;
98
99 enum CmdLineFlags {
100 QMAKE_CMDLINE_SUCCESS = 0x00,
101 QMAKE_CMDLINE_SHOW_USAGE = 0x01,
102 QMAKE_CMDLINE_BAIL = 0x02,
103 QMAKE_CMDLINE_ERROR = 0x04
104 };
105
106 //both of these must be called..
107 static int init(int argc=0, char **argv=0); //parse cmdline
108 static bool postProcessProject(QMakeProject *);
109
110 enum StringFixFlags {
111 FixNone = 0x00,
112 FixEnvVars = 0x01,
113 FixPathCanonicalize = 0x02,
114 FixPathToLocalSeparators = 0x04,
115 FixPathToTargetSeparators = 0x08
116 };
117 static QString fixString(QString string, uchar flags);
118
119 //and convenience functions
120 inline static QString fixPathToLocalOS(const QString &in, bool fix_env=true, bool canonical=true)
121 {
122 uchar flags = FixPathToLocalSeparators;
123 if(fix_env)
124 flags |= FixEnvVars;
125 if(canonical)
126 flags |= FixPathCanonicalize;
127 return fixString(in, flags);
128 }
129 inline static QString fixPathToTargetOS(const QString &in, bool fix_env=true, bool canonical=true)
130 {
131 uchar flags = FixPathToTargetSeparators;
132 if(fix_env)
133 flags |= FixEnvVars;
134 if(canonical)
135 flags |= FixPathCanonicalize;
136 return fixString(in, flags);
137 }
138
139 //global qmake mode, can only be in one mode per invocation!
140 enum QMAKE_MODE { QMAKE_GENERATE_NOTHING, QMAKE_GENERATE_PROJECT, QMAKE_GENERATE_MAKEFILE,
141 QMAKE_GENERATE_PRL, QMAKE_SET_PROPERTY, QMAKE_QUERY_PROPERTY };
142 static QMAKE_MODE qmake_mode;
143
144 //all modes
145 static QString qmake_abslocation;
146 static QFile output;
147 static QString output_dir;
148 static int debug_level;
149 static int warn_level;
150 static bool recursive;
151 static QStringList before_user_vars, after_user_vars, user_configs, after_user_configs;
152 enum TARG_MODE { TARG_UNIX_MODE, TARG_WIN_MODE, TARG_MACX_MODE, TARG_MAC9_MODE, TARG_QNX6_MODE, TARG_OS2_MODE };
153 static TARG_MODE target_mode;
154 static QString user_template, user_template_prefix;
155 static QStringList shellPath;
156
157 //QMAKE_*_PROPERTY options
158 struct prop {
159 static QStringList properties;
160 };
161
162 //QMAKE_GENERATE_PROJECT options
163 struct projfile {
164 static bool do_pwd;
165 static QStringList project_dirs;
166 };
167
168 //QMAKE_GENERATE_MAKEFILE options
169 struct mkfile {
170 static QString qmakespec;
171 static bool do_cache;
172 static bool do_deps;
173 static bool do_mocs;
174 static bool do_dep_heuristics;
175 static bool do_preprocess;
176 static bool do_stub_makefile;
177 static QString cachefile;
178 static int cachefile_depth;
179 static QStringList project_files;
180 static QString qmakespec_commandline;
181 };
182
183private:
184 static int parseCommandLine(int, char **, int=0);
185};
186
187inline QString fixEnvVariables(const QString &x) { return Option::fixString(x, Option::FixEnvVars); }
188inline QStringList splitPathList(const QString &paths) { return paths.split(Option::dirlist_sep); }
189
190
191// this is a stripped down version of the one found in QtCore
192class QLibraryInfo
193{
194public:
195 enum LibraryLocation
196 {
197 PrefixPath,
198 DocumentationPath,
199 HeadersPath,
200 LibrariesPath,
201 BinariesPath,
202 PluginsPath,
203 DataPath,
204 TranslationsPath,
205 SettingsPath,
206 DemosPath,
207 ExamplesPath
208 };
209 static QString location(LibraryLocation);
210};
211
212QT_END_NAMESPACE
213
214#endif // OPTION_H
Note: See TracBrowser for help on using the repository browser.