From 4d0d3312724ce180a3554e1fcdca951ff685632e Mon Sep 17 00:00:00 2001 From: David Carlier Date: Tue, 26 Dec 2017 21:34:33 +0000 Subject: [PATCH] pushing upstream openbsd support from package. --- CMakeLists.txt | 4 ++-- cmake/Config.cmake | 13 +++++++++++++ include/SFML/Config.hpp | 4 ++++ include/SFML/OpenGL.hpp | 2 +- include/SFML/Window/WindowHandle.hpp | 2 +- src/SFML/Window/CMakeLists.txt | 12 +++++++++--- src/SFML/Window/ClipboardImpl.hpp | 2 +- src/SFML/Window/CursorImpl.hpp | 2 +- src/SFML/Window/GlContext.cpp | 2 +- src/SFML/Window/InputImpl.hpp | 2 +- src/SFML/Window/JoystickImpl.hpp | 2 +- src/SFML/Window/SensorImpl.hpp | 2 +- src/SFML/Window/WindowImpl.cpp | 2 +- 13 files changed, 37 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 20557980e..26c5f981e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/cmake/Config.cmake b/cmake/Config.cmake index cebf3debb..784450433 100644 --- a/cmake/Config.cmake +++ b/cmake/Config.cmake @@ -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) @@ -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() diff --git a/include/SFML/Config.hpp b/include/SFML/Config.hpp index 33c4a71b4..659f4a76e 100644 --- a/include/SFML/Config.hpp +++ b/include/SFML/Config.hpp @@ -85,6 +85,10 @@ // FreeBSD #define SFML_SYSTEM_FREEBSD + #elif defined(__OpenBSD__) + + // OpenBSD + #define SFML_SYSTEM_OPENBSD #else diff --git a/include/SFML/OpenGL.hpp b/include/SFML/OpenGL.hpp index 1a57e65f0..6db5d01a2 100644 --- a/include/SFML/OpenGL.hpp +++ b/include/SFML/OpenGL.hpp @@ -45,7 +45,7 @@ #include -#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 diff --git a/include/SFML/Window/WindowHandle.hpp b/include/SFML/Window/WindowHandle.hpp index b2a250b87..daad04719 100644 --- a/include/SFML/Window/WindowHandle.hpp +++ b/include/SFML/Window/WindowHandle.hpp @@ -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; diff --git a/src/SFML/Window/CMakeLists.txt b/src/SFML/Window/CMakeLists.txt index 55083dbdf..7d61bdd12 100644 --- a/src/SFML/Window/CMakeLists.txt +++ b/src/SFML/Window/CMakeLists.txt @@ -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 @@ -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) @@ -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() @@ -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") diff --git a/src/SFML/Window/ClipboardImpl.hpp b/src/SFML/Window/ClipboardImpl.hpp index 95a8721eb..8e60d4e22 100644 --- a/src/SFML/Window/ClipboardImpl.hpp +++ b/src/SFML/Window/ClipboardImpl.hpp @@ -32,7 +32,7 @@ #if defined(SFML_SYSTEM_WINDOWS) #include -#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) +#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) #include #elif defined(SFML_SYSTEM_MACOS) #include diff --git a/src/SFML/Window/CursorImpl.hpp b/src/SFML/Window/CursorImpl.hpp index 4418c871d..d48220cf6 100644 --- a/src/SFML/Window/CursorImpl.hpp +++ b/src/SFML/Window/CursorImpl.hpp @@ -34,7 +34,7 @@ #include -#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) +#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) #include diff --git a/src/SFML/Window/GlContext.cpp b/src/SFML/Window/GlContext.cpp index 9b6c1f70b..3cbb70162 100644 --- a/src/SFML/Window/GlContext.cpp +++ b/src/SFML/Window/GlContext.cpp @@ -49,7 +49,7 @@ #include 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 typedef sf::priv::GlxContext ContextType; diff --git a/src/SFML/Window/InputImpl.hpp b/src/SFML/Window/InputImpl.hpp index d9316d1ac..305fc09d2 100644 --- a/src/SFML/Window/InputImpl.hpp +++ b/src/SFML/Window/InputImpl.hpp @@ -32,7 +32,7 @@ #if defined(SFML_SYSTEM_WINDOWS) #include -#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) +#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) #include #elif defined(SFML_SYSTEM_MACOS) #include diff --git a/src/SFML/Window/JoystickImpl.hpp b/src/SFML/Window/JoystickImpl.hpp index e5d4131fe..b47d5aa8a 100644 --- a/src/SFML/Window/JoystickImpl.hpp +++ b/src/SFML/Window/JoystickImpl.hpp @@ -98,7 +98,7 @@ struct JoystickState #include -#elif defined(SFML_SYSTEM_ANDROID) +#elif defined(SFML_SYSTEM_ANDROID) || defined(SFML_SYSTEM_OPENBSD) #include diff --git a/src/SFML/Window/SensorImpl.hpp b/src/SFML/Window/SensorImpl.hpp index 41a6ca0f9..a5434729d 100644 --- a/src/SFML/Window/SensorImpl.hpp +++ b/src/SFML/Window/SensorImpl.hpp @@ -35,7 +35,7 @@ #include -#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) +#elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) #include diff --git a/src/SFML/Window/WindowImpl.cpp b/src/SFML/Window/WindowImpl.cpp index bd87474b9..3de404a0b 100644 --- a/src/SFML/Window/WindowImpl.cpp +++ b/src/SFML/Window/WindowImpl.cpp @@ -38,7 +38,7 @@ #include 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 typedef sf::priv::WindowImplX11 WindowImplType;