【问题标题】:How to compile C++ for Mac OS X using Visual Studio on Windows and CMake如何在 Windows 和 CMake 上使用 Visual Studio 为 Mac OS X 编译 C++
【发布时间】:2019-05-10 00:06:35
【问题描述】:

I read that Visual Studio now supports cross-platform development。到目前为止,我使用CMake 编译WindowsUbuntu(使用WSL)。然而,似乎没有任何关于如何使用Visual Studio 以目标Mac OS X 实际完成交叉编译的信息。 CMakeSettings.json 可以吗?根据this 的文章,您可以选择Linux-DebugLinux-Release 作为configurationType,但在Visual Studio 2017 Enterprise 中,Linux 选项甚至对我不可用,Mac OS X 也不可用。

我可能只是按照this 帖子中的建议设置一个虚拟机,这似乎是完成工作的最方便的解决方案。

【问题讨论】:

  • 要为 MacOS 编译,您需要 xcode 工具集,但 Apple 禁止在 MacOS 以外的平台上使用它,即您不能为 MacOS 交叉编译...

标签: c++ macos visual-studio cmake cross-compiling


【解决方案1】:

显然你不能。

I ended up installing a virtual machine with Mac OS X 并使用共享文件夹成功编译了我的代码,使我的Windows 主机源代码可供来宾使用。这肯定比some hacky cross-compilation project 更可靠、更理智。后者仍然不能保证代码在交叉编译目标操作系统上能够成功运行并且不会意外崩溃。

【讨论】:

    猜你喜欢
    • 2020-09-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-24
    相关资源
    最近更新 更多