-
Notifications
You must be signed in to change notification settings - Fork 990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[question] How to custom generator for conan 2.x #13709
Comments
Hi @waruqi Thanks for your question. python_requires = "mygenerator/1.0"
def generate(self):
mygenerator =self.python_requires["mygenerator"].module.MyGenerator(self)
mygenerator.generate() This was done because the global registry for custom generators was very problematic, for example, different packages requiring different versions of the generator were simply ovewriting each other, and the last one (pretty random) was the one being used for all packages, leading to total caos. The only possibility to handle this is to do a per-package explicit If you would like to have a named generator, those have to be built-in in Conan 2.0 |
I don't really understand how to use this approach? How can I tell conan to call
If you would consider accepting the new xmake generator as a built-in generator, I would try to open a new pr to do it. |
I tried it, it does not work. from conan import ConanFile
from conan.tools.files import save, load
from conan.tools.microsoft import unix_path, VCVars, is_msvc
from conan.errors import ConanInvalidConfiguration
from conan.errors import ConanException
from conans.model.build_info import CppInfo
class XmakeGenerator:
common = None
def __init__(self, conanfile):
self.conanfile = conanfile
def generate(self):
self.conanfile.output.info("VALUE TOOL: {}!!!".format(XmakeGenerator.common.mycommon()))
class xmake(ConanFile):
name = "xmake_generator"
version = "2.0.1"
python_requires = "xmake_generator/2.0.1"
def generate(self):
print("generate")
mygenerator = self.python_requires["xmake_generator"].module.XmakeGenerator(self)
mygenerator.generate()
|
The In any case, could you please wait a bit, we will be discussing later other possibilities. |
If this is the case, I cannot use
ok. |
Hi @memsharded, |
Yes, @System-Arch @waruqi We have discussed this, I have changed the tag to "feature", it means that we will implement this as global generators in the Conan home |
Thanks. |
Hi @memsharded, |
Implemented in #13718, will be released in next 2.0.5, thanks for the feedback! |
Thanks! 👍 |
Can I ask when 2.0.5 will probably be released? We have made support for it and are looking forward to the next release. xmake-io/xmake#3703 |
Very soon, maybe later this week or early next week |
What is your question?
I'm trying to get xmake support to integrate with conan 2.x, but I'm having some problems. (xmake-io/xmake#327)
For conan 1.x, we use a custom Xmake generator https://github.com/xmake-io/conan-xmake_generator
Then we use the
conan export
command to export it and configure it in conanfile.txtThis works well with a custom generator to export package information.
But for conan 2.0 it doesn't work anymore. I tried writing new generator for conan 2.0
then run
conan export --name xmake_generator /tmp/test/.xmake/linux/x86_64/conan/xmake_generator
to export it.But when I use conan to install package, it will report unknown
xmake
generator .I don't know how to customize the generator and configure the correct generator name in conanfile.txt.
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: