Is there any documentation for building OS X frame

2019-05-11 12:46发布

I have a cross-platform shared library, and I am using GNU autotools for the build system. I would like to be able to package the library as a framework on OS X. Is it possible to do this with autotools + additional scripting e.g. bash?

Is there any good documentation for doing this, or does anyone know an example of a project that does this, which I could copy?

1条回答
迷人小祖宗
2楼-- · 2019-05-11 13:33

A framework is a glorified directory that includes a metadata file (Info.plist) and one or more libraries. I’m not sure if there’s autotools support for frameworks but something like:

# create/cd MyFramework.framework
mkdir MyFramework.framework
cd MyFramework.framework

# create/cd MyFramework.framework/Versions    
mkdir Versions
cd Versions

# create/cd MyFramework.framework/Versions/A
mkdir A
cd A

# create MyFramework.framework/Versions/A/MyFramework (the dylib)
cp /path/to/mylibrary.dylib MyFramework

# create MyFramework.framework/Versions/A/Resources
mkdir Resources

# create MyFramework.framework/Versions/A/Resources/Info.plist
cp /path/to/Info.plist Resources

# cd to MyFramework.framework/Versions
cd ..

# create MyFramework.framework/Versions/Current -> A
ln -s A Current

# cd to Myframework.framework
cd ..

# create MyFramework.framework/MyFramework -> Versions/Current/MyFramework
ln -s Versions/Current/MyFramework MyFramework

# create MyFramework.framework/Resources -> Versions/Current/Resources
ln -s Versions/Current/Resources Resources

should be enough given a properly defined Info.plist file and mylibrary.dylib.

For more information about the framework directory structure and the contents of Info.plist, see the Framework Programming Guide.

查看更多
登录 后发表回答