在 Linux 中从命令行(又名 bash 脚本)以调试模式构建 Qt 项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8949956/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Build Qt Project in Debug Mode from Command line (aka bash script) in Linux
提问by Matthew Hoggan
I already have a project with a .pro file that can be built in debug and release mode. So my question is what is the options on the commandline that I have to specify if I want to build my binaries with debug information. Here is an example building in release using a bash script:
我已经有一个带有 .pro 文件的项目,可以在调试和发布模式下构建。所以我的问题是如果我想用调试信息构建我的二进制文件,我必须指定命令行上的选项是什么。这是使用 bash 脚本在发布中构建的示例:
cd ${CHECKOUT_DIR_DEV_OGL_DX_ENGINE_SKIA};
echo `date`: "Running \`qmake\` on Skia";
qmake&>${SKIA_LOG};
buildstatus $? "Running \`qmake\` on Skia";
echo `date`: "Running \`make\` on Skia";
make&>${SKIA_LOG};
buildstatus $? "Running \`make\` on Skia Please see ${SKIA_LOG}";
What do I need to add to get it now to also build in debug mode?
我现在需要添加什么才能在调试模式下构建它?
采纳答案by Bill
The option you need is "CONFIG+=debug". See General Configurationin qmake Manual.
您需要的选项是“CONFIG+=debug”。见常规配置中的qmake手册。
#!/bin/bash
qmake CONFIG+=debug ${qmake_options}
make ${make_options}