mkspecs/features/uic.prf
changeset 0 1918ee327afb
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 
       
     2 isEmpty(QMAKE_UIC3) {
       
     3     contains(QMAKE_HOST.os,Windows):QMAKE_UIC3 = $$[QT_INSTALL_BINS]\uic3.exe
       
     4     else:QMAKE_UIC3 = $$[QT_INSTALL_BINS]/uic3
       
     5 }
       
     6 
       
     7 isEmpty(QMAKE_UIC) {
       
     8    contains(QMAKE_HOST.os,Windows):QMAKE_UIC = $$[QT_INSTALL_BINS]\uic.exe
       
     9    else:QMAKE_UIC = $$[QT_INSTALL_BINS]/uic
       
    10 }
       
    11 
       
    12 isEmpty(UI_DIR):UI_DIR = .
       
    13 isEmpty(UI_SOURCES_DIR):UI_SOURCES_DIR = $$UI_DIR
       
    14 isEmpty(UI_HEADERS_DIR):UI_HEADERS_DIR = $$UI_DIR
       
    15 isEmpty(QMAKE_MOD_UIC):QMAKE_MOD_UIC = ui_
       
    16 
       
    17 # Allow FORMS3 to contain old UIC3 forms, while FORMS contains new
       
    18 # UIC files in the same project. However, if CONFIG+=uic3 and no
       
    19 # FORMS3 is defined, FORMS may only contain old UIC3 files.
       
    20 
       
    21 !uic3|!isEmpty(FORMS3) {
       
    22     # If we have CONFIG+=uic3 and no FORMS3, then don't do this step,
       
    23     # as UIC3 files don't need a ui_<formname>.h file
       
    24 
       
    25     uic.commands = $$QMAKE_UIC ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
       
    26     uic.depend_command = "$$QMAKE_UIC" -d "${QMAKE_FILE_IN}"
       
    27     uic.output = $$UI_HEADERS_DIR/$${QMAKE_MOD_UIC}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)}
       
    28     uic.input = FORMS
       
    29     uic.variable_out = GENERATED_FILES
       
    30     uic.CONFIG += no_link target_predeps
       
    31     uic.name = UIC ${QMAKE_FILE_IN}
       
    32     silent:uic.commands = @echo uic ${QMAKE_FILE_IN} && $$uic.commands
       
    33     QMAKE_EXTRA_COMPILERS += uic
       
    34     INCREDIBUILD_XGE += uic
       
    35 }
       
    36 
       
    37 !isEmpty(FORMS)|!isEmpty(FORMS3) {
       
    38     ui_dir_short = $$UI_HEADERS_DIR
       
    39     contains(QMAKE_HOST.os,Windows):ui_dir_short ~= s,^.:,/,
       
    40     contains(ui_dir_short, ^[/\\\\].*):INCLUDEPATH += $$UI_HEADERS_DIR
       
    41     else:INCLUDEPATH += $$OUT_PWD/$$UI_HEADERS_DIR
       
    42 }
       
    43 
       
    44 # Backwards compatibility: Make shadow builds with default UI_DIR work
       
    45 # if the user did not add the source dir explicitly.
       
    46 equals(UI_DIR, .) {
       
    47     CONFIG -= include_source_dir
       
    48     CONFIG = include_source_dir $$CONFIG
       
    49 }
       
    50 
       
    51 uic3 {
       
    52     isEmpty(FORMS3) {
       
    53         UIC3_FORMS = FORMS
       
    54         !build_pass:message("Project contains CONFIG+=uic3, but no files in FORMS3; UI files in FORMS treated as UIC3 form files.")
       
    55     } else {
       
    56         UIC3_FORMS = FORMS3
       
    57     }
       
    58 
       
    59     uic3_decl.commands = $$QMAKE_UIC3 ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
       
    60     uic3_decl.dependency_type = TYPE_UI
       
    61     uic3_decl.output = $$UI_HEADERS_DIR/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)}
       
    62     uic3_decl.input = $$UIC3_FORMS
       
    63     uic3_decl.CONFIG += no_link
       
    64     uic3_decl.variable_out = GENERATED_FILES UIC3_HEADERS
       
    65     uic3_decl.name = UIC3 Decl ${QMAKE_FILE_IN}
       
    66     silent:uic3_decl.commands = @echo uic3 ${QMAKE_FILE_IN} && $$uic3_decl.commands
       
    67     QMAKE_EXTRA_COMPILERS += uic3_decl
       
    68 
       
    69     uic3_impl.commands = $$QMAKE_UIC3 -impl ${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)} ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
       
    70     uic3_impl.dependency_type = TYPE_UI
       
    71     uic3_impl.output = $$UI_SOURCES_DIR/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_CPP)}
       
    72     uic3_impl.depends = $$UI_HEADERS_DIR/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)}
       
    73     uic3_impl.input = $$UIC3_FORMS
       
    74     uic3_impl.variable_out = GENERATED_SOURCES
       
    75     uic3_impl.name = UIC3 Impl ${QMAKE_FILE_IN}
       
    76     silent:uic3_impl.commands = @echo uic3 -impl ${QMAKE_FILE_IN} && $$uic3_impl.commands
       
    77     QMAKE_EXTRA_COMPILERS += uic3_impl
       
    78 
       
    79     ### add a moc step
       
    80     load(moc)
       
    81     uic3_moc.commands = $$moc_header.commands
       
    82     uic3_moc.output = $$moc_header.output
       
    83     uic3_moc.depends = $$UI_HEADERS_DIR/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)}
       
    84     uic3_moc.input = UIC3_HEADERS
       
    85     uic3_moc.variable_out = GENERATED_SOURCES
       
    86     uic3_moc.name = $$moc_header.name
       
    87     QMAKE_EXTRA_COMPILERS += uic3_moc
       
    88 }
       
    89 
       
    90 defineReplace(imageCollectionCmd) {
       
    91     unset(EMBEDDED_IMAGES)
       
    92     RET =
       
    93     for(image, $$list($$split(1))) {
       
    94            EMBEDDED_IMAGES += $$image
       
    95            count(EMBEDDED_IMAGES, 5) {
       
    96                 isEmpty(RET): RET += echo $$EMBEDDED_IMAGES > images.tmp $$escape_expand(\n\t)
       
    97                 else:         RET += echo $$EMBEDDED_IMAGES >> images.tmp $$escape_expand(\n\t)
       
    98                 unset(EMBEDDED_IMAGES)
       
    99            }
       
   100     }
       
   101     !isEmpty(EMBEDDED_IMAGES):RET += echo $$EMBEDDED_IMAGES >> images.tmp $$escape_expand(\n\t)
       
   102     !isEmpty(RET) {
       
   103         RET += $$QMAKE_UIC3 -embed $$TARGET -f images.tmp -o $$2 $$escape_expand(\n\t)
       
   104         return($$RET)
       
   105     }
       
   106     return($$QMAKE_UIC3 -embed $$TARGET $$1 -o $$2)
       
   107 }
       
   108 
       
   109 image_collection.output = qmake_image_collection$${first(QMAKE_EXT_CPP)}
       
   110 image_collection.variable_out = SOURCES
       
   111 image_collection.input = IMAGES
       
   112 image_collection.CONFIG += combine
       
   113 image_collection.name = UIC3 Image collection in ${QMAKE_FILE_OUT}
       
   114 !win32 {
       
   115     image_collection.commands = $$QMAKE_UIC3 -embed $$TARGET ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
       
   116     silent:image_collection.commands = @echo uic3 -embed ${QMAKE_FILE_IN} && $$image_collection.commands
       
   117 } else {
       
   118     image_collection.commands = ${QMAKE_FUNC_imageCollectionCmd}
       
   119     silent:image_collection.commands = @echo uic3 -embed $$TARGET -f images.tmp && $image_collection.commands
       
   120 }
       
   121 QMAKE_EXTRA_COMPILERS += image_collection
       
   122 
       
   123