Use experimental/filesystem on GCC.

This commit is contained in:
Allison Vacanti
2022-01-11 17:19:55 -05:00
parent a6925f3c2b
commit 348acbd6eb
2 changed files with 16 additions and 2 deletions

View File

@@ -63,6 +63,11 @@ else()
endif() endif()
endif() endif()
# GCC-specific flags
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
target_link_libraries(nvbench.build_interface INTERFACE stdc++fs)
endif()
# CUDA-specific flags # CUDA-specific flags
target_compile_options(nvbench.build_interface INTERFACE target_compile_options(nvbench.build_interface INTERFACE
$<$<COMPILE_LANG_AND_ID:CUDA,NVIDIA>:-Xcudafe=--display_error_number> $<$<COMPILE_LANG_AND_ID:CUDA,NVIDIA>:-Xcudafe=--display_error_number>

View File

@@ -35,7 +35,6 @@
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <cstdint> #include <cstdint>
#include <filesystem>
#include <fstream> #include <fstream>
#include <iterator> #include <iterator>
#include <ostream> #include <ostream>
@@ -44,6 +43,12 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#ifdef __GNUC__
#include <experimental/filesystem>
#else
#include <filesystem>
#endif
#if NVBENCH_CPP_DIALECT >= 2020 #if NVBENCH_CPP_DIALECT >= 2020
#include <bit> #include <bit>
#endif #endif
@@ -94,7 +99,7 @@ void write_named_values(JsonNode &node, const nvbench::named_values &values)
break; break;
default: default:
NVBENCH_THROW(std::runtime_error, "Unrecognized value type."); NVBENCH_THROW(std::runtime_error, "{}", "Unrecognized value type.");
} // end switch (value type) } // end switch (value type)
} // end foreach value name } // end foreach value name
} }
@@ -136,7 +141,11 @@ void json_printer::do_process_bulk_data_float64(
if (hint == "sample_times") if (hint == "sample_times")
{ {
#ifdef __GNUC__
namespace fs = std::experimental::filesystem;
#else
namespace fs = std::filesystem; namespace fs = std::filesystem;
#endif
nvbench::cpu_timer timer; nvbench::cpu_timer timer;
timer.start(); timer.start();