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

Add platform-conditional directive around spidev include #7

Closed
alexeden opened this issue Oct 31, 2018 · 2 comments
Closed

Add platform-conditional directive around spidev include #7

alexeden opened this issue Oct 31, 2018 · 2 comments

Comments

@alexeden
Copy link

Trying to install this package locally on a mac. Getting this error:

../src/spi.cc:1:10: fatal error: 'linux/spi/spidev.h' file not found
#include <linux/spi/spidev.h>
         ^~~~~~~~~~~~~~~~~~~~
1 error generated.

Makes sense, given that that library wouldn't exist on a mac. I noticed that in the pi-spi package, there's an #if __linux__ conditional around the inclusion of the SPI library. Would it make sense to include something like that in this package as well? Ideally I'd be able to run npm install anywhere without a breakdown.

@fivdi
Copy link
Owner

fivdi commented Oct 31, 2018

If spi-device is added to package.json in the optionalDependencies object rather than in the dependencies object then then it should be possible to achieve what you would like to achieve. There will be errors installing spi-device but npm will not terminate with an error while installing.

@alexeden
Copy link
Author

Fair enough!

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

2 participants