conan-io / wishlist

This repo is to propose libraries, frameworks, and code in general that users would like to have in conan
MIT License
49 stars 5 forks source link

g3log #62

Closed Brunni closed 4 years ago

Brunni commented 7 years ago

Hi,

I just started with conan and all this cpp cmake stuff. So this is my first try: https://github.com/Brunni/conan-g3log

It is working on Windows Visual Studio build with shared=True and shared=False option.

I tried to get it working on Linux. The build works, but test_package fails with a linker error (both shared and static).

Can someone help me with this? And one more question: Is the test_package folder also uploaded to conan.io? Do I need to define export_sources?

memsharded commented 7 years ago

Hi Michael, I will have a look

No, the test_package folder is not uploaded. exports and exports_sources are only if you want to embed other files (as source code files) into the recipe, as an alternative to the source() method. It would be kind of snapshoting, and can be a good approach if the package recipe is located into the source repo (as otherwise it would be weird to be fetching or cloning your own repo, doable, but weird). If you want, you can upload it, using exports_sources but totally unnecessary.

You have put the "unlicensed" license. Please note that the terms of conan.io are that uploads should be free software. Could be even closed source, but the packages are public and for free use, according to some licensing terms. Of course you can use any license if you use your own conan_server.

Brunni commented 7 years ago

So this means, if you do a conan install --build=missing it will be built but the test_package is not executed? This seems strange to me :)

I just used the license from the original github repo. This seems to be a free to use license: https://github.com/KjellKod/g3log/blob/master/LICENSE

memsharded commented 7 years ago

You don't need to specify the option in the test package, and then make it transitive, you can just set it directly as:

$ conan install ... -o g3log:shared=False
Brunni commented 7 years ago

Hi. I just thought, that the test_package should use the same shared flag as the install is using. Otherwise it could happen that it tests the wrong package?

memsharded commented 7 years ago

Not necessarily, the consumer is just specified the library by name "g3log", and the linker infers what to do. You can simplify and remove it. Will submit a PR with fixes in a couple of minutes.

Brunni commented 7 years ago

Thank you for your help. I uploaded one linux package. But I tried this build.py file with use_docker=True but I get this error: cc1plus: error: unrecognized command line option '-std=c++11'

EDIT: I figured this out. I need to use (shared_option_name="g3log:shared", pure_c=False)

But I think it is still not working as I would expect.

memsharded commented 7 years ago

I need more information. When submitting issues, you should:

Please tell me and we will see what could be. Thanks very much for your feedback.

Brunni commented 7 years ago

Hi memsharded, sorry for my stupid comment above. I was just a bit stressed.

I still don't understand how the test_package project works.

I can't execute conan test_package -o shared=True if I don't have this option in the test_package/conanfile.py defined. But I would like to test the different kinds of builds and linkers here.

So what I'm currently doing is changing a line in test_package.

memsharded commented 7 years ago

No worries!

conan install -o g3log:shared=True
conan test_package -o g3log:shared=True

means: I want to install the g3log shared library, and my test_package project will link with it.

Build system and linker will figure out how to link with the library, you don't need to change anything in your consumer test_package project to link with the shared or static versions of the package.

Please tell me if this makes sense or you have any further question. Cheers!

Croydon commented 4 years ago

Fixed by https://github.com/conan-io/conan-center-index/pull/1294