hardware
hardware copied to clipboard
Add support for Mac
Right now the shard was tested, built and ran only on Linux, but we should let the Mac guys in on the fun :)
Suggested way to do it is by having compile time OS specific code wrapped so that the program can be used in different operating systems.
For example (from crystal repo)
{% if flag?(:freebsd) || flag?(:openbsd) %}
require "./system/unix/sysctl_cpucount"
{% elsif flag?(:unix) %}
require "./system/unix/sysconf_cpucount"
{% end %}
Using macros is the way to go. I think also it would be good to put each platform specific implementation in its directory like linux, bsd... and of course keeping the same API.
+1 for mac support
+1 for Mac
Should be more generic rather using /proc/meminfo
Also, working not on every Linux