Merge pull request #12716 from guijan/obsd-port

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

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

View File

@ -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.");
}

View File

@ -5,8 +5,9 @@ add_executable(dolphin-nogui
MainNoGUI.cpp
)
if(ENABLE_X11 AND X11_FOUND)
if(X11_FOUND)
target_sources(dolphin-nogui PRIVATE PlatformX11.cpp)
target_link_libraries(dolphin-nogui PRIVATE PkgConfig::XRANDR PkgConfig::X11)
endif()
if(WIN32)

View File

@ -125,14 +125,12 @@ elseif(APPLE)
-fobjc-arc
)
elseif(X11_FOUND)
target_include_directories(inputcommon PUBLIC ${X11_INPUT_INCLUDE_DIRS})
target_sources(inputcommon PRIVATE
ControllerInterface/Xlib/XInput2.cpp
ControllerInterface/Xlib/XInput2.h
)
target_link_libraries(inputcommon PUBLIC
${X11_LIBRARIES}
${X11_INPUT_LIBRARIES}
)
target_link_libraries(inputcommon PRIVATE PkgConfig::X11_INPUT)
elseif(ANDROID)
target_compile_definitions(inputcommon PRIVATE -DCIFACE_USE_ANDROID)
target_sources(inputcommon PRIVATE

View File

@ -42,10 +42,9 @@ if ((DEFINED CMAKE_ANDROID_ARCH_ABI AND CMAKE_ANDROID_ARCH_ABI MATCHES "x86|x86_
target_link_libraries(uicommon PRIVATE bdisasm)
endif()
if(ENABLE_X11 AND X11_FOUND)
target_include_directories(uicommon PRIVATE ${X11_INCLUDE_DIR})
if(X11_FOUND)
target_sources(uicommon PRIVATE X11Utils.cpp)
target_link_libraries(uicommon PUBLIC ${XRANDR_LIBRARIES})
target_link_libraries(uicommon PUBLIC PkgConfig::XRANDR PkgConfig::X11)
endif()
if(TARGET LibUSB::LibUSB)
@ -56,8 +55,24 @@ if(ENABLE_LLVM)
find_package(LLVM CONFIG QUIET)
if(LLVM_FOUND AND TARGET LLVM)
message(STATUS "LLVM found, enabling LLVM support in disassembler")
target_compile_definitions(uicommon PRIVATE HAVE_LLVM)
target_link_libraries(uicommon PRIVATE LLVM)
# Minimal documentation about LLVM's CMake functions is available here:
# https://releases.llvm.org/16.0.0/docs/CMake.html#embedding-llvm-in-your-project
#
# However, you have to read the source code in any case.
# Look for LLVM-Config.cmake in your (Unix) system:
# $ find /usr -name LLVM-Config\\.cmake 2>/dev/null
separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
target_compile_definitions(uicommon
PRIVATE HAVE_LLVM ${LLVM_DEFINITIONS_LIST}
)
target_link_directories(uicommon PRIVATE ${LLVM_LIBRARY_DIRS})
llvm_expand_pseudo_components(LLVM_EXPAND_COMPONENTS
AllTargetsInfos AllTargetsDisassemblers AllTargetsCodeGens
)
llvm_map_components_to_libnames(LLVM_LIBRARIES
mcdisassembler target ${LLVM_EXPAND_COMPONENTS}
)
target_link_libraries(uicommon PRIVATE ${LLVM_LIBRARIES})
target_include_directories(uicommon PRIVATE ${LLVM_INCLUDE_DIRS})
endif()
endif()

View File

@ -27,14 +27,10 @@ add_library(videoogl
VideoBackend.h
)
target_link_libraries(videoogl
PUBLIC
common
videocommon
PRIVATE
${X11_LIBRARIES}
)
target_link_libraries(videoogl PUBLIC common videocommon)
if(X11_FOUND)
target_link_libraries(videoogl PRIVATE PkgConfig::X11)
endif()
if(MSVC)
# Add precompiled header