1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the Qt Linguist of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21 ** included in the packaging of this file. Please review the following
22 ** information to ensure the GNU General Public License requirements will
23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24 **
25 ** $QT_END_LICENSE$
26 **
27 ****************************************************************************/
28 
29 #ifndef PROFILEEVALUATOR_H
30 #define PROFILEEVALUATOR_H
31 
32 #include "qmake_global.h"
33 #include "qmakeglobals.h"
34 #include "qmakeevaluator.h"
35 #include "proitems.h"
36 
37 #include <QHash>
38 #include <QStringList>
39 
40 QT_BEGIN_NAMESPACE
41 
42 class QMakeVfs;
43 class QMakeParser;
44 class QMakeEvaluator;
45 class QMakeHandler;
46 
47 class QMAKE_EXPORT ProFileGlobals : public QMakeGlobals
48 {
49 public:
50     QString sysroot;
51 };
52 
53 class QMAKE_EXPORT ProFileEvaluator
54 {
55 public:
56     enum TemplateType {
57         TT_Unknown = 0,
58         TT_Application,
59         TT_Library,
60         TT_Script,
61         TT_Aux,
62         TT_Subdirs
63     };
64 
65     // Call this from a concurrency-free context
66     static void initialize();
67 
68     ProFileEvaluator(ProFileGlobals *option, QMakeParser *parser, QMakeVfs *vfs,
69                      QMakeHandler *handler);
70     ~ProFileEvaluator();
71 
72     ProFileEvaluator::TemplateType templateType() const;
73 #ifdef PROEVALUATOR_CUMULATIVE
74     void setCumulative(bool on); // Default is false
75 #endif
76     void setExtraVars(const QHash<QString, QStringList> &extraVars);
77     void setExtraConfigs(const QStringList &extraConfigs);
78     void setOutputDir(const QString &dir); // Default is empty
79 
80     bool loadNamedSpec(const QString &specDir, bool hostSpec);
81 
82     bool accept(ProFile *pro, QMakeEvaluator::LoadFlags flags = QMakeEvaluator::LoadAll);
83 
84     bool contains(const QString &variableName) const;
85     QString value(const QString &variableName) const;
86     QStringList values(const QString &variableName) const;
87     QStringList values(const QString &variableName, const ProFile *pro) const;
88     QStringList absolutePathValues(const QString &variable, const QString &baseDirectory) const;
89     QStringList absoluteFileValues(
90             const QString &variable, const QString &baseDirectory, const QStringList &searchDirs,
91             const ProFile *pro) const;
92     QString propertyValue(const QString &val) const;
93 
94     QString resolvedMkSpec() const;
95 
96 private:
97     QString sysrootify(const QString &path, const QString &baseDir) const;
98 
99     QMakeEvaluator *d;
100 };
101 
102 QT_END_NAMESPACE
103 
104 #endif // PROFILEEVALUATOR_H
105