Skip to content

Commit

Permalink
fix: preventing import std; in GMF
Browse files Browse the repository at this point in the history
  • Loading branch information
mpusz committed Jul 16, 2024
1 parent 2411a7e commit 27bd269
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
9 changes: 9 additions & 0 deletions src/core/include/mp-units/bits/core_gmf.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@

#pragma once

#define MP_UNITS_IN_GMF

#include <mp-units/bits/hacks.h>
#include <mp-units/compat_macros.h>
#include <mp-units/ext/contracts.h>

#ifndef MP_UNITS_IMPORT_STD
#include <array>
#include <compare>
#include <concepts>
Expand All @@ -46,13 +50,18 @@
#if __cpp_lib_text_encoding
#include <text_encoding>
#endif
#endif

#if MP_UNITS_HOSTED
#include <mp-units/ext/format.h>
#ifndef MP_UNITS_IMPORT_STD
#include <cmath>
#include <locale>
#include <ostream>
#include <random>
#include <sstream>
#include <string>
#endif
#endif

#undef MP_UNITS_IN_GMF
10 changes: 6 additions & 4 deletions src/core/include/mp-units/ext/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ MP_UNITS_DIAGNOSTIC_IGNORE_UNREACHABLE
MP_UNITS_DIAGNOSTIC_IGNORE_SHADOW
#include <fmt/format.h>
MP_UNITS_DIAGNOSTIC_POP
#else
#else // MP_UNITS_USE_FMTLIB
#ifdef MP_UNITS_IMPORT_STD
#ifndef MP_UNITS_IN_GMF
import std;
#else
#include <format>
#endif
#endif
#else // MP_UNITS_IMPORT_STD
#include <format>
#endif // MP_UNITS_IMPORT_STD
#endif // MP_UNITS_USE_FMTLIB

#endif
2 changes: 0 additions & 2 deletions src/core/mp-units-core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@

module;

#ifndef MP_UNITS_IMPORT_STD
#include <mp-units/bits/core_gmf.h>
#endif

export module mp_units.core;

Expand Down
2 changes: 0 additions & 2 deletions src/systems/mp-units-systems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@

module;

#ifndef MP_UNITS_IMPORT_STD
#include <mp-units/bits/core_gmf.h>
#include <chrono>
#endif

export module mp_units.systems;

Expand Down

0 comments on commit 27bd269

Please sign in to comment.