Skip to content

Commit 55ea57f

Browse files
committed
HACKY WORKAROUND: Don't use std::filesystem on mingw because the version in Debian Buster has a bug.
1 parent 4824fd7 commit 55ea57f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
2424
option(BUILD_LOADER "Build loader" ON)
2525
option(BUILD_ALL_EXTENSIONS "Build loader and layers with all extensions" OFF)
2626
option(BUILD_LOADER_WITH_EXCEPTION_HANDLING "Enable exception handling in the loader. Leave this on unless your standard library is built to not throw." ON)
27+
if(MINGW)
28+
option(BUILD_WITHOUT_STD_FILESYSTEM "Build without std::[experimental::]filesystem, to work around standard library bugs" ON)
29+
endif()
2730
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
2831
option(DYNAMIC_LOADER "Build the loader as a .dll library" OFF)
2932
else()

src/loader/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,11 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
207207
PRIVATE -fno-strict-aliasing -fno-builtin-memcmp "$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>"
208208
-ffunction-sections -fdata-sections
209209
)
210+
if(BUILD_WITHOUT_STD_FILESYSTEM)
211+
target_compile_definitions(openxr_loader PRIVATE DISABLE_STD_FILESYSTEM)
212+
else()
213+
target_link_libraries(openxr_loader PRIVATE stdc++fs)
214+
endif()
210215
# For GCC version 7.1 or greater, we need to disable the implicit fallthrough warning since
211216
# there's no consistent way to satisfy all compilers until they all accept the C++17 standard
212217
if (CMAKE_COMPILER_IS_GNUCC AND NOT (CMAKE_CXX_COMPILER_VERSION LESS 7.1))

0 commit comments

Comments
 (0)