src/functions.prf
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 19 Apr 2010 14:02:13 +0300
changeset 0 16d8024aca5e
permissions -rw-r--r--
Revision: 201011 Kit: 201015

#
#############################################################################
##
## Copyright (C) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
## Contact: Nokia Corporation (developer.feedback@nokia.com)
##
## This file is part of the UI Extensions for Mobile.
##
## GNU Lesser General Public License Usage
## This file may be used under the terms of the GNU Lesser General Public
## License version 2.1 as published by the Free Software Foundation and
## appearing in the file LICENSE.LGPL included in the packaging of this file.
## Please review the following information to ensure the GNU Lesser General
## Public License version 2.1 requirements will be met:
## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
##
## In addition, as a special exception, Nokia gives you certain additional
## rights.  These rights are described in the Nokia Qt LGPL Exception
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
##
## If you have questions regarding the use of this file, please contact
## Nokia at developer.feedback@nokia.com.
##
#############################################################################
#

defineReplace(hbLibraryTarget) {
    unset(LIBRARY_NAME)
    LIBRARY_NAME = $$1
    # the following leads to ugly vcproj names but had to be commented
    # out, because it broke vcproj generator dependency checks
    #!debug_and_release|build_pass { <-- 
        CONFIG(debug, debug|release) {
            mac:RET = $$member(LIBRARY_NAME, 0)_debug
   	        else:win32:RET = $$member(LIBRARY_NAME, 0)d
        }
    #}
    isEmpty(RET):RET = $$LIBRARY_NAME
    return($$RET)
}

# params: <collection/library>
# eg. hbAddLibrary(hbcore/HbCore)
defineTest(hbAddLibrary) {
    PARTS = $$split(1, "/")
    COLLECTION = $$lower($$first(PARTS))
    LIBRARY = $$last(PARTS)

    INCLUDEPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}
    INCLUDEPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}/private
    DEPENDPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}
    DEPENDPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}/private

    LIBS *= -L$${HB_BUILD_DIR}/lib
    LIBS *= -l$$hbLibraryTarget($$LIBRARY)
    unix:!symbian:!isEmpty(QMAKE_RPATH):QMAKE_LFLAGS *= $${QMAKE_RPATH}$${HB_BUILD_DIR}/lib
    unix:HB_COVERAGE_EXCLUDE += \"*/$$COLLECTION/*\"

    export(LIBS)
    export(INCLUDEPATH)
    export(DEPENDPATH)
    export(QMAKE_LFLAGS)
    export(HB_COVERAGE_EXCLUDE)
    return(true)
}

# params: <collection>
# NOTE: PUBLIC_HEADERS, INTERNAL_HEADERS, CONVENIENCE_HEADERS
# eg. hbExportHeaders(hbcore)
defineTest(hbExportHeaders) {
    for(PUBLIC_HEADER, PUBLIC_HEADERS) {
        PUBLIC_HEADER = $$section(PUBLIC_HEADER, ":", 1)
        EXPORT_PATH = $$sprintf($$HB_EXPORT_DIR, $$1, $$basename(PUBLIC_HEADER))
        BLD_INF_RULES.prj_exports *= "$$PUBLIC_HEADER $$EXPORT_PATH"
    }
    # DO NOT EXPORT PRIVATE HEADERS!
    #for(INTERNAL_HEADER, INTERNAL_HEADERS) {
    #    INTERNAL_HEADER = $$section(INTERNAL_HEADER, ":", 1)
    #    EXPORT_PATH = $$sprintf($$HB_PRIVATE_EXPORT_DIR, $$1, $$basename(INTERNAL_HEADER))
    #    BLD_INF_RULES.prj_exports *= "$$INTERNAL_HEADER $$EXPORT_PATH"
    #}
    for(CONVENIENCE_HEADER, CONVENIENCE_HEADERS) {
        CONVENIENCE_HEADER = $$section(CONVENIENCE_HEADER, ":", 1)
        EXPORT_PATH = $$sprintf($$HB_EXPORT_DIR, $$1, $$basename(CONVENIENCE_HEADER))
        BLD_INF_RULES.prj_exports *= "$$CONVENIENCE_HEADER $$EXPORT_PATH"
    }
    export(BLD_INF_RULES.prj_exports)
    return(true)
}

# params: <path>
# eg. features.path = $$hbNativePath($$[QMAKE_MKSPECS]/features)
defineReplace(hbNativePath) {
    symbian|win32:!win32-g++ {
        unixstyle = false
    } else:win32-g++:isEmpty(QMAKE_SH) {
        unixstyle = false
    } else {
        unixstyle = true
    }
    $$unixstyle {
        return($$quote(\"$$replace(1, "\\", "/")\"))
    } else {
        return($$quote(\"$$replace(1, "/", "\\")\"))
    }
}