如何使用Makefile在Xcode中编译库? [英] How do I compile a library in Xcode using a makefile?

查看:109
本文介绍了如何使用Makefile在Xcode中编译库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要用Xcode编译用C编写的库.为此,我需要使用一个make文件.如何在我的项目中包含制作文件?

I need to compile a library written in C in Xcode. For this I need to use a make file. How can I include a make file in my project?

任何用于写入制作文件或制作文件示例以在iOS模拟器上运行的链接都将有所帮助.

Any link for writing a make file or sample of a make file for running on the iOS simulator would be helpful.

如果我使用cmake,那么我要在终端中使用哪些命令为iOS模拟器创建静态库?

Also if I use cmake, then what commands do I use in the terminal to create a static Library for iOS simulator?

谢谢

推荐答案

首先,您的项目生成器是Xcode或Make.您不能在Xcode中有一个makefile.

First, your project generator is either Xcode or Make. You can't have a makefile in Xcode.

如果您想从C/C ++来源生成iOS库,请查看此谷歌项目.项目Wiki 解释了如何使用iOS CMake工具链.这将为您提供一个.xcodeproj文件.您可以构建然后从其他iOS项目链接到该库.另外,在Github上还有这把叉子,您可以看看.

If you want to generate an iOS library from C/C++ sources, take a look at this google project. The project wiki explains how to use the iOS CMake toolchain. This will give you a .xcodeproj file. You can build and then link to that library from other iOS projects. Also there's this fork available on Github which you could take a look at.

如果目标系统仅是iOS,则可以从头开始创建新的iOS库项目(不使用CMake),然后手动添加源代码.

If the target system is exclusively iOS, you could alternatively create a new iOS library project from scratch (no CMake) and throw in your sources manually.

这篇关于如何使用Makefile在Xcode中编译库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆