pushing upstream openbsd support from package.

This commit is contained in:
David Carlier 2017-12-26 21:34:33 +00:00 committed by Lukas Dürrenberger
parent f4c25ac3fa
commit 4d0d331272
13 changed files with 37 additions and 14 deletions

View File

@ -269,9 +269,9 @@ if(SFML_OS_MACOSX)
set(XCODE_TEMPLATES_ARCH "\$(NATIVE_ARCH_ACTUAL)") set(XCODE_TEMPLATES_ARCH "\$(NATIVE_ARCH_ACTUAL)")
endif() 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) set(PKGCONFIG_DIR lib${LIB_SUFFIX}/pkgconfig)
if(SFML_OS_FREEBSD) if(SFML_OS_FREEBSD OR SFML_OS_OPENBSD)
set(PKGCONFIG_DIR libdata/pkgconfig) set(PKGCONFIG_DIR libdata/pkgconfig)
endif() endif()
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)

View File

@ -31,6 +31,10 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "^k?FreeBSD$")
set(SFML_OS_FREEBSD 1) set(SFML_OS_FREEBSD 1)
# don't use the OpenGL ES implementation on FreeBSD # don't use the OpenGL ES implementation on FreeBSD
set(OPENGL_ES 0) 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") elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
if(IOS) if(IOS)
set(SFML_OS_IOS 1) set(SFML_OS_IOS 1)
@ -117,3 +121,12 @@ else()
message(FATAL_ERROR "Unsupported compiler") message(FATAL_ERROR "Unsupported compiler")
return() return()
endif() 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()

View File

@ -85,6 +85,10 @@
// FreeBSD // FreeBSD
#define SFML_SYSTEM_FREEBSD #define SFML_SYSTEM_FREEBSD
#elif defined(__OpenBSD__)
// OpenBSD
#define SFML_SYSTEM_OPENBSD
#else #else

View File

@ -45,7 +45,7 @@
#include <GL/gl.h> #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) #if defined(SFML_OPENGL_ES)
#include <GLES/gl.h> #include <GLES/gl.h>

View File

@ -42,7 +42,7 @@ namespace sf
// Window handle is HWND (HWND__*) on Windows // Window handle is HWND (HWND__*) on Windows
typedef HWND__* WindowHandle; 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 // Window handle is Window (unsigned long) on Unix - X11
typedef unsigned long WindowHandle; typedef unsigned long WindowHandle;

View File

@ -79,7 +79,7 @@ if(SFML_OS_WINDOWS)
# make sure that we use the Unicode version of the Win API functions # make sure that we use the Unicode version of the Win API functions
add_definitions(-DUNICODE -D_UNICODE) 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 set(PLATFORM_SRC
${SRCROOT}/Unix/CursorImpl.hpp ${SRCROOT}/Unix/CursorImpl.hpp
${SRCROOT}/Unix/CursorImpl.cpp ${SRCROOT}/Unix/CursorImpl.cpp
@ -116,6 +116,12 @@ elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD)
${SRCROOT}/FreeBSD/JoystickImpl.cpp ${SRCROOT}/FreeBSD/JoystickImpl.cpp
${SRCROOT}/FreeBSD/JoystickImpl.hpp ${SRCROOT}/FreeBSD/JoystickImpl.hpp
) )
elseif(SFML_OS_OPENBSD)
set(PLATFORM_SRC
${PLATFORM_SRC}
${SRCROOT}/Android/JoystickImpl.cpp
${SRCROOT}/Android/JoystickImpl.hpp
)
endif() endif()
source_group("unix" FILES ${PLATFORM_SRC}) source_group("unix" FILES ${PLATFORM_SRC})
elseif(SFML_OS_MACOSX) elseif(SFML_OS_MACOSX)
@ -224,7 +230,7 @@ sfml_add_library(sfml-window
target_link_libraries(sfml-window PUBLIC sfml-system) target_link_libraries(sfml-window PUBLIC sfml-system)
# find and setup usage for external libraries # 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") sfml_find_package(X11 INCLUDE "X11_INCLUDE_DIR" LINK "X11_X11_LIB" "X11_Xrandr_LIB")
target_link_libraries(sfml-window PRIVATE X11) target_link_libraries(sfml-window PRIVATE X11)
endif() endif()
@ -259,7 +265,7 @@ if(SFML_OS_LINUX)
target_link_libraries(sfml-window PRIVATE UDev) target_link_libraries(sfml-window PRIVATE UDev)
elseif(SFML_OS_WINDOWS) elseif(SFML_OS_WINDOWS)
target_link_libraries(sfml-window PRIVATE winmm gdi32) 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) target_link_libraries(sfml-window PRIVATE usbhid)
elseif(SFML_OS_MACOSX) elseif(SFML_OS_MACOSX)
target_link_libraries(sfml-window PRIVATE "-framework Foundation" "-framework AppKit" "-framework IOKit" "-framework Carbon") target_link_libraries(sfml-window PRIVATE "-framework Foundation" "-framework AppKit" "-framework IOKit" "-framework Carbon")

View File

@ -32,7 +32,7 @@
#if defined(SFML_SYSTEM_WINDOWS) #if defined(SFML_SYSTEM_WINDOWS)
#include <SFML/Window/Win32/ClipboardImpl.hpp> #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> #include <SFML/Window/Unix/ClipboardImpl.hpp>
#elif defined(SFML_SYSTEM_MACOS) #elif defined(SFML_SYSTEM_MACOS)
#include <SFML/Window/OSX/ClipboardImpl.hpp> #include <SFML/Window/OSX/ClipboardImpl.hpp>

View File

@ -34,7 +34,7 @@
#include <SFML/Window/Win32/CursorImpl.hpp> #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> #include <SFML/Window/Unix/CursorImpl.hpp>

View File

@ -49,7 +49,7 @@
#include <SFML/Window/Win32/WglContext.hpp> #include <SFML/Window/Win32/WglContext.hpp>
typedef sf::priv::WglContext ContextType; 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> #include <SFML/Window/Unix/GlxContext.hpp>
typedef sf::priv::GlxContext ContextType; typedef sf::priv::GlxContext ContextType;

View File

@ -32,7 +32,7 @@
#if defined(SFML_SYSTEM_WINDOWS) #if defined(SFML_SYSTEM_WINDOWS)
#include <SFML/Window/Win32/InputImpl.hpp> #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> #include <SFML/Window/Unix/InputImpl.hpp>
#elif defined(SFML_SYSTEM_MACOS) #elif defined(SFML_SYSTEM_MACOS)
#include <SFML/Window/OSX/InputImpl.hpp> #include <SFML/Window/OSX/InputImpl.hpp>

View File

@ -98,7 +98,7 @@ struct JoystickState
#include <SFML/Window/iOS/JoystickImpl.hpp> #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> #include <SFML/Window/Android/JoystickImpl.hpp>

View File

@ -35,7 +35,7 @@
#include <SFML/Window/Win32/SensorImpl.hpp> #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> #include <SFML/Window/Unix/SensorImpl.hpp>

View File

@ -38,7 +38,7 @@
#include <SFML/Window/Win32/WindowImplWin32.hpp> #include <SFML/Window/Win32/WindowImplWin32.hpp>
typedef sf::priv::WindowImplWin32 WindowImplType; 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> #include <SFML/Window/Unix/WindowImplX11.hpp>
typedef sf::priv::WindowImplX11 WindowImplType; typedef sf::priv::WindowImplX11 WindowImplType;