SFML community forums

Help => General => Topic started by: ccbsd on September 14, 2011, 04:21:31 pm

Title: SFML works on FreeBSD very good
Post by: ccbsd on September 14, 2011, 04:21:31 pm
Edit: I am sorry for this edit. SFML works on FreeBSD very good after years.

When I compile SFML 2.0 in my FreeBSD 8.2 with cmake:
Code: [Select]
CMake Warning at cmake/Config.cmake:20 (message):
   Unsupported operating system
 Call Stack (most recent call first):
   CMakeLists.txt:14 (include)



 CMake Error at CMakeLists.txt:190 (install):
   install FILES given no DESTINATION!

Part of the cmake/Config.cmake file:
Code: [Select]
# detect the OS
 if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
     set(WINDOWS 1)
 elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
     set(LINUX 1)
 elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
     set(MACOSX 1)

Do you really don't want SFML to support FreeBSD?

Edit: I am sorry for this edit. SFML can be built on FreeBSD without suspense. It just run better. SFML works on FreeBSD very good after years.

cmake/Config.cmake
     19 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
     20     set(SFML_OS_UNIX 1)
     21     if(ANDROID)
     22         set(SFML_OS_ANDROID 1)
     23         # use the OpenGL ES implementation on Android
     24         set(OPENGL_ES 1)
     25     else()
     26         set(SFML_OS_LINUX 1)
     27         # don't use the OpenGL ES implementation on Linux
     28         set(OPENGL_ES 0)
     29     endif()
     30 elseif(CMAKE_SYSTEM_NAME MATCHES "^k?FreeBSD$")
     31     set(SFML_OS_FREEBSD 1)
     32     # don't use the OpenGL ES implementation on FreeBSD
     33     set(OPENGL_ES 0)
 

And I wish more other BSD supports. Bitrig, NetBSD, OpenBSD, ...
Title: FreeBSD is an Unsupported operating system?
Post by: Laurent on September 14, 2011, 05:00:43 pm
In fact SFML supports FreeBSD, it's just the CMake file which is incomplete.
Title: FreeBSD is an Unsupported operating system?
Post by: ccbsd on September 14, 2011, 05:07:02 pm
Quote from: "Laurent"
In fact SFML supports FreeBSD, it's just the CMake file which is incomplete.


I see, thank you.
Title: FreeBSD is an Unsupported operating system?
Post by: ccbsd on September 14, 2011, 05:52:57 pm
but I don't know how to modify the cmake files.
Title: FreeBSD is an Unsupported operating system?
Post by: Laurent on September 14, 2011, 05:59:34 pm
You don't have to, it's already fixed.

It was not tested so... I hope it really works :)
Title: FreeBSD is an Unsupported operating system?
Post by: ccbsd on September 15, 2011, 02:44:19 pm
I downloaded LaurentGomila-SFML-bindings_removed-98-g78a625d.tar.gz just now and build it. I still failed to build it.
Code: [Select]

 elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
     # FreeBSD compile path is the same as Linux
     set(LINUX 1)

FreeBSD is not Linux.




Code: [Select]

LaurentGomila-SFML-a647c68/src/SFML/Window/Linux/JoystickImpl.cpp:55: error: 'O_RDONLY' was not declared in this scope
LaurentGomila-SFML-a647c68/src/SFML/Window/Linux/JoystickImpl.cpp:55: error: 'open' was not declared in this scope

So I add #include <fcntl.h> into src/SFML/Window/Linux/JoystickImpl.cpp



Code: [Select]

LaurentGomila-SFML-a647c68/src/SFML/Window/Linux/JoystickImpl.cpp:63: error: 'ioctl' was not declared in this scope

So I ad #include <sys/ioctl.h> into src/SFML/Window/Linux/JoystickImpl.cpp



Code: [Select]

LaurentGomila-SFML-a647c68/src/SFML/Window/Linux/JoystickImpl.cpp:64: error: 'JSIOCGAXMAP' was not declared in this scope
LaurentGomila-SFML-a647c68/src/SFML/Window/Linux/JoystickImpl.cpp:92: error: 'JSIOCGBUTTONS' was not declared in this scope
LaurentGomila-SFML-a647c68/src/SFML/Window/Linux/JoystickImpl.cpp:99: error: 'JSIOCGAXES' was not declared in this scope


Code: [Select]

LaurentGomila-SFML-a647c68/src/SFML/Window/Linux/JoystickImpl.cpp:104: error: 'ABS_X' was not declared in this scope

...
Code: [Select]

LaurentGomila-SFML-a647c68/src/SFML/Window/Linux/JoystickImpl.cpp:126: error: 'js_event' was not declared in this scope

Which file defines JSIO*, ABS_*, js_event_* ?
Title: FreeBSD is an Unsupported operating system?
Post by: Laurent on September 15, 2011, 05:02:50 pm
Quote
I downloaded LaurentGomila-SFML-bindings_removed-98-g78a625d.tar.gz

This looks like an old revision (bindings_removed is a tag that I set when I removed bindings from the main repository).

Quote
FreeBSD is not Linux.

Yeah, I know... but the build configuration is the same on both. That's why I've put a comment to explain this.

Quote
...many errors with joystick API...

Ok, here is the interesting stuff :)
The joystick API on FreeBSD is undocumented and I was waiting for someone to help me for implementation and tests. Would you like to help?
Title: FreeBSD is an Unsupported operating system?
Post by: ccbsd on September 15, 2011, 05:21:39 pm
Quote from: "Laurent"

Quote
...many errors with joystick API...

Ok, here is the interesting stuff :)
The joystick API on FreeBSD is undocumented and I was waiting for someone to help me for implementation and tests. Would you like to help?


I 'd like. How to do? (I have some level c and c++ skills. But I have a frew system and project build skills).
Title: FreeBSD is an Unsupported operating system?
Post by: Laurent on September 15, 2011, 06:02:30 pm
First, we need to find documentation for the joystick API on FreeBSD. It should be close the Linux one, but without a doc we can't do anything.

Then with a doc I think I'll be able to fix the code blindly, and you would test it for me.

So... do you know where I could find the documentation of the FreeBSD joystick API?
Title: FreeBSD is an Unsupported operating system?
Post by: ccbsd on September 15, 2011, 06:22:44 pm
Quote from: "Laurent"
First, we need to find documentation for the joystick API on FreeBSD. It should be close the Linux one, but without a doc we can't do anything.

Then with a doc I think I'll be able to fix the code blindly, and you would test it for me.

So... do you know where I could find the documentation of the FreeBSD joystick API?


sounds interesting. I will have a try.
Title: FreeBSD is an Unsupported operating system?
Post by: ccbsd on September 16, 2011, 05:09:57 pm
Quote from: "Laurent"
First, we need to find documentation for the joystick API on FreeBSD. It should be close the Linux one, but without a doc we can't do anything.

Then with a doc I think I'll be able to fix the code blindly, and you would test it for me.

So... do you know where I could find the documentation of the FreeBSD joystick API?


xf86-input-joystick  is in FreeBSD ports tree.
Code: [Select]

# cd /usr/ports/x11-drivers/xf86-input-joystick/
# make install clean
# pkg_info -Ix xf86-input-joystick
xf86-input-joystick-1.5.0_1 X.Org joystick input driver
# pkg_info -L xf86-input-joystick-1.5.0_1
Information for xf86-input-joystick-1.5.0_1:

Files:
/usr/local/man/man4/joystick.4x.gz
/usr/local/include/xorg/joystick-properties.h
/usr/local/lib/xorg/modules/input/joystick_drv.la
/usr/local/lib/xorg/modules/input/joystick_drv.so
/usr/local/libdata/pkgconfig/xorg-joystick.pc





This is the entire code of /usr/local/include/xorg/joystick-properties.h
Code: [Select]

/*
 * Copyright 2007-2008 by Sascha Hlusiak. <saschahlusiak@freedesktop.org>    
 *                                                                            
 * Permission to use, copy, modify, distribute, and sell this software and its
 * documentation for any purpose is  hereby granted without fee, provided that
 * the  above copyright   notice appear  in   all  copies and  that both  that
 * copyright  notice   and   this  permission   notice  appear  in  supporting
 * documentation, and that   the  name of  Sascha   Hlusiak  not  be  used  in
 * advertising or publicity pertaining to distribution of the software without
 * specific,  written      prior  permission.     Sascha   Hlusiak   makes  no
 * representations about the suitability of this software for any purpose.  It
 * is provided "as is" without express or implied warranty.                  
 *                                                                            
 * SASCHA  HLUSIAK  DISCLAIMS ALL   WARRANTIES WITH REGARD  TO  THIS SOFTWARE,
 * INCLUDING ALL IMPLIED   WARRANTIES OF MERCHANTABILITY  AND   FITNESS, IN NO
 * EVENT  SHALL SASCHA  HLUSIAK  BE   LIABLE   FOR ANY  SPECIAL, INDIRECT   OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * DATA  OR PROFITS, WHETHER  IN  AN ACTION OF  CONTRACT,  NEGLIGENCE OR OTHER
 * TORTIOUS  ACTION, ARISING    OUT OF OR   IN  CONNECTION  WITH THE USE    OR
 * PERFORMANCE OF THIS SOFTWARE.
 *
 */

#ifndef _JOYSTICK_PROPERTIES_
#define _JOYSTICK_PROPERTIES_

/**
 * Properties exported by the joystick driver. These properties are
 * recognized by the driver and will change its behavior when modified.
 */



/** To be used with property JSTK_PROP_AXIS_TYPE **/
typedef enum _JSTK_TYPE {
    JSTK_TYPE_NONE=0,      /* Axis value is not relevant */
    JSTK_TYPE_BYVALUE,     /* Speed of cursor is relative to amplitude */
    JSTK_TYPE_ACCELERATED, /* Speed is accelerated */
    JSTK_TYPE_ABSOLUTE     /* The amplitude defines the cursor position */
} JSTK_TYPE;


/** To be used with properties JSTK_PROP_AXIS_MAPPING, JSTK_PROP_BUTTON_MAPPING */
typedef enum _JSTK_MAPPING {
    JSTK_MAPPING_NONE=0,         /* Nothing */
    JSTK_MAPPING_X,              /* X-Axis */
    JSTK_MAPPING_Y,              /* Y-Axis */
    JSTK_MAPPING_ZX,             /* Horizontal scrolling */
    JSTK_MAPPING_ZY,             /* Vertical scrolling */
    JSTK_MAPPING_BUTTON,         /* Mouse button */
    JSTK_MAPPING_KEY,            /* Keyboard event */
    JSTK_MAPPING_SPEED_MULTIPLY, /* Will amplify all axis movement */
    JSTK_MAPPING_DISABLE,        /* Disable mouse and key events */
    JSTK_MAPPING_DISABLE_MOUSE,  /* Disable only mouse events */
    JSTK_MAPPING_DISABLE_KEYS    /* Disable only key events */
} JSTK_MAPPING;



/** Controls the verbosity of the driver */
/* 8 bit (0..20) */
#define JSTK_PROP_DEBUGLEVEL "Debug Level"

/** Number of buttons found on device */
/* 8 bit (0..MAXBUTTONS), read-only */
#define JSTK_PROP_NUMBUTTONS "Buttons"

/** Number of axes found on device */
/* 8 bit (0..MAXAXES), read-only */
#define JSTK_PROP_NUMAXES "Axes"

/** Generate pointer movement or button events */
/* 8 bit (0 or 1) */
#define JSTK_PROP_MOUSE_ENABLED "Generate Mouse Events"

/** Generate key events */
/* 8 bit (0 or 1) */
#define JSTK_PROP_KEYS_ENABLED "Generate Key Events"

/** Set the dead zone of each axis */
/* 32 bit (0..30000), for each axis*/
#define JSTK_PROP_AXIS_DEADZONE   "Axis Deadzone"

/** Set axis type to none, byvalue, accelerated, absolute */
/* 8 bit, one of enum _JSTK_TYPE per axis*/
#define JSTK_PROP_AXIS_TYPE   "Axis Type"

/** Set mapping of axis to none, x, y, zx, zy, key */
/* 8 bit, one of enum _JSTK_MAPPING per axis */
#define JSTK_PROP_AXIS_MAPPING   "Axis Mapping"

/** Set movement factor of axis (default 1.0f) */
/* FLOAT[MAXAXES], movement amplify per axis */
#define JSTK_PROP_AXIS_AMPLIFY "Axis Amplify"

/** Scancodes for axis in low position */
/* 8 bit, 4 per axis */
#define JSTK_PROP_AXIS_KEYS_LOW "Axis Keys (low)"

/** Scancodes for axis in high position */
/* 8 bit, 4 per axis */
#define JSTK_PROP_AXIS_KEYS_HIGH "Axis keys (high)"

/** Set the mapping of each button to
    none, x, y, zx, zy, button, key, speed_multiply,
    disable, disable_mouse, disable_keys */
/* 8 bit, one of enum _JSTK_MAPPING per button */
#define JSTK_PROP_BUTTON_MAPPING   "Button Mapping"

/** Set the logical button to report for this physical button */
/* 8 bit (0..32), logical button number per button */
#define JSTK_PROP_BUTTON_BUTTONNUMBER "Button Number"

/** Set amplify factor of button (default 1.0f) */
/* FLOAT[MAXBUTTONS], amplify value per button */
#define JSTK_PROP_BUTTON_AMPLIFY "Button Amplify"

/** Scancodes for button */
/* 8 bit, 4 per button */
#define JSTK_PROP_BUTTON_KEYS "Button Keys"


#endif /* _JOYSTICK_PROPERTIES_ */
Title: FreeBSD is an Unsupported operating system?
Post by: Laurent on September 16, 2011, 05:55:48 pm
Now we need some functions to make use of these constants :P

After searching a little bit I found that most of the libraries that implement joystick handling (like SDL) rely on uhid directly on FreeBSD. That's... raw.
Title: FreeBSD is an Unsupported operating system?
Post by: ccbsd on September 19, 2011, 05:12:24 pm
Maybe ois is a solution, I am not sure. A friend told me.
Quote
Object Oriented Input System (OIS) is meant to be a cross platform, simple solution for using all kinds of Input Devices (Keyboards, Mice, Joysticks, etc) and feedback devices (e.g. force feedback). Written in C++ using Object Oriented Design pattern

http://sourceforge.net/projects/wgois/
ois is in FreeBSD ports tree:
/usr/ports/devel/ois/
Title: FreeBSD is an Unsupported operating system?
Post by: Laurent on September 19, 2011, 07:13:32 pm
I don't want to use a high-level library for this, but I can have a look at their source code.

They have files for Win32, Mac, Linux, iPhone but I can't find what they use for FreeBSD.
Title: FreeBSD is an Unsupported operating system?
Post by: ccbsd on October 25, 2011, 03:11:46 pm
I am sorry that it's hard for me to do something for SFML. It's a pity that FreeBSD users can't use SFML 2.0 now.
Title: Re: FreeBSD is an Unsupported operating system?
Post by: andreas on October 08, 2012, 09:57:48 am
Hi everyone, hello Laurent,

I'd like to bring this thread up again, since I tried to build SFML2 on FreeBSD 9.0 recently.

I still get a bunch of errors from JoystickImpl.cpp saying that a bunch of variables have not been declared
(::open, O_RDONLY, F_SETFL and so on ).

Is there some progress considering the Joystick issues on FreeBSD? I'd also like to offer my help if needed.

Thanks a lot.


Title: Re: FreeBSD is an Unsupported operating system?
Post by: Laurent on October 08, 2012, 10:10:52 am
Quote
Is there some progress considering the Joystick issues on FreeBSD?
No, since I cannot find any documentation about the joystick API on FreeBSD. So yes, I really need your help :)
Title: Re: FreeBSD is an Unsupported operating system?
Post by: andreas on October 08, 2012, 12:24:11 pm
As far as I understand, on FreeBSD (as well as NetBSD and OpenBSD) all USB-input devices are handled within the uhub/uhid module. There is also no special device-file for Joysticks (like /dev/input/jsX on linux). Thus there is also no special JoystickAPI available. The Joystick Interface should rather be adressed by using the USB-HID API  (bsd jstk.c).

I'll take a look into that.
Title: Re: FreeBSD is an Unsupported operating system?
Post by: deaddodo on October 22, 2012, 11:46:06 am
If you don't want to use UHIDD (though that is the recommended method on *BSD), you can always use the linux-js port:

http://www.freshports.org/devel/linux-js

Which is a port of the Linux Joystick API.
Title: Re: FreeBSD is an Unsupported operating system?
Post by: Laurent on October 22, 2012, 01:23:49 pm
Quote
If you don't want to use UHIDD (though that is the recommended method on *BSD), you can always use the linux-js port
That would be very convenient (nothing to change in SFML), but I'd like to use only "standard" dependencies. If most users are forced to install linux-js because of SFML, I think it's a bad idea. However if many applications use it, and it's likely to be already installed on the majority of systems, then it could be a good solution.
Title: Re: FreeBSD is an Unsupported operating system?
Post by: andreas on October 25, 2012, 12:18:49 pm
The linux-js port is marked as broken on FreeBSD 9.x stable.
So it can't be easily installed.
Title: Re: Edit: SFML works on FreeBSD very good
Post by: ccbsd on August 27, 2016, 12:05:51 am
SFML works better on FreeBSD now. And I wish it supports more BSD OS.