-
Notifications
You must be signed in to change notification settings - Fork 12
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
Clang 12 + linux support, project improvements #3
Conversation
…and stuff (17.10 11:45)
…etic fixes; Template specialization in template argument as qualtype(important fix); a bit more tests (18.10 00:44)
…on; some fixes; using tabs; autoformated everything (18.10 14:09)
Also this(Hexlord@b245edb) commit fixes infinite recursion for my project usage (it was something like struct Some : public struct Templ), I think I introduced this in the first place when allowed decl-only for templ specializations, fyi UPD: wow markdown hid my example: |
Okay I think I finally grokked your codestyle settings, so my reformat does not tear code base apart, just forcepushed my best effort |
The setup you propose with ProduceMetaCPP is a good solution. I think it is even better with MSVC, since I can rebuild the Example project without triggering a full meta generation which can take a few seconds (metadata could be stale, so it should be used with caution). I configured a basic CI workflow to execute the Example program. I'm testing the workflow in this repo, I'll delete it after the PR is merged. As you can see in this build it seems that ProduceCPP is failing to generate the metadata but the process is still exiting normally (it should exit with 1). This is a problem with MetaCPPCLI itself, because
Is it normal that it uses the includes from GCC? I didn't really tested it on Linux at all. Give me a few more days to review the changes and we're set :). Edit: It seems workflows created in PRs don't trigger until the workflow file is merged 😞 . |
Hey! Yes, I was also unable to use MetaCPP at linux until I added following flags: Important part being "-I/usr/local/lib/clang/12.0.0/include" - this is the path where my clang is installed locally Edit: Yes, it is normal for clang to use GCC includes. It could be configured to use clang own's stl implementation, but for some reason it is not the default behaviour, but I am no expert at this. Edit2: stddef.h - I had this error, if I recall correctly, I fixed it with "-xc++", which is still present if code flags preparation, I wonder if this change (f7e551b) broke it (# add_definitions(${LLVM_COMPILE_FLAGS})) - the flags are commented out, but I am not really sure what is happening just yet, will look soon enough |
I commented the flags because if LLVM is compiled with |
I added the exit code for MetaCPPCLI, now it fails on the |
We don't have to fix it today, take it easy =) |
It is fine, it kinda works now (build on my pc and in the container), deserialization is actually broken for static arrays it seems, guess will look at it tomorrow |
So I reimplemented the thing with the recursion, and added ARRAY qualifier, and it worked (reserialization matched) for array and array of arrays. But array of arrays of pointers did not work, because the element type was interpreted as char[2] (instead of char* [2]), because qualifiers are dropped in reflection types (so that we reflect the types, not the pointers to types and other stuff like that, I totally dig your approach, but it seems it brings serious limitations). To make this work we have to support both the instantiation type qualifiers, and the type qualifiers, so that we could support char (arrayOfPointersToArrays[2])[2] , and just char [2][2]. To support it we need to add vector of qualifiers to Type, namely - variant of (pointer, ref, array(n)). I will try to implement it, but it is a serious architecture change, and would probably take some time for me to do. For my needs, I don't even need pointers, I use handles everywhere in GPP, but I do use arrays and bitfields, so it is a top priority for me. What do you think? @mlomb |
Implementing that solution would requires some time and I don't have many right now, if this PR fills your needs, we can merge it and leave the array of arrays of pointers problem for another time.
I'm ready to merge, please confim |
Okay I pushed the version where it works for char* C, char C[2], and char C[2][2], but not char C[2][2][2] and not C*[2][2]. |
And It's merged. Thanks for your contribution and time spent! 😄 Closes #2 |
Updated cmake to work with ninja on linux (tested under ubuntu 20.04)
Updated code to:
Improtant:
Due to changes to cmake source generation, first fresh build results in failure due to source files being overwritten during project compilation: ProduceMetaCPP and Example are built in parallel, and I know of no way to prevent that from cmake (I really searched), but maybe some post-cmake-generation makefile injection could do the trick - but this is a dangerous territory. In my build system I fail the build from my old analogue of MetaCPP, saying that "Hey, I just changed the .generated source, you might want to restart the build, so that your actual project recompiles it".
Without the changes, though, ninja is not supported. I would perfectly understand you not wanting to use these changes in case you are comfortable with MSVC sole setup.
Also I am not sure about the flag I am adding with the include path, but I do not think it would hurt. It is the path clang resides in when built from sources and installed on linux.