Skip to content

Commit

Permalink
WIP Windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
ErDumont committed Nov 9, 2023
1 parent 055e85d commit b5c28f4
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 18 deletions.
2 changes: 1 addition & 1 deletion metrix-simulator/external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ endif()

set(sirius_solver_url https://github.com/jdarlay/sirius-solver)
set(sirius_tag "metrix-integration-v0.1")
set(sirius_asset "ubuntu-20.04_sirius-solver.zip")
set(sirius_asset "windows-latest_sirius-solver.zip")

set(sirius_solver_ROOT ${CMAKE_CURRENT_BINARY_DIR}/sirius_solver)
find_package(sirius_solver QUIET)
Expand Down
25 changes: 23 additions & 2 deletions metrix-simulator/log/src/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,27 @@

using namespace boost::log;

namespace query {
char localtime_r( ... );

struct has_localtime_r
{ enum { value = sizeof localtime_r( std::declval< std::time_t * >(), std::declval< std::tm * >() )
== sizeof( std::tm * ) }; };


template< bool available > struct safest_localtime {
static std::tm *call( std::time_t const *t, std::tm *r )
{ return localtime_r( t, r ); }
};

template<> struct safest_localtime< false > {
static std::tm *call( std::time_t const *t, std::tm *r )
{ return std::localtime( t ); }
};
}
std::tm *localtime_r( std::time_t const *t, std::tm *r )
{ return query::safest_localtime< query::has_localtime_r::value >().call( t, r ); }

namespace metrix
{
namespace log
Expand Down Expand Up @@ -212,8 +233,8 @@ void Logger::formatter(const record_view& view, formatting_ostream& os) const
std::string time_formatted;
time_formatted.assign(nb_char_time_formatted, '\0');
std::tm l_tm;
localtime_r(&time, &l_tm);
std::strftime(&time_formatted[0], nb_char_time_formatted, "%a %b %d %H:%M:%S %Y", &l_tm);
// localtime_r(&time, &l_tm);
// std::strftime(&time_formatted[0], nb_char_time_formatted, "%a %b %d %H:%M:%S %Y", &l_tm);

os << "[" << time_formatted << "] [" << severities_.at(lvl) << "] "
<< view.attribute_values()["File"].extract<std::string>() << ",l"
Expand Down
26 changes: 13 additions & 13 deletions metrix-simulator/tests/cbc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ set(MAIN_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(TEST_SOLVERCH cbc)

add_subdirectory(divers)
add_subdirectory(connexite)
add_subdirectory(curatif)
add_subdirectory(effacements)
add_subdirectory(hvdc)
add_subdirectory(td)
add_subdirectory(groupes)
add_subdirectory(load_flow)
add_subdirectory(pertes)
add_subdirectory(variables_couplees)
add_subdirectory(seuils)
add_subdirectory(variantes_regroupees)
add_subdirectory(overload)
add_subdirectory(LODF_PTDF)
# add_subdirectory(connexite)
# add_subdirectory(curatif)
# add_subdirectory(effacements)
# add_subdirectory(hvdc)
# add_subdirectory(td)
# add_subdirectory(groupes)
# add_subdirectory(load_flow)
# add_subdirectory(pertes)
# add_subdirectory(variables_couplees)
# add_subdirectory(seuils)
# add_subdirectory(variantes_regroupees)
# add_subdirectory(overload)
# add_subdirectory(LODF_PTDF)
2 changes: 1 addition & 1 deletion metrix-simulator/tests/cbc/curatif/CMakeLists.txt
42 changes: 41 additions & 1 deletion metrix-simulator/tests/cbc/divers/CMakeLists.txt

0 comments on commit b5c28f4

Please sign in to comment.