How do I compile a library in Xcode using a makefi

2019-09-17 19:51发布

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?

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

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

Thanks

标签: ios xcode cmake
1条回答
再贱就再见
2楼-- · 2019-09-17 20:46

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

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.

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.

查看更多
登录 后发表回答