summaryrefslogtreecommitdiff
path: root/qmake/generators/projectgenerator.cpp
Unidiff
Diffstat (limited to 'qmake/generators/projectgenerator.cpp') (more/less context) (show whitespace changes)
-rw-r--r--qmake/generators/projectgenerator.cpp36
1 files changed, 21 insertions, 15 deletions
diff --git a/qmake/generators/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp
index 1515216..1c17379 100644
--- a/qmake/generators/projectgenerator.cpp
+++ b/qmake/generators/projectgenerator.cpp
@@ -1,14 +1,12 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$
3** 2**
4** Definition of ________ class.
5** 3**
6** Created : 970521 4** Implementation of ProjectGenerator class.
7** 5**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 6** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
9** 7**
10** This file is part of the network module of the Qt GUI Toolkit. 8** This file is part of qmake.
11** 9**
12** This file may be distributed under the terms of the Q Public License 10** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file 11** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file. 12** LICENSE.QPL included in the packaging of this file.
@@ -156,8 +154,9 @@ ProjectGenerator::init()
156 if(!file_count) { //shall we try a subdir? 154 if(!file_count) { //shall we try a subdir?
157 QStringList dirs = Option::projfile::project_dirs; 155 QStringList dirs = Option::projfile::project_dirs;
158 if(Option::projfile::do_pwd) 156 if(Option::projfile::do_pwd)
159 dirs.prepend("."); 157 dirs.prepend(".");
158 const QString out_file = fileFixify(Option::output.name());
160 for(QStringList::Iterator pd = dirs.begin(); pd != dirs.end(); pd++) { 159 for(QStringList::Iterator pd = dirs.begin(); pd != dirs.end(); pd++) {
161 if(QFile::exists((*pd))) { 160 if(QFile::exists((*pd))) {
162 QString newdir = (*pd); 161 QString newdir = (*pd);
163 QFileInfo fi(newdir); 162 QFileInfo fi(newdir);
@@ -170,16 +169,19 @@ ProjectGenerator::init()
170 } else { 169 } else {
171 QDir d(newdir, "*.pro"); 170 QDir d(newdir, "*.pro");
172 d.setFilter(QDir::Files); 171 d.setFilter(QDir::Files);
173 for(int i = 0; i < (int)d.count(); i++) { 172 for(int i = 0; i < (int)d.count(); i++) {
174 QString nd = newdir + QDir::separator() + d[i]; 173 QString nd = newdir;
174 if(nd == ".")
175 nd = "";
176 else if(!nd.isEmpty() && !nd.endsWith(QString(QChar(QDir::separator()))))
177 nd += QDir::separator();
178 nd += d[i];
175 fileFixify(nd); 179 fileFixify(nd);
176 if(d[i] != "." && d[i] != ".." && !subdirs.contains(nd)) { 180 if(d[i] != "." && d[i] != ".." && !subdirs.contains(nd) && !out_file.endsWith(nd))
177 if(newdir + d[i] != Option::output_dir + Option::output.name())
178 subdirs.append(nd); 181 subdirs.append(nd);
179 } 182 }
180 } 183 }
181 }
182 if(Option::projfile::do_recursive) { 184 if(Option::projfile::do_recursive) {
183 QDir d(newdir); 185 QDir d(newdir);
184 d.setFilter(QDir::Dirs); 186 d.setFilter(QDir::Dirs);
185 for(int i = 0; i < (int)d.count(); i++) { 187 for(int i = 0; i < (int)d.count(); i++) {
@@ -323,9 +325,9 @@ ProjectGenerator::init()
323 found = TRUE; 325 found = TRUE;
324 break; 326 break;
325 } 327 }
326 } 328 }
327 if(!found && (*val_it).endsWith(Option::moc_ext)) 329 if(!found && (*val_it).endsWith(Option::cpp_moc_ext))
328 found = TRUE; 330 found = TRUE;
329 if(found) 331 if(found)
330 val_it = l.remove(val_it); 332 val_it = l.remove(val_it);
331 else 333 else
@@ -390,9 +392,9 @@ ProjectGenerator::addFile(QString file)
390 QString dir; 392 QString dir;
391 int s = file.findRev(Option::dir_sep); 393 int s = file.findRev(Option::dir_sep);
392 if(s != -1) 394 if(s != -1)
393 dir = file.left(s+1); 395 dir = file.left(s+1);
394 if(file.mid(dir.length(), Option::moc_mod.length()) == Option::moc_mod) 396 if(file.mid(dir.length(), Option::h_moc_mod.length()) == Option::h_moc_mod)
395 return FALSE; 397 return FALSE;
396 398
397 QString where; 399 QString where;
398 for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) { 400 for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) {
@@ -434,9 +436,9 @@ ProjectGenerator::addFile(QString file)
434} 436}
435 437
436 438
437QString 439QString
438ProjectGenerator::getWritableVar(const QString &v, bool /*fixPath*/) 440ProjectGenerator::getWritableVar(const QString &v, bool fixPath)
439{ 441{
440 QStringList &vals = project->variables()[v]; 442 QStringList &vals = project->variables()[v];
441 if(vals.isEmpty()) 443 if(vals.isEmpty())
442 return ""; 444 return "";
@@ -454,12 +456,16 @@ ProjectGenerator::getWritableVar(const QString &v, bool /*fixPath*/)
454 for(unsigned int i = 0; i < ret.length(); i++) 456 for(unsigned int i = 0; i < ret.length(); i++)
455 spaces += " "; 457 spaces += " ";
456 join = vals.join(" \\\n" + spaces); 458 join = vals.join(" \\\n" + spaces);
457 } 459 }
460#if 0
458 // ### Commented out for now so that project generation works. 461 // ### Commented out for now so that project generation works.
459 // Sam: can you look at why this was needed? 462 // Sam: it had to do with trailing \'s (ie considered continuation lines)
460 /* if(fixPath) 463 if(fixPath)
461 join = join.replace("\\", "/");*/ 464 join = join.replace("\\", "/");
465#else
466 Q_UNUSED(fixPath);
467#endif
462 return ret + join + "\n"; 468 return ret + join + "\n";
463} 469}
464 470
465bool 471bool