-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Add minimal example project (including CI) - take 2 #122
Conversation
Thanks for your changes! 😄 Could you please rebase? To fix this CI problem instead:
I guess we need to create the |
1e14dbf
to
6b0ebfa
Compare
Done.
Shouldn't |
Yep, it's a good solution
Yes, we can extend it in another PR
i think a
For now it's fine, we could eventually add a test to compare the
You can add Something like:
In this way you can use |
@Luni-4 Thanks for the review! In the meantime, I've renamed the directory with the C test: e055202.
I've decided this is too complicated for me (as a non-Windows-user), so I disabled the installation on Windows for now: 799aacb.
Perfect, this goes way beyond my abilities (and I don't really want to learn how to do it).
OK, cool. I thought that maybe CMake could be used, because this might also work on Windows ... but this is beyond the scope of this PR.
OK, cool.
I know, but if the library is installed to the default location, I don't even need And I don't see any advantage in having the header file in a sub-directory. The only situation where this makes sense is if there are multiple header files. I think the default for single header files should be to not create a sub-directory. Anyway, this can be further discussed and implemented at another time. |
@mgeier Thanks to you for your work! Yes, we can implement the
Thinking about this more in deep, building the example with a build system could help people to figure out how to use it alongside
Can we use the sub-directory approach for this example for now? As you said, we can always change that behavior later.
After the new sub-directories |
c7d6317
to
1214b41
Compare
I think this is a good idea, but I'm not familiar with
Sure, currently that's the only way to do it, AFAICT. Getting rid of the unnecessary sub-directory is a separate task, I've just created an issue for that: #125.
I don't understand what you mean by that.
Done. |
Perfect, thanks!
Using |
I don't think that's the best way to do it in this instructional example. Since the library is installed into the default location, no If we would want to show the use of I think we should show the most typical usage in this example, therefore I chose not to involve The switch to |
Seems legit, let's fix #125 first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I addressed the points discussed above in this review
Thanks for merging! |
This is an extension of #113.
I've re-based this PR in order to take advantage of #116 (
Box<T>
gets converted to*T
).I've also extended the Rust example code a bit, using an opaque pointer in the C API. I think this is a typical use case, isn't it?
I've also added a test program and a corresponding
Makefile
. I also added aREADME.md
.I think it is good to test the actual linking and usage of the generated library in CI, which is now done for Linux and macOS.
I have no idea how such a thing is typically done in Windows, but I guess this can be added later by somebody else.
I guess an actual C unit test framework could be used to test this, but for now I chose the simpler option of a small hand-written test program.
For now, only a simple
Makefile
is shown as an example for a build system, but at a later point other build systems (like e.g. CMake) could be added.I've added a CI step that prints out the
pkg-config
results, any ideas how to more properly test this?The auto-generated header file is installed to
/usr/local/include/example_project/example_project.h
. Is there a way to avoid creating a separate sub-directory and install it directly to/usr/local/include/example_project.h
?For now I've used this:
... but I think it would be more typical (at least for small projects) to do this: