Changeset 967


Ignore:
Timestamp:
Aug 11, 2011, 9:05:41 PM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

qmake: Added replace functions fixpath_target and fixpath_local.

They match to Option::fixPathToTargetOS() and Option::fixPathToTargetOS()
respectively. These operations are frequently used to fix paths when generating
makefiles and having them in .pro allows to do many things that would otherwise
require patching qmake itself. See the next changeset for a real life example.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/qmake/project.cpp

    r847 r967  
    8484                  E_FIND, E_SYSTEM, E_UNIQUE, E_QUOTE, E_ESCAPE_EXPAND,
    8585                  E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, E_REPLACE,
    86                   E_SIZE, E_GENERATE_UID };
     86                  E_SIZE, E_GENERATE_UID, E_FIXPATH_TARGET, E_FIXPATH_LOCAL };
    8787QMap<QString, ExpandFunc> qmake_expandFunctions()
    8888{
     
    117117        qmake_expand_functions->insert("size", E_SIZE);
    118118        qmake_expand_functions->insert("generate_uid", E_GENERATE_UID);
     119        qmake_expand_functions->insert("fixpath_target", E_FIXPATH_TARGET);
     120        qmake_expand_functions->insert("fixpath_local", E_FIXPATH_LOCAL);
    119121    }
    120122    return *qmake_expand_functions;
     
    22502252        }
    22512253        break;
     2254    case E_FIXPATH_TARGET:
     2255    case E_FIXPATH_LOCAL:
     2256        if (args.count() < 1 || args.count() > 3) {
     2257            fprintf(stderr, "%s:%d: fixpath_%s(str) requires one argument.\n",
     2258                    parser.file.toLatin1().constData(), parser.line_no,
     2259                    func_t == E_FIXPATH_TARGET ? "target" : "local");
     2260        } else {
     2261            bool fix_env = true;
     2262            if(args.count() > 1)
     2263                fix_env = (args[1].toLower() == "true" || args[1].toInt());
     2264            bool canonical = true;
     2265            if(args.count() > 2)
     2266                canonical = (args[2].toLower() == "true" || args[1].toInt());
     2267            if(func_t == E_FIXPATH_TARGET)
     2268                ret += Option::fixPathToTargetOS(args[0], fix_env, canonical);
     2269            else
     2270                ret += Option::fixPathToLocalOS(args[0], fix_env, canonical);
     2271        }
     2272        break;
    22522273    default: {
    22532274        fprintf(stderr, "%s:%d: Unknown replace function: %s\n",
Note: See TracChangeset for help on using the changeset viewer.