Linking libuv library in XCode

2020-04-17 05:16发布

问题:

Has anyone had any experience with linking libuv in xcode? I've created a submodule in git to allow easy updating to the library but I can't quite figure out how to correctly add the library to the project to allow me to include uv.h. Any help would me greatly appreciated.

回答1:

You can use GYP to generate an xcodeproj for libuv (as explained in libuv's README) and add this xcodeproj to your main Xcode project.

It can be automated (for easy updating) with a simple shell script (assumes you put the libuv submodule in Externals/libuv, but can be changed):

git submodule update --init
git clone https://chromium.googlesource.com/external/gyp.git Externals/libuv/build/gyp
Externals/libuv/gyp_uv.py -f xcode

Then you'll be able to add libuv as a dependency and to the libraries to link your target to:

The last thing to do is to tell Xcode where are libuv's headers:



回答2:

You shall add header search path for libuv (/pathto/libuv/include) in Xcode's build settings.



标签: c xcode libuv