mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 06:51:17 +01:00
Merge pull request #2741 from endrift/fix-freebsd-build-stable
Fix FreeBSD (stable)
This commit is contained in:
commit
da38e3a8ae
@ -160,6 +160,7 @@ endif()
|
|||||||
if(NOT ENABLE_GENERIC)
|
if(NOT ENABLE_GENERIC)
|
||||||
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^x86" OR
|
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^x86" OR
|
||||||
${CMAKE_SYSTEM_PROCESSOR} MATCHES "i.86" OR
|
${CMAKE_SYSTEM_PROCESSOR} MATCHES "i.86" OR
|
||||||
|
${CMAKE_SYSTEM_PROCESSOR} MATCHES "amd64" OR
|
||||||
APPLE)
|
APPLE)
|
||||||
if(_ARCH_64)
|
if(_ARCH_64)
|
||||||
set(_M_X86 1)
|
set(_M_X86 1)
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
|
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BSD4_4
|
#if defined BSD4_4 || defined __FreeBSD__
|
||||||
#define stat64 stat
|
#define stat64 stat
|
||||||
#define fstat64 fstat
|
#define fstat64 fstat
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,7 +63,7 @@ void MemArena::GrabSHMSegment(size_t size)
|
|||||||
#else
|
#else
|
||||||
for (int i = 0; i < 10000; i++)
|
for (int i = 0; i < 10000; i++)
|
||||||
{
|
{
|
||||||
std::string file_name = StringFromFormat("dolphinmem.%d", i);
|
std::string file_name = StringFromFormat("/dolphinmem.%d", i);
|
||||||
fd = shm_open(file_name.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600);
|
fd = shm_open(file_name.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600);
|
||||||
if (fd != -1)
|
if (fd != -1)
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifdef __APPLE__
|
#if defined __APPLE__ || defined __FreeBSD__
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h>
|
||||||
@ -256,11 +256,15 @@ size_t MemPhysical()
|
|||||||
memInfo.dwLength = sizeof(MEMORYSTATUSEX);
|
memInfo.dwLength = sizeof(MEMORYSTATUSEX);
|
||||||
GlobalMemoryStatusEx(&memInfo);
|
GlobalMemoryStatusEx(&memInfo);
|
||||||
return memInfo.ullTotalPhys;
|
return memInfo.ullTotalPhys;
|
||||||
#elif defined(__APPLE__)
|
#elif defined __APPLE__ || defined __FreeBSD__
|
||||||
int mib[2];
|
int mib[2];
|
||||||
size_t physical_memory;
|
size_t physical_memory;
|
||||||
mib[0] = CTL_HW;
|
mib[0] = CTL_HW;
|
||||||
|
#ifdef __APPLE__
|
||||||
mib[1] = HW_MEMSIZE;
|
mib[1] = HW_MEMSIZE;
|
||||||
|
#elif defined __FreeBSD__
|
||||||
|
mib[1] = HW_REALMEM;
|
||||||
|
#endif
|
||||||
size_t length = sizeof(size_t);
|
size_t length = sizeof(size_t);
|
||||||
sysctl(mib, 2, &physical_memory, &length, NULL, 0);
|
sysctl(mib, 2, &physical_memory, &length, NULL, 0);
|
||||||
return physical_memory;
|
return physical_memory;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
#elif defined BSD4_4
|
#elif defined BSD4_4 || defined __FreeBSD__
|
||||||
#include <pthread_np.h>
|
#include <pthread_np.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -94,8 +94,12 @@ void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask)
|
|||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
thread_policy_set(pthread_mach_thread_np(thread),
|
thread_policy_set(pthread_mach_thread_np(thread),
|
||||||
THREAD_AFFINITY_POLICY, (integer_t *)&mask, 1);
|
THREAD_AFFINITY_POLICY, (integer_t *)&mask, 1);
|
||||||
#elif (defined __linux__ || defined BSD4_4) && !(defined ANDROID)
|
#elif (defined __linux__ || defined BSD4_4 || defined __FreeBSD__) && !(defined ANDROID)
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
cpuset_t cpu_set;
|
||||||
|
#else
|
||||||
cpu_set_t cpu_set;
|
cpu_set_t cpu_set;
|
||||||
|
#endif
|
||||||
CPU_ZERO(&cpu_set);
|
CPU_ZERO(&cpu_set);
|
||||||
|
|
||||||
for (int i = 0; i != sizeof(mask) * 8; ++i)
|
for (int i = 0; i != sizeof(mask) * 8; ++i)
|
||||||
@ -125,6 +129,8 @@ void SetCurrentThreadName(const char* szThreadName)
|
|||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
pthread_setname_np(szThreadName);
|
pthread_setname_np(szThreadName);
|
||||||
|
#elif defined __FreeBSD__
|
||||||
|
pthread_set_name_np(pthread_self(), szThreadName);
|
||||||
#else
|
#else
|
||||||
pthread_setname_np(pthread_self(), szThreadName);
|
pthread_setname_np(pthread_self(), szThreadName);
|
||||||
#endif
|
#endif
|
||||||
|
@ -327,7 +327,7 @@ public:
|
|||||||
DWORD mMtu;
|
DWORD mMtu;
|
||||||
OVERLAPPED mReadOverlapped;
|
OVERLAPPED mReadOverlapped;
|
||||||
static VOID CALLBACK ReadWaitCallback(PVOID lpParameter, BOOLEAN TimerFired);
|
static VOID CALLBACK ReadWaitCallback(PVOID lpParameter, BOOLEAN TimerFired);
|
||||||
#elif defined(__linux__) || defined(__APPLE__)
|
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
int fd;
|
int fd;
|
||||||
std::thread readThread;
|
std::thread readThread;
|
||||||
std::atomic<bool> readEnabled;
|
std::atomic<bool> readEnabled;
|
||||||
|
@ -15,7 +15,7 @@ typedef pollfd pollfd_t;
|
|||||||
#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
|
#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
|
||||||
#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
|
#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
|
||||||
|
|
||||||
#elif defined(__linux__) or defined(__APPLE__)
|
#elif defined(__linux__) or defined(__APPLE__) or defined(__FreeBSD__)
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
#ifndef _M_GENERIC
|
#ifndef _M_GENERIC
|
||||||
#include "Core/PowerPC/JitCommon/JitBase.h"
|
#include "Core/PowerPC/JitCommon/JitBase.h"
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace EMM
|
namespace EMM
|
||||||
{
|
{
|
||||||
@ -256,7 +259,11 @@ static void sigsegv_handler(int sig, siginfo_t *info, void *raw_context)
|
|||||||
void InstallExceptionHandler()
|
void InstallExceptionHandler()
|
||||||
{
|
{
|
||||||
stack_t signal_stack;
|
stack_t signal_stack;
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
signal_stack.ss_sp = (char*)malloc(SIGSTKSZ);
|
||||||
|
#else
|
||||||
signal_stack.ss_sp = malloc(SIGSTKSZ);
|
signal_stack.ss_sp = malloc(SIGSTKSZ);
|
||||||
|
#endif
|
||||||
signal_stack.ss_size = SIGSTKSZ;
|
signal_stack.ss_size = SIGSTKSZ;
|
||||||
signal_stack.ss_flags = 0;
|
signal_stack.ss_flags = 0;
|
||||||
if (sigaltstack(&signal_stack, nullptr))
|
if (sigaltstack(&signal_stack, nullptr))
|
||||||
|
@ -64,7 +64,11 @@ if(USE_X11)
|
|||||||
set(NOGUI_SRCS ${NOGUI_SRCS} X11Utils.cpp)
|
set(NOGUI_SRCS ${NOGUI_SRCS} X11Utils.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(WXLIBS ${wxWidgets_LIBRARIES} dl)
|
set(WXLIBS ${wxWidgets_LIBRARIES})
|
||||||
|
|
||||||
|
if(NOT CMAKE_SYSTEM_NAME MATCHES FreeBSD)
|
||||||
|
set(WXLIBS ${WXLIBS} dl)
|
||||||
|
endif()
|
||||||
|
|
||||||
list(APPEND LIBS core uicommon)
|
list(APPEND LIBS core uicommon)
|
||||||
|
|
||||||
|
@ -45,8 +45,10 @@ set(LIBS ${LIBS}
|
|||||||
videocommon
|
videocommon
|
||||||
SOIL
|
SOIL
|
||||||
common
|
common
|
||||||
dl
|
|
||||||
${X11_LIBRARIES})
|
${X11_LIBRARIES})
|
||||||
|
if(NOT CMAKE_SYSTEM_NAME MATCHES FreeBSD)
|
||||||
|
set(LIBS ${LIBS} dl)
|
||||||
|
endif()
|
||||||
if(USE_EGL)
|
if(USE_EGL)
|
||||||
set(LIBS ${LIBS} EGL)
|
set(LIBS ${LIBS} EGL)
|
||||||
endif()
|
endif()
|
||||||
|
@ -30,6 +30,8 @@ namespace DriverDetails
|
|||||||
const u32 m_os = OS_ALL | OS_OSX;
|
const u32 m_os = OS_ALL | OS_OSX;
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
const u32 m_os = OS_ALL | OS_LINUX;
|
const u32 m_os = OS_ALL | OS_LINUX;
|
||||||
|
#elif __FreeBSD__
|
||||||
|
const u32 m_os = OS_ALL | OS_FREEBSD;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static Vendor m_vendor = VENDOR_UNKNOWN;
|
static Vendor m_vendor = VENDOR_UNKNOWN;
|
||||||
|
@ -14,6 +14,7 @@ namespace DriverDetails
|
|||||||
OS_LINUX = (1 << 2),
|
OS_LINUX = (1 << 2),
|
||||||
OS_OSX = (1 << 3),
|
OS_OSX = (1 << 3),
|
||||||
OS_ANDROID = (1 << 4),
|
OS_ANDROID = (1 << 4),
|
||||||
|
OS_FREEBSD = (1 << 5),
|
||||||
};
|
};
|
||||||
// Enum of known vendors
|
// Enum of known vendors
|
||||||
// Tegra and Nvidia are separated out due to such substantial differences
|
// Tegra and Nvidia are separated out due to such substantial differences
|
||||||
|
Loading…
x
Reference in New Issue
Block a user