• Qt Qml Application Deploy (部署Qt程序以便发布到平台上执行)


    QMake: (Add this in .pro)

    isEmpty(TARGET_EXT) {
        win32 {
            TARGET_CUSTOM_EXT = .exe
        }
        macx {
            TARGET_CUSTOM_EXT = .app
        }
    } else {
        TARGET_CUSTOM_EXT = $${TARGET_EXT}
    }
    
    DEPLOY_COMMAND = $$(QTDIR)/bin/windeployqt
    
    CONFIG( debug, debug|release ) {
        # debug
        DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/debug/$${TARGET}$${TARGET_CUSTOM_EXT}))
    } else {
        # release
        DEPLOY_TARGET = $$shell_quote($$shell_path($${OUT_PWD}/release/$${TARGET}$${TARGET_CUSTOM_EXT}))
    }
    
    QMAKE_POST_LINK = $${DEPLOY_COMMAND} $${DEPLOY_TARGET} 
        --qmldir $${PWD} 
        --no-translations 
        --no-system-d3d-compiler 
        --no-webkit2 
        --no-angle 
        --no-opengl-sw 
        --no-virtualkeyboard
    message($${QMAKE_POST_LINK})
    

    CMake:

    string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
    get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
    get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
    find_program(DEPLOYQT_EXECUTABLE NAMES windeployqt HINTS "${_qt_bin_dir}")
    add_custom_command(TARGET PROJECT_NAME
            POST_BUILD
            COMMAND ${DEPLOYQT_EXECUTABLE} "$<TARGET_FILE:PROJECT_NAME>"
            --force
            --${CMAKE_BUILD_TYPE_LOWER}
            --qmldir ${CMAKE_SOURCE_DIR}/qml
            --no-translations
            --no-system-d3d-compiler
            --no-webkit2
            --no-angle
            --no-opengl-sw
            --no-virtualkeyboard
        )
    
  • 相关阅读:
    flask
    admin站点管理
    DRF
    基础
    通过djangocrontab扩展来实现 定时任务
    配置asgi来达到能处理websocket
    用es实现模糊搜索
    迁移问题
    启动活动的最佳写法
    启动活动的最佳写法
  • 原文地址:https://www.cnblogs.com/yinsua/p/15060846.html
Copyright © 2020-2023  润新知