diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c0249ea936..772e743921 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -51,6 +51,16 @@ target_link_libraries( add_library(mp-units::mp-units ALIAS mp-units) install(TARGETS mp-units EXPORT mp-unitsTargets) +# C++ module +if(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API) + add_library(mp-units-module STATIC) + add_library(mp-units::module ALIAS mp-units-module) + target_sources( + mp-units-module PUBLIC FILE_SET CXX_MODULES BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES "mp-units.cpp" + ) + target_link_libraries(mp-units-module PRIVATE mp-units::mp-units) +endif() + # local build export(EXPORT mp-unitsTargets NAMESPACE mp-units::) configure_file("mp-unitsConfig.cmake" "." COPYONLY) diff --git a/src/core-fmt/include/mp-units/bits/fmt_hacks.h b/src/core-fmt/include/mp-units/bits/fmt_hacks.h index 008c3159ef..340e014758 100644 --- a/src/core-fmt/include/mp-units/bits/fmt_hacks.h +++ b/src/core-fmt/include/mp-units/bits/fmt_hacks.h @@ -62,7 +62,7 @@ MP_UNITS_DIAGNOSTIC_POP #else -#ifndef __cpp_lib_format +#if !defined(__cpp_lib_format) && !defined(__cpp_lib_format_ranges) #error "std::formatting facility not supported" #endif diff --git a/src/mp-units.cpp b/src/mp-units.cpp new file mode 100644 index 0000000000..15a949475b --- /dev/null +++ b/src/mp-units.cpp @@ -0,0 +1,58 @@ +module; + +// core +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// core-io +#include + +// core-fmt +#include + +// utility +#include +#include +#include + +export module mp_units; + +export +{ +// core +#include + +// core-io +#include + +// core-fmt +#include + +// systems +#include +#include +#include +#include + +// utility +#include +#include +#include +} diff --git a/src/utility/include/mp-units/random.h b/src/utility/include/mp-units/random.h index 2c26b97a97..811494875d 100644 --- a/src/utility/include/mp-units/random.h +++ b/src/utility/include/mp-units/random.h @@ -30,7 +30,7 @@ namespace mp_units { namespace detail { template -static std::vector i_qty_to_rep(InputIt first, InputIt last) +std::vector i_qty_to_rep(InputIt first, InputIt last) { std::vector intervals_rep; intervals_rep.reserve(static_cast(std::distance(first, last))); @@ -41,7 +41,7 @@ static std::vector i_qty_to_rep(InputIt first, InputIt last) } template -static std::vector bl_qty_to_rep(std::initializer_list& bl) +std::vector bl_qty_to_rep(std::initializer_list& bl) { std::vector bl_rep; bl_rep.reserve(bl.size()); @@ -52,7 +52,7 @@ static std::vector bl_qty_to_rep(std::initializer_list& bl) } template -inline static std::vector fw_bl_pwc(std::initializer_list& bl, UnaryOperation fw) +std::vector fw_bl_pwc(std::initializer_list& bl, UnaryOperation fw) { using rep = MP_UNITS_TYPENAME Q::rep; std::vector w_bl; @@ -70,7 +70,7 @@ inline static std::vector fw_bl_pwc(std::initializer_list& b } template -static std::vector fw_bl_pwl(std::initializer_list& bl, UnaryOperation fw) +std::vector fw_bl_pwl(std::initializer_list& bl, UnaryOperation fw) { std::vector weights; weights.reserve(bl.size());