don't let the make spec determine the host mode any more
(some of) the generators are (moderately) x-platform, so it makes no sense to nail the host platform to a generator (and thus a spec). overriding the host platform is only a debugging mesasure anyway, so one can use the (now undocumented) -unix/-macx/-win32 options for that. Change-Id: If2a059f1feeb2c726e5838625ede1c7add829985 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com> Reviewed-by: Mark Brand <mabrand@mabrand.nl>
This commit is contained in:
parent
fc1bca8608
commit
0ce1a6ba24
@ -515,37 +515,21 @@ MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &na
|
||||
#endif // QT_QMAKE_PARSER_ONLY
|
||||
|
||||
bool
|
||||
MetaMakefileGenerator::modesForGenerator(const QString &gen,
|
||||
Option::HOST_MODE *host_mode, Option::TARG_MODE *target_mode)
|
||||
MetaMakefileGenerator::modeForGenerator(const QString &gen, Option::TARG_MODE *target_mode)
|
||||
{
|
||||
if (gen == "UNIX") {
|
||||
#ifdef Q_OS_MAC
|
||||
*host_mode = Option::HOST_MACX_MODE;
|
||||
*target_mode = Option::TARG_MACX_MODE;
|
||||
#elif defined(Q_OS_WIN)
|
||||
*host_mode = Option::HOST_WIN_MODE;
|
||||
*target_mode = Option::TARG_UNIX_MODE;
|
||||
#else
|
||||
*host_mode = Option::HOST_UNIX_MODE;
|
||||
*target_mode = Option::TARG_UNIX_MODE;
|
||||
#endif
|
||||
} else if (gen == "MSVC.NET" || gen == "BMAKE" || gen == "MSBUILD") {
|
||||
*host_mode = Option::HOST_WIN_MODE;
|
||||
*target_mode = Option::TARG_WIN_MODE;
|
||||
} else if (gen == "MINGW") {
|
||||
#if defined(Q_OS_MAC)
|
||||
*host_mode = Option::HOST_MACX_MODE;
|
||||
#elif defined(Q_OS_UNIX)
|
||||
*host_mode = Option::HOST_UNIX_MODE;
|
||||
#else
|
||||
*host_mode = Option::HOST_WIN_MODE;
|
||||
#endif
|
||||
*target_mode = Option::TARG_WIN_MODE;
|
||||
} else if (gen == "PROJECTBUILDER" || gen == "XCODE") {
|
||||
*host_mode = Option::HOST_MACX_MODE;
|
||||
*target_mode = Option::TARG_MACX_MODE;
|
||||
} else if (gen == "GBUILD") {
|
||||
*host_mode = Option::HOST_UNIX_MODE;
|
||||
*target_mode = Option::TARG_INTEGRITY_MODE;
|
||||
} else {
|
||||
fprintf(stderr, "Unknown generator specified: %s\n", gen.toLatin1().constData());
|
||||
|
@ -67,8 +67,7 @@ public:
|
||||
static MetaMakefileGenerator *createMetaGenerator(QMakeProject *proj, const QString &name, bool op=true, bool *success = 0);
|
||||
static MakefileGenerator *createMakefileGenerator(QMakeProject *proj, bool noIO = false);
|
||||
|
||||
static bool modesForGenerator(const QString &generator,
|
||||
Option::HOST_MODE *host_mode, Option::TARG_MODE *target_mode);
|
||||
static bool modeForGenerator(const QString &generator, Option::TARG_MODE *target_mode);
|
||||
|
||||
inline QMakeProject *projectFile() const { return project; }
|
||||
|
||||
|
@ -401,6 +401,13 @@ static QStringList detectShellPath()
|
||||
int
|
||||
Option::init(int argc, char **argv)
|
||||
{
|
||||
#if defined(Q_OS_MAC)
|
||||
Option::host_mode = Option::HOST_MACX_MODE;
|
||||
#elif defined(Q_OS_UNIX)
|
||||
Option::host_mode = Option::HOST_UNIX_MODE;
|
||||
#else
|
||||
Option::host_mode = Option::HOST_WIN_MODE;
|
||||
#endif
|
||||
Option::application_argv0 = 0;
|
||||
Option::cpp_moc_mod = "";
|
||||
Option::h_moc_mod = "moc_";
|
||||
@ -554,32 +561,24 @@ Option::init(int argc, char **argv)
|
||||
}
|
||||
} else if (Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) {
|
||||
#if defined(Q_OS_MAC)
|
||||
Option::host_mode = Option::HOST_MACX_MODE;
|
||||
Option::target_mode = Option::TARG_MACX_MODE;
|
||||
#elif defined(Q_OS_UNIX)
|
||||
Option::host_mode = Option::HOST_UNIX_MODE;
|
||||
Option::target_mode = Option::TARG_UNIX_MODE;
|
||||
#else
|
||||
Option::host_mode = Option::HOST_WIN_MODE;
|
||||
Option::target_mode = Option::TARG_WIN_MODE;
|
||||
#endif
|
||||
}
|
||||
|
||||
//defaults for globals
|
||||
if (Option::host_mode != Option::HOST_UNKNOWN_MODE)
|
||||
applyHostMode();
|
||||
return QMAKE_CMDLINE_SUCCESS;
|
||||
}
|
||||
if (Option::host_mode == Option::HOST_WIN_MODE) {
|
||||
Option::dir_sep = "\\";
|
||||
Option::obj_ext = ".obj";
|
||||
} else {
|
||||
Option::dir_sep = "/";
|
||||
Option::obj_ext = ".o";
|
||||
}
|
||||
|
||||
void Option::applyHostMode()
|
||||
{
|
||||
if (Option::host_mode == Option::HOST_WIN_MODE) {
|
||||
Option::dir_sep = "\\";
|
||||
Option::obj_ext = ".obj";
|
||||
} else {
|
||||
Option::dir_sep = "/";
|
||||
Option::obj_ext = ".o";
|
||||
}
|
||||
return QMAKE_CMDLINE_SUCCESS;
|
||||
}
|
||||
|
||||
void Option::prepareProject(const QString &pfile)
|
||||
|
@ -106,7 +106,6 @@ struct Option
|
||||
|
||||
//both of these must be called..
|
||||
static int init(int argc=0, char **argv=0); //parse cmdline
|
||||
static void applyHostMode();
|
||||
static void prepareProject(const QString &pfile);
|
||||
static bool postProcessProject(QMakeProject *);
|
||||
|
||||
|
@ -1600,37 +1600,27 @@ QMakeProject::read(uchar cmd)
|
||||
|
||||
void QMakeProject::validateModes()
|
||||
{
|
||||
if (Option::host_mode == Option::HOST_UNKNOWN_MODE
|
||||
|| Option::target_mode == Option::TARG_UNKNOWN_MODE) {
|
||||
Option::HOST_MODE host_mode;
|
||||
if (Option::target_mode == Option::TARG_UNKNOWN_MODE) {
|
||||
Option::TARG_MODE target_mode;
|
||||
const QStringList &gen = base_vars.value("MAKEFILE_GENERATOR");
|
||||
if (gen.isEmpty()) {
|
||||
fprintf(stderr, "%s:%d: Using OS scope before setting MAKEFILE_GENERATOR\n",
|
||||
parser.file.toLatin1().constData(), parser.line_no);
|
||||
} else if (MetaMakefileGenerator::modesForGenerator(gen.first(),
|
||||
&host_mode, &target_mode)) {
|
||||
if (Option::host_mode == Option::HOST_UNKNOWN_MODE) {
|
||||
Option::host_mode = host_mode;
|
||||
Option::applyHostMode();
|
||||
}
|
||||
|
||||
if (Option::target_mode == Option::TARG_UNKNOWN_MODE) {
|
||||
const QStringList &tgt = base_vars.value("TARGET_PLATFORM");
|
||||
if (!tgt.isEmpty()) {
|
||||
const QString &os = tgt.first();
|
||||
if (os == "unix")
|
||||
Option::target_mode = Option::TARG_UNIX_MODE;
|
||||
else if (os == "macx")
|
||||
Option::target_mode = Option::TARG_MACX_MODE;
|
||||
else if (os == "win32")
|
||||
Option::target_mode = Option::TARG_WIN_MODE;
|
||||
else
|
||||
fprintf(stderr, "Unknown target platform specified: %s\n",
|
||||
os.toLatin1().constData());
|
||||
} else {
|
||||
Option::target_mode = target_mode;
|
||||
}
|
||||
} else if (MetaMakefileGenerator::modeForGenerator(gen.first(), &target_mode)) {
|
||||
const QStringList &tgt = base_vars.value("TARGET_PLATFORM");
|
||||
if (!tgt.isEmpty()) {
|
||||
const QString &os = tgt.first();
|
||||
if (os == "unix")
|
||||
Option::target_mode = Option::TARG_UNIX_MODE;
|
||||
else if (os == "macx")
|
||||
Option::target_mode = Option::TARG_MACX_MODE;
|
||||
else if (os == "win32")
|
||||
Option::target_mode = Option::TARG_WIN_MODE;
|
||||
else
|
||||
fprintf(stderr, "Unknown target platform specified: %s\n",
|
||||
os.toLatin1().constData());
|
||||
} else {
|
||||
Option::target_mode = target_mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1752,7 +1742,6 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QHash<QString, QString
|
||||
if(flags & IncludeFlagFeature) {
|
||||
if(!file.endsWith(Option::prf_ext))
|
||||
file += Option::prf_ext;
|
||||
validateModes(); // init dir_sep
|
||||
if(file.indexOf(QLatin1Char('/')) == -1 || !QFile::exists(file)) {
|
||||
QStringList *&feature_roots = all_feature_roots[host_build];
|
||||
if(!feature_roots) {
|
||||
@ -3737,7 +3726,6 @@ QStringList &QMakeProject::values(const QString &_var, QHash<QString, QStringLis
|
||||
var = ".BUILTIN." + var;
|
||||
place[var] = QStringList(qmake_getpwd());
|
||||
} else if(var == QLatin1String("DIR_SEPARATOR")) {
|
||||
validateModes();
|
||||
var = ".BUILTIN." + var;
|
||||
place[var] = QStringList(Option::dir_sep);
|
||||
} else if(var == QLatin1String("DIRLIST_SEPARATOR")) {
|
||||
|
Loading…
Reference in New Issue
Block a user