Changeset 846 for trunk/qmake/option.cpp


Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/qmake/option.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    8585//all modes
    8686QString Option::qmake_abslocation;
    87 int Option::warn_level = WarnLogic;
     87int Option::warn_level = WarnLogic;
    8888int Option::debug_level = 0;
    8989QFile Option::output;
    9090QString Option::output_dir;
    91 bool Option::recursive = false;
     91;
    9292QStringList Option::before_user_vars;
    9393QStringList Option::after_user_vars;
     
    9797QString Option::user_template_prefix;
    9898QStringList Option::shellPath;
    99 #if defined(Q_OS_WIN32)
    100 Option::TARG_MODE Option::target_mode = Option::TARG_WIN_MODE;
    101 #elif defined(Q_OS_OS2)
    102 Option::TARG_MODE Option::target_mode = Option::TARG_OS2_MODE;
    103 #elif defined(Q_OS_MAC)
    104 Option::TARG_MODE Option::target_mode = Option::TARG_MACX_MODE;
    105 #else
    106 Option::TARG_MODE Option::target_mode = Option::TARG_UNIX_MODE;
    107 #endif
     99Option::HOST_MODE Option::host_mode = Option::HOST_UNKNOWN_MODE;
     100Option::TARG_MODE Option::target_mode = Option::TARG_UNKNOWN_MODE;
     101bool Option::target_mode_overridden = false;
    108102
    109103//QMAKE_*_PROPERTY stuff
     
    129123static Option::QMAKE_MODE default_mode(QString progname)
    130124{
    131     int s = progname.lastIndexOf(Option::dir_sep);
     125    int s = progname.lastIndexOf();
    132126    if(s != -1)
    133127        progname = progname.right(progname.length() - (s + 1));
     
    137131        return Option::QMAKE_QUERY_PROPERTY;
    138132    return Option::QMAKE_GENERATE_MAKEFILE;
     133
     134
     135
     136
     137
     138
     139
     140
     141
     142
     143
     144
     145
     146
    139147}
    140148
     
    163171            "\n"
    164172            "Warnings Options:\n"
    165             "  -Wnone         Turn off all warnings\n"
     173            "  -Wnone         Turn off all warnings; specific ones may be re-enabled by\n"
     174            "                 later -W options\n"
    166175            "  -Wall          Turn on all warnings\n"
    167176            "  -Wparser       Turn on parser warnings\n"
    168             "  -Wlogic        Turn on logic warnings\n"
     177            "  -Wlogic        Turn on logic warnings (on by default)\n"
     178            "  -Wdeprecated   Turn on deprecation warnings (on by default)\n"
    169179            "\n"
    170180            "Options:\n"
     
    173183            "   * before [files].                                                     *\n"
    174184            "  -o file        Write output to file\n"
    175             "  -unix          Run in unix mode\n"
    176             "  -win32         Run in win32 mode\n"
    177             "  -os2           Run in OS/2 mode\n"
    178             "  -macx          Run in Mac OS X mode\n"
    179185            "  -d             Increase debug level\n"
    180186            "  -t templ       Overrides TEMPLATE as templ\n"
     
    213219                bool specified = true;
    214220                if(opt == "project") {
    215                     Option::recursive = true;
     221                    Option::recursive = ;
    216222                    Option::qmake_mode = Option::QMAKE_GENERATE_PROJECT;
    217223                } else if(opt == "prl") {
     
    240246            } else if(opt == "tp" || opt == "template_prefix") {
    241247                Option::user_template_prefix = argv[++x];
    242             } else if(opt == "mac9") {
    243                 Option::target_mode = TARG_MAC9_MODE;
    244248            } else if(opt == "macx") {
     249
     250
    245251                Option::target_mode = TARG_MACX_MODE;
     252
    246253            } else if(opt == "unix") {
     254
     255
    247256                Option::target_mode = TARG_UNIX_MODE;
     257
    248258            } else if(opt == "win32") {
     259
     260
    249261                Option::target_mode = TARG_WIN_MODE;
     262
    250263            } else if(opt == "os2") {
     264
     265
    251266                Option::target_mode = TARG_OS2_MODE;
     267
    252268            } else if(opt == "d") {
    253269                Option::debug_level++;
     
    270286            } else if(opt == "Wlogic") {
    271287                Option::warn_level |= WarnLogic;
     288
     289
    272290            } else if(opt == "Wnone") {
    273291                Option::warn_level = WarnNone;
    274292            } else if(opt == "r" || opt == "recursive") {
    275                 Option::recursive = true;
    276             } else if(opt == "norecursive") {
    277                 Option::recursive = false;
     293                Option::recursive = ;
     294            } else if(opt == "norecursive") {
     295                Option::recursive = ;
    278296            } else if(opt == "config") {
    279297                Option::user_configs += argv[++x];
     
    292310                        Option::mkfile::do_dep_heuristics = false;
    293311                    } else if(opt == "E") {
     312
    294313                        Option::mkfile::do_preprocess = true;
    295314                    } else if(opt == "cache") {
     
    328347                        arg = fi.filePath();
    329348                    if(Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE ||
    330                        Option::qmake_mode == Option::QMAKE_GENERATE_PRL)
     349                       Option::qmake_mode == Option::QMAKE_GENERATE_PRL) {
     350                        if(fi.isDir()) {
     351                            QString proj = detectProjectFile(arg);
     352                            if (!proj.isNull())
     353                                arg = proj;
     354                        }
    331355                        Option::mkfile::project_files.append(arg);
    332                     else if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT)
     356                   
    333357                        Option::projfile::project_dirs.append(arg);
    334                     else
     358                   
    335359                        handled = false;
     360
    336361                }
    337362                if(!handled) {
     
    401426    Option::dirlist_sep = ";";
    402427    Option::shellPath = detectShellPath();
     428
    403429#else
    404430    Option::dirlist_sep = ":";
     431
    405432#endif
    406433    Option::sysenv_mod = "QMAKE_ENV_";
     
    508535        //try REALLY hard to do it for them, lazy..
    509536        if(Option::mkfile::project_files.isEmpty()) {
    510             QString pwd = qmake_getpwd(),
    511                    proj = pwd + "/" + pwd.right(pwd.length() - (pwd.lastIndexOf('/') + 1)) + Option::pro_ext;
    512             if(QFile::exists(proj)) {
     537            QString proj = detectProjectFile(qmake_getpwd());
     538            if(!proj.isNull())
    513539                Option::mkfile::project_files.append(proj);
    514             } else { //last try..
    515                 QStringList profiles = QDir(pwd).entryList(QStringList("*" + Option::pro_ext));
    516                 if(profiles.count() == 1)
    517                     Option::mkfile::project_files.append(pwd + "/" + profiles[0]);
    518             }
    519540#ifndef QT_BUILD_QMAKE_LIBRARY
    520541            if(Option::mkfile::project_files.isEmpty()) {
     
    524545#endif
    525546        }
     547
     548
     549
     550
     551
     552
     553
     554
     555
     556
     557
     558
     559
     560
    526561    }
    527562
    528563    //defaults for globals
    529     if(Option::target_mode == Option::TARG_WIN_MODE ||
    530        Option::target_mode == Option::TARG_OS2_MODE) {
    531         Option::dir_sep = "\\";
    532         Option::obj_ext = ".obj";
    533         Option::res_ext = ".res";
    534     } else {
    535         if(Option::target_mode == Option::TARG_MAC9_MODE)
    536             Option::dir_sep = ":";
    537         else
    538             Option::dir_sep = "/";
    539         Option::obj_ext = ".o";
    540     }
    541     Option::qmake_abslocation = Option::fixPathToTargetOS(Option::qmake_abslocation);
     564    if (Option::host_mode != Option::HOST_UNKNOWN_MODE)
     565        applyHostMode();
    542566    return QMAKE_CMDLINE_SUCCESS;
     567
     568
     569
     570
     571
     572
     573
     574
     575
     576
     577
     578
    543579}
    544580
     
    599635Option::fixString(QString string, uchar flags)
    600636{
    601     const QString orig_string = string;
     637    const QString orig_string = string;
    602638    static QHash<FixStringCacheKey, QString> *cache = 0;
    603639    if(!cache) {
Note: See TracChangeset for help on using the changeset viewer.