在Mac OS X上对APP中的二进制可执行文件有什么要求?

时间:2014-02-21 13:23:21

标签: macos build

我们不使用Xcode IDE来构建.app。我们使用shell脚本来构建它。我们按照document进行操作,但似乎无法加载可执行文件且.app无效。

在Mac文档中,.app需要包含以下两部分:

  • Info.plist:RPK.app/Contents/Info.plist
  • 可执行文件:RPK.app/Contents/MacOS/RPK

因此,我们将以下内容复制到Info.plist文件。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDisplayName</key>
    <string>RPK</string>
    <key>CFBundleExecutable</key>
    <string>RPK</string>
    <key>CFBundleIdentifier</key>
    <string>com.codetool.RPK</string>
    <key>CFBundleName</key>
    <string>RPK</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleSignature</key>
    <string>XCEL</string>
    <key>CFBundleVersion</key>
    <string>12.2.0</string>
</dict>
</plist>

我使用:

创建可执行文件
g++ -x objective-c++ main.mm -o RPK

main.mm:

#include <iostream>
#include <vector>
#include <algorithm>
int main(int argc, const char *argv[])
{
    printf("HELLO WORD");
    return 0;
}

但似乎仍然无法加载.app,原因似乎与可执行文件有关。 那么可执行文件的要求是什么,因此可以在Mac上加载(运行)APP

0 个答案:

没有答案
相关问题