如何在 Linux 或 Windows 中为 OS X 编译?
我想将我的 C/C++ 应用程序移植到 OS X.
I would like to port my C/C++ apps to OS X.
我没有 Mac,但我有 Linux 和 Windows.有没有这方面的工具?
I don't have a Mac, but I have Linux and Windows. Is there any tool for this?
推荐答案
似乎有一些脚本 帮助您为 Mac 设置交叉编译;我不能说它们有多好,或者如何适用于您的项目.在文档中,他们参考了这些说明以进行 10.4 的交叉编译,以及 这些 用于 10.5 的交叉编译;这些说明可能比脚本更有帮助,具体取决于脚本对您的需求的满足程度.
There appears to be some scripts that have been written to help get you set up cross compiling for the Mac; I can't say how good they are, or how applicable to your project. In the documentation, they refer to these instructions for cross-compiling for 10.4, and these ones for cross compiling for 10.5; those instructions may be more helpful than the script, depending on how well the script fits your needs.
如果您的程序是免费或开源软件,那么您可能希望创建一个 MacPorts 端口文件(文档此处),并允许您的用户使用 MacPorts 构建您的程序;这通常是在 Mac OS X 上安装可移植的免费或开源软件的首选方式.过去已知 MacPorts 可以在 Linux 上运行,因此有可能在 Linux 上开发和测试您的 Portfile(尽管它显然需要将在 Mac 上进行测试).
If your program is free or open source software, then you may wish instead to create a MacPorts portfile (documentation here), and allow your users to build your program using MacPorts; that is generally the preferred way to install portable free or open source software on Mac OS X. MacPorts has been known to run on Linux in the past, so it may be possible to develop and test your Portfile on Linux (though it will obviously need to be tested on a Mac).
相关文章