Skip to content

OIS compilation

David Mansolino edited this page Feb 4, 2019 · 4 revisions

This page explains how to recompile the Object Oriented Input System dependency on every platforms. Object Oriented Input System is used to interface Webots with joysticks.

Linux

# Get libOIS
cd ~
git clone https://github.com/wgois/OIS.git

# Install required dependencies
sudo apt-get install libtool

# Build it
cd OIS
git checkout v1.4
chmod u+x bootstrap
./bootstrap
./configure
make

# Populate Webots and create the package
cp includes/*h ~/webots/include/libOIS/OIS/
cp src/.libs/*so ~/webots/lib/
cd ~
tar -cvjf libOIS.1.4.tar.bz2 webots/include/libOIS webots/lib/libOIS*

Mac

Download OIS 1.3 from SourceForge: https://sourceforge.net/projects/wgois Apply the patch from mac port: https://trac.macports.org/ticket/31974

For example, put the *.diff files into the ois directory and apply:

ls -1 *diff | xargs -L1 -I {} sh -c "patch -p0 < {}"

Comment the following lines in src/OISInputManager.cpp:

id obj = (id)strtoul(i->second.c_str(), 0, 10);
if(obj && [obj isKindOfClass:[NSWindow class]]) {

Comment the following lines in src/mac/MacHIDManager.cpp:

if(str)
  info->vendor = CFStringGetCStringPtr(str, CFStringGetSystemEncoding());

You should then be able to compile using the Xcode project (you might need to change some build settings to build to the 64bits architecture, the OIS.dylib can be created in an external directory, please check the log).

Change the internal library reference:

cd ~/webots
install_name_tool -id @rpath/lib/libOIS.dylib lib/libOIS.dylib
install_name_tool -id @rpath/lib/OIS.dylib lib/OIS.dylib

Windows

Download OIS 1.3 from SourceForge: https://sourceforge.net/projects/wgois Compile OIS using a simple makefile such as the following one:

CXX_SOURCES = $(wildcard src/*.cpp)
CXX_SOURCES += $(wildcard src/win32/*.cpp)

LIBRARIES = -ldinput8 -ldxguid -lole32 -loleaut32 -lXInput9_1_0
CFLAGS = -DOIS_WIN32_PLATFORM -DOIS_MINGW_COMPILER -DOIS_WIN32_XINPUT_SUPPORT -DNDEBUG -DOIS_DYNAMIC_LIB
INCLUDE = -I"./includes"

space :=
space +=
WEBOTS_HOME_PATH=$(subst $(space),\ ,$(strip $(subst \,/,$(WEBOTS_HOME))))
include $(WEBOTS_HOME_PATH)/resources/Makefile.include

Dependency package creation

Create an archive containing the following files and put it on the ftp:

cd ~/webots
tar jcvf libOIS.tar.bz2 webots/lib/*OIS* include/libOIS/OIS/*h
Clone this wiki locally