From 1718cb2fcee7714dd5754fe47a2e33bb0670f4da Mon Sep 17 00:00:00 2001 From: leper Date: Mon, 15 Dec 2014 07:50:11 +0100 Subject: [PATCH] FreeBSD build fixes. Irrlicht change also submitted upstream https://sourceforge.net/p/irrlicht/patches/300/. --- lib/glew/CMakeLists.txt | 3 +++ lib/irrlicht/CMakeLists.txt | 3 +++ lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp | 13 +++++++------ src/network/protocols/get_public_address.cpp | 1 + src/network/stk_host.cpp | 1 + 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/glew/CMakeLists.txt b/lib/glew/CMakeLists.txt index a6d2c9ab7..ebe8edb64 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 e8bf4f8f1..9655ace96 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 75231dca8..9f98d03bc 100644 --- a/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp +++ b/lib/irrlicht/source/Irrlicht/CIrrDeviceLinux.cpp @@ -35,7 +35,7 @@ extern bool GLContextDebugBit; #include #include -#ifdef __FREE_BSD_ +#ifdef __FreeBSD__ #include #else @@ -2023,7 +2023,7 @@ bool CIrrDeviceLinux::activateJoysticks(core::array & 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 & 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 03c232323..503875743 100644 --- a/src/network/protocols/get_public_address.cpp +++ b/src/network/protocols/get_public_address.cpp @@ -39,6 +39,7 @@ # include #else # include +# include #endif #include diff --git a/src/network/stk_host.cpp b/src/network/stk_host.cpp index 081fbcc73..d685d63b3 100644 --- a/src/network/stk_host.cpp +++ b/src/network/stk_host.cpp @@ -31,6 +31,7 @@ #else # include # include +# include #endif #include #include