Closed Brunni closed 4 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.
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
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
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?
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.
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.
I need more information. When submitting issues, you should:
conaninfo.txt
file.Please tell me and we will see what could be. Thanks very much for your feedback.
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.
No worries!
The option "shared" is defining the type of the library being compiled. If a package "g3log" define such option, if it is set to True, it will generate some "g3log.so" or "g3log.dll" (win), and if it is False, the package will contain some "g3log.a" or "g3log.lib" (win)
Any consumer project, when using the "g3log" package can opt for one type of library or the other: "I want to link with g3log static library" or "I want to link with g3log shared library". So what they do is they specify that they want such package:
conan install -o g3log:shared=True
The "test_package" subproject, is not building a library, just an executable. It doesn't need to specify if itself is shared or static, because an executable can't be shared or static. This is why the test_package/conanfile.py
doesn't have such shared
option.
$conan test_package
is just a convenience command that basically does an export + install + build test + run test. The command line arguments provided to it are just arguments for the underlying conan install
. So:
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!
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?