Skip to content

Instantly share code, notes, and snippets.

@leper
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leper/626baab3d681ac7e2288 to your computer and use it in GitHub Desktop.
Save leper/626baab3d681ac7e2288 to your computer and use it in GitHub Desktop.
diff --git a/lib/glew/CMakeLists.txt b/lib/glew/CMakeLists.txt
index a6d2c9a..ebe8edb 100644
--- a/lib/glew/CMakeLists.txt
+++ b/lib/glew/CMakeLists.txt
@@ -7,6 +7,9 @@ if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch i386 -F/Library/Frameworks")
endif()
+find_package(OpenGL REQUIRED)
+include_directories(${OPENGL_INCLUDE_DIR})
+
add_library(glew STATIC
include/GL/glew.h include/GL/glxew.h include/GL/wglew.h
src/glew.c src/glewinfo.c
diff --git a/lib/irrlicht/CMakeLists.txt b/lib/irrlicht/CMakeLists.txt
index e8bf4f8..9655ace 100644
--- a/lib/irrlicht/CMakeLists.txt
+++ b/lib/irrlicht/CMakeLists.txt
@@ -6,6 +6,9 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include/"
"${CMAKE_CURRENT_SOURCE_DIR}/source/Irrlicht/zlib"
"${CMAKE_CURRENT_SOURCE_DIR}/source/Irrlicht/bzip2")
+find_package(OpenGL REQUIRED)
+include_directories(${OPENGL_INCLUDE_DIR})
+
if(APPLE)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/source/Irrlicht/MacOSX" "${CMAKE_CURRENT_SOURCE_DIR}/source/Irrlicht")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch i386")
diff --git a/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp b/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp
index 1f7b055..07c7b91 100644
--- a/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp
+++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp
@@ -35,7 +35,7 @@ extern bool GLContextDebugBit;
#include <fcntl.h>
#include <unistd.h>
-#ifdef __FREE_BSD_
+#ifdef __FreeBSD__
#include <sys/joystick.h>
#else
@@ -2023,7 +2023,7 @@ bool CIrrDeviceLinux::activateJoysticks(core::array<SJoystickInfo> & joystickInf
if (-1 == info.fd)
continue;
-#ifdef __FREE_BSD_
+#ifdef __FreeBSD__
info.axes=2;
info.buttons=2;
#else
@@ -2048,7 +2048,7 @@ bool CIrrDeviceLinux::activateJoysticks(core::array<SJoystickInfo> & joystickInf
returnInfo.Axes = info.axes;
returnInfo.Buttons = info.buttons;
-#ifndef __FREE_BSD_
+#ifndef __FreeBSD__
char name[80];
ioctl( info.fd, JSIOCGNAME(80), name);
returnInfo.Name = name;
@@ -2083,13 +2083,14 @@ void CIrrDeviceLinux::pollJoysticks()
{
JoystickInfo & info = ActiveJoysticks[j];
-#ifdef __FREE_BSD_
+#ifdef __FreeBSD__
struct joystick js;
- if (read(info.fd, &js, JS_RETURN) == JS_RETURN)
+ if (read(info.fd, &js, sizeof(js)) == sizeof(js))
{
- info.persistentData.JoystickEvent.ButtonStates = js.buttons; /* should be a two-bit field */
+ info.persistentData.JoystickEvent.ButtonStates = js.b1 | (js.b2 << 1); /* should be a two-bit field */
info.persistentData.JoystickEvent.Axis[0] = js.x; /* X axis */
info.persistentData.JoystickEvent.Axis[1] = js.y; /* Y axis */
+ }
#else
struct js_event event;
while (sizeof(event) == read(info.fd, &event, sizeof(event)))
diff --git a/src/network/protocols/get_public_address.cpp b/src/network/protocols/get_public_address.cpp
index 03c2323..5038757 100644
--- a/src/network/protocols/get_public_address.cpp
+++ b/src/network/protocols/get_public_address.cpp
@@ -39,6 +39,7 @@
# include <ws2tcpip.h>
#else
# include <netdb.h>
+# include <sys/socket.h>
#endif
#include <sys/types.h>
diff --git a/src/network/stk_host.cpp b/src/network/stk_host.cpp
index 081fbcc..d685d63 100644
--- a/src/network/stk_host.cpp
+++ b/src/network/stk_host.cpp
@@ -31,6 +31,7 @@
#else
# include <arpa/inet.h>
# include <errno.h>
+# include <sys/socket.h>
#endif
#include <pthread.h>
#include <signal.h>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment