从命令行编译Qt项目 [英] Compile a Qt project from command Line

查看:110
本文介绍了从命令行编译Qt项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Qt,C ++库/框架开发应用程序。使用QT-Creator我可以编译我的项目很好,构建目录生成所需的可执行文件很好。但是,我试图自动化我的问题和使用Apache ANT。但我遇到以下问题。

I am developing a application using Qt, the C++ library/framework. Using the QT-Creator I can compile my project just fine and the build directory generates the desired executable files just fine. However, I am trying to automate my asks and using Apache ANT. But I am running into the following issues.

以下是命令行的输出:

build.mac.64:
     [echo] Building for Mac
     [echo] Updating destination path
     [exec] Project WARNING: No .qmake.cache is present. This significantly slows down qmake with this makespec.
     [exec] Project WARNING: Call 'cache()' in the top-level project file to rectify this problem.
     [exec] make: Nothing to be done for `first'.
     [exec] cp: ./build/mac.64/settings.ini: No such file or directory
     [exec] Result: 1
     [echo] Reverting destination path

我不知道为什么它不编译可执行文件。

I am not sure why it is not compiling the executable file.

这里是我的目标如何:

<target name="build.mac.64">
    <echo>Building for Mac</echo>
    <exec executable="qmake">
        <arg value="myproject.pro"/>
        <arg
        value="-r"/>
        <arg value="-spec"/>
        <arg value="macx-clang"/>
        <arg value="CONFIG+=x86_64"/>
    </exec>

    <exec executable="make" />

    <exec executable="cp">
        <arg value="./settings.ini"/>
        <arg value="${default.build.dir.mac.64}/settings.ini"/>
    </exec>

</target>

任何想法我错了什么?

推荐答案

感谢你的提示。我意识到我做错了。

Thanks for the tips guys. I realized what I was doing wrong. QT-Creator actually takes the first two steps silently.


  1. 创建构建输出目录

  2. 到建立输出目录(KEY STEP)

  3. 呼叫qmake参照.pro档案

  4. 呼叫make

  1. Create the build output directory
  2. CD to the build output directory (KEY STEP)
  3. Call qmake referencing the .pro file
  4. Call make


    所以,我忽略的关键是,你必须先在构建目录,然后调用qmake,make等...以及如果构建已经有文件编译它抛出那个错误。我只需要确保我清理编译目录来编译所有的新鲜。

So, the key thing that I overlooked was that you had to be in the build directory first and then call qmake, make etc... And also if the build already has the files compiled it throws that error. I just have to make sure I clean the build directory to compile everything fresh.

这篇关于从命令行编译Qt项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆