BinomialLLC / basis_universal

Basis Universal GPU Texture Codec
Apache License 2.0
2.72k stars 267 forks source link

Fix compilation on FreeBSD #265

Closed Calinou closed 2 years ago

Calinou commented 3 years ago

Follow-up to https://github.com/BinomialLLC/basis_universal/pull/234. Downstream issues/PRs: https://github.com/godotengine/godot/pull/55139, https://github.com/godotengine/godot/issues/55138

Linux's <sys/timex.h> header was used instead of FreeBSD's <sys/time.h> due to missing preprocessor comparison.

akien-mga commented 3 years ago

Probably also relevant for NetBSD: https://man.netbsd.org/gettimeofday.2

And DragonFly BSD: https://leaf.dragonflybsd.org/cgi/web-man?command=gettimeofday&section=ANY

robfram commented 3 years ago

Perhaps it could instead use a common define present on all that systems except Apple universe, like __unix__, __unix or unix.

Then that line of code could be simply:

#elif defined(__APPLE__) || defined(__unix__)

Or, if it need to be somehow more precisse, something like which it is used here:

#elif defined(__APPLE__) || defined(__unix__) || defined(BSD)
richgel999 commented 2 years ago

Got it - thanks! I have used FreeBSD in the past, but I don't use it all the time.