support openbsd

このコミットが含まれているのは:
守矢諏訪子 2024-06-14 21:41:54 +09:00
コミット 6763201cc5
9個のファイルの変更39行の追加4行の削除

1
.gitignore vendored
ファイルの表示

@ -16,3 +16,4 @@ thirdparty/SDL/libSDL2-2.0.0.dylib
macos-xcode/
.swiftpm
*.xcodeproj
*.core

ファイルの表示

@ -109,6 +109,8 @@ int64_t get_current_time_nsecs()
struct timespec ts = {};
#ifdef ANDROID
constexpr auto timebase = CLOCK_MONOTONIC;
#elif defined (__OpenBSD__)
constexpr auto timebase = CLOCK_MONOTONIC;
#else
constexpr auto timebase = CLOCK_MONOTONIC_RAW;
#endif
@ -128,4 +130,4 @@ double Timer::end()
auto nt = get_current_time_nsecs();
return double(nt - t) * 1e-9;
}
}
}

ファイルの表示

@ -30,6 +30,15 @@
#include <algorithm>
#include <string.h>
#ifdef __OpenBSD__
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_core.h>
#include <vulkan/vulkan_beta.h>
#ifndef VK_KHR_LOAD_STORE_OP_NONE_EXTENSION_NAME
#define VK_KHR_LOAD_STORE_OP_NONE_EXTENSION_NAME "VK_KHR_load_store_op_none"
#endif
#endif
#ifndef _WIN32
#include <dlfcn.h>
#elif defined(_WIN32)

ファイルの表示

@ -74,6 +74,11 @@ ifneq ($(filter $(platform),linux bsd),)
else
$(error unrecognized hiro backend $(hiro))
endif
ifeq ($(platform),bsd)
hiro.flags += -I/usr/X11R6/include -I/usr/local/include/cairo -I/usr/local/include/gtk-3.0 -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/pango-1.0 -I/usr/local/include/harfbuzz -I/usr/local/include/gdk-pixbuf-2.0 -I/usr/local/include/atk-1.0
hiro.options += -L/usr/X11R6/lib
endif
endif
ifeq ($(hiro.resource),)

ファイルの表示

@ -230,7 +230,7 @@ ifeq ($(lto),true)
options += -Wl,-cache_path_lto,$(object.path)/lto
else ifeq ($(msvc),true)
options += -Wl,-lldltocache:$(object.path)/lto
else
else ifeq ($(platform),linux)
options += -Wl,--thinlto-cache-dir=$(object.path)/lto
endif
endif

ファイルの表示

@ -90,7 +90,7 @@ struct inode {
#if defined(PLATFORM_WINDOWS)
//on Windows, the last status change time (ctime) holds the file creation time instead
case time::create: return data.st_ctime;
#elif defined(PLATFORM_BSD) || defined(PLATFORM_MACOS)
#elif defined(PLATFORM_MACOS)
//st_birthtime may return -1 or st_atime if it is not supported by the file system
//the best that can be done in this case is to return st_mtime if it's older
case time::create: return min((u32)data.st_birthtime, (u32)data.st_mtime);

ファイルの表示

@ -70,6 +70,9 @@ ifeq ($(platform),macos)
endif
else
ruby.flags := $(flags.cpp)
ifeq ($(platform),bsd)
ruby.flags += -I/usr/X11R6/include
endif
endif
ruby.flags += -I../thirdparty
@ -134,7 +137,7 @@ ifeq ($(platform),linux)
endif
ifeq ($(platform),bsd)
ruby.options += -lX11 -lXext -lXrandr
ruby.options += -L/usr/X11R6/lib -lX11 -lXext -lXrandr
ruby.options += $(if $(findstring audio.openal,$(ruby)),-lopenal -fuse-ld=bfd)
# -fuse-ld=bfd: see FreeBSD bug 219089
endif

ファイルの表示

@ -1,7 +1,11 @@
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#ifdef __OpenBSD__
#include <soundcard.h>
#else
#include <sys/soundcard.h>
#endif
//OSSv4 features: define fallbacks for OSSv3 (where these ioctls are ignored)

ファイルの表示

@ -1,8 +1,15 @@
#pragma once
#include <usbhid.h>
#ifdef __OpenBSD__
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
#include <stdint.h>
typedef uint8_t uByte;
#else
#include <dev/usb/usbhid.h>
#include <dev/usb/usb_ioctl.h>
#endif
struct InputJoypadUHID {
Input& input;
@ -119,7 +126,11 @@ struct InputJoypadUHID {
}
joypad.report = hid_get_report_desc(joypad.fd);
#ifdef __OpenBSD__
joypad.reportID = 0;
#else
joypad.reportID = hid_get_report_id(joypad.fd);
#endif
joypad.reportSize = hid_report_size(joypad.report, hid_input, joypad.reportID);
joypad.buffer = new u8[joypad.reportSize];
auto parse = hid_start_parse(joypad.report, 1 << hid_input, joypad.reportID);