Merge branch 'freebsd-fixes' of https://github.com/leper/stk-code into leper-freebsd-fixes

This commit is contained in:
hiker 2015-01-20 14:56:25 +11:00
commit f724369a8e
5 changed files with 15 additions and 6 deletions

View File

@ -7,6 +7,9 @@ if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch i386 -F/Library/Frameworks") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch i386 -F/Library/Frameworks")
endif() endif()
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
add_library(glew STATIC add_library(glew STATIC
include/GL/glew.h include/GL/glxew.h include/GL/wglew.h include/GL/glew.h include/GL/glxew.h include/GL/wglew.h
src/glew.c src/glewinfo.c src/glew.c src/glewinfo.c

View File

@ -8,6 +8,9 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include/"
"${ZLIB_INCLUDE_DIR}" "${ZLIB_INCLUDE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}/../zlib/") # For zconf.h on WIN32 "${CMAKE_CURRENT_BINARY_DIR}/../zlib/") # For zconf.h on WIN32
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
if(APPLE) if(APPLE)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/source/Irrlicht/MacOSX" "${CMAKE_CURRENT_SOURCE_DIR}/source/Irrlicht") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/source/Irrlicht/MacOSX" "${CMAKE_CURRENT_SOURCE_DIR}/source/Irrlicht")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch i386") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch i386")

View File

@ -35,7 +35,7 @@ extern bool GLContextDebugBit;
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#ifdef __FREE_BSD_ #ifdef __FreeBSD__
#include <sys/joystick.h> #include <sys/joystick.h>
#else #else
@ -2023,7 +2023,7 @@ bool CIrrDeviceLinux::activateJoysticks(core::array<SJoystickInfo> & joystickInf
if (-1 == info.fd) if (-1 == info.fd)
continue; continue;
#ifdef __FREE_BSD_ #ifdef __FreeBSD__
info.axes=2; info.axes=2;
info.buttons=2; info.buttons=2;
#else #else
@ -2048,7 +2048,7 @@ bool CIrrDeviceLinux::activateJoysticks(core::array<SJoystickInfo> & joystickInf
returnInfo.Axes = info.axes; returnInfo.Axes = info.axes;
returnInfo.Buttons = info.buttons; returnInfo.Buttons = info.buttons;
#ifndef __FREE_BSD_ #ifndef __FreeBSD__
char name[80]; char name[80];
ioctl( info.fd, JSIOCGNAME(80), name); ioctl( info.fd, JSIOCGNAME(80), name);
returnInfo.Name = name; returnInfo.Name = name;
@ -2083,13 +2083,14 @@ void CIrrDeviceLinux::pollJoysticks()
{ {
JoystickInfo & info = ActiveJoysticks[j]; JoystickInfo & info = ActiveJoysticks[j];
#ifdef __FREE_BSD_ #ifdef __FreeBSD__
struct joystick js; 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[0] = js.x; /* X axis */
info.persistentData.JoystickEvent.Axis[1] = js.y; /* Y axis */ info.persistentData.JoystickEvent.Axis[1] = js.y; /* Y axis */
}
#else #else
struct js_event event; struct js_event event;
while (sizeof(event) == read(info.fd, &event, sizeof(event))) while (sizeof(event) == read(info.fd, &event, sizeof(event)))

View File

@ -39,6 +39,7 @@
# include <ws2tcpip.h> # include <ws2tcpip.h>
#else #else
# include <netdb.h> # include <netdb.h>
# include <sys/socket.h>
#endif #endif
#include <sys/types.h> #include <sys/types.h>

View File

@ -31,6 +31,7 @@
#else #else
# include <arpa/inet.h> # include <arpa/inet.h>
# include <errno.h> # include <errno.h>
# include <sys/socket.h>
#endif #endif
#include <pthread.h> #include <pthread.h>
#include <signal.h> #include <signal.h>