mkspecs/hb_functions.prf
branchGCC_SURGE
changeset 15 f378acbc9cfb
parent 7 923ff622b8b9
child 21 4633027730f5
child 34 ed14f46c0e55
equal deleted inserted replaced
9:730c025d4b77 15:f378acbc9cfb
    46     PARTS = $$split(1, "/")
    46     PARTS = $$split(1, "/")
    47     COLLECTION = $$lower($$first(PARTS))
    47     COLLECTION = $$lower($$first(PARTS))
    48     LIBRARY = $$last(PARTS)
    48     LIBRARY = $$last(PARTS)
    49 
    49 
    50     INCLUDEPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}
    50     INCLUDEPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}
       
    51     INCLUDEPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}/restricted
    51     INCLUDEPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}/private
    52     INCLUDEPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}/private
    52     DEPENDPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}
    53     DEPENDPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}
       
    54     DEPENDPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}/restricted
    53     DEPENDPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}/private
    55     DEPENDPATH *= $${HB_BUILD_DIR}/include/$${COLLECTION}/private
    54 
    56 
    55     LIBS *= -L$${HB_BUILD_DIR}/lib
    57     LIBS *= -L$${HB_BUILD_DIR}/lib
    56     LIBS *= -l$$hbLibraryTarget($$LIBRARY)
    58     LIBS *= -l$$hbLibraryTarget($$LIBRARY)
    57     QMAKE_RPATHDIR *= $${HB_BUILD_DIR}/lib
       
    58     unix:HB_COVERAGE_EXCLUDE += \"*/$$COLLECTION/*\"
    59     unix:HB_COVERAGE_EXCLUDE += \"*/$$COLLECTION/*\"
    59 
    60 
    60     export(LIBS)
    61     export(LIBS)
    61     export(INCLUDEPATH)
    62     export(INCLUDEPATH)
    62     export(DEPENDPATH)
    63     export(DEPENDPATH)
    63     export(QMAKE_RPATHDIR)
       
    64     export(HB_COVERAGE_EXCLUDE)
    64     export(HB_COVERAGE_EXCLUDE)
    65     return(true)
    65     return(true)
    66 }
    66 }
    67 
    67 
    68 # params: <collection>
    68 # params: <collection>
    69 # NOTE: PUBLIC_HEADERS, INTERNAL_HEADERS, CONVENIENCE_HEADERS
    69 # NOTE: exports PUBLIC_HEADERS, RESTRICTED_HEADERS and CONVENIENCE_HEADERS
    70 # eg. hbExportHeaders(hbcore)
    70 # eg. hbExportHeaders(hbcore)
    71 defineTest(hbExportHeaders) {
    71 defineTest(hbExportHeaders) {
    72     for(PUBLIC_HEADER, PUBLIC_HEADERS) {
    72     for(PUBLIC_HEADER, PUBLIC_HEADERS) {
    73         PUBLIC_HEADER = $$section(PUBLIC_HEADER, ":", 1)
    73         PUBLIC_HEADER = $$section(PUBLIC_HEADER, ":", 1)
    74         EXPORT_PATH = $$sprintf($$HB_EXPORT_DIR, $$1, $$basename(PUBLIC_HEADER))
    74         EXPORT_PATH = $$sprintf($$HB_EXPORT_DIR, $$1, $$basename(PUBLIC_HEADER))
    75         BLD_INF_RULES.prj_exports *= "$$PUBLIC_HEADER $$EXPORT_PATH"
    75         BLD_INF_RULES.prj_exports *= "$$PUBLIC_HEADER $$EXPORT_PATH"
    76     }
    76     }
    77     # DO NOT EXPORT PRIVATE HEADERS!
    77     for(RESTRICTED_HEADER, RESTRICTED_HEADERS) {
    78     #for(INTERNAL_HEADER, INTERNAL_HEADERS) {
    78         RESTRICTED_HEADER = $$section(RESTRICTED_HEADER, ":", 1)
    79     #    INTERNAL_HEADER = $$section(INTERNAL_HEADER, ":", 1)
    79         EXPORT_PATH = $$sprintf($$HB_RESTRICTED_EXPORT_DIR, $$1, $$basename(RESTRICTED_HEADER))
    80     #    EXPORT_PATH = $$sprintf($$HB_PRIVATE_EXPORT_DIR, $$1, $$basename(INTERNAL_HEADER))
    80         BLD_INF_RULES.prj_exports *= "$$RESTRICTED_HEADER $$EXPORT_PATH"
    81     #    BLD_INF_RULES.prj_exports *= "$$INTERNAL_HEADER $$EXPORT_PATH"
    81     }
    82     #}
       
    83     for(CONVENIENCE_HEADER, CONVENIENCE_HEADERS) {
    82     for(CONVENIENCE_HEADER, CONVENIENCE_HEADERS) {
    84         CONVENIENCE_HEADER = $$section(CONVENIENCE_HEADER, ":", 1)
    83         CONVENIENCE_HEADER = $$section(CONVENIENCE_HEADER, ":", 1)
    85         EXPORT_PATH = $$sprintf($$HB_EXPORT_DIR, $$1, $$basename(CONVENIENCE_HEADER))
    84         EXPORT_PATH = $$sprintf($$HB_EXPORT_DIR, $$1, $$basename(CONVENIENCE_HEADER))
    86         BLD_INF_RULES.prj_exports *= "$$CONVENIENCE_HEADER $$EXPORT_PATH"
    85         BLD_INF_RULES.prj_exports *= "$$CONVENIENCE_HEADER $$EXPORT_PATH"
    87     }
    86     }
    90 }
    89 }
    91 
    90 
    92 # params: -
    91 # params: -
    93 # eg. $$hbUnixStyle():CMD=/path/to/cmd else:CMD=\path\to\cmd
    92 # eg. $$hbUnixStyle():CMD=/path/to/cmd else:CMD=\path\to\cmd
    94 defineTest(hbUnixStyle) {
    93 defineTest(hbUnixStyle) {
    95     symbian|win32:!win32-g++ {
    94     contains(QMAKE_HOST.os, Windows):isEmpty(QMAKE_SH) {
    96         unixstyle = false
       
    97     } else:win32-g++:isEmpty(QMAKE_SH) {
       
    98         unixstyle = false
    95         unixstyle = false
    99     } else {
    96     } else {
   100         unixstyle = true
    97         unixstyle = true
   101     }
    98     }
   102     return($$unixstyle)
    99     return($$unixstyle)
   103 }
   100 }
   104 
   101 
   105 # params: <path>
   102 # params: <path>
   106 # eg. features.path = $$hbNativePath($$[QMAKE_MKSPECS]/features)
   103 # eg. features.path = $$hbNativePath($$[QMAKE_MKSPECS]/features)
   107 defineReplace(hbNativePath) {
   104 defineReplace(hbNativePath) {
   108     hbUnixStyle() {
   105     contains(QMAKE_HOST.os, Windows) {
   109         return($$quote(\"$$replace(1, "\\", "/")\"))
   106         isEmpty(QMAKE_SH) {
       
   107             1 = $$replace(1, \\\\, $$QMAKE_DIR_SEP)
       
   108             1 = $$replace(1, /, $$QMAKE_DIR_SEP)
       
   109         } else {
       
   110             1 = $$replace(1, \\\\, /)
       
   111             1 = $$replace(1, /, /)
       
   112         }
   110     } else {
   113     } else {
   111         return($$quote(\"$$replace(1, "/", "\\")\"))
   114         1 = $$replace(1, \\\\, $$QMAKE_DIR_SEP)
       
   115         1 = $$replace(1, /, $$QMAKE_DIR_SEP)
   112     }
   116     }
       
   117     
       
   118     return($$quote(\"$$1\"))
   113 }
   119 }
   114 
   120 
   115 # params: <tool name>
   121 # params: <tool name>
   116 # eg. hbfoo.command = $$hbToolCommand(hbfoo)
   122 # eg. hbfoo.command = $$hbToolCommand(hbfoo)
   117 defineReplace(hbToolCommand) {
   123 defineReplace(hbToolCommand) {
   118     # tool in PATH?
   124     symbian {
   119     hbUnixStyle():DEVNULL = /dev/null
   125         # tool in PATH?
   120     else:DEVNULL = nul
   126         exists(/dev/null) {
   121     system($$1 > $$DEVNULL 2>&1):return($$1)
   127             DEVNULL = /dev/null
       
   128         } else {
       
   129             DEVNULL = nul
       
   130         }
       
   131         system($$1 > $$DEVNULL 2>&1):return($$1)
   122 
   132 
   123     # host build is runnable?
   133         # host build is runnable?
   124     hbtoolcmd = $$hbNativePath($$HB_BUILD_DIR/bin/$$1)
   134         hbtoolcmd = $$hbNativePath($$HB_BUILD_DIR/bin/$$1)
   125     system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd)
   135         system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd)
   126 
   136 
   127     # pre-built tool is runnable?
   137         # tool in HB_BIN_DIR?
   128     hbtoolcmd = $$hbNativePath($$sprintf("%1%2", $$HB_SOURCE_DIR/bin/$$1, "_symbian.exe"))
   138         hbtoolcmd = $$hbNativePath($$HB_BIN_DIR/$$1)
   129     system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd)
   139         system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd)
   130 
   140 
       
   141         # pre-built tool is runnable?
       
   142         hbtoolcmd = $$hbNativePath($$sprintf("%1%2", $$HB_SOURCE_DIR/bin/$$1, "_symbian.exe"))
       
   143         system($$hbtoolcmd > $$DEVNULL 2>&1):return($$hbtoolcmd)
       
   144     }
   131     # fall back to <builddir>/bin
   145     # fall back to <builddir>/bin
   132     return($$hbNativePath($$HB_BUILD_DIR/bin/$$1))
   146     return($$hbNativePath($$HB_BUILD_DIR/bin/$$1))
   133 }
   147 }
       
   148 
       
   149 # params: <file> <dir>
       
   150 defineReplace(hbCopyCommand) {
       
   151     file = $$hbNativePath($$1)
       
   152     dir = $$hbNativePath($$2)
       
   153 
       
   154     contains(QMAKE_HOST.os, Windows):isEmpty(QMAKE_SH) {
       
   155         chk_dir_exists = if not exist $$dir
       
   156         mkdir = mkdir $$dir
       
   157         copy = copy /y $$file $$dir
       
   158     } else {
       
   159         chk_dir_exists = test -d $$dir
       
   160         mkdir = mkdir -p $$dir
       
   161         copy = cp $$file $$dir
       
   162     }
       
   163 
       
   164     hbUnixStyle(): chk_dir_exists_mkdir = $$chk_dir_exists || $$mkdir
       
   165     else:chk_dir_exists_mkdir = $$chk_dir_exists $$mkdir
       
   166 
       
   167     return(($$chk_dir_exists_mkdir) && $$copy)
       
   168 }