1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 01:24:11 +01:00

[dxvk] Add FreeBSD support

This commit is contained in:
Er2 2024-07-07 14:22:43 +03:00 committed by GitHub
parent 60e523b4bf
commit 38006e9cda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 34 additions and 3 deletions

View File

@ -25,6 +25,8 @@ shift 2
opt_nopackage=0 opt_nopackage=0
opt_devbuild=0 opt_devbuild=0
opt_buildid=false opt_buildid=false
opt_64_only=0
opt_32_only=0
CC=${CC:="gcc"} CC=${CC:="gcc"}
CXX=${CXX:="g++"} CXX=${CXX:="g++"}
@ -41,6 +43,12 @@ while [ $# -gt 0 ]; do
"--build-id") "--build-id")
opt_buildid=true opt_buildid=true
;; ;;
"--64-only")
opt_64_only=1
;;
"--32-only")
opt_32_only=1
;;
*) *)
echo "Unrecognized option: $1" >&2 echo "Unrecognized option: $1" >&2
exit 1 exit 1
@ -81,8 +89,12 @@ function package {
rm -R "dxvk-native-$DXVK_VERSION" rm -R "dxvk-native-$DXVK_VERSION"
} }
build_arch 64 lib if [ $opt_32_only -eq 0 ]; then
build_arch 32 lib32 build_arch 64 lib
fi
if [ $opt_64_only -eq 0 ]; then
build_arch 32 lib32
fi
if [ $opt_nopackage -eq 0 ]; then if [ $opt_nopackage -eq 0 ]; then
package package

View File

@ -316,7 +316,11 @@ namespace dxvk {
switch (priority) { switch (priority) {
default: default:
case ThreadPriority::Normal: policy = SCHED_OTHER; break; case ThreadPriority::Normal: policy = SCHED_OTHER; break;
#ifndef __linux__
case ThreadPriority::Lowest: policy = SCHED_OTHER; break;
#else
case ThreadPriority::Lowest: policy = SCHED_IDLE; break; case ThreadPriority::Lowest: policy = SCHED_IDLE; break;
#endif
} }
::pthread_setschedparam(this->native_handle(), policy, &param); ::pthread_setschedparam(this->native_handle(), policy, &param);
} }

View File

@ -6,6 +6,10 @@
#ifdef __linux__ #ifdef __linux__
#include <unistd.h> #include <unistd.h>
#include <limits.h> #include <limits.h>
#elif defined(__FreeBSD__)
#include <sys/sysctl.h>
#include <unistd.h>
#include <limits.h>
#endif #endif
#include "util_env.h" #include "util_env.h"
@ -85,6 +89,17 @@ namespace dxvk::env {
size_t count = readlink("/proc/self/exe", exePath.data(), exePath.size()); size_t count = readlink("/proc/self/exe", exePath.data(), exePath.size());
return std::string(exePath.begin(), exePath.begin() + count); return std::string(exePath.begin(), exePath.begin() + count);
#elif defined(__FreeBSD__)
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, getpid()};
char exePath[PATH_MAX] = {};
size_t size = PATH_MAX;
if (sysctl(mib, 4, exePath, &size, NULL, 0) != 0) {
// throw error here?
return "";
}
return std::string(exePath);
#endif #endif
} }

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#if defined(__linux__) #if defined(__unix__)
#include <windows.h> #include <windows.h>
#include <dlfcn.h> #include <dlfcn.h>