1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Merge pull request #100047 from MBCX/fix-freebsd-compilation

Make Godot compile on `FreeBSD`
This commit is contained in:
Thaddeus Crews
2024-12-05 14:12:11 -06:00
5 changed files with 34 additions and 2 deletions

View File

@@ -1,4 +1,8 @@
def can_build(env, platform):
import sys
if sys.platform.startswith("freebsd"):
return False
return platform == "macos" or platform == "windows" or platform == "linuxbsd"

View File

@@ -1,6 +1,8 @@
#!/usr/bin/env python
from misc.utility.scons_hints import *
import sys
Import("env")
Import("env_modules")
@@ -29,7 +31,9 @@ elif env["platform"] == "linuxbsd":
env_openxr.AppendUnique(CPPDEFINES=["XR_USE_PLATFORM_EGL"])
# FIXME: Review what needs to be set for Android and macOS.
env_openxr.AppendUnique(CPPDEFINES=["HAVE_SECURE_GETENV"])
# FreeBSD uses non-standard getenv functions.
if not sys.platform.startswith("freebsd"):
env_openxr.AppendUnique(CPPDEFINES=["HAVE_SECURE_GETENV"])
elif env["platform"] == "windows":
env_openxr.AppendUnique(CPPDEFINES=["XR_OS_WINDOWS", "NOMINMAX", "XR_USE_PLATFORM_WIN32"])
elif env["platform"] == "macos":

View File

@@ -32,8 +32,12 @@
#ifdef WAYLAND_ENABLED
// FIXME: Does this cause issues with *BSDs?
#ifdef __FreeBSD__
#include <dev/evdev/input-event-codes.h>
#else
// Assume Linux.
#include <linux/input-event-codes.h>
#endif
// For the actual polling thread.
#include <poll.h>

View File

@@ -38,7 +38,11 @@
#include <poll.h>
#include <errno.h>
#include <stdarg.h>
#ifdef __FreeBSD__
#include <sys/endian.h>
#else
#include <endian.h>
#endif // __FreeBSD__
#ifndef __GNUC__
#define __inline__ inline

View File

@@ -0,0 +1,16 @@
diff --git a/thirdparty/linuxbsd_headers/alsa/asoundlib.h b/thirdparty/linuxbsd_headers/alsa/asoundlib.h
index a546194382..598175403c 100644
--- a/thirdparty/linuxbsd_headers/alsa/asoundlib.h
+++ b/thirdparty/linuxbsd_headers/alsa/asoundlib.h
@@ -38,7 +38,11 @@
#include <poll.h>
#include <errno.h>
#include <stdarg.h>
+#ifdef __FreeBSD__
+#include <sys/endian.h>
+#else
#include <endian.h>
+#endif // __FreeBSD__
#ifndef __GNUC__
#define __inline__ inline