Skip to content

Commit 83ef709

Browse files
committed
Linux support
1 parent aa9e8ca commit 83ef709

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ if(WIN32)
4545
add_compile_definitions(/w26812)
4646
endif()
4747
else()
48-
set(library_filename "${library_name}.so")
48+
set(library_filename "../lib${library_name}.so")
4949
endif(WIN32)
5050

5151
configure_file(

src/layer.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "layer.hpp"
88
#include "layer_config.hpp"
99
#include <stdexcept>
10+
#include <string.h>
1011

1112
OpenXRLayer* OpenXRLayer::this_layer = nullptr;
1213
std::vector<const char*> OpenXRLayer::extensions{};
@@ -18,14 +19,13 @@ void OpenXRLayer::SetEnabledExtensions(const std::vector<const char*>& extension
1819

1920
bool OpenXRLayer::IsExtensionEnabled(const char* extensionName)
2021
{
21-
const auto iterator = std::find_if(extensions.begin(),
22-
extensions.end(),
23-
[extensionName](const char* enabled_extension)
24-
{
25-
return 0 == strcmp(extensionName, enabled_extension);
26-
});
27-
28-
return iterator != extensions.end();
22+
for(const auto ext : extensions)
23+
{
24+
if(!strcmp(ext, extensionName))
25+
return true;
26+
}
27+
28+
return false;
2929
}
3030

3131
OpenXRLayer::OpenXRLayer(PFN_xrGetInstanceProcAddr nextLayerGetInstanceProcAddr) :

src/layer_bootstrap.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@
1111
#define XR_OS_WINDOWS
1212
#define WIN32_LEAN_AND_MEAN
1313
#define NOMINMAX
14-
#include <Windows.h>
14+
#include <windows.h>
15+
#elif defined __linux__
16+
// openxr loader recommends using secure_getenv, which was introduced in glibc 2.17
17+
#include <stdlib.h>
18+
#define XR_OS_LINUX
19+
#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 17
20+
#define HAVE_SECURE_GETENV
21+
#endif
1522
#endif
1623

1724
#include "openxr/openxr_platform_defines.h"

0 commit comments

Comments
 (0)