KhronosGroup / OpenXR-SDK-Source

Sources for OpenXR loader, basic API layers, and example code.
https://khronos.org/openxr
Apache License 2.0
680 stars 251 forks source link

hello_xr is not aware of BSD #241

Open yurivict opened 3 years ago

yurivict commented 3 years ago

Build fails with clang-10:

/usr/ports/misc/openxr/work/OpenXR-SDK-Source-release-1.0.14/src/common/gfxwrapper_opengl.c:38:31: error: unused parameter 'format' [-Werror,-Wunused-parameter]
static void Print(const char *format, ...) {
                              ^
rpavlik-bot commented 3 years ago

An issue (number 1523) has been filed to correspond to this issue in the internal Khronos GitLab (Khronos members only: KHR:openxr/openxr#1523 ), to facilitate working group processes.

This GitHub issue will continue to be the main site of discussion.

rpavlik commented 3 years ago

Ah, I assume this isn't the only error you're seeing, since it means that you are missing an OS define for that file. I'm guessing you're on a BSD based on the source path? I suspect the OS_LINUX defines will actually get you what you want here, so if you can confirm that (e.g. adding -DOS_LINUX to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS) we can adjust the build system accordingly. I think most of the stuff labeled "Linux" is actually just Posix.

rpavlik commented 3 years ago

Yeah, it actually looks like all the utils and such from Facebook/Oculus that are used mainly in hello_xr are unaware of BSD and will need ports: see external/include/utils in addition to gfxwrapper. Hopefully the ports aren't too hard.

rpavlik commented 11 months ago

FWIW, the platform plugins have been renamed, though there is still an OS_LINUX define in gfxwrapper.

This should not be an impediment to getting the loader to build, however.

msub2 commented 11 months ago

I managed to build successfully on FreeBSD 14 with OpenGL+X11. Only required changes were:

VVD commented 9 months ago

My patch for build https://github.com/KhronosGroup/OpenXR-SDK is:

--- src/CMakeLists.txt.orig     2024-02-17 20:48:29 UTC
+++ src/CMakeLists.txt
@@ -165,7 +165,7 @@ cmake_dependent_option(
 if(WIN32)
     add_definitions(-DXR_OS_WINDOWS)
     add_definitions(-DNOMINMAX)
-elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
     add_definitions(-DXR_OS_LINUX)
 elseif(ANDROID)
     add_definitions(-DXR_OS_ANDROID)

It's hack. Correct patch must define -DXR_OS_FREEBSD and add defined(XR_OS_FREEBSD) to all #if defined(XR_OS_LINUX)/#ifdef XR_OS_LINUX lines in sources. Or replace XR_OS_LINUX with XR_OS_POSIX as suggester above.

VVD commented 7 months ago

ping