]> git.lizzy.rs Git - irrlicht.git/commitdiff
Add support for OpenBSD
authorJosiahWI <41302989+JosiahWI@users.noreply.github.com>
Sat, 28 Aug 2021 16:12:40 +0000 (11:12 -0500)
committerGitHub <noreply@github.com>
Sat, 28 Aug 2021 16:12:40 +0000 (18:12 +0200)
There were three patches OpenBSD applied to build Irrlicht, and I implemented two of them. The first required turning off joystick events on OpenBSD, and the second (which I didn't confirm was necessary) required some defines in os.h. The third patch would have added an include to CIrrDeviceLinux.cpp, but the file had changed quite a bit and I could not tell whether this was necessary, so I left it out, and it appears Irrlicht builds fine.

include/IrrCompileConfig.h
source/Irrlicht/os.cpp

index fde88be1b5913a1989cf9e78f823ff41220ea375..6dc28615b3179ad9dc26bcd8338c9488df7405ac 100644 (file)
 \r
 \r
 //! Define _IRR_COMPILE_WITH_JOYSTICK_SUPPORT_ if you want joystick events.\r
+#if !(defined(__FreeBSD__) || defined(__OpenBSD__))\r
 #define _IRR_COMPILE_WITH_JOYSTICK_EVENTS_\r
+#endif\r
 #ifdef NO_IRR_COMPILE_WITH_JOYSTICK_EVENTS_\r
 #undef _IRR_COMPILE_WITH_JOYSTICK_EVENTS_\r
 #endif\r
index 2af9443acfe670975924fb667641f209e0ebbc3e..a410a91a4f1ac27f6ebe18150ac8b60b6f737c9d 100644 (file)
        #define bswap_16(X) OSReadSwapInt16(&X,0)\r
        #define bswap_32(X) OSReadSwapInt32(&X,0)\r
        #define bswap_64(X) OSReadSwapInt64(&X,0)\r
-#elif defined(__FreeBSD__) || defined(__OpenBSD__)\r
+#elif defined(__FreeBSD__)\r
        #include <sys/endian.h>\r
        #define bswap_16(X) bswap16(X)\r
        #define bswap_32(X) bswap32(X)\r
        #define bswap_64(X) bswap64(X)\r
+#elif defined(__OpenBSD__)\r
+       #include <endian.h>\r
+       #define bswap_16(X) letoh16(X)\r
+       #define bswap_32(X) letoh32(X)\r
+       #define bswap_64(X) letoh64(X)\r
 #elif !defined(_IRR_SOLARIS_PLATFORM_) && !defined(__PPC__) && !defined(_IRR_WINDOWS_API_)\r
        #include <byteswap.h>\r
 #else\r