#
# ==============================================================================
#  Name        : platform_paths.prf
#  Part of     : 
#  Interface   : Platform Path Definitions API for Qt/S60
#  Description : Predefined include paths to be used in the pro-files for the 
#                components in the layered model. There is one definition for
#                each layer. The pro-file should use the statement that is 
#                intended for the same layer as where the pro-file resides.
#
# Usage examples:
#
#     Note: this file gets automatically added to all Qt/S60 projects
#    
#     Variable usages to add the system include paths
#       
#       The include paths has to be related to the layer in which your SW 
#       resides. Thus as an example: a component residing in middleware
#       layer should use the MW specific macro.
#
#         INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
#         INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
#         INCLUDEPATH += $$OS_LAYER_SYSTEMINCLUDE
#
#       If there is a need to include public headers of some S60 component,
#       various *_EXPORT_PATH macros can be utilized:
#
#         INCLUDEPATH += $$OS_LAYER_PUBLIC_EXPORT_PATH(somecomponent)
#
#     Variables related to using various parts of stdapis:
#
#       To use STLLIB you need to have this in your pro-file:
#
#         QMAKE_CXXFLAGS.CW *= $$STLLIB_USAGE_CW_FLAGS
#         DEFINES *= $$STLLIB_USAGE_DEFINES
#
#       Depending on what module you are using from stdapis you need to have
#       one or more of the following variables in your pro-file.
#
#         INCLUDEPATH += $$OS_LAYER_LIBC_SYSTEMINCLUDE
#         INCLUDEPATH += $$OS_LAYER_GLIB_SYSTEMINCLUDE
#         INCLUDEPATH += $$OS_LAYER_SSL_SYSTEMINCLUDE
#         INCLUDEPATH += $$OS_LAYER_STDCPP_SYSTEMINCLUDE
#         INCLUDEPATH += $$OS_LAYER_BOOST_SYSTEMINCLUDE
#         INCLUDEPATH += $$OS_LAYER_DBUS_SYSTEMINCLUDE
#         INCLUDEPATH += $$OS_LAYER_LIBUTILITY_SYSTEMINCLUDE
#
#     These paths are primarily meant to be used as is in bld.inf and .mmp
#     files, so they do not contain epocroot when using official symbian
#     toolchains (symbian-abld or symbian-sbsv2).
#     For makefile based mkspecs, epocroot is prepended to all paths for
#     convenience.
#
#     To use paths defined here in other contexts that require epocroot to be
#     prepended always, such as exists checks, please use prependEpocroot
#     replacement function:
#
#         exists($$prependEpocroot($$MW_LAYER_PUBLIC_EXPORT_PATH(foobar.h)))
#
# ==============================================================================

symbian-abld|symbian-sbsv2 {
    epocroot_prefix = /
} else {
    epocroot_prefix = $${EPOCROOT}
}

symbian-abld|symbian-sbsv2:exists($${EPOCROOT}epoc32/include/platform_paths.prf) {

    # Symbian does not provide correct profiles for non-mmp based systems, so
    # we only should get in here with abld and sbsv2.

    # Load platform specific paths
    load($${EPOCROOT}epoc32/include/platform_paths.prf)

} else {  

    # No platform specific paths provided, use default paths

    exists($${EPOCROOT}epoc32/include/mw) { # New SF structure
    
        # ---------------------------------------
        # Location, where the applications layer specific public headers are exported
        # ---------------------------------------

        defineReplace(APP_LAYER_SDK_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/app/$$1)
        }
        defineReplace(APP_LAYER_PUBLIC_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/app/$$1)
        }

        # ---------------------------------------
        # Location, where the applications layer specific platform headers are exported
        # ---------------------------------------

        defineReplace(APP_LAYER_DOMAIN_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/platform/app/$$1)
        }
        defineReplace(APP_LAYER_PLATFORM_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/platform/app/$$1)
        }

        # ---------------------------------------
        # Location, where the middleware layer specific public headers are exported
        # ---------------------------------------

        defineReplace(MW_LAYER_SDK_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/mw/$$1)
        }
        defineReplace(MW_LAYER_PUBLIC_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/mw/$$1)
        }

        # ---------------------------------------
        # Location, where the middleware layer specific platform headers are exported
        # ---------------------------------------

        defineReplace(MW_LAYER_DOMAIN_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/platform/mw/$$1)
        }
        defineReplace(MW_LAYER_PLATFORM_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/platform/mw/$$1)
        }

        # ---------------------------------------
        # Location, where the os layer specific public headers are exported
        # ---------------------------------------

        defineReplace(OSEXT_LAYER_SDK_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/$$1)
        }
        # WARNING: If the following path changes see the exists() function around line 219
        defineReplace(OS_LAYER_PUBLIC_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/$$1)
        }

        # ---------------------------------------
        # Location, where the os specific platform headers are exported
        # ---------------------------------------

        defineReplace(OSEXT_LAYER_DOMAIN_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/platform/$$1)
        }
        defineReplace(OS_LAYER_PLATFORM_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/platform/$$1)
        }

        # ---------------------------------------
        #  General comments about the 3 define statements related to include paths:
        #  1) the /epoc32/include/oem is now defined there for backward compability.
        #     Once the directory is empty, the directory will be removed. However this 
        #     enables us to ensure that if you use these define statements => you do 
        #     not have to remove the statements later on, when the directory no longer 
        #     exists.
        #  2) These statements should be enough in normal cases. For certain specific 
        #     cases you might need to add some specific directory from /epoc32/include
        #     (for instance /epoc32/include/ecom).
        #     In normal cases the include staments in code should be relative to one of 
        #     the system include paths, but in certain cases, the included files requires
        #     that the subdirectory is also part of the system include paths.
        # ---------------------------------------

        # This variable defines the include paths, which are intended to be 
        # used in the pro-files that are part of the applications-layer. It includes all 
        # the needed directories from the /epoc32/include, that are valid ones for the 
        # application-layer components. 
        #
        # Applications layer is the last one in the list, since most likely the most of 
        # the headers come from middleware or os-layer  => thus they are first.

        APP_LAYER_SYSTEMINCLUDE = \
         $${epocroot_prefix}epoc32/include \
         $${epocroot_prefix}epoc32/include/mw \
         $${epocroot_prefix}epoc32/include/platform/mw \
         $${epocroot_prefix}epoc32/include/platform \
         $${epocroot_prefix}epoc32/include/app \
         $${epocroot_prefix}epoc32/include/platform/app \
         $${epocroot_prefix}epoc32/include/platform/loc \
         $${epocroot_prefix}epoc32/include/platform/mw/loc \
         $${epocroot_prefix}epoc32/include/platform/app/loc \
         $${epocroot_prefix}epoc32/include/platform/loc/sc \
         $${epocroot_prefix}epoc32/include/platform/mw/loc/sc \
         $${epocroot_prefix}epoc32/include/platform/app/loc/sc

        # This define statements defines the include paths, which are intended to be
        # used in the pro-files that are part of the middleware-layer. It includes all 
        # the needed directories from the /epoc32/include, that are valid ones for the 
        # middleware-layer components. 

        MW_LAYER_SYSTEMINCLUDE = \
         $${epocroot_prefix}epoc32/include \
         $${epocroot_prefix}epoc32/include/mw \
         $${epocroot_prefix}epoc32/include/platform/mw \
         $${epocroot_prefix}epoc32/include/platform \
         $${epocroot_prefix}epoc32/include/platform/loc \
         $${epocroot_prefix}epoc32/include/platform/mw/loc \
         $${epocroot_prefix}epoc32/include/platform/loc/sc \
         $${epocroot_prefix}epoc32/include/platform/mw/loc/sc

        # This define statements defines the include paths, which are intended to be
        # used in the pro-files that are part of the  osextensions-layer. It includes all
        # the needed directories from the /epoc32/include, that are valid ones for the
        # os-layer components. 

        OS_LAYER_SYSTEMINCLUDE = \
         $${epocroot_prefix}epoc32/include \
         $${epocroot_prefix}epoc32/include/platform \
         $${epocroot_prefix}epoc32/include/platform/loc \
         $${epocroot_prefix}epoc32/include/platform/loc/sc

        # This define statements defines the include paths, which are intended to be
        # used in the pro-files that are part of the os-layer. This is intended 
        # to be only used by those components which need to use in their mmp-file either
        # kern_ext.mmh or nkern_ext.mmh. Reason is that those
        # 2 files already contain the /epoc32/include  as system include path.

        OS_LAYER_KERNEL_SYSTEMINCLUDE = \
         $${epocroot_prefix}epoc32/include/platform


        # ---------------------------------------
        # Definitions that also define the systeminclude paths for various
        # part of stdapis. Append to INCLUDEPATH in pro-file.
        # ---------------------------------------

        OS_LAYER_LIBC_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis) \
                                      $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/sys)

        OS_LAYER_GLIB_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/glib-2.0) \
                                      $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/glib-2.0/glib) \
                                      $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/glib-2.0/gObject)

        OS_LAYER_SSL_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/openssl)

        # stlportv5 is preferred over stlport as it has the throwing version of operator new
        exists($${EPOCROOT}epoc32/include/stdapis/stlport) \
        :!exists($${EPOCROOT}epoc32/include/stdapis/stlportv5) {
            OS_LAYER_STDCPP_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/stlport)
        } else {
            OS_LAYER_STDCPP_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/stlportv5)
        }
        
        OS_LAYER_BOOST_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/boost)

        OS_LAYER_DBUS_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/dbus-1.0) \
                                      $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/dbus-1.0/dbus)

        OS_LAYER_LIBUTILITY_SYSTEMINCLUDE = $$OS_LAYER_PLATFORM_EXPORT_PATH(stdapis/utility)

    } else { # Old pre-SF structure

        # ---------------------------------------
        # Location, where the applications layer specific public headers are exported
        # ---------------------------------------

        defineReplace(APP_LAYER_SDK_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/applications/$$1)
        }
        defineReplace(APP_LAYER_PUBLIC_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/applications/$$1)
        }

        # ---------------------------------------
        # Location, where the applications layer specific platform headers are exported
        # ---------------------------------------

        defineReplace(APP_LAYER_DOMAIN_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/domain/applications/$$1)
        }
        defineReplace(APP_LAYER_PLATFORM_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/domain/applications/$$1)
        }

        # ---------------------------------------
        # Location, where the middleware layer specific public headers are exported
        # ---------------------------------------

        defineReplace(MW_LAYER_SDK_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/middleware/$$1)
        }
        defineReplace(MW_LAYER_PUBLIC_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/middleware/$$1)
        }

        # ---------------------------------------
        # Location, where the middleware layer specific platform headers are exported
        # ---------------------------------------

        defineReplace(MW_LAYER_DOMAIN_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/domain/middleware/$$1)
        }
        defineReplace(MW_LAYER_PLATFORM_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/domain/middleware/$$1)
        }

        # ---------------------------------------
        # Location, where the os layer specific public headers are exported
        # ---------------------------------------

        defineReplace(OSEXT_LAYER_SDK_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/osextensions/$$1)
        }
        # WARNING: If the following path changes see the exists() function around line 430
        defineReplace(OS_LAYER_PUBLIC_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/osextensions/$$1)
        }

        # ---------------------------------------
        # Location, where the os specific platform headers are exported
        # ---------------------------------------

        defineReplace(OSEXT_LAYER_DOMAIN_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/domain/osextensions/$$1)
        }
        defineReplace(OS_LAYER_PLATFORM_EXPORT_PATH) {
             return ($${epocroot_prefix}epoc32/include/domain/osextensions/$$1)
        }

        # ---------------------------------------
        #  General comments about the 3 define statements related to include paths:
        #  1) the /epoc32/include/oem is now defined there for backward compability.
        #     Once the directory is empty, the directory will be removed. However this 
        #     enables us to ensure that if you use these define statements => you do 
        #     not have to remove the statements later on, when the directory no longer 
        #     exists.
        #  2) These statements should be enough in normal cases. For certain specific 
        #     cases you might need to add some specific directory from /epoc32/include
        #     (for instance /epoc32/include/ecom).
        #     In normal cases the include staments in code should be relative to one of 
        #     the system include paths, but in certain cases, the included files requires
        #     that the subdirectory is also part of the system include paths.
        # ---------------------------------------

        # This variable defines the include paths, which are intended to be 
        # used in the pro-files that are part of the applications-layer. It includes all 
        # the needed directories from the /epoc32/include, that are valid ones for the 
        # application-layer components. 
        #
        # Applications layer is the last one in the list, since most likely the most of 
        # the headers come from middleware or os-layer  => thus they are first.

        APP_LAYER_SYSTEMINCLUDE = \
         $${epocroot_prefix}epoc32/include \
         $${epocroot_prefix}epoc32/include/oem \
         $${epocroot_prefix}epoc32/include/middleware \
         $${epocroot_prefix}epoc32/include/domain/middleware \
         $${epocroot_prefix}epoc32/include/osextensions \
         $${epocroot_prefix}epoc32/include/domain/osextensions \
         $${epocroot_prefix}epoc32/include/applications \
         $${epocroot_prefix}epoc32/include/domain/applications \
         $${epocroot_prefix}epoc32/include/domain/osextensions/loc \
         $${epocroot_prefix}epoc32/include/domain/middleware/loc \
         $${epocroot_prefix}epoc32/include/domain/applications/loc \
         $${epocroot_prefix}epoc32/include/domain/osextensions/loc/sc \
         $${epocroot_prefix}epoc32/include/domain/middleware/loc/sc \
         $${epocroot_prefix}epoc32/include/domain/applications/loc/sc

        # This define statements defines the include paths, which are intended to be
        # used in the pro-files that are part of the middleware-layer. It includes all 
        # the needed directories from the /epoc32/include, that are valid ones for the 
        # middleware-layer components. 

        MW_LAYER_SYSTEMINCLUDE = \
         $${epocroot_prefix}epoc32/include \
         $${epocroot_prefix}epoc32/include/oem \
         $${epocroot_prefix}epoc32/include/middleware \
         $${epocroot_prefix}epoc32/include/domain/middleware \
         $${epocroot_prefix}epoc32/include/osextensions \
         $${epocroot_prefix}epoc32/include/domain/osextensions \
         $${epocroot_prefix}epoc32/include/domain/osextensions/loc \
         $${epocroot_prefix}epoc32/include/domain/middleware/loc \
         $${epocroot_prefix}epoc32/include/domain/osextensions/loc/sc \
         $${epocroot_prefix}epoc32/include/domain/middleware/loc/sc

        # This define statements defines the include paths, which are intended to be
        # used in the pro-files that are part of the  osextensions-layer. It includes all
        # the needed directories from the /epoc32/include, that are valid ones for the
        # os-layer components. 

        OS_LAYER_SYSTEMINCLUDE = \
         $${epocroot_prefix}epoc32/include \
         $${epocroot_prefix}epoc32/include/oem \
         $${epocroot_prefix}epoc32/include/osextensions \
         $${epocroot_prefix}epoc32/include/domain/osextensions \
         $${epocroot_prefix}epoc32/include/domain/osextensions/loc \
         $${epocroot_prefix}epoc32/include/domain/osextensions/loc/sc

        # This define statements defines the include paths, which are intended to be
        # used in the pro-files that are part of the os-layer. This is intended 
        # to be only used by those components which need to use in their mmp-file either
        # kern_ext.mmh or nkern_ext.mmh. Reason is that those
        # 2 files already contain the /epoc32/include  as system include path.

        OS_LAYER_KERNEL_SYSTEMINCLUDE = \
         $${epocroot_prefix}epoc32/include/oem \
         $${epocroot_prefix}epoc32/include/osextensions \
         $${epocroot_prefix}epoc32/include/domain/osextensions


        # ---------------------------------------
        # Definitions that also define the systeminclude paths for various
        # part of stdapis. Append to INCLUDEPATH in pro-file.
        # ---------------------------------------

        OS_LAYER_LIBC_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis) \
                                      $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/sys) \
                                      $${epocroot_prefix}epoc32/include/stdapis \
                                      $${epocroot_prefix}epoc32/include/stdapis/sys

        OS_LAYER_GLIB_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/glib-2.0) \
                                      $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/glib-2.0/glib) \
                                      $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/glib-2.0/gObject) \
                                      $${epocroot_prefix}epoc32/include/stdapis/glib-2.0 \
                                      $${epocroot_prefix}epoc32/include/stdapis/glib-2.0/glib \
                                      $${epocroot_prefix}epoc32/include/stdapis/glib-2.0/gObject

        OS_LAYER_SSL_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/openssl) \
                                     $${epocroot_prefix}epoc32/include/stdapis/openssl

        # stlportv5 is preferred over stlport as it has the throwing version of operator new
        OS_LAYER_STDCPP_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/stlportv5) \
                                        $${epocroot_prefix}epoc32/include/stdapis/stlportv5
        exists($${EPOCROOT}epoc32/include/osextensions/stdapis/stlport) \
        |exists($${EPOCROOT}epoc32/include/stdapis/stlport) {
            !exists($${EPOCROOT}epoc32/include/osextensions/stdapis/stlportv5) \
            :!exists($${EPOCROOT}epoc32/include/stdapis/stlportv5) {
                OS_LAYER_STDCPP_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/stlport) \
                                                $${epocroot_prefix}epoc32/include/stdapis/stlport
            }
        }
        
        OS_LAYER_BOOST_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/boost) \
                                       $${epocroot_prefix}epoc32/include/stdapis/boost

        OS_LAYER_DBUS_SYSTEMINCLUDE = $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/dbus-1.0) \
                                      $$OS_LAYER_PUBLIC_EXPORT_PATH(stdapis/dbus-1.0/dbus) \
                                      $${epocroot_prefix}epoc32/include/stdapis/dbus-1.0 \
                                      $${epocroot_prefix}epoc32/include/stdapis/dbus-1.0/dbus

        OS_LAYER_LIBUTILITY_SYSTEMINCLUDE = $$OS_LAYER_PLATFORM_EXPORT_PATH(stdapis/utility) \
                                            $${epocroot_prefix}epoc32/include/stdapis/utility

    } 

    # Definitions common to both structures

    # ---------------------------------------
    # Definitions to export IBY files to different folders where they will be taken
    # to ROM image
    # ---------------------------------------

    defineReplace(CORE_APP_LAYER_IBY_EXPORT_PATH) {
        return($${epocroot_prefix}epoc32/rom/include/core/app/$$1)
    }
    defineReplace(CORE_MW_LAYER_IBY_EXPORT_PATH) {
        return($${epocroot_prefix}epoc32/rom/include/core/mw/$$1)
    }

    defineReplace(LANGUAGE_APP_LAYER_IBY_EXPORT_PATH) {
        return($${epocroot_prefix}epoc32/rom/include/language/app/$$1)
    }
    defineReplace(LANGUAGE_MW_LAYER_IBY_EXPORT_PATH) {
        return($${epocroot_prefix}epoc32/rom/include/language/mw/$$1)
    }

    defineReplace(CUSTOMER_APP_LAYER_IBY_EXPORT_PATH) {
        return($${epocroot_prefix}epoc32/rom/include/customer/app/$$1)
    }
    defineReplace(CUSTOMER_MW_LAYER_IBY_EXPORT_PATH) {
        return($${epocroot_prefix}epoc32/rom/include/customer/mw/$$1)
    }

    defineReplace(CUSTOMER_VARIANT_APP_LAYER_IBY_EXPORT_PATH) {
        return($${epocroot_prefix}epoc32/rom/include/customervariant/app/$$1)
    }
    defineReplace(CUSTOMER_VARIANT_MW_LAYER_IBY_EXPORT_PATH) {
        return($${epocroot_prefix}epoc32/rom/include/customervariant/mw/$$1)
    }

    # You need to define the following in pro-file, if you are using the stllib:
    # QMAKE_CXXFLAGS.CW *= $$STLLIB_USAGE_CW_FLAGS
    # DEFINES *= $$STLLIB_USAGE_DEFINES
    STLLIB_USAGE_CW_FLAGS = "-wchar_t on"
    STLLIB_USAGE_DEFINES = _WCHAR_T_DECLARED

    # Smart prepend of EPOCROOT to a string
    defineReplace(prependEpocroot) {
        contains(1, ^$${EPOCROOT}) {
            return($$1)
        } else {
            return($${EPOCROOT}$$replace(1,"^/",))
        }
    }

}
