Ignore:
Timestamp:
Aug 12, 2009, 3:19:40 AM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

mkspecs/os2-g++: 1) Generate a separate rule for the import library (for the split DLL function). 2) Make link_prl work (in particular, automatically add the required libraries from the .prl file of the library to the target that uses it).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/qmake/generators/os2/gnumake.cpp

    r94 r103  
    9595}
    9696
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
     125
     126
     127
     128
     129
     130
     131
     132
     133
     134
     135
     136
     137
     138
     139
     140
     141
     142
     143
     144
     145
     146
     147
     148
     149
     150
     151
     152
     153
     154
    97155bool GNUMakefileGenerator::findLibraries()
    98156{
     
    107165    }
    108166
    109     QStringList::Iterator it = l.begin();
    110     while (it != l.end()) {
    111         if ((*it).startsWith("-l")) {
    112             QString steam = (*it).mid(2), out;
     167    for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
     168        if((*it).startsWith("-L")) {
     169            dirs.append(QMakeLocalFileName((*it).mid(2)));
     170        } else {
     171            QString stem = *it, out;
     172
     173            if (stem.startsWith("-l"))
     174                stem = stem.mid(2);
     175
    113176            QString suffix;
    114             if (!project->isEmpty("QMAKE_" + steam.toUpper() + "_SUFFIX"))
    115                 suffix = project->first("QMAKE_" + steam.toUpper() + "_SUFFIX");
     177            if (!project->isEmpty("QMAKE_" + stem.toUpper() + "_SUFFIX"))
     178                suffix = project->first("QMAKE_" + stem.toUpper() + "_SUFFIX");
    116179            for (QList<QMakeLocalFileName>::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
    117                 QString extension;
    118                 int ver = findHighestVersion((*dir_it).local(), steam, "dll.lib|lib");
    119                 if (ver != -1)
    120                     extension += QString::number(ver);
    121                 extension += suffix;
    122                 if(QMakeMetaInfo::libExists((*dir_it).local() + Option::dir_sep + steam) ||
    123                     exists((*dir_it).local() + Option::dir_sep + steam + extension + ".lib") ||
    124                     exists((*dir_it).local() + Option::dir_sep + steam + extension + ".dll.lib")) {
    125                         out = (*it) + extension;
    126                         break;
     180                QString best = findBestVersion((*dir_it).local(), stem,
     181                                               QString("%1.lib").arg(suffix));
     182                if (!best.isEmpty()) {
     183                    out = best.prepend("-l");
     184                    break;
    127185                }
    128186            }
    129187            if (!out.isEmpty()) // We assume if it never finds it that its correct
    130                 (*it) = out;
    131             } else if((*it).startsWith("-L")) {
    132             dirs.append(QMakeLocalFileName((*it).mid(2)));
    133         }
    134 
    135         ++it;
    136     }
     188                if (!project->values("QMAKE_LIBS").contains(out))
     189                    (*it) = out;
     190        }
     191    }
     192
     193    QStringList l2 = project->values("QMAKE_INTERNAL_PRL_LIBS");
     194    for (QStringList::ConstIterator it = l2.begin(); it != l2.end(); ++it) {
     195        if (!l.contains(*it))
     196            l.append((*it));
     197    }
     198
    137199    return true;
    138200}
     
    383445            t << "\n\t" << var("QMAKE_RUN_RC2EXE");
    384446        }
    385         if (mode == DLL && !project->isEmpty("QMAKE_RUN_IMPLIB")) {
    386             t << "\n\t" << var("QMAKE_RUN_IMPLIB");
    387         }
    388447    }
    389448    if(!project->isEmpty("QMAKE_POST_LINK"))
     
    399458    if (!project->isEmpty("RES_FILE")) {
    400459        t << "RES_FILE      = " << valList(escapeFilePaths(project->values("RES_FILE"))) << endl;
    401     }
    402     if (mode == DLL && !project->isEmpty("QMAKE_RUN_IMPLIB")) {
    403         t << "TARGET_IMPLIB = $(basename $(DESTDIR_TARGET)).lib" << endl;
    404         project->values("QMAKE_CLEAN").append("$(TARGET_IMPLIB)");
    405460    }
    406461
     
    429484        project->values("POST_TARGETDEPS") += escapeFileVars("$(DEF_FILE)");
    430485    }
     486
     487
     488
     489
     490
     491
    431492}
    432493
     
    439500    }
    440501
    441     if (project->isEmpty("DEF_FILE") && mode == DLL) {
    442         /* generate a DEF file for the DLL when not supplied */
    443         t << escapeFileVars("$(DEF_FILE): ") << var("QMAKE_GENDEF_DEPS");
    444         t << valGlue(var("QMAKE_RUN_GENDEF").split(";;"), "\n\t", "\n\t", "") << endl;
     502    if (mode == DLL) {
     503        if (project->isEmpty("DEF_FILE")) {
     504            /* generate a DEF file for the DLL when not supplied */
     505            t << escapeFileVars("$(DEF_FILE): ") << var("QMAKE_GENDEF_DEPS");
     506            t << valGlue(var("QMAKE_RUN_GENDEF").split(";;"), "\n\t", "\n\t", "") << endl;
     507        }
     508        if (!project->isEmpty("QMAKE_RUN_IMPLIB")) {
     509            /* generate the import library */
     510            t << escapeFileVars("$(TARGET_IMPLIB): ") << escapeFileVars("$(DEF_FILE)");
     511            t << "\n\t" << var("QMAKE_RUN_IMPLIB") << endl;
     512        }
    445513    }
    446514}
     
    470538void GNUMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l)
    471539{
    472     if (var == "QMAKE_PRL_LIBS") {
    473         QString where = "QMAKE_LIBS";
    474         if (!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
    475             where = project->first("QMAKE_INTERNAL_PRL_LIBS");
    476         QStringList &out = project->values(where);
    477         for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
    478             out.removeAll((*it));
    479             out.append((*it));
    480         }
    481     } else {
    482         Win32MakefileGenerator::processPrlVariable(var, l);
    483     }
     540    // we don't do any processing here; everything we need is done in
     541    // GNUMakefileGenerator::findLibraries()
     542    return;
     543}
     544
     545void GNUMakefileGenerator::processPrlFiles()
     546{
     547    // we don't do any processing here; everything we need is done in
     548    // GNUMakefileGenerator::findLibraries()
     549    return;
    484550}
    485551
Note: See TracChangeset for help on using the changeset viewer.