refactor: modules support redesigned

This commit is contained in:
Mateusz Pusz
2024-01-06 08:51:01 +01:00
parent b582e200a0
commit 0eaf6e2e56
129 changed files with 271 additions and 838 deletions

View File

@ -1,22 +1,12 @@
parse: parse:
additional_commands: additional_commands:
add_documentation:
pargs:
nargs: 1
flags:
- ALL
kwargs:
BREATHE_PROJECT: 1
CODE_SOURCE_DIR: 1
INSTALL_DIR: 1
CODE_DEPENDS: 1
DOCS_DEPENDS: 1
add_units_module: add_units_module:
pargs: pargs:
nargs: 1 nargs: 1
kwargs: kwargs:
DEPENDENCIES: + DEPENDENCIES: "+"
HEADERS: + HEADERS: "*"
MODULE_INTERFACE_UNIT: "?"
enable_iwyu: enable_iwyu:
pargs: pargs:
flags: flags:
@ -26,13 +16,6 @@ parse:
kwargs: kwargs:
MAPPING_FILE: 1 MAPPING_FILE: 1
MAX_LINE_LENGTH: 1 MAX_LINE_LENGTH: 1
metabench_add_chart:
pargs:
nargs: 1
kwargs:
TITLE: 1
SUBTITLE: 1
DATASETS: +
format: format:
line_width: 120 line_width: 120
tab_size: 4 tab_size: 4

View File

@ -27,53 +27,47 @@ if(NOT TARGET gsl::gsl-lite)
find_package(gsl-lite CONFIG REQUIRED) find_package(gsl-lite CONFIG REQUIRED)
endif() endif()
if(${projectPrefix}BUILD_CXX_MODULES)
add_library(example_utils INTERFACE) add_library(example_utils INTERFACE)
target_compile_definitions(example_utils INTERFACE ${projectPrefix}MODULES)
target_include_directories(example_utils INTERFACE include) target_include_directories(example_utils INTERFACE include)
target_link_libraries(example_utils INTERFACE gsl::gsl-lite) target_link_libraries(example_utils INTERFACE gsl::gsl-lite)
endif()
add_library(example_utils-headers INTERFACE)
target_include_directories(example_utils-headers INTERFACE include)
target_link_libraries(example_utils-headers INTERFACE gsl::gsl-lite)
# #
# add_example(target <mp-units-depependencies>...) # add_example(target <depependencies>...)
# #
function(add_example target) function(add_example target)
add_executable(${target} ${target}.cpp) if(${projectPrefix}BUILD_CXX_MODULES)
if(TARGET mp-units::modules) add_executable(${target} ${target}.cpp)
target_link_libraries(${target} PRIVATE mp-units::modules) target_compile_definitions(${target} PUBLIC ${projectPrefix}MODULES)
else() target_link_libraries(${target} PRIVATE mp-units::mp-units ${ARGN})
target_link_libraries(${target} PRIVATE ${ARGN})
endif() endif()
add_executable(${target}-headers ${target}.cpp)
list(TRANSFORM ARGN APPEND "-headers")
target_link_libraries(${target}-headers PRIVATE mp-units::mp-units ${ARGN})
endfunction() endfunction()
add_example(avg_speed mp-units::core-io mp-units::si mp-units::cgs mp-units::usc) add_example(avg_speed)
add_example(capacitor_time_curve mp-units::core-io mp-units::si mp-units::utility) add_example(capacitor_time_curve)
add_example( add_example(clcpp_response)
clcpp_response add_example(conversion_factor)
mp-units::core-fmt add_example(currency)
mp-units::core-io add_example(foot_pound_second)
mp-units::si add_example(glide_computer glide_computer_lib)
mp-units::iau add_example(hello_units)
mp-units::imperial add_example(measurement)
mp-units::international add_example(si_constants)
mp-units::typographic add_example(spectroscopy_units)
mp-units::usc add_example(storage_tank)
) add_example(strong_angular_quantities)
add_example(conversion_factor mp-units::core-fmt mp-units::core-io mp-units::si) add_example(total_energy)
add_example(currency mp-units::core-io) add_example(unmanned_aerial_vehicle example_utils)
add_example(foot_pound_second mp-units::core-fmt mp-units::international mp-units::imperial)
add_example(glide_computer mp-units::core-fmt mp-units::international mp-units::utility)
target_link_libraries(glide_computer PRIVATE glide_computer_lib)
add_example(hello_units mp-units::core-fmt mp-units::core-io mp-units::si mp-units::usc)
add_example(measurement mp-units::core-io mp-units::si)
add_example(si_constants mp-units::core-fmt mp-units::si)
add_example(spectroscopy_units mp-units::core-fmt mp-units::si)
add_example(storage_tank mp-units::core-fmt mp-units::si mp-units::utility)
add_example(
strong_angular_quantities mp-units::core-fmt mp-units::core-io mp-units::si mp-units::isq_angle mp-units::utility
)
add_example(total_energy mp-units::core-io mp-units::si mp-units::natural mp-units::utility)
add_example(
unmanned_aerial_vehicle mp-units::core-fmt mp-units::core-io mp-units::si mp-units::international mp-units::utility
)
target_link_libraries(unmanned_aerial_vehicle PRIVATE example_utils)
add_subdirectory(glide_computer_lib) add_subdirectory(glide_computer_lib)
add_subdirectory(kalman_filter) add_subdirectory(kalman_filter)

View File

@ -15,7 +15,7 @@
along with this program. If not, see http://www.gnu.org/licenses./ along with this program. If not, see http://www.gnu.org/licenses./
*/ */
#include <mp-units/bits/fmt_hacks.h> #include <mp-units/compat_fmt_macros.h>
#include <iostream> #include <iostream>
#ifdef MP_UNITS_MODULES #ifdef MP_UNITS_MODULES
import mp_units; import mp_units;

View File

@ -15,7 +15,7 @@
along with this program. If not, see http://www.gnu.org/licenses./ along with this program. If not, see http://www.gnu.org/licenses./
*/ */
#include <mp-units/bits/fmt_hacks.h> #include <mp-units/compat_fmt_macros.h>
#include <iostream> #include <iostream>
#include <type_traits> #include <type_traits>
#ifdef MP_UNITS_MODULES #ifdef MP_UNITS_MODULES

View File

@ -20,7 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE. // SOFTWARE.
#include <mp-units/quantity_spec_macro.h> #include <mp-units/compat_macros.h>
#include <iostream> #include <iostream>
#include <map> #include <map>
#ifdef MP_UNITS_MODULES #ifdef MP_UNITS_MODULES

View File

@ -20,7 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE. // SOFTWARE.
#include <mp-units/bits/fmt_hacks.h> #include <mp-units/compat_fmt_macros.h>
#include <iostream> #include <iostream>
#include <string_view> #include <string_view>
#ifdef MP_UNITS_MODULES #ifdef MP_UNITS_MODULES

View File

@ -21,7 +21,7 @@
// SOFTWARE. // SOFTWARE.
#include "glide_computer_lib.h" #include "glide_computer_lib.h"
#include <mp-units/bits/fmt_hacks.h> #include <mp-units/compat_fmt_macros.h>
#include <array> #include <array>
#include <exception> #include <exception>
#include <iostream> #include <iostream>
@ -32,10 +32,9 @@
#ifdef MP_UNITS_MODULES #ifdef MP_UNITS_MODULES
import mp_units; import mp_units;
#else #else
#include <mp-units/chrono.h>
#include <mp-units/math.h> #include <mp-units/math.h>
#include <mp-units/systems/international/international.h> #include <mp-units/systems/international/international.h>
#include <mp-units/systems/si/unit_symbols.h> #include <mp-units/systems/si/si.h>
#endif #endif
namespace { namespace {

View File

@ -22,11 +22,13 @@
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
add_library(glide_computer_lib STATIC glide_computer_lib.cpp include/glide_computer_lib.h) add_library(glide_computer_lib-headers STATIC glide_computer_lib.cpp include/glide_computer_lib.h)
if(TARGET mp-units::modules) target_link_libraries(glide_computer_lib-headers PUBLIC mp-units::mp-units example_utils)
target_link_libraries(glide_computer_lib PUBLIC gsl::gsl-lite mp-units::modules) target_include_directories(glide_computer_lib-headers PUBLIC include)
else()
target_link_libraries(glide_computer_lib PRIVATE mp-units::core-fmt PUBLIC mp-units::si mp-units::utility) if(${projectPrefix}BUILD_CXX_MODULES)
add_library(glide_computer_lib STATIC glide_computer_lib.cpp include/glide_computer_lib.h)
target_compile_definitions(glide_computer_lib PUBLIC ${projectPrefix}MODULES)
target_link_libraries(glide_computer_lib PUBLIC mp-units::mp-units example_utils)
target_include_directories(glide_computer_lib PUBLIC include)
endif() endif()
target_link_libraries(glide_computer_lib PUBLIC example_utils)
target_include_directories(glide_computer_lib PUBLIC include)

View File

@ -22,7 +22,7 @@
#pragma once #pragma once
#include <mp-units/quantity_spec_macro.h> #include <mp-units/compat_macros.h>
// //
#include "geographic.h" #include "geographic.h"
#include <algorithm> #include <algorithm>
@ -36,10 +36,10 @@
#ifdef MP_UNITS_MODULES #ifdef MP_UNITS_MODULES
import mp_units; import mp_units;
#else #else
#include <mp-units/chrono.h>
#include <mp-units/math.h> // IWYU pragma: keep #include <mp-units/math.h> // IWYU pragma: keep
#include <mp-units/quantity_point.h> #include <mp-units/quantity_point.h>
#include <mp-units/systems/isq/space_and_time.h> #include <mp-units/systems/isq/space_and_time.h>
#include <mp-units/systems/si/chrono.h>
#endif #endif
// An example of a really simplified tactical glide computer // An example of a really simplified tactical glide computer

View File

@ -25,7 +25,7 @@
// !!! renders correctly in the documentation "Examples" section. !!! // !!! renders correctly in the documentation "Examples" section. !!!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#include <mp-units/bits/fmt_hacks.h> #include <mp-units/compat_fmt_macros.h>
#include <iostream> #include <iostream>
#ifdef MP_UNITS_MODULES #ifdef MP_UNITS_MODULES
import mp_units; import mp_units;

View File

@ -23,7 +23,7 @@
#pragma once #pragma once
#include "ranged_representation.h" #include "ranged_representation.h"
#include <mp-units/bits/fmt_hacks.h> #include <mp-units/compat_fmt_macros.h>
#include <compare> #include <compare>
#include <limits> #include <limits>
#include <numbers> #include <numbers>
@ -33,11 +33,10 @@ import mp_units;
#else #else
#include <mp-units/compare.h> #include <mp-units/compare.h>
#include <mp-units/format.h> #include <mp-units/format.h>
#include <mp-units/math.h>
#include <mp-units/quantity.h> #include <mp-units/quantity.h>
#include <mp-units/quantity_point.h> #include <mp-units/quantity_point.h>
#include <mp-units/systems/isq/space_and_time.h> #include <mp-units/systems/isq/space_and_time.h>
#include <mp-units/systems/si/units.h> #include <mp-units/systems/si/si.h>
#endif #endif
namespace geographic { namespace geographic {

View File

@ -23,7 +23,7 @@
#pragma once #pragma once
#include <gsl/gsl-lite.hpp> #include <gsl/gsl-lite.hpp>
#include <mp-units/bits/fmt_hacks.h> #include <mp-units/compat_fmt_macros.h>
#include <ostream> #include <ostream>
#include <utility> #include <utility>
#ifdef MP_UNITS_MODULES #ifdef MP_UNITS_MODULES

View File

@ -22,23 +22,11 @@
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
# add_example(kalman_filter-example_1)
# add_example(target <depependencies>...) add_example(kalman_filter-example_2)
# add_example(kalman_filter-example_3)
function(add_example target) add_example(kalman_filter-example_4)
add_executable(${target} ${target}.cpp) add_example(kalman_filter-example_5)
if(TARGET mp-units::modules) add_example(kalman_filter-example_6)
target_link_libraries(${target} PRIVATE mp-units::modules) add_example(kalman_filter-example_7)
else() add_example(kalman_filter-example_8)
target_link_libraries(${target} PRIVATE ${ARGN})
endif()
endfunction()
add_example(kalman_filter-example_1 mp-units::core-fmt mp-units::si mp-units::utility)
add_example(kalman_filter-example_2 mp-units::core-fmt mp-units::si mp-units::utility)
add_example(kalman_filter-example_3 mp-units::core-fmt mp-units::si mp-units::utility)
add_example(kalman_filter-example_4 mp-units::core-fmt mp-units::si mp-units::utility)
add_example(kalman_filter-example_5 mp-units::core-fmt mp-units::si mp-units::utility)
add_example(kalman_filter-example_6 mp-units::core-fmt mp-units::si mp-units::utility)
add_example(kalman_filter-example_7 mp-units::core-fmt mp-units::si mp-units::utility)
add_example(kalman_filter-example_8 mp-units::core-fmt mp-units::si mp-units::utility)

View File

@ -22,7 +22,7 @@
#pragma once #pragma once
#include <mp-units/bits/fmt_hacks.h> #include <mp-units/compat_fmt_macros.h>
#include <tuple> #include <tuple>
#ifdef MP_UNITS_MODULES #ifdef MP_UNITS_MODULES
import mp_units; import mp_units;

View File

@ -25,7 +25,7 @@
// !!! renders correctly in the documentation "Examples" section. !!! // !!! renders correctly in the documentation "Examples" section. !!!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#include <mp-units/bits/fmt_hacks.h> #include <mp-units/compat_fmt_macros.h>
#include <iostream> #include <iostream>
#ifdef MP_UNITS_MODULES #ifdef MP_UNITS_MODULES
import mp_units; import mp_units;

View File

@ -20,7 +20,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE. // SOFTWARE.
#include <mp-units/bits/fmt_hacks.h> #include <mp-units/compat_fmt_macros.h>
#include <iostream> #include <iostream>
#include <tuple> #include <tuple>
#ifdef MP_UNITS_MODULES #ifdef MP_UNITS_MODULES

View File

@ -20,8 +20,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE. // SOFTWARE.
#include <mp-units/bits/fmt_hacks.h> #include <mp-units/compat_fmt_macros.h>
#include <mp-units/quantity_spec_macro.h> #include <mp-units/compat_macros.h>
#include <cassert> #include <cassert>
#include <chrono> #include <chrono>
#include <iostream> #include <iostream>
@ -30,14 +30,11 @@
#ifdef MP_UNITS_MODULES #ifdef MP_UNITS_MODULES
import mp_units; import mp_units;
#else #else
#include <mp-units/chrono.h>
#include <mp-units/format.h> #include <mp-units/format.h>
#include <mp-units/math.h> #include <mp-units/math.h>
#include <mp-units/systems/isq/mechanics.h> #include <mp-units/systems/isq/mechanics.h>
#include <mp-units/systems/isq/space_and_time.h> #include <mp-units/systems/isq/space_and_time.h>
#include <mp-units/systems/si/constants.h> #include <mp-units/systems/si/si.h>
#include <mp-units/systems/si/unit_symbols.h>
#include <mp-units/systems/si/units.h>
#endif #endif
// allows standard gravity (acceleration) and weight (force) to be expressed with scalar representation // allows standard gravity (acceleration) and weight (force) to be expressed with scalar representation

View File

@ -21,7 +21,7 @@
// SOFTWARE. // SOFTWARE.
#include "geographic.h" #include "geographic.h"
#include <mp-units/bits/fmt_hacks.h> #include <mp-units/compat_fmt_macros.h>
#include <cassert> #include <cassert>
#include <iostream> #include <iostream>
#ifdef MP_UNITS_MODULES #ifdef MP_UNITS_MODULES

View File

@ -36,84 +36,26 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include(AddUnitsModule) include(AddUnitsModule)
include(GNUInstallDirs) include(GNUInstallDirs)
if(${projectPrefix}BUILD_CXX_MODULES)
set(${projectPrefix}TARGET_SCOPE "PUBLIC")
else()
set(${projectPrefix}TARGET_SCOPE "INTERFACE")
endif()
if(${projectPrefix}AS_SYSTEM_HEADERS) if(${projectPrefix}AS_SYSTEM_HEADERS)
set(unitsAsSystem SYSTEM) set(unitsAsSystem SYSTEM)
endif() endif()
add_subdirectory(core-macros)
add_subdirectory(core) add_subdirectory(core)
add_subdirectory(core-fmt-macros)
add_subdirectory(core-fmt) add_subdirectory(core-fmt)
add_subdirectory(core-io) add_subdirectory(core-io)
add_subdirectory(systems) add_subdirectory(systems)
add_subdirectory(utility)
# project-wide wrapper # project-wide wrapper
add_library(mp-units INTERFACE) add_units_module(
target_link_libraries( mp-units DEPENDENCIES mp-units::core mp-units::core-io mp-units::core-fmt mp-units::systems
mp-units INTERFACE mp-units::core mp-units::core-io mp-units::core-fmt mp-units::systems mp-units::utility MODULE_INTERFACE_UNIT mp-units.cpp
) )
add_library(mp-units::mp-units ALIAS mp-units)
install(TARGETS mp-units EXPORT mp-unitsTargets)
# C++ modules
if(${projectPrefix}BUILD_CXX_MODULES)
add_library(mp-units-core-module)
add_library(mp-units::core-module ALIAS mp-units-core-module)
target_sources(
mp-units-core-module PUBLIC FILE_SET CXX_MODULES BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES
"mp-units-core.cpp"
)
target_compile_definitions(mp-units-core-module PUBLIC ${projectPrefix}MODULES)
target_link_libraries(mp-units-core-module PRIVATE mp-units::core mp-units::utility PUBLIC mp-units::core-macros)
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
target_compile_definitions(mp-units-core-module PUBLIC _LIBCPP_NO_ABI_TAG)
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 18)
target_compile_options(mp-units-core-module PUBLIC "-Wno-include-angled-in-module-purview")
endif()
endif()
add_library(mp-units-core-fmt-module)
add_library(mp-units::core-fmt-module ALIAS mp-units-core-fmt-module)
target_sources(
mp-units-core-fmt-module PUBLIC FILE_SET CXX_MODULES BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES
"mp-units-core-fmt.cpp"
)
target_link_libraries(
mp-units-core-fmt-module PRIVATE mp-units::core-fmt PUBLIC mp-units::core-fmt-macros mp-units::core-module
)
add_library(mp-units-core-io-module)
add_library(mp-units::core-io-module ALIAS mp-units-core-io-module)
target_sources(
mp-units-core-io-module PUBLIC FILE_SET CXX_MODULES BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES
"mp-units-core-io.cpp"
)
target_link_libraries(mp-units-core-io-module PRIVATE mp-units::core-io PUBLIC mp-units::core-module)
add_library(mp-units-systems-module)
add_library(mp-units::systems-module ALIAS mp-units-systems-module)
target_sources(
mp-units-systems-module PUBLIC FILE_SET CXX_MODULES BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES
"mp-units-systems.cpp"
)
target_link_libraries(
mp-units-systems-module PRIVATE mp-units::systems mp-units::utility PUBLIC mp-units::core-module
)
add_library(mp-units-modules)
add_library(mp-units::modules ALIAS mp-units-modules)
target_sources(
mp-units-modules PUBLIC FILE_SET CXX_MODULES BASE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" FILES "mp-units.cpp"
)
target_link_libraries(
mp-units-modules PUBLIC mp-units::core-module mp-units::core-fmt-module mp-units::core-io-module
mp-units::systems-module
)
endif()
# local build # local build
export(EXPORT mp-unitsTargets NAMESPACE mp-units::) export(EXPORT mp-unitsTargets NAMESPACE mp-units::)

View File

@ -43,27 +43,46 @@ endfunction()
# #
# add_units_module(ModuleName # add_units_module(ModuleName
# DEPENDENCIES <depependency>... # DEPENDENCIES <depependency>...
# HEADERS <header_file>...) # [HEADERS <header_file>...]
# MODULE_INTERFACE_UNIT <miu_file>)
# #
function(add_units_module name) function(add_units_module name)
# parse arguments # parse arguments
set(oneValue MODULE_INTERFACE_UNIT)
set(multiValues DEPENDENCIES HEADERS) set(multiValues DEPENDENCIES HEADERS)
cmake_parse_arguments(PARSE_ARGV 1 ARG "" "" "${multiValues}") cmake_parse_arguments(PARSE_ARGV 1 ARG "" "${oneValue}" "${multiValues}")
# validate and process arguments # validate and process arguments
validate_unparsed(${name} ARG) validate_unparsed(${name} ARG)
validate_arguments_exists(${name} ARG DEPENDENCIES HEADERS) validate_arguments_exists(${name} ARG DEPENDENCIES MODULE_INTERFACE_UNIT)
if(${projectPrefix}TARGET_SCOPE STREQUAL INTERFACE)
set(SCOPE "INTERFACE")
endif()
# define the target for a module # define the target for a module
add_library(mp-units-${name} INTERFACE ${ARG_HEADERS}) add_library(mp-units-${name} ${SCOPE} ${ARG_HEADERS})
target_link_libraries(mp-units-${name} INTERFACE ${ARG_DEPENDENCIES}) target_link_libraries(mp-units-${name} ${${projectPrefix}TARGET_SCOPE} ${ARG_DEPENDENCIES})
target_include_directories( if(ARG_HEADERS)
mp-units-${name} ${unitsAsSystem} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> target_include_directories(
$<INSTALL_INTERFACE:include> mp-units-${name} ${unitsAsSystem} ${${projectPrefix}TARGET_SCOPE}
) $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>
)
endif()
set_target_properties(mp-units-${name} PROPERTIES EXPORT_NAME ${name}) set_target_properties(mp-units-${name} PROPERTIES EXPORT_NAME ${name})
add_library(mp-units::${name} ALIAS mp-units-${name}) add_library(mp-units::${name} ALIAS mp-units-${name})
install(TARGETS mp-units-${name} EXPORT mp-unitsTargets) if(${projectPrefix}BUILD_CXX_MODULES)
install(DIRECTORY include/mp-units TYPE INCLUDE) target_sources(mp-units-${name} PUBLIC FILE_SET CXX_MODULES FILES ${ARG_MODULE_INTERFACE_UNIT})
install(TARGETS mp-units-${name}
EXPORT mp-unitsTargets
FILE_SET CXX_MODULES
DESTINATION ${CMAKE_INSTALL_LIBDIR}/miu
)
else()
install(TARGETS mp-units-${name} EXPORT mp-unitsTargets)
endif()
if(ARG_HEADERS)
install(DIRECTORY include/mp-units TYPE INCLUDE)
endif()
endfunction() endfunction()

View File

@ -1,45 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.19)
# core-fmt-macros library definition
add_library(mp-units-core-fmt-macros INTERFACE include/mp-units/bits/fmt_hacks.h)
target_include_directories(
mp-units-core-fmt-macros ${unitsAsSystem} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(mp-units-core-fmt-macros INTERFACE mp-units::core-macros)
if(${projectPrefix}USE_LIBFMT)
if(NOT TARGET fmt::fmt)
find_package(fmt CONFIG REQUIRED)
endif()
target_link_libraries(mp-units-core-fmt-macros INTERFACE fmt::fmt)
endif()
set_target_properties(mp-units-core-fmt-macros PROPERTIES EXPORT_NAME core-fmt-macros)
add_library(mp-units::core-fmt-macros ALIAS mp-units-core-fmt-macros)
# installation
install(TARGETS mp-units-core-fmt-macros EXPORT mp-unitsTargets)
install(DIRECTORY include/mp-units TYPE INCLUDE)

View File

@ -25,13 +25,19 @@ cmake_minimum_required(VERSION 3.19)
option(${projectPrefix}USE_LIBFMT "Enables usage of libfmt instead of the one from 'std'" ON) option(${projectPrefix}USE_LIBFMT "Enables usage of libfmt instead of the one from 'std'" ON)
message(STATUS "${projectPrefix}USE_LIBFMT: ${${projectPrefix}USE_LIBFMT}") message(STATUS "${projectPrefix}USE_LIBFMT: ${${projectPrefix}USE_LIBFMT}")
add_units_module(core-fmt DEPENDENCIES mp-units::core HEADERS include/mp-units/format.h) add_units_module(
target_compile_definitions(mp-units-core-fmt INTERFACE ${projectPrefix}USE_LIBFMT=$<BOOL:${${projectPrefix}USE_LIBFMT}>) core-fmt
target_link_libraries(mp-units-core-fmt INTERFACE mp-units::core-fmt-macros) DEPENDENCIES mp-units::core
HEADERS include/mp-units/bits/fmt.h include/mp-units/compat_fmt_macros.h include/mp-units/format.h
MODULE_INTERFACE_UNIT mp-units-core-fmt.cpp
)
target_compile_definitions(
mp-units-core-fmt ${${projectPrefix}TARGET_SCOPE} ${projectPrefix}USE_LIBFMT=$<BOOL:${${projectPrefix}USE_LIBFMT}>
)
if(${projectPrefix}USE_LIBFMT) if(${projectPrefix}USE_LIBFMT)
if(NOT TARGET fmt::fmt) if(NOT TARGET fmt::fmt)
find_package(fmt CONFIG REQUIRED) find_package(fmt CONFIG REQUIRED)
endif() endif()
target_link_libraries(mp-units-core-fmt INTERFACE fmt::fmt) target_link_libraries(mp-units-core-fmt ${${projectPrefix}TARGET_SCOPE} fmt::fmt)
endif() endif()

View File

@ -30,7 +30,7 @@
#pragma once #pragma once
#include <gsl/gsl-lite.hpp> #include <gsl/gsl-lite.hpp>
#include <mp-units/bits/fmt_hacks.h> #include <mp-units/compat_fmt_macros.h>
#include <concepts> #include <concepts>
#include <limits> #include <limits>
#include <string_view> #include <string_view>

View File

@ -1,7 +1,7 @@
module; module;
#include <mp-units/bits/core-gmf.h> #include <mp-units/bits/core_gmf.h>
#include <mp-units/bits/fmt_hacks.h> #include <mp-units/compat_fmt_macros.h>
export module mp_units.core_fmt; export module mp_units.core_fmt;

View File

@ -22,4 +22,9 @@
cmake_minimum_required(VERSION 3.19) cmake_minimum_required(VERSION 3.19)
add_units_module(core-io DEPENDENCIES mp-units::core HEADERS include/mp-units/ostream.h) add_units_module(
core-io
DEPENDENCIES mp-units::core
HEADERS include/mp-units/ostream.h
MODULE_INTERFACE_UNIT mp-units-core-io.cpp
)

View File

@ -1,6 +1,6 @@
module; module;
#include <mp-units/bits/core-gmf.h> #include <mp-units/bits/core_gmf.h>
#include <sstream> #include <sstream>
export module mp_units.core_io; export module mp_units.core_io;

View File

@ -1,40 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.19)
# core-macros library definition
add_library(
mp-units-core-macros INTERFACE include/mp-units/bits/external/hacks.h include/mp-units/quantity_spec_macro.h
)
target_compile_features(mp-units-core-macros INTERFACE cxx_std_20)
target_include_directories(
mp-units-core-macros ${unitsAsSystem} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
set_target_properties(mp-units-core-macros PROPERTIES EXPORT_NAME core-macros)
add_library(mp-units::core-macros ALIAS mp-units-core-macros)
# installation
install(TARGETS mp-units-core-macros EXPORT mp-unitsTargets)
install(DIRECTORY include/mp-units TYPE INCLUDE)

View File

@ -28,60 +28,67 @@ if(NOT TARGET gsl::gsl-lite)
endif() endif()
# core library definition # core library definition
add_library( add_units_module(
mp-units-core core
INTERFACE DEPENDENCIES gsl::gsl-lite
include/mp-units/bits/external/algorithm.h HEADERS include/mp-units/bits/external/algorithm.h
include/mp-units/bits/external/fixed_string.h include/mp-units/bits/external/fixed_string.h
include/mp-units/bits/external/math_concepts.h include/mp-units/bits/external/hacks.h
include/mp-units/bits/external/prime.h include/mp-units/bits/external/math_concepts.h
include/mp-units/bits/external/type_list.h include/mp-units/bits/external/prime.h
include/mp-units/bits/external/type_name.h include/mp-units/bits/external/type_list.h
include/mp-units/bits/external/type_traits.h include/mp-units/bits/external/type_name.h
include/mp-units/bits/dimension_concepts.h include/mp-units/bits/external/type_traits.h
include/mp-units/bits/expression_template.h include/mp-units/bits/core_gmf.h
include/mp-units/bits/get_associated_quantity.h include/mp-units/bits/dimension_concepts.h
include/mp-units/bits/get_common_base.h include/mp-units/bits/expression_template.h
include/mp-units/bits/magnitude.h include/mp-units/bits/get_associated_quantity.h
include/mp-units/bits/quantity_cast.h include/mp-units/bits/get_common_base.h
include/mp-units/bits/quantity_concepts.h include/mp-units/bits/magnitude.h
include/mp-units/bits/quantity_point_concepts.h include/mp-units/bits/quantity_cast.h
include/mp-units/bits/quantity_spec_concepts.h include/mp-units/bits/quantity_concepts.h
include/mp-units/bits/ratio.h include/mp-units/bits/quantity_point_concepts.h
include/mp-units/bits/reference_concepts.h include/mp-units/bits/quantity_spec_concepts.h
include/mp-units/bits/representation_concepts.h include/mp-units/bits/ratio.h
include/mp-units/bits/sudo_cast.h include/mp-units/bits/reference_concepts.h
include/mp-units/bits/symbol_text.h include/mp-units/bits/representation_concepts.h
include/mp-units/bits/text_tools.h include/mp-units/bits/sudo_cast.h
include/mp-units/bits/unit_concepts.h include/mp-units/bits/symbol_text.h
include/mp-units/bits/value_cast.h include/mp-units/bits/text_tools.h
include/mp-units/concepts.h include/mp-units/bits/unit_concepts.h
include/mp-units/core.h include/mp-units/bits/value_cast.h
include/mp-units/customization_points.h include/mp-units/compare.h
include/mp-units/dimension.h include/mp-units/compat_macros.h
include/mp-units/quantity.h include/mp-units/concepts.h
include/mp-units/quantity_point.h include/mp-units/core.h
include/mp-units/quantity_spec.h include/mp-units/customization_points.h
include/mp-units/reference.h include/mp-units/dimension.h
include/mp-units/system_reference.h include/mp-units/math.h
include/mp-units/unit.h include/mp-units/quantity.h
) include/mp-units/quantity_point.h
target_link_libraries(mp-units-core INTERFACE gsl::gsl-lite mp-units::core-macros) include/mp-units/quantity_spec.h
target_include_directories( include/mp-units/random.h
mp-units-core ${unitsAsSystem} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> include/mp-units/reference.h
$<INSTALL_INTERFACE:include> include/mp-units/system_reference.h
include/mp-units/unit.h
MODULE_INTERFACE_UNIT mp-units-core.cpp
) )
if(${projectPrefix}BUILD_CXX_MODULES)
if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18)
target_compile_definitions(mp-units-core PUBLIC _LIBCPP_NO_ABI_TAG)
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 18)
target_compile_options(mp-units-core PUBLIC "-Wno-include-angled-in-module-purview")
endif()
endif()
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options( target_compile_options(
mp-units-core mp-units-core ${${projectPrefix}TARGET_SCOPE}
INTERFACE /utf-8 # Specifies both the source character set and the execution character set as UTF-8 /utf-8 # Specifies both the source character set and the execution character set as UTF-8
) )
endif() endif()
set_target_properties(mp-units-core PROPERTIES EXPORT_NAME core)
add_library(mp-units::core ALIAS mp-units-core)
# installation
install(TARGETS mp-units-core EXPORT mp-unitsTargets)
install(DIRECTORY include/mp-units TYPE INCLUDE)

View File

@ -26,6 +26,7 @@
#include <gsl/gsl-lite.hpp> #include <gsl/gsl-lite.hpp>
#include <mp-units/bits/external/hacks.h> #include <mp-units/bits/external/hacks.h>
#include <array> #include <array>
#include <cmath>
#include <compare> #include <compare>
#include <concepts> #include <concepts>
#include <cstddef> #include <cstddef>
@ -37,6 +38,7 @@
#include <numbers> #include <numbers>
#include <numeric> #include <numeric>
#include <optional> #include <optional>
#include <random>
#include <ranges> #include <ranges>
#include <string> #include <string>
#include <string_view> #include <string_view>
@ -44,7 +46,5 @@
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
// utility // si
#include <chrono> #include <chrono>
#include <cmath>
#include <random>

View File

@ -22,8 +22,6 @@
#pragma once #pragma once
#include <version>
#if __clang__ #if __clang__
#define MP_UNITS_COMP_CLANG __clang_major__ #define MP_UNITS_COMP_CLANG __clang_major__
#elif __GNUC__ #elif __GNUC__
@ -70,9 +68,6 @@
#define MP_UNITS_DIAGNOSTIC_IGNORE_DEPRECATED #define MP_UNITS_DIAGNOSTIC_IGNORE_DEPRECATED
#endif #endif
#include <compare>
#include <concepts>
#if MP_UNITS_COMP_MSVC #if MP_UNITS_COMP_MSVC
#define MP_UNITS_TYPENAME typename #define MP_UNITS_TYPENAME typename
@ -83,7 +78,7 @@
#endif #endif
#if (defined MP_UNITS_COMP_CLANG && MP_UNITS_COMP_CLANG < 17) || (defined MP_UNITS_COMP_GCC && MP_UNITS_COMP_GCC < 12) #if (defined MP_UNITS_COMP_CLANG && MP_UNITS_COMP_CLANG < 17)
#define MP_UNITS_CONSTEVAL constexpr #define MP_UNITS_CONSTEVAL constexpr

View File

@ -22,6 +22,8 @@
#pragma once #pragma once
#include <mp-units/bits/external/hacks.h>
#ifdef __cpp_explicit_this_parameter #ifdef __cpp_explicit_this_parameter
#define QUANTITY_SPEC(name, ...) \ #define QUANTITY_SPEC(name, ...) \

View File

@ -22,13 +22,16 @@
#pragma once #pragma once
#include <mp-units/bits/math_core.h> #include <mp-units/compare.h>
#include <mp-units/compat_macros.h>
#include <mp-units/concepts.h> #include <mp-units/concepts.h>
#include <mp-units/customization_points.h> #include <mp-units/customization_points.h>
#include <mp-units/dimension.h> #include <mp-units/dimension.h>
#include <mp-units/math.h>
#include <mp-units/quantity.h> #include <mp-units/quantity.h>
#include <mp-units/quantity_point.h> #include <mp-units/quantity_point.h>
#include <mp-units/quantity_spec.h> #include <mp-units/quantity_spec.h>
#include <mp-units/random.h>
#include <mp-units/reference.h> #include <mp-units/reference.h>
#include <mp-units/system_reference.h> #include <mp-units/system_reference.h>
#include <mp-units/unit.h> #include <mp-units/unit.h>

View File

@ -23,27 +23,13 @@
#pragma once #pragma once
#include <mp-units/bits/quantity_point_concepts.h> #include <mp-units/bits/quantity_point_concepts.h>
#include <mp-units/compare.h>
#include <mp-units/customization_points.h> #include <mp-units/customization_points.h>
#include <mp-units/quantity.h> #include <mp-units/quantity.h>
#include <compare> #include <compare>
namespace mp_units { namespace mp_units {
namespace detail {
template<typename T>
requires requires {
{
T::zero()
} -> std::equality_comparable_with<T>;
}
[[nodiscard]] constexpr bool is_eq_zero(T v)
{
return v == T::zero();
}
} // namespace detail
template<typename Derived, QuantitySpec auto QS> template<typename Derived, QuantitySpec auto QS>
struct absolute_point_origin { struct absolute_point_origin {
static constexpr QuantitySpec auto quantity_spec = QS; static constexpr QuantitySpec auto quantity_spec = QS;
@ -95,11 +81,9 @@ template<PointOrigin PO1, PointOrigin PO2>
else if constexpr (detail::RelativePointOrigin<PO1> && detail::RelativePointOrigin<PO2>) else if constexpr (detail::RelativePointOrigin<PO1> && detail::RelativePointOrigin<PO2>)
return PO1::quantity_point == PO2::quantity_point; return PO1::quantity_point == PO2::quantity_point;
else if constexpr (detail::RelativePointOrigin<PO1>) else if constexpr (detail::RelativePointOrigin<PO1>)
return detail::same_absolute_point_origins(po1, po2) && return detail::same_absolute_point_origins(po1, po2) && is_eq_zero(PO1::quantity_point.quantity_from_zero());
detail::is_eq_zero(PO1::quantity_point.quantity_from_zero());
else if constexpr (detail::RelativePointOrigin<PO2>) else if constexpr (detail::RelativePointOrigin<PO2>)
return detail::same_absolute_point_origins(po1, po2) && return detail::same_absolute_point_origins(po1, po2) && is_eq_zero(PO2::quantity_point.quantity_from_zero());
detail::is_eq_zero(PO2::quantity_point.quantity_from_zero());
} }
template<Reference R> template<Reference R>

View File

@ -31,8 +31,8 @@
#include <mp-units/bits/quantity_spec_concepts.h> #include <mp-units/bits/quantity_spec_concepts.h>
#include <mp-units/bits/reference_concepts.h> #include <mp-units/bits/reference_concepts.h>
#include <mp-units/bits/representation_concepts.h> #include <mp-units/bits/representation_concepts.h>
#include <mp-units/compat_macros.h>
#include <mp-units/dimension.h> #include <mp-units/dimension.h>
#include <mp-units/quantity_spec_macro.h>
#include <tuple> #include <tuple>
namespace mp_units { namespace mp_units {

View File

@ -0,0 +1,10 @@
module;
#include <mp-units/bits/core_gmf.h>
export module mp_units.core;
export
{
#include <mp-units/core.h>
}

View File

@ -1,15 +0,0 @@
module;
#include <mp-units/bits/core-gmf.h>
export module mp_units.core;
export
{
// core
#include <mp-units/core.h>
// utility
#include <mp-units/compare.h>
#include <mp-units/random.h>
}

View File

@ -22,40 +22,39 @@
cmake_minimum_required(VERSION 3.19) cmake_minimum_required(VERSION 3.19)
# systems add_units_module(
add_subdirectory(angular) systems
add_subdirectory(iec80000) DEPENDENCIES mp-units::core
add_subdirectory(isq) HEADERS include/mp-units/systems/angular/angular.h
add_subdirectory(isq_angle) include/mp-units/systems/angular/math.h
add_subdirectory(natural) include/mp-units/systems/angular/units.h
add_subdirectory(si) include/mp-units/systems/cgs/cgs.h
add_subdirectory(cgs) include/mp-units/systems/hep/hep.h
add_subdirectory(hep) include/mp-units/systems/iau/iau.h
add_subdirectory(iau) include/mp-units/systems/iec80000/binary_prefixes.h
add_subdirectory(imperial) include/mp-units/systems/iec80000/iec80000.h
add_subdirectory(international) include/mp-units/systems/iec80000/quantities.h
add_subdirectory(typographic) include/mp-units/systems/iec80000/unit_symbols.h
add_subdirectory(usc) include/mp-units/systems/iec80000/units.h
include/mp-units/systems/imperial/imperial.h
# wrapper for all the systems include/mp-units/systems/international/international.h
add_library(mp-units-systems INTERFACE) include/mp-units/systems/isq/atomic_and_nuclear_physics.h
target_link_libraries( include/mp-units/systems/isq/base_quantities.h
mp-units-systems include/mp-units/systems/isq/electromagnetism.h
INTERFACE include/mp-units/systems/isq/isq.h
mp-units::angular include/mp-units/systems/isq/mechanics.h
mp-units::iec80000 include/mp-units/systems/isq/space_and_time.h
mp-units::isq include/mp-units/systems/isq/thermodynamics.h
mp-units::isq_angle include/mp-units/systems/isq_angle/isq_angle.h
mp-units::natural include/mp-units/systems/natural/natural.h
mp-units::si include/mp-units/systems/si/chrono.h
mp-units::cgs include/mp-units/systems/si/constants.h
mp-units::hep include/mp-units/systems/si/math.h
mp-units::iau include/mp-units/systems/si/prefixes.h
mp-units::imperial include/mp-units/systems/si/si.h
mp-units::international include/mp-units/systems/si/unit_symbols.h
mp-units::typographic include/mp-units/systems/si/units.h
mp-units::usc include/mp-units/systems/typographic/typographic.h
include/mp-units/systems/usc/usc.h
MODULE_INTERFACE_UNIT mp-units-systems.cpp
) )
add_library(mp-units::systems ALIAS mp-units-systems)
set_target_properties(mp-units-systems PROPERTIES EXPORT_NAME systems)
install(TARGETS mp-units-systems EXPORT mp-unitsTargets)

View File

@ -1,25 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.19)
add_units_module(angular DEPENDENCIES mp-units::isq HEADERS include/mp-units/systems/angular/angular.h)

View File

@ -1,25 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.19)
add_units_module(cgs DEPENDENCIES mp-units::si HEADERS include/mp-units/systems/cgs/cgs.h)

View File

@ -1,25 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) 2021 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.19)
add_units_module(hep DEPENDENCIES mp-units::si HEADERS include/mp-units/systems/hep/hep.h)

View File

@ -1,25 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.19)
add_units_module(iau DEPENDENCIES mp-units::si HEADERS include/mp-units/systems/iau/iau.h)

View File

@ -1,31 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.19)
add_units_module(
iec80000
DEPENDENCIES mp-units::isq mp-units::si
HEADERS include/mp-units/systems/iec80000/binary_prefixes.h include/mp-units/systems/iec80000/quantities.h
include/mp-units/systems/iec80000/iec80000.h include/mp-units/systems/iec80000/unit_symbols.h
include/mp-units/systems/iec80000/units.h
)

View File

@ -1,27 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.19)
add_units_module(
imperial DEPENDENCIES mp-units::si mp-units::international HEADERS include/mp-units/systems/imperial/imperial.h
)

View File

@ -22,12 +22,5 @@
#pragma once #pragma once
#include <mp-units/bits/math_angular.h> #include <mp-units/systems/angular/math.h>
#include <mp-units/bits/math_core.h> #include <mp-units/systems/angular/units.h>
#include <mp-units/bits/math_si.h>
// This header is intentionally empty and just include other headers
// `math.h` is just a convenience wrapper for not modular code
// With C++20 modules:
// - math_core is a part of the mp_units.core module
// - math_si and math_angular is provided with the mp_units.systems module

View File

@ -26,7 +26,7 @@
#include <mp-units/bits/value_cast.h> #include <mp-units/bits/value_cast.h>
#include <mp-units/customization_points.h> #include <mp-units/customization_points.h>
#include <mp-units/quantity.h> #include <mp-units/quantity.h>
#include <mp-units/systems/angular/angular.h> #include <mp-units/systems/angular/units.h>
#include <mp-units/unit.h> #include <mp-units/unit.h>
// IWYU pragma: begin_exports // IWYU pragma: begin_exports

View File

@ -22,7 +22,9 @@
#pragma once #pragma once
#include <mp-units/systems/si/chrono.h>
#include <mp-units/systems/si/constants.h> #include <mp-units/systems/si/constants.h>
#include <mp-units/systems/si/math.h>
#include <mp-units/systems/si/prefixes.h> #include <mp-units/systems/si/prefixes.h>
#include <mp-units/systems/si/unit_symbols.h> #include <mp-units/systems/si/unit_symbols.h>
#include <mp-units/systems/si/units.h> #include <mp-units/systems/si/units.h>

View File

@ -1,25 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.19)
add_units_module(international DEPENDENCIES mp-units::si HEADERS include/mp-units/systems/international/international.h)

View File

@ -1,35 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.19)
add_units_module(
isq
DEPENDENCIES mp-units::core
HEADERS include/mp-units/systems/isq/atomic_and_nuclear_physics.h
include/mp-units/systems/isq/base_quantities.h
include/mp-units/systems/isq/electromagnetism.h
include/mp-units/systems/isq/isq.h
include/mp-units/systems/isq/mechanics.h
include/mp-units/systems/isq/space_and_time.h
include/mp-units/systems/isq/thermodynamics.h
)

View File

@ -1,27 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.19)
add_units_module(
isq_angle DEPENDENCIES mp-units::angular mp-units::isq HEADERS include/mp-units/systems/isq_angle/isq_angle.h
)

View File

@ -1,7 +1,7 @@
module; module;
#include <mp-units/bits/core-gmf.h> #include <mp-units/bits/core_gmf.h>
#include <mp-units/quantity_spec_macro.h> #include <mp-units/compat_macros.h>
export module mp_units.systems; export module mp_units.systems;
@ -9,7 +9,6 @@ export import mp_units.core;
export export
{ {
// systems
#include <mp-units/systems/angular/angular.h> #include <mp-units/systems/angular/angular.h>
#include <mp-units/systems/cgs/cgs.h> #include <mp-units/systems/cgs/cgs.h>
#include <mp-units/systems/hep/hep.h> #include <mp-units/systems/hep/hep.h>
@ -23,8 +22,4 @@ export
#include <mp-units/systems/si/si.h> #include <mp-units/systems/si/si.h>
#include <mp-units/systems/typographic/typographic.h> #include <mp-units/systems/typographic/typographic.h>
#include <mp-units/systems/usc/usc.h> #include <mp-units/systems/usc/usc.h>
// utility
#include <mp-units/chrono.h>
#include <mp-units/math.h>
} }

View File

@ -1,25 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.19)
add_units_module(natural DEPENDENCIES mp-units::isq HEADERS include/mp-units/systems/natural/natural.h)

View File

@ -1,31 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.19)
add_units_module(
si
DEPENDENCIES mp-units::isq
HEADERS include/mp-units/systems/si/constants.h include/mp-units/systems/si/prefixes.h
include/mp-units/systems/si/si.h include/mp-units/systems/si/unit_symbols.h
include/mp-units/systems/si/units.h
)

View File

@ -1,25 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.19)
add_units_module(typographic DEPENDENCIES mp-units::usc HEADERS include/mp-units/systems/typographic/typographic.h)

View File

@ -1,25 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.19)
add_units_module(usc DEPENDENCIES mp-units::si mp-units::international HEADERS include/mp-units/systems/usc/usc.h)

View File

@ -1,29 +0,0 @@
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
cmake_minimum_required(VERSION 3.19)
add_units_module(
utility DEPENDENCIES mp-units::core mp-units::isq mp-units::si mp-units::angular
HEADERS include/mp-units/bits/math_angular.h include/mp-units/bits/math_core.h include/mp-units/bits/math_si.h
include/mp-units/chrono.h include/mp-units/math.h include/mp-units/random.h
)

View File

@ -22,7 +22,5 @@
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
add_subdirectory(unit_test/runtime) add_subdirectory(runtime)
add_subdirectory(unit_test/static) add_subdirectory(static)
# add_subdirectory(metabench)

View File

@ -25,12 +25,10 @@ cmake_minimum_required(VERSION 3.5)
find_package(Catch2 3 CONFIG REQUIRED) find_package(Catch2 3 CONFIG REQUIRED)
add_executable(unit_tests_runtime distribution_test.cpp fmt_test.cpp math_test.cpp) add_executable(unit_tests_runtime distribution_test.cpp fmt_test.cpp math_test.cpp)
if(TARGET mp-units::modules) if(${projectPrefix}BUILD_CXX_MODULES)
target_link_libraries(unit_tests_runtime PRIVATE mp-units::modules) target_compile_definitions(unit_tests_runtime PUBLIC ${projectPrefix}MODULES)
else()
target_link_libraries(unit_tests_runtime PRIVATE mp-units::mp-units)
endif() endif()
target_link_libraries(unit_tests_runtime PRIVATE Catch2::Catch2WithMain) target_link_libraries(unit_tests_runtime PRIVATE mp-units::mp-units Catch2::Catch2WithMain)
if(${projectPrefix}BUILD_LA) if(${projectPrefix}BUILD_LA)
find_package(wg21_linear_algebra CONFIG REQUIRED) find_package(wg21_linear_algebra CONFIG REQUIRED)

View File

@ -21,7 +21,7 @@
// SOFTWARE. // SOFTWARE.
#include <catch2/matchers/catch_matchers_templated.hpp> #include <catch2/matchers/catch_matchers_templated.hpp>
#include <mp-units/bits/fmt_hacks.h> #include <mp-units/compat_fmt_macros.h>
#include <algorithm> #include <algorithm>
#ifdef MP_UNITS_MODULES #ifdef MP_UNITS_MODULES
import mp_units; import mp_units;

View File

@ -22,7 +22,7 @@
#include <catch2/catch_test_macros.hpp> #include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_exception.hpp> #include <catch2/matchers/catch_matchers_exception.hpp>
#include <mp-units/bits/fmt_hacks.h> #include <mp-units/compat_fmt_macros.h>
#include <iomanip> #include <iomanip>
#include <limits> #include <limits>
#include <locale> #include <locale>

View File

@ -21,7 +21,7 @@
// SOFTWARE. // SOFTWARE.
#include <catch2/catch_test_macros.hpp> #include <catch2/catch_test_macros.hpp>
#include <mp-units/bits/fmt_hacks.h> #include <mp-units/compat_fmt_macros.h>
#include <cmath> #include <cmath>
#include <matrix> #include <matrix>
#ifdef MP_UNITS_MODULES #ifdef MP_UNITS_MODULES

View File

@ -30,8 +30,7 @@ import mp_units;
#include <mp-units/ostream.h> #include <mp-units/ostream.h>
#include <mp-units/systems/angular/angular.h> #include <mp-units/systems/angular/angular.h>
#include <mp-units/systems/isq/space_and_time.h> #include <mp-units/systems/isq/space_and_time.h>
#include <mp-units/systems/si/unit_symbols.h> #include <mp-units/systems/si/si.h>
#include <mp-units/systems/si/units.h>
#endif #endif
using namespace mp_units; using namespace mp_units;

View File

@ -23,11 +23,10 @@
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
add_library(unit_tests_static_truncating quantity_test.cpp) add_library(unit_tests_static_truncating quantity_test.cpp)
if(TARGET mp-units::modules) if(${projectPrefix}BUILD_CXX_MODULES)
target_link_libraries(unit_tests_static_truncating PRIVATE mp-units::modules) target_compile_definitions(unit_tests_static_truncating PUBLIC ${projectPrefix}MODULES)
else()
target_link_libraries(unit_tests_static_truncating PRIVATE mp-units::mp-units)
endif() endif()
target_link_libraries(unit_tests_static_truncating PRIVATE mp-units::mp-units)
target_compile_options( target_compile_options(
unit_tests_static_truncating PRIVATE $<IF:$<CXX_COMPILER_ID:MSVC>,/wd4242 /wd4244,-Wno-conversion> unit_tests_static_truncating PRIVATE $<IF:$<CXX_COMPILER_ID:MSVC>,/wd4242 /wd4244,-Wno-conversion>
) )
@ -68,9 +67,8 @@ add_library(
usc_test.cpp usc_test.cpp
) )
if(TARGET mp-units::modules) target_link_libraries(unit_tests_static PRIVATE mp-units::mp-units)
target_link_libraries(unit_tests_static PRIVATE mp-units::modules) if(${projectPrefix}BUILD_CXX_MODULES)
else() target_compile_definitions(unit_tests_static PUBLIC ${projectPrefix}MODULES)
target_link_libraries(unit_tests_static PRIVATE mp-units::mp-units)
endif() endif()
target_link_libraries(unit_tests_static PRIVATE unit_tests_static_truncating) target_link_libraries(unit_tests_static PRIVATE unit_tests_static_truncating)

View File

@ -27,9 +27,8 @@
import mp_units; import mp_units;
#else #else
#include <mp-units/bits/external/type_traits.h> #include <mp-units/bits/external/type_traits.h>
#include <mp-units/chrono.h>
#include <mp-units/quantity_point.h> #include <mp-units/quantity_point.h>
#include <mp-units/systems/si/unit_symbols.h> #include <mp-units/systems/si/si.h>
#endif #endif
namespace { namespace {

View File

@ -27,7 +27,6 @@
#ifdef MP_UNITS_MODULES #ifdef MP_UNITS_MODULES
import mp_units; import mp_units;
#else #else
#include <mp-units/chrono.h>
#include <mp-units/concepts.h> #include <mp-units/concepts.h>
#include <mp-units/quantity_point.h> #include <mp-units/quantity_point.h>
#include <mp-units/systems/isq/space_and_time.h> #include <mp-units/systems/isq/space_and_time.h>

Some files were not shown because too many files have changed in this diff Show More