Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ file(MAKE_DIRECTORY ${layer_directory})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${layer_directory})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${layer_directory})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${layer_directory})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${layer_directory})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${layer_directory})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${layer_directory})
set(current_folder_path_prefix "./") # This works on windows too now with up-to-date OpenXR loaders
set(CMAKE_CXX_STANDARD 17)

Expand All @@ -45,7 +48,8 @@ if(WIN32)
add_compile_definitions(/w26812)
endif()
else()
set(library_filename "${library_name}.so")
set(library_filename "lib${library_name}.so")
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
endif(WIN32)

configure_file(
Expand Down
16 changes: 8 additions & 8 deletions src/layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "layer.hpp"
#include "layer_config.hpp"
#include <stdexcept>
#include <string.h>

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

bool OpenXRLayer::IsExtensionEnabled(const char* extensionName)
{
const auto iterator = std::find_if(extensions.begin(),
extensions.end(),
[extensionName](const char* enabled_extension)
{
return 0 == strcmp(extensionName, enabled_extension);
});

return iterator != extensions.end();
for(const auto ext : extensions)
{
if(!strcmp(ext, extensionName))
return true;
}

return false;
}

OpenXRLayer::OpenXRLayer(PFN_xrGetInstanceProcAddr nextLayerGetInstanceProcAddr) :
Expand Down
9 changes: 8 additions & 1 deletion src/layer_bootstrap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@
#define XR_OS_WINDOWS
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <Windows.h>
#include <windows.h>
#elif defined __linux__
// openxr loader recommends using secure_getenv, which was introduced in glibc 2.17
#include <stdlib.h>
#define XR_OS_LINUX
#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 17
#define HAVE_SECURE_GETENV
#endif
#endif

#include "openxr/openxr_platform_defines.h"
Expand Down