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

Clean up libftdi dependencies #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

maksymko
Copy link

@maksymko maksymko commented Oct 9, 2019

This removes dependency on libftdi/libftdi1 include file from mpsse.h

The user still needs to know which library to link against, but issue is left for some other time.

Maxim Sloyko added 2 commits October 9, 2019 10:46
Remove dependency on ftdi.h header from public mpsse.h header.
The conditional include is moved to the mpsse.c and support.c files.
Remove dependency on config.h from examples. This file is not installed
and not available to clients, so should not be used in examples.

Also fixed two implicit-function-declaration warnings.
@l29ah
Copy link
Owner

l29ah commented Oct 19, 2019

I don't really understand why is it a good idea to remove the dependency from the header file. Aren't you supposed to have both libraries installed when you build the target application anyway?

@maksymko
Copy link
Author

This removes the dependency on config.h, which only exists when you are building the library.
This also removed source code dependency on libftdi header. The problem was that you pick libftdi vs libftdi1, when you compile libmpsse library, not when you compile your target application. However, your target application still implicitly chooses which header to include (ibftdti1 or libftdi), which may cause problems.

As I've mentioned, this solution is still not perfect, because you indeed still need to know which library to link against, but this is a step in the right direction. Alternatively, you can generate mpsse.h header, so that it will include the header from the library, which was used, when libmpsse was compiled.

@Matheus-Garbelini
Copy link

Hi @maksymko and @l29ah I've made a PR which ships a static build of libftdi so it works straight away by linking against it.
The generated libmpsse.a includes libftdi, libusb and libconfuse-2.5. Only thing left to do for the user is to link with pthreads and udev and include the header files on src folder. Let me know your feedback.

Regards.

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

Successfully merging this pull request may close these issues.

3 participants