diff --git a/BUILD_FREEBSD.md b/BUILD_FREEBSD.md new file mode 100644 index 00000000000..d07c9c80784 --- /dev/null +++ b/BUILD_FREEBSD.md @@ -0,0 +1,132 @@ + + +# Build FreeBSD + +*Last Updated on 2026-03-19* + +Please read the [general build guide](BUILD.md) for information on dependencies required for all platforms. Only FreeBSD specific instructions are found in this file. + +## Install build tools: + +First update the system packages: +```sh +pkg upgrade +``` + +Install dependencies +```sh +pkg install git gmake cmake conan +``` + +## Extra dependencies to compile Interface on a server +Install the following: +```sh +pkg install qt5-core qt5-network qt5-testlib qt5-websockets qt5-gui qt5-widgets qt5-concurrent qt5-quickcontrols2 qt5-multimedia qt5-webchannel qt5-webengine qt5-xml qt5-xmlpatterns qt5-svg +``` + +Install Python 3: +```sh +pkg install python3 +``` + +Install Node.js as it is required to build the jsdoc documentation: +```sh +pkg install node +``` + +## Get code and checkout the branch you need + +Clone this repository: +```sh +git clone https://github.com/overte-org/overte.git +``` + +Then checkout the master branch with: +```sh +git checkout master +``` + +If you need a different branch, you can get a list of all tags with: +```sh +git fetch --tags +git tag +``` + +## Prepare conan + +The next step is setting up conan + +First, create a conan profile +```sh +conan profile detect --force +``` + +Next, add the overte remote to conan +```sh +conan remote add overte https://artifactory.overte.org/artifactory/api/conan/overte -f +``` + +## Compiling + +Install the dependencies with conan +```sh +cd overte +conan install . -s build_type=Release -b missing -pr:a=tools/conan-profiles/freebsd -of build +``` + +If you want to build Debug or RelWithDebInfo versions, change the `build_type` to `Debug` or `RelWithDebInfo` and run the command again. E.g.: +```sh +conan install . -s build_type=Debug -b missing -pr:a=tools/conan-profiles/freebsd -of build +``` + +Prepare makefiles: +```sh +cmake --preset conan-release +``` + +### Server + +To compile the Domain server: +```sh +cmake --build --preset conan-release domain-server assignment-client +``` + +*Note: For a server, it is not necessary to compile the Interface.* + +### Interface + +To compile the Interface client: +```sh +cmake --build --preset conan-release interface +``` + +## Running the software + +### Domain server + +Running Domain server: +```sh +./domain-server/domain-server +``` + +### Assignment clients + +Running assignment client: +```sh +./assignment-client/assignment-client -n 6 +``` + +### Interface + +Running Interface: +```sh +./interface/interface +``` + +Go to "localhost" in the running Interface to visit your newly launched Domain server. + diff --git a/conanfile.py b/conanfile.py index 582e9a8b357..34f2c102dc3 100644 --- a/conanfile.py +++ b/conanfile.py @@ -65,20 +65,22 @@ def requirements(self): self.requires("gli/cci.20210515") # NOTE: not maintained for 4 years self.requires("glslang/1.3.268.0") self.requires("liblo/0.30@overte/stable") - self.requires("libnode/22.22.0@overte/stable#1f75a2b0272c5e3ad9d4ddb432a467f8") + self.requires("libnode/22.22.0@overte/stable#593f688551e3a5a7a115bca8074a43fc") self.requires("nlohmann_json/3.11.2") self.requires("nvidia-texture-tools/2023.01@overte/stable#f4eff53a38bd2c26eb6fa1206ffd22f6") self.requires("onetbb/2021.10.0") self.requires("openexr/3.1.9") - self.requires("openvr/2.2.3@overte/stable") - self.requires("openxr/1.1.46@overte/stable") + if self.settings.os != "FreeBSD": + self.requires("openvr/2.2.3@overte/stable") + self.requires("openxr/1.1.46@overte/stable") self.requires("opus/1.5.2") self.requires("quazip/1.4") self.requires("scribe/2019.02@overte/stable") self.requires("sdl/2.32.10") self.requires("spirv-cross/1.3.268.0") self.requires("spirv-tools/1.3.268.0") - self.requires("steamworks/158a@overte/prebuild") + if self.settings.os != "FreeBSD": + self.requires("steamworks/158a@overte/prebuild") self.requires("v-hacd/4.1.0") self.requires("vulkan-memory-allocator/3.0.1") self.requires("webrtc-audio-processing/2.1@overte/stable") @@ -89,7 +91,7 @@ def requirements(self): if self.options.qt_source == "system": self.requires("qt/5.15.2@overte/system", force=True) - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: openssl = "openssl/system@anotherfoxguy/stable" elif self.options.qt_source == "aqt": self.requires("qt/5.15.2@overte/aqt", force=True) @@ -169,6 +171,12 @@ def generate(self): "CMAKE_COMPILE_WARNING_AS_ERROR": "OFF", }) + if self.settings.os == "FreeBSD": + # Steam is not a thing on FreeBSD (yet) + tc.cache_variables.update({ + "USE_STEAMWORKS": "OFF", + }) + tc.generate() deps = CMakeDeps(self) deps.generate() diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 92ac16c68bd..bedcc18981c 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -307,6 +307,10 @@ if (UNIX AND NOT ANDROID AND NOT OVERTE_THREAD_DEBUGGING) if (CMAKE_SYSTEM_NAME MATCHES "Linux") # Linux target_link_libraries(${TARGET_NAME} pthread atomic) + elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + # FreeBSD + find_package(Threads REQUIRED) + target_link_libraries(${TARGET_NAME} Threads::Threads) else () # OSX target_link_libraries(${TARGET_NAME} pthread) diff --git a/interface/src/Application_Graphics.cpp b/interface/src/Application_Graphics.cpp index a7e7c7e217d..8cd553d8bcf 100644 --- a/interface/src/Application_Graphics.cpp +++ b/interface/src/Application_Graphics.cpp @@ -430,7 +430,7 @@ void Application::initializeUi() { setIsInterstitialMode(true); -#if defined(DISABLE_QML) && defined(Q_OS_LINUX) +#if defined(DISABLE_QML) && (defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)) resumeAfterLoginDialogActionTaken(); #endif } diff --git a/interface/src/main.cpp b/interface/src/main.cpp index 2edcf7f09eb..e85683c7415 100644 --- a/interface/src/main.cpp +++ b/interface/src/main.cpp @@ -586,7 +586,7 @@ int main(int argc, const char* argv[]) { PROFILE_SYNC_BEGIN(startup, "main startup", ""); -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar); #endif @@ -779,7 +779,7 @@ int main(int argc, const char* argv[]) { app.initialize(parser); PROFILE_SYNC_END(startup, "app full ctor", ""); -#if defined(Q_OS_LINUX) +#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) app.setWindowIcon(QIcon(PathUtils::resourcesPath() + "images/brand-logo.svg")); #endif ch.startMonitor(&app); @@ -859,7 +859,7 @@ int main(int argc, const char* argv[]) { Application::shutdownPlugins(); qCDebug(interfaceapp, "Normal exit."); -#if !defined(DEBUG) && !defined(Q_OS_LINUX) +#if !defined(DEBUG) && !defined(Q_OS_LINUX) && !defined(Q_OS_FREEBSD) // HACK: exit immediately (don't handle shutdown callbacks) for Release build _exit(exitCode); #endif diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index a6b8b282ed4..b232de73885 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -637,7 +637,7 @@ QString defaultAudioDeviceName(QAudio::Mode mode) { #endif -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) if ( mode == QAudio::AudioInput ) { deviceName = QAudioDeviceInfo::defaultInputDevice().deviceName(); } else { @@ -2308,7 +2308,7 @@ const float AudioClient::CALLBACK_ACCELERATOR_RATIO = 2.0f; #ifdef Q_OS_ANDROID const float AudioClient::CALLBACK_ACCELERATOR_RATIO = 0.5f; -#elif defined(Q_OS_LINUX) +#elif defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) const float AudioClient::CALLBACK_ACCELERATOR_RATIO = 2.0f; #endif diff --git a/libraries/auto-updater/src/AutoUpdater.cpp b/libraries/auto-updater/src/AutoUpdater.cpp index 01c4f212e50..bad1fc60b63 100644 --- a/libraries/auto-updater/src/AutoUpdater.cpp +++ b/libraries/auto-updater/src/AutoUpdater.cpp @@ -30,6 +30,8 @@ AutoUpdater::AutoUpdater() : _operatingSystem = "mac"; #elif defined Q_OS_LINUX _operatingSystem = "ubuntu"; +#elif defined Q_OS_FREEBSD + _operatingSystem = "freebsd"; #endif connect(this, SIGNAL(latestVersionDataParsed()), this, SLOT(checkVersionAndNotify())); diff --git a/libraries/gl/src/gl/Config.cpp b/libraries/gl/src/gl/Config.cpp index 34d35f08fa1..d9aa41a0704 100644 --- a/libraries/gl/src/gl/Config.cpp +++ b/libraries/gl/src/gl/Config.cpp @@ -25,6 +25,9 @@ #include #include #include +#elif defined(Q_OS_FREEBSD) +#include +#include #endif @@ -74,7 +77,7 @@ static void* getGlProcessAddress(const char *namez) { return dlsym(GL_LIB, namez); } -#elif defined(Q_OS_LINUX) && !defined(Q_OS_ANDORID) +#elif (defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)) && !defined(Q_OS_ANDORID) typedef Bool (*PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC) (int attribute, unsigned int *value); typedef int (*PFNGLXSWAPINTERVALMESAPROC)(unsigned int interval); @@ -94,9 +97,11 @@ PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC QueryCurrentRendererIntegerMESA; PFNGLXSWAPINTERVALMESAPROC SwapIntervalMESA; PFNGLXGETSWAPINTERVALMESAPROC GetSwapIntervalMESA; +#if !defined(Q_OS_FREEBSD) // EGL has its own swap interval functions, so the MESA ones aren't needed there static bool contextIsEGL = false; static int previousSwapInterval = 1; +#endif // the real GetProcAddress functions return a placeholder function // pointer type (void (*)(void)), but glad expects one returning void* @@ -117,6 +122,8 @@ void gl::initModuleGl() { } else { getGlProcessAddress = reinterpret_cast(glXGetProcAddressARB); } +#elif defined(Q_OS_FREEBSD) + getGlProcessAddress = reinterpret_cast(glXGetProcAddressARB); #endif #if defined(Q_OS_WIN) @@ -132,6 +139,10 @@ void gl::initModuleGl() { SwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)getGlProcessAddress("glXSwapIntervalMESA"); GetSwapIntervalMESA = (PFNGLXGETSWAPINTERVALMESAPROC)getGlProcessAddress("glXGetSwapIntervalMESA"); } +#elif defined(Q_OS_FREEBSD) + QueryCurrentRendererIntegerMESA = (PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC)getGlProcessAddress("glXQueryCurrentRendererIntegerMESA"); + SwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)getGlProcessAddress("glXSwapIntervalMESA"); + GetSwapIntervalMESA = (PFNGLXGETSWAPINTERVALMESAPROC)getGlProcessAddress("glXGetSwapIntervalMESA"); #endif #if defined(USE_GLES) @@ -159,6 +170,12 @@ int gl::getSwapInterval() { } else { return 1; } +#elif defined(Q_OS_FREEBSD) + if (GetSwapIntervalMESA) { + return GetSwapIntervalMESA(); + } else { + return 1; + } #else return 1; #endif @@ -180,6 +197,8 @@ void gl::setSwapInterval(int interval) { } else if (SwapIntervalMESA) { SwapIntervalMESA(interval); } +#elif defined(Q_OS_FREEBSD) + SwapIntervalMESA(interval); #else Q_UNUSED(interval); #endif @@ -190,6 +209,10 @@ bool gl::queryCurrentRendererIntegerMESA(int attr, unsigned int *value) { if (!contextIsEGL && QueryCurrentRendererIntegerMESA) { return QueryCurrentRendererIntegerMESA(attr, value); } +#elif defined(Q_OS_FREEBSD) + if (QueryCurrentRendererIntegerMESA) { + return QueryCurrentRendererIntegerMESA(attr, value); + } #endif *value = 0; diff --git a/libraries/image/CMakeLists.txt b/libraries/image/CMakeLists.txt index 8c72bc7e72a..3d8179bf438 100644 --- a/libraries/image/CMakeLists.txt +++ b/libraries/image/CMakeLists.txt @@ -12,6 +12,10 @@ if (UNIX AND NOT APPLE) target_link_libraries(image Threads::Threads) endif() +if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + target_link_libraries(image execinfo) +endif() + if (WIN32) add_compile_definitions(_USE_MATH_DEFINES) endif() diff --git a/libraries/image/src/image/OpenEXRReader.cpp b/libraries/image/src/image/OpenEXRReader.cpp index d1af1c96212..027569e2c06 100644 --- a/libraries/image/src/image/OpenEXRReader.cpp +++ b/libraries/image/src/image/OpenEXRReader.cpp @@ -17,7 +17,7 @@ #include #include -#if !defined(Q_OS_ANDROID) +#if !defined(Q_OS_ANDROID) && !defined(Q_OS_FREEBSD) #include #include @@ -60,7 +60,7 @@ class QIODeviceImfStream : public Imf::IStream { #endif image::Image image::readOpenEXR(QIODevice& content, const std::string& filename) { -#if !defined(Q_OS_ANDROID) +#if !defined(Q_OS_ANDROID) && !defined(Q_OS_FREEBSD) QIODeviceImfStream device(content, filename); if (Imf::isOpenExrFile(device)) { diff --git a/libraries/networking/src/FingerprintUtils.cpp b/libraries/networking/src/FingerprintUtils.cpp index 5bb530d332b..93294eaa2c8 100644 --- a/libraries/networking/src/FingerprintUtils.cpp +++ b/libraries/networking/src/FingerprintUtils.cpp @@ -32,6 +32,10 @@ #include #endif //Q_OS_MAC +#ifdef Q_OS_FREEBSD +#include +#endif + // Number of iterations to apply to the hash, for stretching. // The number is arbitrary and has the only purpose of slowing down brute-force // attempts. The number here should be low enough not to cause any trouble for @@ -97,6 +101,23 @@ QString FingerprintUtils::getMachineFingerprintString() { #endif //Q_OS_LINUX +#ifdef Q_OS_FREEBSD + size_t uuidlen = 37; + char *uuid = new char[uuidlen]; + + int mib[4]; + mib[0] = CTL_KERN; + mib[1] = KERN_HOSTUUID; + mib[2] = -1; + mib[3] = -1; + if (sysctl(mib, 4, uuid, &uuidlen, NULL, 0) == -1) { + qCWarning(networking) << "sysctl call to KERN_HOSTUUID failed: " << strerror(errno); + } else { + hash.addData(uuid, uuidlen); + } + delete[] uuid; +#endif // Q_OS_FREEBSD + #ifdef Q_OS_MAC io_registry_entry_t ioRegistryRoot = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/"); CFStringRef uuidCf = (CFStringRef) IORegistryEntryCreateCFProperty(ioRegistryRoot, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); diff --git a/libraries/networking/src/crash-handler/CrashHandlerBackend_Crashpad.cpp b/libraries/networking/src/crash-handler/CrashHandlerBackend_Crashpad.cpp index cf893f267b4..456aa339ccd 100644 --- a/libraries/networking/src/crash-handler/CrashHandlerBackend_Crashpad.cpp +++ b/libraries/networking/src/crash-handler/CrashHandlerBackend_Crashpad.cpp @@ -354,6 +354,25 @@ static QString findBinaryDir() { #endif +#ifdef Q_OS_FREEBSD + size_t pathlen = PATH_MAX; + char *path = new char[pathlen]; + + int mib[4]; + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PATHNAME; + mib[3] = -1; + if (sysctl(mib, 4, path, &pathlen, NULL, 0) == -1) { + delete[] path; + qCWarning(crash_handler) << "sysctl call to KERN_PROC_PATHNAME failed: " << strerror(errno); + } else { + QString exePath = QString(path); + delete[] path; + return exePath; + } +#endif // Q_OS_FREEBSD + return QString(); } diff --git a/libraries/platform/src/platform/PlatformKeys.h b/libraries/platform/src/platform/PlatformKeys.h index 63cab3c7f77..006c733e9d6 100644 --- a/libraries/platform/src/platform/PlatformKeys.h +++ b/libraries/platform/src/platform/PlatformKeys.h @@ -101,6 +101,7 @@ namespace platform { namespace keys{ extern const char* OS_MACOS; extern const char* OS_LINUX; extern const char* OS_ANDROID; + extern const char* OS_FREEBSD; extern const char* OSVersion; diff --git a/libraries/platform/src/platform/Profiler.cpp b/libraries/platform/src/platform/Profiler.cpp index 50f090b5a6f..4ab32311ba6 100644 --- a/libraries/platform/src/platform/Profiler.cpp +++ b/libraries/platform/src/platform/Profiler.cpp @@ -39,8 +39,8 @@ Profiler::Tier Profiler::profilePlatform() { return platformTier; } -#ifdef Q_OS_LINUX - // GPUIdent.cpp is missing GPU detection on Linux and most currently available GPUs should handle high detail mode. +#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) + // GPUIdent.cpp is missing GPU detection on Linux and FreeBSD and most currently available GPUs should handle high detail mode. return Profiler::Tier::HIGH; #else // Default answer is diff --git a/libraries/platform/src/platform/backend/FreeBSDPlatform.cpp b/libraries/platform/src/platform/backend/FreeBSDPlatform.cpp new file mode 100644 index 00000000000..4089e182873 --- /dev/null +++ b/libraries/platform/src/platform/backend/FreeBSDPlatform.cpp @@ -0,0 +1,78 @@ +// +// Created by Amer Cerkic 05/02/2019 +// Copyright 2019 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include "FreeBSDPlatform.h" +#include "../PlatformKeys.h" + +#include +#include +#include + +#include + +#include +#include + +#ifdef Q_OS_FREEBSD +extern "C" { +#include +} +#endif + +using namespace platform; + +void FreeBSDInstance::enumerateCpus() { + json cpu = {}; + + cpu[keys::cpu::vendor] = CPUIdent::Vendor(); + cpu[keys::cpu::model] = CPUIdent::Brand(); + cpu[keys::cpu::numCores] = std::thread::hardware_concurrency(); + + _cpus.push_back(cpu); +} + +void FreeBSDInstance::enumerateGpusAndDisplays() { + GPUIdent* ident = GPUIdent::getInstance(); + json gpu = {}; + gpu[keys::gpu::model] = ident->getName().toUtf8().constData(); + gpu[keys::gpu::vendor] = findGPUVendorInDescription(gpu[keys::gpu::model].get()); + gpu[keys::gpu::videoMemory] = ident->getMemory(); + gpu[keys::gpu::driver] = ident->getDriver().toUtf8().constData(); + + _gpus.push_back(gpu); + _displays = ident->getOutput(); +} + +void FreeBSDInstance::enumerateMemory() { + json ram = {}; + +#ifdef Q_OS_FREEBSD + u_int v_page_size, v_page_count; + size_t size = sizeof(v_page_size); + if (sysctlbyname("vm.stat.vm.v_page_size", &v_page_size, &size, NULL, 0) == -1) + v_page_size = 0; + size = sizeof(v_page_count); + if (sysctlbyname("vm.stat.vm.v_page_count", &v_page_count, &size, NULL, 0) == -1) + v_page_count = 0; + + ram[keys::memory::memTotal] = v_page_count * v_page_size; +#endif + _memory = ram; +} + +void FreeBSDInstance::enumerateComputer() { + + _computer[keys::computer::OS] = keys::computer::OS_FREEBSD; + _computer[keys::computer::vendor] = ""; + _computer[keys::computer::model] = ""; + + auto sysInfo = QSysInfo(); + + _computer[keys::computer::OSVersion] = sysInfo.kernelVersion().toStdString(); +} + diff --git a/libraries/platform/src/platform/backend/FreeBSDPlatform.h b/libraries/platform/src/platform/backend/FreeBSDPlatform.h new file mode 100644 index 00000000000..9b46d2c1584 --- /dev/null +++ b/libraries/platform/src/platform/backend/FreeBSDPlatform.h @@ -0,0 +1,26 @@ +// +// Created by Amer Cerkic 05/02/2019 +// Copyright 2019 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_FreeBSDPlatform_h +#define hifi_FreeBSDPlatform_h + +#include "PlatformInstance.h" + +namespace platform { + class FreeBSDInstance : public Instance { + + public: + void enumerateCpus() override; + void enumerateGpusAndDisplays() override; + void enumerateMemory() override; + void enumerateComputer() override; + }; + +} // namespace platform + +#endif //hifi_FreeBSDPlatform_h diff --git a/libraries/platform/src/platform/backend/Platform.cpp b/libraries/platform/src/platform/backend/Platform.cpp index 3b1e3e1db78..d223556af02 100644 --- a/libraries/platform/src/platform/backend/Platform.cpp +++ b/libraries/platform/src/platform/backend/Platform.cpp @@ -235,6 +235,7 @@ namespace platform { namespace keys { const char* OS_MACOS = "MACOS"; const char* OS_LINUX = "LINUX"; const char* OS_ANDROID = "ANDROID"; + const char* OS_FREEBSD = "FREEBSD"; const char* OSVersion = "OSVersion"; @@ -265,6 +266,8 @@ namespace platform { namespace keys { #include "AndroidPlatform.h" #elif defined(Q_OS_LINUX) #include "LinuxPlatform.h" +#elif defined(Q_OS_FREEBSD) +#include "FreeBSDPlatform.h" #endif using namespace platform; @@ -280,6 +283,8 @@ void platform::create() { _instance= new AndroidInstance(); #elif defined(Q_OS_LINUX) _instance= new LinuxInstance(); +#elif defined(Q_OS_FREEBSD) + _instance= new FreeBSDInstance(); #endif } diff --git a/libraries/render-utils/src/LightClusterGrid_shared.slh b/libraries/render-utils/src/LightClusterGrid_shared.slh index cf58ce56ff9..e6740e1e6ec 100644 --- a/libraries/render-utils/src/LightClusterGrid_shared.slh +++ b/libraries/render-utils/src/LightClusterGrid_shared.slh @@ -1,5 +1,5 @@ // glsl / C++ compatible source as interface for FrustrumGrid -#if defined(Q_OS_LINUX) +#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) #define float_exp2 exp2f #else #define float_exp2 exp2 diff --git a/libraries/render/src/render/Scene.cpp b/libraries/render/src/render/Scene.cpp index 953ed1fbfe2..a5eabbf184e 100644 --- a/libraries/render/src/render/Scene.cpp +++ b/libraries/render/src/render/Scene.cpp @@ -182,7 +182,7 @@ void Transaction::clear() { } -Scene::Scene(glm::vec3 origin, float size) : +Scene::Scene(const glm::vec3& origin, float size) : _primarySpatialTree(origin, size) { _items.push_back(Item()); // add the itemID #0 to nothing diff --git a/libraries/render/src/render/Scene.h b/libraries/render/src/render/Scene.h index 8b95bfff5a6..ef37c825ea9 100644 --- a/libraries/render/src/render/Scene.h +++ b/libraries/render/src/render/Scene.h @@ -135,7 +135,7 @@ typedef std::vector TransactionQueue; class Scene { public: - Scene(glm::vec3 origin, float size); + Scene(const glm::vec3 &origin, float size); ~Scene(); // This call is thread safe, can be called from anywhere to allocate a new ID diff --git a/libraries/render/src/render/SpatialTree.h b/libraries/render/src/render/SpatialTree.h index b06053344df..9f7df337b4f 100644 --- a/libraries/render/src/render/SpatialTree.h +++ b/libraries/render/src/render/SpatialTree.h @@ -375,14 +375,14 @@ namespace render { float _invSize { 1.0f / _size }; glm::vec3 _origin { -16384.0f }; - void init(glm::vec3 origin, float size) { + void init(const glm::vec3 &origin, float size) { _size = size; _invSize = 1.0f / _size; _origin = origin; } public: // THe overall size and origin of the tree are defined at creation - ItemSpatialTree(glm::vec3 origin, float size) { init(origin, size); } + ItemSpatialTree(const glm::vec3 &origin, float size) { init(origin, size); } float getSize() const { return _size; } const glm::vec3& getOrigin() const { return _origin; } diff --git a/libraries/shared/src/SharedUtil.cpp b/libraries/shared/src/SharedUtil.cpp index 177390d053b..c48b3986a9a 100644 --- a/libraries/shared/src/SharedUtil.cpp +++ b/libraries/shared/src/SharedUtil.cpp @@ -22,6 +22,12 @@ #include #include +#ifdef __FreeBSD__ +extern "C" { +#include +} +#endif + #include #include @@ -46,7 +52,7 @@ extern "C" FILE * __cdecl __iob_func(void) { #endif -#if defined(Q_OS_LINUX) || defined(Q_OS_MAC) +#if defined(Q_OS_LINUX) || defined(Q_OS_MAC) || defined(Q_OS_FREEBSD) #include #include #endif @@ -1120,7 +1126,7 @@ void watchParentProcess(int parentPID) { HANDLE newHandle; RegisterWaitForSingleObject(&newHandle, procHandle, parentDiedCallback, NULL, INFINITE, WT_EXECUTEONLYONCE); } -#elif defined(Q_OS_MAC) || defined(Q_OS_LINUX) +#elif defined(Q_OS_MAC) || defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) void watchParentProcess(int parentPID) { auto timer = new QTimer(qApp); timer->setInterval(MSECS_PER_SECOND); diff --git a/libraries/shared/src/shared/WebRTC.h b/libraries/shared/src/shared/WebRTC.h index 942fcb5621c..c31b0177343 100644 --- a/libraries/shared/src/shared/WebRTC.h +++ b/libraries/shared/src/shared/WebRTC.h @@ -36,7 +36,7 @@ # endif #elif defined(Q_OS_ANDROID) # define WEBRTC_AUDIO 1 -#elif defined(Q_OS_LINUX) +#elif defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) # ifndef DISABLE_WEBRTC # define WEBRTC_AUDIO 1 // # define WEBRTC_DATA_CHANNELS 1 diff --git a/libraries/task/src/task/Config.h b/libraries/task/src/task/Config.h index 785f94d4285..c8e92d9e588 100644 --- a/libraries/task/src/task/Config.h +++ b/libraries/task/src/task/Config.h @@ -70,7 +70,7 @@ template class PersistentConfig : public C { if (_presets.contains(preset)) { // Always start back at default to remain deterministic QVariantMap config = _default; - QVariantMap presetConfig = _presets[preset].toMap(); + QVariantMap presetConfig = _presets.find(preset)->toMap(); for (auto it = presetConfig.cbegin(); it != presetConfig.cend(); it++) { config.insert(it.key(), it.value()); } diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index cb8c5f8727d..08e0d3966e2 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -13,14 +13,16 @@ list(REMOVE_ITEM PLUGIN_SUBDIRS "CMakeFiles") # client-side plugins if (OVERTE_BUILD_CLIENT AND NOT ANDROID) - if (NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") + if (NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") # Note: OpenVR is a Steam thing, which is different from OVR, which is an Oculus SDK component. set(DIR "openvr") add_subdirectory(${DIR}) endif() - set(DIR "openxr") - add_subdirectory(${DIR}) + if (NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + set(DIR "openxr") + add_subdirectory(${DIR}) + endif() set(DIR "hifiSdl2") add_subdirectory(${DIR}) diff --git a/tools/conan-profiles/freebsd b/tools/conan-profiles/freebsd new file mode 100644 index 00000000000..74876d38f17 --- /dev/null +++ b/tools/conan-profiles/freebsd @@ -0,0 +1,22 @@ +include(default) + +[settings] +compiler.cppstd=gnu20 + +[conf] +# Avoid dependencies failing to build on GCC 15 and newer. +tools.build:cxxflags+=['-include', 'cstdint'] + +# Needed for OneTBB to link properly +tools.build:sharedlinkflags+=['-Wl,--undefined-version'] + +# Workaround for Linux-isms in dependencies +tools.gnu:make_program=gmake + +[platform_tool_requires] +# Conan CMake is broken on FreeBSD, so use system +cmake/3.31.11 + +[options] +# Required for building oneTBB. +hwloc/*:shared=True