Skip to content

Commit

Permalink
Merge pull request #201 from rpavlik/picked
Browse files Browse the repository at this point in the history
Small script/build fixes
  • Loading branch information
rpavlik authored Aug 11, 2020
2 parents 73c4051 + 6f5432d commit 5ab0bac
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion runClangFormat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ set -e
cd "$(dirname $0)"
if [ ! "${CLANGFORMAT}" ]; then
for tool in ${ACCEPTABLE_CLANG_FORMATS}; do
if which $tool > /dev/null; then
if which $tool > /dev/null 2> /dev/null; then
CLANGFORMAT=$tool
break
fi
Expand Down
7 changes: 5 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,11 @@ include(CMakeDependentOption)
cmake_dependent_option(
BUILD_WITH_SYSTEM_JSONCPP "Use system jsoncpp instead of vendored source" ON "JSONCPP_FOUND" OFF
)
cmake_dependent_option(BUILD_WITH_STD_FILESYSTEM "Use std::[experimental::]filesystem." ON
"HAVE_FILESYSTEM_WITHOUT_LIB OR HAVE_FILESYSTEM_NEEDING_LIB" OFF)
cmake_dependent_option(
BUILD_WITH_STD_FILESYSTEM "Use std::[experimental::]filesystem." ON
"HAVE_FILESYSTEM_WITHOUT_LIB OR HAVE_FILESYSTEM_NEEDING_LIBSTDCXXFS OR HAVE_FILESYSTEM_NEEDING_LIBCXXFS"
OFF
)

# Several files use these compile-time OS switches
if(WIN32)
Expand Down
23 changes: 16 additions & 7 deletions src/cmake/StdFilesystemFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
if(MSVC AND MSVC_VERSION GREATER 1890)
set(HAVE_FILESYSTEM_WITHOUT_LIB
ON
CACHE INTERNAL "" FORCE)
CACHE INTERNAL "" FORCE
)
if(MSVC_VERSION GREATER 1910)
# Visual Studio 2017 Update 3 added new filesystem impl,
# which only works in C++17 mode.
set(HAVE_FILESYSTEM_NEEDS_17
ON
CACHE INTERNAL "" FORCE)
CACHE INTERNAL "" FORCE
)
endif()
else()
include(CheckCXXSourceCompiles)
Expand Down Expand Up @@ -50,7 +52,8 @@ else()
#endif
#endif
")
"
)
set(_stdfs_source
"${_stdfs_conditions}
#ifdef USE_FINAL_FS
Expand All @@ -61,7 +64,7 @@ else()
"
)
set(_stdfs_experimental_source
"${_stdfs_conditions}
"${_stdfs_conditions}
#ifdef USE_EXPERIMENTAL_FS
#include <experimental/filesystem>
using namespace std::experimental::filesystem;
Expand Down Expand Up @@ -113,7 +116,9 @@ else()
set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE)
check_cxx_source_compiles("${_stdfs_needlib_source}" HAVE_FILESYSTEM_WITHOUT_LIB)
set(CMAKE_REQUIRED_LIBRARIES stdc++fs)
check_cxx_source_compiles("${_stdfs_needlib_source}" HAVE_FILESYSTEM_NEEDING_LIB)
check_cxx_source_compiles("${_stdfs_needlib_source}" HAVE_FILESYSTEM_NEEDING_LIBSTDCXXFS)
set(CMAKE_REQUIRED_LIBRARIES c++fs)
check_cxx_source_compiles("${_stdfs_needlib_source}" HAVE_FILESYSTEM_NEEDING_LIBCXXFS)
unset(CMAKE_REQUIRED_LIBRARIES)
unset(CMAKE_TRY_COMPILE_TARGET_TYPE)

Expand All @@ -129,8 +134,12 @@ function(openxr_add_filesystem_utils TARGET_NAME)
set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD 17)
set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD_REQUIRED TRUE)
endif()
if(HAVE_FILESYSTEM_NEEDING_LIB AND NOT HAVE_FILESYSTEM_WITHOUT_LIB)
target_link_libraries(${TARGET_NAME} PRIVATE stdc++fs)
if(NOT HAVE_FILESYSTEM_WITHOUT_LIB)
if(HAVE_FILESYSTEM_NEEDING_LIBSTDCXXFS)
target_link_libraries(${TARGET_NAME} PRIVATE stdc++fs)
elseif(HAVE_FILESYSTEM_NEEDING_LIBCXXFS)
target_link_libraries(${TARGET_NAME} PRIVATE c++fs)
endif()
endif()
endif()
endfunction()
2 changes: 1 addition & 1 deletion src/loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export(

if((CMAKE_SYSTEM_NAME STREQUAL "Windows") OR (CMAKE_SYSTEM_NAME STREQUAL "WindowsStore"))
set(TARGET_DESTINATION cmake)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
else()
set(TARGET_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/openxr/)
endif()

Expand Down

0 comments on commit 5ab0bac

Please sign in to comment.