Add FreeBSD support to num_cpu_cores() function

Hello!

Currently num_cpu_cores() function assumes that build environment is either MacOS (Darwin) or Linux. This commit adds support for FreeBSD, which has the same hw.ncpu sysctl as Darwin.