【问题标题】:How to create qtcreator installer from its source code?如何从其源代码创建 qtcreator 安装程序?
【发布时间】:2016-04-25 14:00:53
【问题描述】:

我已经创建了 Qt creator 插件并使用了来自 git repo 的 Qt creator source code。但我至少找不到如何为 Windows 制作安装程序包。如果你去https://www.qt.io/download-open-source/#section-2,你可以看到Qt creator安装程序已经创建,所以我们只能安装Qt creator。 Qt 使用 Qt 安装程序框架来创建安装程序。构建 Qt creator 安装程序的脚本在哪里?

【问题讨论】:

    标签: qt-creator


    【解决方案1】:

    要求:您需要安装 7zip (7z)、python (2.7) 和 IFW。

    Answer 基于 Windows。你可能需要与 linux 略有不同的情况

    我的工作结构是:

    /home
     /Qt5.5.1
     /qt-creator3.6  (Qt creator  source)  
     /qtcreator3.6  (Qt creator build)
     /So-ADE
      /So-ADEDebugger   (My plugin)
    

    脚本在/home

    这是我做同样事情的脚本:请适应你自己的插件目录(我的是So-ADEDebugger)和文件结构。

    使用 /tmp 作为构建目录

    mkdir c:\tmp
    rmdir /s /q c:\tmp\out
    

    移动到我的插件目录,构建它

    cd So-ADEDebugger
    ..\..\Qt5.5.1\5.5\mingw492_32\bin\qmake.exe
    

    将 gcc 添加到 windows 路径(以防万一)

    set PATH=%CD%\..\..\Qt5.5.1\Tools\mingw492_32\bin\;C:\Program Files\7-Zip\;%PATH%
    ..\..\Qt5.5.1\Tools\mingw492_32\bin\mingw32-make.exe
    

    移动到 qtcreator 构建目录(影子构建)并安装到目标目录(/tmp)

    cd ..
    cd ..\qtcreator3.6
    set INSTALL_ROOT=c:\tmp\out
    ..\Qt5.5.1\Tools\mingw492_32\bin\mingw32-make.exe -j 4 install
    

    复制 Qt windows dll 到位

    cd ..\So-ADE
    xcopy /i/s ..\Qt5.5.1\5.5\mingw492_32\bin\*.dll c:\tmp\out\bin
    mkdir c:\tmp\out\bin\plugins
    xcopy /i/s ..\Qt5.5.1\5.5\mingw492_32\plugins\designer c:\tmp\out\bin\plugins\designer
    xcopy /i/s ..\Qt5.5.1\5.5\mingw492_32\plugins\iconengines c:\tmp\out\bin\plugins\iconengines
    xcopy /i/s ..\Qt5.5.1\5.5\mingw492_32\plugins\imageformats c:\tmp\out\bin\plugins\imageformats
    xcopy /i/s ..\Qt5.5.1\5.5\mingw492_32\plugins\platforms c:\tmp\out\bin\plugins\platforms
    xcopy /i/s ..\Qt5.5.1\5.5\mingw492_32\plugins\printsupport c:\tmp\out\bin\plugins\printsupport
    xcopy /i/s ..\Qt5.5.1\5.5\mingw492_32\plugins\sqldrivers c:\tmp\out\bin\plugins\sqldrivers
    mkdir c:\tmp\out\lib\vcredist_msvc2013
    xcopy /i/s ..\Qt5.5.1\vcredist\vcredist_msvc2013_x86.exe c:\tmp\out\lib\vcredist_msvc2013\
    move c:\tmp\out\lib\vcredist_msvc2013\vcredist_msvc2013_x86.exe c:\tmp\out\lib\vcredist_msvc2013\vcredist_x86.exe 
    

    并拒绝调试

    del /s c:\tmp\out\bin\*d.dll
    

    现在在目标中安装插件

    cd So-ADEDebugger
    ..\..\Qt5.5.1\Tools\mingw492_32\bin\mingw32-make.exe -j 4 install
    

    在我的插件中,我有一个 qt-creator/dist/installer 目录的副本,其中包含我的安装程序自定义设置(可选通道)。我将它复制回 qt 以使用我的设置构建安装程序

    xcopy /i /s /y installer ..\..\qt-creator3.6\dist\installer
    xcopy /i /s /y qt.conf c:\tmp\out\bin
    cd ..
    

    万一……

    strip c:\tmp\out\bin\* c:\tmp\out\lib\qtcreator\plugins\*
    

    为安装程序构建 tar(make 的 bindist_installer 目标)

    cd ..\qt-creator3.6
    set IFW_PATH=C:\Qt\QtIFW2.0.1
    ..\Qt5.5.1\Tools\mingw492_32\bin\mingw32-make.exe bindist_installer
    

    最后打包。用你的设置改变它

    c:\Python27\python -u .\scripts\packageIfw.py -i "C:\Qt\QtIFW2.0.1" -v 2.0.0 -a "qt-creator-windows-3.6.1-installer-archive.7z" ..\So-ADE\So-ADEdebugger.2.0.0.win  
    

    【讨论】:

    • 不错。我在找这个。我想为我的学生制作一个包含编译器 (MinGW) 和 C++ 帮助 (en.cppreference.com/w/Cppreference:Archives) 的独立 Qt Creator 安装程序。但是我在 Qt Creator 存储库中再也找不到安装程序脚本了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-21
    • 2021-10-14
    • 2010-12-01
    相关资源
    最近更新 更多