简体   繁体   English

在Mac OSX下使用Qt在Eclipse CDT中进行交叉编译

[英]Cross-compiling in Eclipse CDT with Qt under Mac OSX

Let me list all that I have setup: 让我列出我设置的所有内容:

OS: Mac OSX - 10.6.8 操作系统:Mac OSX - 10.6.8

IDE: Eclipse CDT Indigo IDE:Eclipse CDT Indigo

Framework: Qt 4.7.2 框架:Qt 4.7.2

As known, the Qt doesn't have integration to Eclipse on Mac, so I installed everything using this tutorial here: http://www.hyper-world.de/en/2009/05/13/qt-and-eclipse-under-mac-os-x/ 众所周知,Qt没有与Mac上的Eclipse集成,所以我在这里使用本教程安装了所有内容: http//www.hyper-world.de/en/2009/05/13/qt-and-eclipse-下-MAC-OS-X /

I was able to compile a simple program to MacOS without a problem. 我能够毫无问题地将一个简单的程序编译到MacOS。

The issue here is that I need to cross compile my apps to Windows and to Linux. 这里的问题是我需要将我的应用程序交叉编译到Windows和Linux。 But I'm new to cross compiling, so I need some directions: 但我是新手来编译,所以我需要一些指示:

  1. I used this cross compilers for MacOS here: http://crossgcc.rts-software.org/doku.php . 我在这里使用了这个用于MacOS的交叉编译器: http//crossgcc.rts-software.org/doku.php Do you guys think that is the best approach? 你认为这是最好的方法吗?

  2. I currently using automatically generated makefiles from Eclipse. 我目前使用Eclipse自动生成的makefile。 Can Eclipse generate, from a single project, 3 different OSs outputs without using external make builders? Eclipse可以从单个项目生成3个不同的OS输出而无需使用外部make构建器吗?

  3. If I send to another developer this project, can he compile it under Windows or Linux (Ubuntu)? 如果我发送给另一个开发人员这个项目,他可以在Windows或Linux下编译它(Ubuntu)吗?

  4. If a step-by-step tutorial can be provided for that or any sample project files for Eclipse with this configs, I appreciate. 如果可以使用此配置为Eclipse或任何示例项目文件提供分步教程,我很感激。

I may not help you with all you asked. 你提出的所有问题我都无法帮助你。 Buf have you heard of cmake? 你有没有听说过cmake? if you use cmake in your project, it will work everywhere. 如果你在你的项目中使用cmake,它将在任何地方工作。 It generates the makefiles for you. 它会为您生成makefile。 Take a look: http://www.vtk.org/Wiki/CMake_Cross_Compiling . 看看: http//www.vtk.org/Wiki/CMake_Cross_Compiling

CMake finds the location of libraries, it linkes your code. CMake找到库的位置,它链接您的代码。 About QT, it also can moc the Q_OBJECT files so you don't have to worry about it. 关于Qt,它也可以moc的Q_OBJECT文件,所以你不必担心。

We develop a full cross-platform Qt application, and deploy on Windows, OSX, and 32-bit and 64-bit Linux. 我们开发了一个完整的跨平台Qt应用程序,并在Windows,OSX以及32位和64位Linux上进行部署。

In my experience there is not an easy way to do "it just works" cross platform builds. 根据我的经验,没有一种简单的方法可以做到“它只是工作”跨平台构建。 What we do is literally build on dedicated OS-specific machines (you could use VMs too). 我们所做的就是在专用的OS专用机器上构建(您也可以使用VM)。 This is not a trivial undertaking either of course. 当然,这不是一项微不足道的工作。 CMake might be a great way to try and unify the project so it'll build on all platforms, and possibly use Eclipse "on the side" (or if it works with CMake, even better). CMake可能是尝试和统一项目的好方法,因此它将构建在所有平台上,并且可能在侧面使用Eclipse(或者如果它与CMake一起工作,甚至更好)。 We like to use Visual Studio, so we ended up writing a bunch of scripts to do the builds on the other machines. 我们喜欢使用Visual Studio,因此我们最终编写了一堆脚本来在其他机器上进行构建。

We had to use C++/Qt because of our need for hardware access and speed; 我们不得不使用C ++ / Qt,因为我们需要硬件访问和速度; if your needs are different there are much easier solutions to go cross platform, such as Adobe Air. 如果您的需求不同,那么跨平台的解决方案就更容易,例如Adobe Air。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM