Linking libuv library in XCode

2020-04-17 05:23发布

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.

标签: c xcode libuv
2条回答
Juvenile、少年°
2楼-- · 2020-04-17 05:26

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

查看更多
不美不萌又怎样
3楼-- · 2020-04-17 05:49

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:

Xcode configuration

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

Headers configuration

查看更多
登录 后发表回答