Skip to content
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

Empty generation #7

Closed
ghost opened this issue Feb 14, 2021 · 10 comments
Closed

Empty generation #7

ghost opened this issue Feb 14, 2021 · 10 comments

Comments

@ghost
Copy link

ghost commented Feb 14, 2021

Hello there,

I hope this message finds you well. First of all, thank you for your work! I was able to build the generator and test it out, however I think there is something I miss. The generator generates empty classes i.e sokol_gfx, is there something that I miss?

image

@lithiumtoast
Copy link
Member

Something is for sure not right.

What os+arch you using?
What parameters are you using?

I use the following parameters for sokol_gfx.h on macOS:

-i
"/Users/lstranks/Programming/sokol/sokol_gfx.h"
-o
"./sokol_gfx.cs"
-u
-l
"sokol_gfx"
-s
"/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include"

Output: https://www.dropbox.com/s/melgx7wv2ida8lt/sokol_gfx.cs?dl=0

@ghost
Copy link
Author

ghost commented Feb 14, 2021

Windows 10 x64, can it be due to -s parameter that needs to be specified? I tried with -s and clang include path the output is the same.

C2CS.CommandLine.exe -i "sokol_gfx.h" -o "test.cs" -u -l "sokol_gfx"

@lithiumtoast
Copy link
Member

lithiumtoast commented Feb 14, 2021

Interesting just tested on Windows 10 Home 64-bit (10.0, Build 18363), and it works for me

-i
"C:\Users\lustr\Programming\sokol\sokol_gfx.h"
-o
"./sokol_gfx.cs"
-u
-l
"sokol_gfx"

Did you copy C2CS.CommandLine.exe to somewhere? I usually just use the tool from the bin directory .\bin\C2CS.CommandLine\Debug\net5.0

@lithiumtoast
Copy link
Member

I'll probably take this opportunity as a hint that I need some CI/CD.

@ghost
Copy link
Author

ghost commented Feb 14, 2021

No no, I used it from the bin directory. Is -s parameter mandatory or the generator should work without it?

Update: I see you use Debug, I tried both Debug and Release version of the generator

@lithiumtoast
Copy link
Member

The -s is for include directories. I would think you would only need to do use it if libclang reported a missing header like:

fatal error: 'stdint.h' file not found

What's the command line output? Is there any clang diagnostics printed to stdout or stderr?

@ghost
Copy link
Author

ghost commented Feb 14, 2021

Ah I see. No errors reported
image

@lithiumtoast
Copy link
Member

May seem dumb, but what are the contents of sokol_gfx.h? That file is copied to bin directory? I usually just pass the full path to the sokol git repository like: C:\Users\lustr\Programming\sokol\sokol_gfx.h

@ghost
Copy link
Author

ghost commented Feb 14, 2021

Uff, that was it. I had not only copied sokol_gfx but other headers, but I guess that was not enough. As soon as I specified the git path as you suggested it all worked. Thank you so much.
image

@lithiumtoast
Copy link
Member

Nice!

Btw, I noticed for sokol_gfx you will need the CBool type. You can find it here: https://github.com/lithiumtoast/c2cs/blob/master/src/dotnet/projects/production/C2CS.Core/C2CS/C/CBool.cs

I'm still trying to figure out how to add this to generated C# files in a smart way...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant