diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f40963..441fcbf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -158,6 +158,7 @@ if(WIN32) INTERFACE NOMINMAX _CRT_SECURE_NO_WARNINGS + _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR # https://github.com/gabime/spdlog/issues/3212 ) endif() diff --git a/src/cooler_file_writer.cpp b/src/cooler_file_writer.cpp index 9c74df9..f7b72b5 100644 --- a/src/cooler_file_writer.cpp +++ b/src/cooler_file_writer.cpp @@ -112,17 +112,11 @@ void CoolerFileWriter::finalize([[maybe_unused]] std::string_view log_lvl_str, assert(_w.has_value()); // NOLINTBEGIN(*-unchecked-optional-access) -#ifndef _WIN32 - // TODO fixme - // There is something very odd going on when trying to call most spdlog functions from within - // Python bindings on recent versions of Windows. - // Possibly related to https://github.com/gabime/spdlog/issues/3212 const auto log_lvl = spdlog::level::from_str(normalize_log_lvl(log_lvl_str)); const auto previous_lvl = spdlog::default_logger()->level(); spdlog::default_logger()->set_level(log_lvl); SPDLOG_INFO(FMT_STRING("finalizing file \"{}\"..."), _path); -#endif try { std::visit( [&](const auto &num) { @@ -131,17 +125,14 @@ void CoolerFileWriter::finalize([[maybe_unused]] std::string_view log_lvl_str, }, _w->open("0").pixel_variant()); } catch (...) { -#ifndef _WIN32 spdlog::default_logger()->set_level(previous_lvl); -#endif throw; } _finalized = true; SPDLOG_INFO(FMT_STRING("merged {} cooler(s) into file \"{}\""), _w->cells().size(), _path); -#ifndef _WIN32 spdlog::default_logger()->set_level(previous_lvl); -#endif + const std::string sclr_path{_w->path()}; _w.reset(); std::filesystem::remove(sclr_path); // NOLINT diff --git a/src/hic_file_writer.cpp b/src/hic_file_writer.cpp index d4ebe99..f09a7d9 100644 --- a/src/hic_file_writer.cpp +++ b/src/hic_file_writer.cpp @@ -52,30 +52,20 @@ void HiCFileWriter::finalize([[maybe_unused]] std::string_view log_lvl_str) { fmt::format(FMT_STRING("finalize() was already called on file \"{}\""), _w.path())); } -#ifndef _WIN32 - // TODO fixme - // There is something very odd going on when trying to call most spdlog functions from within - // Python bindings on recent versions of Windows. - // Possibly related to https://github.com/gabime/spdlog/issues/3212 const auto log_lvl = spdlog::level::from_str(normalize_log_lvl(log_lvl_str)); const auto previous_lvl = spdlog::default_logger()->level(); spdlog::default_logger()->set_level(log_lvl); SPDLOG_INFO(FMT_STRING("finalizing file \"{}\"..."), _w.path()); -#endif try { _w.serialize(); _finalized = true; } catch (...) { -#ifndef _WIN32 spdlog::default_logger()->set_level(previous_lvl); -#endif throw; } SPDLOG_INFO(FMT_STRING("successfully finalized \"{}\"!"), _w.path()); -#ifndef _WIN32 spdlog::default_logger()->set_level(previous_lvl); -#endif } std::filesystem::path HiCFileWriter::path() const noexcept {