Skip to content

Commit 5ab0bac

Browse files
authored
Merge pull request #201 from rpavlik/picked
Small script/build fixes
2 parents 73c4051 + 6f5432d commit 5ab0bac

File tree

4 files changed

+23
-11
lines changed

4 files changed

+23
-11
lines changed

runClangFormat.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ set -e
2222
cd "$(dirname $0)"
2323
if [ ! "${CLANGFORMAT}" ]; then
2424
for tool in ${ACCEPTABLE_CLANG_FORMATS}; do
25-
if which $tool > /dev/null; then
25+
if which $tool > /dev/null 2> /dev/null; then
2626
CLANGFORMAT=$tool
2727
break
2828
fi

src/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,11 @@ include(CMakeDependentOption)
9696
cmake_dependent_option(
9797
BUILD_WITH_SYSTEM_JSONCPP "Use system jsoncpp instead of vendored source" ON "JSONCPP_FOUND" OFF
9898
)
99-
cmake_dependent_option(BUILD_WITH_STD_FILESYSTEM "Use std::[experimental::]filesystem." ON
100-
"HAVE_FILESYSTEM_WITHOUT_LIB OR HAVE_FILESYSTEM_NEEDING_LIB" OFF)
99+
cmake_dependent_option(
100+
BUILD_WITH_STD_FILESYSTEM "Use std::[experimental::]filesystem." ON
101+
"HAVE_FILESYSTEM_WITHOUT_LIB OR HAVE_FILESYSTEM_NEEDING_LIBSTDCXXFS OR HAVE_FILESYSTEM_NEEDING_LIBCXXFS"
102+
OFF
103+
)
101104

102105
# Several files use these compile-time OS switches
103106
if(WIN32)

src/cmake/StdFilesystemFlags.cmake

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
if(MSVC AND MSVC_VERSION GREATER 1890)
66
set(HAVE_FILESYSTEM_WITHOUT_LIB
77
ON
8-
CACHE INTERNAL "" FORCE)
8+
CACHE INTERNAL "" FORCE
9+
)
910
if(MSVC_VERSION GREATER 1910)
1011
# Visual Studio 2017 Update 3 added new filesystem impl,
1112
# which only works in C++17 mode.
1213
set(HAVE_FILESYSTEM_NEEDS_17
1314
ON
14-
CACHE INTERNAL "" FORCE)
15+
CACHE INTERNAL "" FORCE
16+
)
1517
endif()
1618
else()
1719
include(CheckCXXSourceCompiles)
@@ -50,7 +52,8 @@ else()
5052
#endif
5153
5254
#endif
53-
")
55+
"
56+
)
5457
set(_stdfs_source
5558
"${_stdfs_conditions}
5659
#ifdef USE_FINAL_FS
@@ -61,7 +64,7 @@ else()
6164
"
6265
)
6366
set(_stdfs_experimental_source
64-
"${_stdfs_conditions}
67+
"${_stdfs_conditions}
6568
#ifdef USE_EXPERIMENTAL_FS
6669
#include <experimental/filesystem>
6770
using namespace std::experimental::filesystem;
@@ -113,7 +116,9 @@ else()
113116
set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE)
114117
check_cxx_source_compiles("${_stdfs_needlib_source}" HAVE_FILESYSTEM_WITHOUT_LIB)
115118
set(CMAKE_REQUIRED_LIBRARIES stdc++fs)
116-
check_cxx_source_compiles("${_stdfs_needlib_source}" HAVE_FILESYSTEM_NEEDING_LIB)
119+
check_cxx_source_compiles("${_stdfs_needlib_source}" HAVE_FILESYSTEM_NEEDING_LIBSTDCXXFS)
120+
set(CMAKE_REQUIRED_LIBRARIES c++fs)
121+
check_cxx_source_compiles("${_stdfs_needlib_source}" HAVE_FILESYSTEM_NEEDING_LIBCXXFS)
117122
unset(CMAKE_REQUIRED_LIBRARIES)
118123
unset(CMAKE_TRY_COMPILE_TARGET_TYPE)
119124

@@ -129,8 +134,12 @@ function(openxr_add_filesystem_utils TARGET_NAME)
129134
set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD 17)
130135
set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD_REQUIRED TRUE)
131136
endif()
132-
if(HAVE_FILESYSTEM_NEEDING_LIB AND NOT HAVE_FILESYSTEM_WITHOUT_LIB)
133-
target_link_libraries(${TARGET_NAME} PRIVATE stdc++fs)
137+
if(NOT HAVE_FILESYSTEM_WITHOUT_LIB)
138+
if(HAVE_FILESYSTEM_NEEDING_LIBSTDCXXFS)
139+
target_link_libraries(${TARGET_NAME} PRIVATE stdc++fs)
140+
elseif(HAVE_FILESYSTEM_NEEDING_LIBCXXFS)
141+
target_link_libraries(${TARGET_NAME} PRIVATE c++fs)
142+
endif()
134143
endif()
135144
endif()
136145
endfunction()

src/loader/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ export(
253253

254254
if((CMAKE_SYSTEM_NAME STREQUAL "Windows") OR (CMAKE_SYSTEM_NAME STREQUAL "WindowsStore"))
255255
set(TARGET_DESTINATION cmake)
256-
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
256+
else()
257257
set(TARGET_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/openxr/)
258258
endif()
259259

0 commit comments

Comments
 (0)