cpp-ipfs-http-client icon indicating copy to clipboard operation
cpp-ipfs-http-client copied to clipboard

Could be nice to generate/install pkg-config file

Open Lecrapouille opened this issue 2 years ago • 3 comments

I'm testing your project right now.

Could be nice to create a pkg-config file like in: https://github.com/sebastiandev/zipper/blob/master/zipper.pc.cmakein

Or for Makefile: https://github.com/Lecrapouille/MyMakefile/blob/master/Makefile.macros#L165 sudo make install will install it: https://github.com/Lecrapouille/MyMakefile/blob/master/Makefile.macros#L181 https://github.com/Lecrapouille/MyMakefile/blob/master/Makefile.macros#L63 (not sure this is working well for Mac)

So in your readme instead of:

g++ -std=c++11 -I/path/to/header -L/path/to/lib -lipfs-http-client myprog.cc -o myprog

Could be replaced by:

g++ -std=c++11 myprog.cc -o myprog `pkg-config --cflags --libs ipfs-http-client`

In addition in your command -lipfs-http-client is misplaced and -lcurl is missing. The pkg-config will contain the -lcurl code

Lecrapouille avatar Apr 09 '22 22:04 Lecrapouille

I see, thank you for you remarks. Ideally you should use CMake, which interact very well with an existing CMake project.

But I will test if pkg-config config you provided also work, instead of the manual -I .. and -L .., which is indeed old school.

The additional pkg-config file is also a great idea! Thx.

Please, be welcome to add a PR if you wish.

melroy89 avatar Jun 04 '23 23:06 melroy89

pkg-config generation is managed by CMakefile. I'll check if I can make a PR from this project I helped, I'm noob with CMake:

https://github.com/sebastiandev/zipper/blob/master/zipper.pc.cmakein

https://github.com/sebastiandev/zipper/blob/87b14a4b31771ed94ebb3204dc6ed69ad9c78436/CMakeLists.txt#L465

https://github.com/sebastiandev/zipper/blob/87b14a4b31771ed94ebb3204dc6ed69ad9c78436/CMakeLists.txt#L479

Lecrapouille avatar Jun 05 '23 11:06 Lecrapouille

Yes so zipper.pc.cmakein is an input file for the configure_file of CMake, generating the final file. Which is exported to: ${PROJECT_BINARY_DIR}/zipper.pc, so under the CMAKE project binary directory with final name 'zipper.pc'. Configure_file will fill all the @CMAKE_INSTALL_PREFIX@ statement etc. during the build.

melroy89 avatar Jun 05 '23 12:06 melroy89