Skip to content

Commit

Permalink
pushing upstream openbsd support from package.
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Apr 7, 2018
1 parent d032050 commit b957281
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 14 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,9 @@ if(SFML_OS_MACOSX)
set(XCODE_TEMPLATES_ARCH "\$(NATIVE_ARCH_ACTUAL)")
endif()

if(SFML_OS_LINUX OR SFML_OS_FREEBSD)
if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD)
set(PKGCONFIG_DIR lib${LIB_SUFFIX}/pkgconfig)
if(SFML_OS_FREEBSD)
if(SFML_OS_FREEBSD OR SFML_OS_OPENBSD)
set(PKGCONFIG_DIR libdata/pkgconfig)
endif()
if(BUILD_SHARED_LIBS)
Expand Down
13 changes: 13 additions & 0 deletions cmake/Config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "^k?FreeBSD$")
set(SFML_OS_FREEBSD 1)
# don't use the OpenGL ES implementation on FreeBSD
set(OPENGL_ES 0)
elseif(CMAKE_SYSTEM_NAME MATCHES "^OpenBSD$")
set(SFML_OS_OPENBSD 1)
# don't use the OpenGL ES implementation on OpenBSD
set(OPENGL_ES 0)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
if(IOS)
set(SFML_OS_IOS 1)
Expand Down Expand Up @@ -117,3 +121,12 @@ else()
message(FATAL_ERROR "Unsupported compiler")
return()
endif()

# define the install directory for miscellaneous files
if(SFML_OS_WINDOWS OR SFML_OS_IOS)
set(INSTALL_MISC_DIR .)
elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_MACOSX OR SFML_OS_OPENBSD)
set(INSTALL_MISC_DIR share/SFML)
elseif(SFML_OS_ANDROID)
set(INSTALL_MISC_DIR ${ANDROID_NDK}/sources/sfml)
endif()
4 changes: 4 additions & 0 deletions include/SFML/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@

// FreeBSD
#define SFML_SYSTEM_FREEBSD
#elif defined(__OpenBSD__)

// OpenBSD
#define SFML_SYSTEM_OPENBSD

#else

Expand Down
2 changes: 1 addition & 1 deletion include/SFML/OpenGL.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

#include <GL/gl.h>

#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD)
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD)

#if defined(SFML_OPENGL_ES)
#include <GLES/gl.h>
Expand Down
2 changes: 1 addition & 1 deletion include/SFML/Window/WindowHandle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace sf
// Window handle is HWND (HWND__*) on Windows
typedef HWND__* WindowHandle;

#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD)
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD)

// Window handle is Window (unsigned long) on Unix - X11
typedef unsigned long WindowHandle;
Expand Down
12 changes: 9 additions & 3 deletions src/SFML/Window/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ if(SFML_OS_WINDOWS)

# make sure that we use the Unicode version of the Win API functions
add_definitions(-DUNICODE -D_UNICODE)
elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD)
elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD)
set(PLATFORM_SRC
${SRCROOT}/Unix/CursorImpl.hpp
${SRCROOT}/Unix/CursorImpl.cpp
Expand Down Expand Up @@ -116,6 +116,12 @@ elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD)
${SRCROOT}/FreeBSD/JoystickImpl.cpp
${SRCROOT}/FreeBSD/JoystickImpl.hpp
)
elseif(SFML_OS_OPENBSD)
set(PLATFORM_SRC
${PLATFORM_SRC}
${SRCROOT}/Android/JoystickImpl.cpp
${SRCROOT}/Android/JoystickImpl.hpp
)
endif()
source_group("unix" FILES ${PLATFORM_SRC})
elseif(SFML_OS_MACOSX)
Expand Down Expand Up @@ -224,7 +230,7 @@ sfml_add_library(sfml-window
target_link_libraries(sfml-window PUBLIC sfml-system)

# find and setup usage for external libraries
if(SFML_OS_LINUX OR SFML_OS_FREEBSD)
if(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OPENBSD)
sfml_find_package(X11 INCLUDE "X11_INCLUDE_DIR" LINK "X11_X11_LIB" "X11_Xrandr_LIB")
target_link_libraries(sfml-window PRIVATE X11)
endif()
Expand Down Expand Up @@ -259,7 +265,7 @@ if(SFML_OS_LINUX)
target_link_libraries(sfml-window PRIVATE UDev)
elseif(SFML_OS_WINDOWS)
target_link_libraries(sfml-window PRIVATE winmm gdi32)
elseif(SFML_OS_FREEBSD)
elseif(SFML_OS_FREEBSD OR SFML_OS_OPENBSD)
target_link_libraries(sfml-window PRIVATE usbhid)
elseif(SFML_OS_MACOSX)
target_link_libraries(sfml-window PRIVATE "-framework Foundation" "-framework AppKit" "-framework IOKit" "-framework Carbon")
Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Window/ClipboardImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#if defined(SFML_SYSTEM_WINDOWS)
#include <SFML/Window/Win32/ClipboardImpl.hpp>
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD)
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD)
#include <SFML/Window/Unix/ClipboardImpl.hpp>
#elif defined(SFML_SYSTEM_MACOS)
#include <SFML/Window/OSX/ClipboardImpl.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Window/CursorImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include <SFML/Window/Win32/CursorImpl.hpp>

#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD)
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD)

#include <SFML/Window/Unix/CursorImpl.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Window/GlContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#include <SFML/Window/Win32/WglContext.hpp>
typedef sf::priv::WglContext ContextType;

#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD)
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD)

#include <SFML/Window/Unix/GlxContext.hpp>
typedef sf::priv::GlxContext ContextType;
Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Window/InputImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#if defined(SFML_SYSTEM_WINDOWS)
#include <SFML/Window/Win32/InputImpl.hpp>
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD)
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD)
#include <SFML/Window/Unix/InputImpl.hpp>
#elif defined(SFML_SYSTEM_MACOS)
#include <SFML/Window/OSX/InputImpl.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Window/JoystickImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ struct JoystickState

#include <SFML/Window/iOS/JoystickImpl.hpp>

#elif defined(SFML_SYSTEM_ANDROID)
#elif defined(SFML_SYSTEM_ANDROID) || defined(SFML_SYSTEM_OPENBSD)

#include <SFML/Window/Android/JoystickImpl.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Window/SensorImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

#include <SFML/Window/Win32/SensorImpl.hpp>

#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD)
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD)

#include <SFML/Window/Unix/SensorImpl.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Window/WindowImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <SFML/Window/Win32/WindowImplWin32.hpp>
typedef sf::priv::WindowImplWin32 WindowImplType;

#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD)
#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD)

#include <SFML/Window/Unix/WindowImplX11.hpp>
typedef sf::priv::WindowImplX11 WindowImplType;
Expand Down

0 comments on commit b957281

Please sign in to comment.