Merge pull request #12716 from guijan/obsd-port

port to OpenBSD
This commit is contained in:
Admiral H. Curtiss authored and GitHub committed 2024-05-02 16:42:31 +02:00
commit 967280f140
8 files changed
+55 -30

No files matched your search

+6
View File
@@ -751,6 +751,12 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux")
endif()
endif()
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
# OpenBSD doesn't allow memory to be both writable and executable by default.
# The JIT currently needs this.
target_link_options(core PUBLIC -Wl,-zwxneeded)
endif()
if(TARGET Hidapi::Hidapi)
target_sources(core PRIVATE
HW/WiimoteReal/IOhidapi.cpp
@@ -41,6 +41,13 @@ namespace WiimoteReal
{
WiimoteScannerHidapi::WiimoteScannerHidapi()
{
#ifdef __OpenBSD__
// OpenBSD renamed libhidapi's hidapi_init function because the system has its own USB library
// which contains a symbol with the same name. See:
// https://cvsweb.openbsd.org/ports/comms/libhidapi/patches/patch-hidapi_hidapi_h?rev=1.3&content-type=text/x-cvsweb-markup
// https://man.openbsd.org/usbhid.3
#define hid_init hidapi_hid_init
#endif
int ret = hid_init();
ASSERT_MSG(WIIMOTE, ret == 0, "Couldn't initialise hidapi.");
}