diff --git a/.cmake-format.yaml b/.cmake-format.yaml index 2956b76e..537bcefb 100644 --- a/.cmake-format.yaml +++ b/.cmake-format.yaml @@ -1,22 +1,12 @@ parse: 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: pargs: nargs: 1 kwargs: - DEPENDENCIES: + - HEADERS: + + DEPENDENCIES: "+" + HEADERS: "*" + MODULE_INTERFACE_UNIT: "?" enable_iwyu: pargs: flags: @@ -26,13 +16,6 @@ parse: kwargs: MAPPING_FILE: 1 MAX_LINE_LENGTH: 1 - metabench_add_chart: - pargs: - nargs: 1 - kwargs: - TITLE: 1 - SUBTITLE: 1 - DATASETS: + format: line_width: 120 tab_size: 4 diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 33d09727..4a268ce4 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -27,53 +27,47 @@ if(NOT TARGET gsl::gsl-lite) find_package(gsl-lite CONFIG REQUIRED) endif() +if(${projectPrefix}BUILD_CXX_MODULES) add_library(example_utils INTERFACE) +target_compile_definitions(example_utils INTERFACE ${projectPrefix}MODULES) target_include_directories(example_utils INTERFACE include) 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 ...) +# add_example(target ...) # function(add_example target) - add_executable(${target} ${target}.cpp) - if(TARGET mp-units::modules) - target_link_libraries(${target} PRIVATE mp-units::modules) - else() - target_link_libraries(${target} PRIVATE ${ARGN}) + if(${projectPrefix}BUILD_CXX_MODULES) + add_executable(${target} ${target}.cpp) + target_compile_definitions(${target} PUBLIC ${projectPrefix}MODULES) + target_link_libraries(${target} PRIVATE mp-units::mp-units ${ARGN}) endif() + + add_executable(${target}-headers ${target}.cpp) + list(TRANSFORM ARGN APPEND "-headers") + target_link_libraries(${target}-headers PRIVATE mp-units::mp-units ${ARGN}) endfunction() -add_example(avg_speed mp-units::core-io mp-units::si mp-units::cgs mp-units::usc) -add_example(capacitor_time_curve mp-units::core-io mp-units::si mp-units::utility) -add_example( - clcpp_response - mp-units::core-fmt - mp-units::core-io - mp-units::si - mp-units::iau - mp-units::imperial - mp-units::international - mp-units::typographic - mp-units::usc -) -add_example(conversion_factor mp-units::core-fmt mp-units::core-io mp-units::si) -add_example(currency mp-units::core-io) -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_example(avg_speed) +add_example(capacitor_time_curve) +add_example(clcpp_response) +add_example(conversion_factor) +add_example(currency) +add_example(foot_pound_second) +add_example(glide_computer glide_computer_lib) +add_example(hello_units) +add_example(measurement) +add_example(si_constants) +add_example(spectroscopy_units) +add_example(storage_tank) +add_example(strong_angular_quantities) +add_example(total_energy) +add_example(unmanned_aerial_vehicle example_utils) add_subdirectory(glide_computer_lib) add_subdirectory(kalman_filter) diff --git a/example/clcpp_response.cpp b/example/clcpp_response.cpp index 58cdd912..1bf0bbb5 100644 --- a/example/clcpp_response.cpp +++ b/example/clcpp_response.cpp @@ -15,7 +15,7 @@ along with this program. If not, see http://www.gnu.org/licenses./ */ -#include +#include #include #ifdef MP_UNITS_MODULES import mp_units; diff --git a/example/conversion_factor.cpp b/example/conversion_factor.cpp index 2b666b9c..d6846f4d 100644 --- a/example/conversion_factor.cpp +++ b/example/conversion_factor.cpp @@ -15,7 +15,7 @@ along with this program. If not, see http://www.gnu.org/licenses./ */ -#include +#include #include #include #ifdef MP_UNITS_MODULES diff --git a/example/currency.cpp b/example/currency.cpp index 57cf5a57..65527711 100644 --- a/example/currency.cpp +++ b/example/currency.cpp @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#include +#include #include #include #ifdef MP_UNITS_MODULES diff --git a/example/foot_pound_second.cpp b/example/foot_pound_second.cpp index bfb5719d..63a303fc 100644 --- a/example/foot_pound_second.cpp +++ b/example/foot_pound_second.cpp @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#include +#include #include #include #ifdef MP_UNITS_MODULES diff --git a/example/glide_computer.cpp b/example/glide_computer.cpp index cefe692e..c691d12d 100644 --- a/example/glide_computer.cpp +++ b/example/glide_computer.cpp @@ -21,7 +21,7 @@ // SOFTWARE. #include "glide_computer_lib.h" -#include +#include #include #include #include @@ -32,10 +32,9 @@ #ifdef MP_UNITS_MODULES import mp_units; #else -#include #include #include -#include +#include #endif namespace { diff --git a/example/glide_computer_lib/CMakeLists.txt b/example/glide_computer_lib/CMakeLists.txt index 65d11b35..810a666c 100644 --- a/example/glide_computer_lib/CMakeLists.txt +++ b/example/glide_computer_lib/CMakeLists.txt @@ -22,11 +22,13 @@ cmake_minimum_required(VERSION 3.5) -add_library(glide_computer_lib STATIC glide_computer_lib.cpp include/glide_computer_lib.h) -if(TARGET mp-units::modules) - target_link_libraries(glide_computer_lib PUBLIC gsl::gsl-lite mp-units::modules) -else() - target_link_libraries(glide_computer_lib PRIVATE mp-units::core-fmt PUBLIC mp-units::si mp-units::utility) +add_library(glide_computer_lib-headers STATIC glide_computer_lib.cpp include/glide_computer_lib.h) +target_link_libraries(glide_computer_lib-headers PUBLIC mp-units::mp-units example_utils) +target_include_directories(glide_computer_lib-headers PUBLIC include) + +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() -target_link_libraries(glide_computer_lib PUBLIC example_utils) -target_include_directories(glide_computer_lib PUBLIC include) diff --git a/example/glide_computer_lib/include/glide_computer_lib.h b/example/glide_computer_lib/include/glide_computer_lib.h index 50229a9b..b198dabf 100644 --- a/example/glide_computer_lib/include/glide_computer_lib.h +++ b/example/glide_computer_lib/include/glide_computer_lib.h @@ -22,7 +22,7 @@ #pragma once -#include +#include // #include "geographic.h" #include @@ -36,10 +36,10 @@ #ifdef MP_UNITS_MODULES import mp_units; #else -#include #include // IWYU pragma: keep #include #include +#include #endif // An example of a really simplified tactical glide computer diff --git a/example/hello_units.cpp b/example/hello_units.cpp index 6bc12235..e707cd99 100644 --- a/example/hello_units.cpp +++ b/example/hello_units.cpp @@ -25,7 +25,7 @@ // !!! renders correctly in the documentation "Examples" section. !!! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -#include +#include #include #ifdef MP_UNITS_MODULES import mp_units; diff --git a/example/include/geographic.h b/example/include/geographic.h index ade0f6e0..3d285bd8 100644 --- a/example/include/geographic.h +++ b/example/include/geographic.h @@ -23,7 +23,7 @@ #pragma once #include "ranged_representation.h" -#include +#include #include #include #include @@ -33,11 +33,10 @@ import mp_units; #else #include #include -#include #include #include #include -#include +#include #endif namespace geographic { diff --git a/example/include/validated_type.h b/example/include/validated_type.h index 77422ccc..9924fc4a 100644 --- a/example/include/validated_type.h +++ b/example/include/validated_type.h @@ -23,7 +23,7 @@ #pragma once #include -#include +#include #include #include #ifdef MP_UNITS_MODULES diff --git a/example/kalman_filter/CMakeLists.txt b/example/kalman_filter/CMakeLists.txt index 4c7954d9..d1d1a6c8 100644 --- a/example/kalman_filter/CMakeLists.txt +++ b/example/kalman_filter/CMakeLists.txt @@ -22,23 +22,11 @@ cmake_minimum_required(VERSION 3.5) -# -# add_example(target ...) -# -function(add_example target) - add_executable(${target} ${target}.cpp) - if(TARGET mp-units::modules) - target_link_libraries(${target} PRIVATE mp-units::modules) - else() - 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) +add_example(kalman_filter-example_1) +add_example(kalman_filter-example_2) +add_example(kalman_filter-example_3) +add_example(kalman_filter-example_4) +add_example(kalman_filter-example_5) +add_example(kalman_filter-example_6) +add_example(kalman_filter-example_7) +add_example(kalman_filter-example_8) diff --git a/example/kalman_filter/kalman.h b/example/kalman_filter/kalman.h index 310d9941..9115aae3 100644 --- a/example/kalman_filter/kalman.h +++ b/example/kalman_filter/kalman.h @@ -22,7 +22,7 @@ #pragma once -#include +#include #include #ifdef MP_UNITS_MODULES import mp_units; diff --git a/example/si_constants.cpp b/example/si_constants.cpp index 35d855d5..e3d02d6e 100644 --- a/example/si_constants.cpp +++ b/example/si_constants.cpp @@ -25,7 +25,7 @@ // !!! renders correctly in the documentation "Examples" section. !!! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -#include +#include #include #ifdef MP_UNITS_MODULES import mp_units; diff --git a/example/spectroscopy_units.cpp b/example/spectroscopy_units.cpp index 7a6270d6..71da66d5 100644 --- a/example/spectroscopy_units.cpp +++ b/example/spectroscopy_units.cpp @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#include +#include #include #include #ifdef MP_UNITS_MODULES diff --git a/example/storage_tank.cpp b/example/storage_tank.cpp index 84d1c42c..a2317384 100644 --- a/example/storage_tank.cpp +++ b/example/storage_tank.cpp @@ -20,8 +20,8 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#include -#include +#include +#include #include #include #include @@ -30,14 +30,11 @@ #ifdef MP_UNITS_MODULES import mp_units; #else -#include #include #include #include #include -#include -#include -#include +#include #endif // allows standard gravity (acceleration) and weight (force) to be expressed with scalar representation diff --git a/example/unmanned_aerial_vehicle.cpp b/example/unmanned_aerial_vehicle.cpp index 6e089939..35978aab 100644 --- a/example/unmanned_aerial_vehicle.cpp +++ b/example/unmanned_aerial_vehicle.cpp @@ -21,7 +21,7 @@ // SOFTWARE. #include "geographic.h" -#include +#include #include #include #ifdef MP_UNITS_MODULES diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c8a43497..b3f87735 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,84 +36,26 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") include(AddUnitsModule) include(GNUInstallDirs) +if(${projectPrefix}BUILD_CXX_MODULES) + set(${projectPrefix}TARGET_SCOPE "PUBLIC") +else() + set(${projectPrefix}TARGET_SCOPE "INTERFACE") +endif() + if(${projectPrefix}AS_SYSTEM_HEADERS) set(unitsAsSystem SYSTEM) endif() -add_subdirectory(core-macros) add_subdirectory(core) -add_subdirectory(core-fmt-macros) add_subdirectory(core-fmt) add_subdirectory(core-io) add_subdirectory(systems) -add_subdirectory(utility) # project-wide wrapper -add_library(mp-units INTERFACE) -target_link_libraries( - mp-units INTERFACE mp-units::core mp-units::core-io mp-units::core-fmt mp-units::systems mp-units::utility +add_units_module( + mp-units DEPENDENCIES mp-units::core mp-units::core-io mp-units::core-fmt mp-units::systems + 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 export(EXPORT mp-unitsTargets NAMESPACE mp-units::) diff --git a/src/cmake/AddUnitsModule.cmake b/src/cmake/AddUnitsModule.cmake index de89f1af..4e0ac2a4 100644 --- a/src/cmake/AddUnitsModule.cmake +++ b/src/cmake/AddUnitsModule.cmake @@ -43,27 +43,46 @@ endfunction() # # add_units_module(ModuleName # DEPENDENCIES ... -# HEADERS ...) +# [HEADERS ...] +# MODULE_INTERFACE_UNIT ) # function(add_units_module name) # parse arguments + set(oneValue MODULE_INTERFACE_UNIT) 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_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 - add_library(mp-units-${name} INTERFACE ${ARG_HEADERS}) - target_link_libraries(mp-units-${name} INTERFACE ${ARG_DEPENDENCIES}) - target_include_directories( - mp-units-${name} ${unitsAsSystem} INTERFACE $ - $ - ) + add_library(mp-units-${name} ${SCOPE} ${ARG_HEADERS}) + target_link_libraries(mp-units-${name} ${${projectPrefix}TARGET_SCOPE} ${ARG_DEPENDENCIES}) + if(ARG_HEADERS) + target_include_directories( + mp-units-${name} ${unitsAsSystem} ${${projectPrefix}TARGET_SCOPE} + $ $ + ) + endif() set_target_properties(mp-units-${name} PROPERTIES EXPORT_NAME ${name}) add_library(mp-units::${name} ALIAS mp-units-${name}) - install(TARGETS mp-units-${name} EXPORT mp-unitsTargets) - install(DIRECTORY include/mp-units TYPE INCLUDE) + if(${projectPrefix}BUILD_CXX_MODULES) + 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() diff --git a/src/core-fmt-macros/CMakeLists.txt b/src/core-fmt-macros/CMakeLists.txt deleted file mode 100644 index 8f6bc13c..00000000 --- a/src/core-fmt-macros/CMakeLists.txt +++ /dev/null @@ -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 $ - $ -) -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) diff --git a/src/core-fmt/CMakeLists.txt b/src/core-fmt/CMakeLists.txt index 35a59370..71a643da 100644 --- a/src/core-fmt/CMakeLists.txt +++ b/src/core-fmt/CMakeLists.txt @@ -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) message(STATUS "${projectPrefix}USE_LIBFMT: ${${projectPrefix}USE_LIBFMT}") -add_units_module(core-fmt DEPENDENCIES mp-units::core HEADERS include/mp-units/format.h) -target_compile_definitions(mp-units-core-fmt INTERFACE ${projectPrefix}USE_LIBFMT=$) -target_link_libraries(mp-units-core-fmt INTERFACE mp-units::core-fmt-macros) +add_units_module( + core-fmt + 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=$ +) if(${projectPrefix}USE_LIBFMT) if(NOT TARGET fmt::fmt) find_package(fmt CONFIG REQUIRED) endif() - target_link_libraries(mp-units-core-fmt INTERFACE fmt::fmt) + target_link_libraries(mp-units-core-fmt ${${projectPrefix}TARGET_SCOPE} fmt::fmt) endif() diff --git a/src/core-fmt/include/mp-units/bits/fmt.h b/src/core-fmt/include/mp-units/bits/fmt.h index 973f01ad..28fa08ea 100644 --- a/src/core-fmt/include/mp-units/bits/fmt.h +++ b/src/core-fmt/include/mp-units/bits/fmt.h @@ -30,7 +30,7 @@ #pragma once #include -#include +#include #include #include #include diff --git a/src/core-fmt-macros/include/mp-units/bits/fmt_hacks.h b/src/core-fmt/include/mp-units/compat_fmt_macros.h similarity index 100% rename from src/core-fmt-macros/include/mp-units/bits/fmt_hacks.h rename to src/core-fmt/include/mp-units/compat_fmt_macros.h diff --git a/src/mp-units-core-fmt.cpp b/src/core-fmt/mp-units-core-fmt.cpp similarity index 60% rename from src/mp-units-core-fmt.cpp rename to src/core-fmt/mp-units-core-fmt.cpp index 8576e7bb..da3e62e8 100644 --- a/src/mp-units-core-fmt.cpp +++ b/src/core-fmt/mp-units-core-fmt.cpp @@ -1,7 +1,7 @@ module; -#include -#include +#include +#include export module mp_units.core_fmt; diff --git a/src/core-io/CMakeLists.txt b/src/core-io/CMakeLists.txt index d4ae7a20..6f991530 100644 --- a/src/core-io/CMakeLists.txt +++ b/src/core-io/CMakeLists.txt @@ -22,4 +22,9 @@ 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 +) diff --git a/src/mp-units-core-io.cpp b/src/core-io/mp-units-core-io.cpp similarity index 78% rename from src/mp-units-core-io.cpp rename to src/core-io/mp-units-core-io.cpp index db16a2df..b31e7803 100644 --- a/src/mp-units-core-io.cpp +++ b/src/core-io/mp-units-core-io.cpp @@ -1,6 +1,6 @@ module; -#include +#include #include export module mp_units.core_io; diff --git a/src/core-macros/CMakeLists.txt b/src/core-macros/CMakeLists.txt deleted file mode 100644 index 38bfe974..00000000 --- a/src/core-macros/CMakeLists.txt +++ /dev/null @@ -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 $ - $ -) - -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) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index ed0270cd..46143809 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -28,60 +28,67 @@ if(NOT TARGET gsl::gsl-lite) endif() # core library definition -add_library( - mp-units-core - INTERFACE - include/mp-units/bits/external/algorithm.h - include/mp-units/bits/external/fixed_string.h - include/mp-units/bits/external/math_concepts.h - include/mp-units/bits/external/prime.h - include/mp-units/bits/external/type_list.h - include/mp-units/bits/external/type_name.h - include/mp-units/bits/external/type_traits.h - include/mp-units/bits/dimension_concepts.h - include/mp-units/bits/expression_template.h - include/mp-units/bits/get_associated_quantity.h - include/mp-units/bits/get_common_base.h - include/mp-units/bits/magnitude.h - include/mp-units/bits/quantity_cast.h - include/mp-units/bits/quantity_concepts.h - include/mp-units/bits/quantity_point_concepts.h - include/mp-units/bits/quantity_spec_concepts.h - include/mp-units/bits/ratio.h - include/mp-units/bits/reference_concepts.h - include/mp-units/bits/representation_concepts.h - include/mp-units/bits/sudo_cast.h - include/mp-units/bits/symbol_text.h - include/mp-units/bits/text_tools.h - include/mp-units/bits/unit_concepts.h - include/mp-units/bits/value_cast.h - include/mp-units/concepts.h - include/mp-units/core.h - include/mp-units/customization_points.h - include/mp-units/dimension.h - include/mp-units/quantity.h - include/mp-units/quantity_point.h - include/mp-units/quantity_spec.h - include/mp-units/reference.h - include/mp-units/system_reference.h - include/mp-units/unit.h -) -target_link_libraries(mp-units-core INTERFACE gsl::gsl-lite mp-units::core-macros) -target_include_directories( - mp-units-core ${unitsAsSystem} INTERFACE $ - $ +add_units_module( + core + DEPENDENCIES gsl::gsl-lite + HEADERS include/mp-units/bits/external/algorithm.h + include/mp-units/bits/external/fixed_string.h + include/mp-units/bits/external/hacks.h + include/mp-units/bits/external/math_concepts.h + include/mp-units/bits/external/prime.h + include/mp-units/bits/external/type_list.h + include/mp-units/bits/external/type_name.h + include/mp-units/bits/external/type_traits.h + include/mp-units/bits/core_gmf.h + include/mp-units/bits/dimension_concepts.h + include/mp-units/bits/expression_template.h + include/mp-units/bits/get_associated_quantity.h + include/mp-units/bits/get_common_base.h + include/mp-units/bits/magnitude.h + include/mp-units/bits/quantity_cast.h + include/mp-units/bits/quantity_concepts.h + include/mp-units/bits/quantity_point_concepts.h + include/mp-units/bits/quantity_spec_concepts.h + include/mp-units/bits/ratio.h + include/mp-units/bits/reference_concepts.h + include/mp-units/bits/representation_concepts.h + include/mp-units/bits/sudo_cast.h + include/mp-units/bits/symbol_text.h + include/mp-units/bits/text_tools.h + include/mp-units/bits/unit_concepts.h + include/mp-units/bits/value_cast.h + include/mp-units/compare.h + include/mp-units/compat_macros.h + include/mp-units/concepts.h + include/mp-units/core.h + include/mp-units/customization_points.h + include/mp-units/dimension.h + include/mp-units/math.h + include/mp-units/quantity.h + include/mp-units/quantity_point.h + include/mp-units/quantity_spec.h + include/mp-units/random.h + include/mp-units/reference.h + 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") target_compile_options( - mp-units-core - INTERFACE /utf-8 # Specifies both the source character set and the execution character set as UTF-8 + mp-units-core ${${projectPrefix}TARGET_SCOPE} + /utf-8 # Specifies both the source character set and the execution character set as UTF-8 ) 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) diff --git a/src/core-macros/include/mp-units/bits/core-gmf.h b/src/core/include/mp-units/bits/core_gmf.h similarity index 99% rename from src/core-macros/include/mp-units/bits/core-gmf.h rename to src/core/include/mp-units/bits/core_gmf.h index fdcd10ad..8c21e6ec 100644 --- a/src/core-macros/include/mp-units/bits/core-gmf.h +++ b/src/core/include/mp-units/bits/core_gmf.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -37,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -44,7 +46,5 @@ #include #include -// utility +// si #include -#include -#include diff --git a/src/core-macros/include/mp-units/bits/external/hacks.h b/src/core/include/mp-units/bits/external/hacks.h similarity index 95% rename from src/core-macros/include/mp-units/bits/external/hacks.h rename to src/core/include/mp-units/bits/external/hacks.h index f943dc25..6bf6f45d 100644 --- a/src/core-macros/include/mp-units/bits/external/hacks.h +++ b/src/core/include/mp-units/bits/external/hacks.h @@ -22,8 +22,6 @@ #pragma once -#include - #if __clang__ #define MP_UNITS_COMP_CLANG __clang_major__ #elif __GNUC__ @@ -70,9 +68,6 @@ #define MP_UNITS_DIAGNOSTIC_IGNORE_DEPRECATED #endif -#include -#include - #if MP_UNITS_COMP_MSVC #define MP_UNITS_TYPENAME typename @@ -83,7 +78,7 @@ #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 diff --git a/src/utility/include/mp-units/compare.h b/src/core/include/mp-units/compare.h similarity index 100% rename from src/utility/include/mp-units/compare.h rename to src/core/include/mp-units/compare.h diff --git a/src/core-macros/include/mp-units/quantity_spec_macro.h b/src/core/include/mp-units/compat_macros.h similarity index 97% rename from src/core-macros/include/mp-units/quantity_spec_macro.h rename to src/core/include/mp-units/compat_macros.h index 9e45b833..4ab02761 100644 --- a/src/core-macros/include/mp-units/quantity_spec_macro.h +++ b/src/core/include/mp-units/compat_macros.h @@ -22,6 +22,8 @@ #pragma once +#include + #ifdef __cpp_explicit_this_parameter #define QUANTITY_SPEC(name, ...) \ diff --git a/src/core/include/mp-units/core.h b/src/core/include/mp-units/core.h index 209076f0..e92ceb28 100644 --- a/src/core/include/mp-units/core.h +++ b/src/core/include/mp-units/core.h @@ -22,13 +22,16 @@ #pragma once -#include +#include +#include #include #include #include +#include #include #include #include +#include #include #include #include diff --git a/src/utility/include/mp-units/bits/math_core.h b/src/core/include/mp-units/math.h similarity index 100% rename from src/utility/include/mp-units/bits/math_core.h rename to src/core/include/mp-units/math.h diff --git a/src/core/include/mp-units/quantity_point.h b/src/core/include/mp-units/quantity_point.h index 73d1f66c..c42994c0 100644 --- a/src/core/include/mp-units/quantity_point.h +++ b/src/core/include/mp-units/quantity_point.h @@ -23,27 +23,13 @@ #pragma once #include +#include #include #include #include namespace mp_units { -namespace detail { - -template - requires requires { - { - T::zero() - } -> std::equality_comparable_with; - } -[[nodiscard]] constexpr bool is_eq_zero(T v) -{ - return v == T::zero(); -} - -} // namespace detail - template struct absolute_point_origin { static constexpr QuantitySpec auto quantity_spec = QS; @@ -95,11 +81,9 @@ template else if constexpr (detail::RelativePointOrigin && detail::RelativePointOrigin) return PO1::quantity_point == PO2::quantity_point; else if constexpr (detail::RelativePointOrigin) - return detail::same_absolute_point_origins(po1, po2) && - detail::is_eq_zero(PO1::quantity_point.quantity_from_zero()); + return detail::same_absolute_point_origins(po1, po2) && is_eq_zero(PO1::quantity_point.quantity_from_zero()); else if constexpr (detail::RelativePointOrigin) - return detail::same_absolute_point_origins(po1, po2) && - detail::is_eq_zero(PO2::quantity_point.quantity_from_zero()); + return detail::same_absolute_point_origins(po1, po2) && is_eq_zero(PO2::quantity_point.quantity_from_zero()); } template diff --git a/src/core/include/mp-units/quantity_spec.h b/src/core/include/mp-units/quantity_spec.h index 4550c1e7..556b8cd2 100644 --- a/src/core/include/mp-units/quantity_spec.h +++ b/src/core/include/mp-units/quantity_spec.h @@ -31,8 +31,8 @@ #include #include #include +#include #include -#include #include namespace mp_units { diff --git a/src/utility/include/mp-units/random.h b/src/core/include/mp-units/random.h similarity index 100% rename from src/utility/include/mp-units/random.h rename to src/core/include/mp-units/random.h diff --git a/src/core/mp-units-core.cpp b/src/core/mp-units-core.cpp new file mode 100644 index 00000000..17a3d87c --- /dev/null +++ b/src/core/mp-units-core.cpp @@ -0,0 +1,10 @@ +module; + +#include + +export module mp_units.core; + +export +{ +#include +} diff --git a/src/mp-units-core.cpp b/src/mp-units-core.cpp deleted file mode 100644 index 2826e6fe..00000000 --- a/src/mp-units-core.cpp +++ /dev/null @@ -1,15 +0,0 @@ -module; - -#include - -export module mp_units.core; - -export -{ -// core -#include - -// utility -#include -#include -} diff --git a/src/systems/CMakeLists.txt b/src/systems/CMakeLists.txt index b21c786b..95e20497 100644 --- a/src/systems/CMakeLists.txt +++ b/src/systems/CMakeLists.txt @@ -22,40 +22,39 @@ cmake_minimum_required(VERSION 3.19) -# systems -add_subdirectory(angular) -add_subdirectory(iec80000) -add_subdirectory(isq) -add_subdirectory(isq_angle) -add_subdirectory(natural) -add_subdirectory(si) -add_subdirectory(cgs) -add_subdirectory(hep) -add_subdirectory(iau) -add_subdirectory(imperial) -add_subdirectory(international) -add_subdirectory(typographic) -add_subdirectory(usc) - -# wrapper for all the systems -add_library(mp-units-systems INTERFACE) -target_link_libraries( - mp-units-systems - INTERFACE - mp-units::angular - mp-units::iec80000 - mp-units::isq - mp-units::isq_angle - mp-units::natural - mp-units::si - mp-units::cgs - mp-units::hep - mp-units::iau - mp-units::imperial - mp-units::international - mp-units::typographic - mp-units::usc +add_units_module( + systems + DEPENDENCIES mp-units::core + HEADERS include/mp-units/systems/angular/angular.h + include/mp-units/systems/angular/math.h + include/mp-units/systems/angular/units.h + include/mp-units/systems/cgs/cgs.h + include/mp-units/systems/hep/hep.h + include/mp-units/systems/iau/iau.h + include/mp-units/systems/iec80000/binary_prefixes.h + include/mp-units/systems/iec80000/iec80000.h + include/mp-units/systems/iec80000/quantities.h + include/mp-units/systems/iec80000/unit_symbols.h + include/mp-units/systems/iec80000/units.h + include/mp-units/systems/imperial/imperial.h + include/mp-units/systems/international/international.h + 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 + include/mp-units/systems/isq_angle/isq_angle.h + include/mp-units/systems/natural/natural.h + include/mp-units/systems/si/chrono.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/si.h + include/mp-units/systems/si/unit_symbols.h + include/mp-units/systems/si/units.h + 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) diff --git a/src/systems/angular/CMakeLists.txt b/src/systems/angular/CMakeLists.txt deleted file mode 100644 index 2c7886b2..00000000 --- a/src/systems/angular/CMakeLists.txt +++ /dev/null @@ -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) diff --git a/src/systems/cgs/CMakeLists.txt b/src/systems/cgs/CMakeLists.txt deleted file mode 100644 index 604b5937..00000000 --- a/src/systems/cgs/CMakeLists.txt +++ /dev/null @@ -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) diff --git a/src/systems/hep/CMakeLists.txt b/src/systems/hep/CMakeLists.txt deleted file mode 100644 index b09581b4..00000000 --- a/src/systems/hep/CMakeLists.txt +++ /dev/null @@ -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) diff --git a/src/systems/iau/CMakeLists.txt b/src/systems/iau/CMakeLists.txt deleted file mode 100644 index 6f1cbd6d..00000000 --- a/src/systems/iau/CMakeLists.txt +++ /dev/null @@ -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) diff --git a/src/systems/iec80000/CMakeLists.txt b/src/systems/iec80000/CMakeLists.txt deleted file mode 100644 index f1bd31ca..00000000 --- a/src/systems/iec80000/CMakeLists.txt +++ /dev/null @@ -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 -) diff --git a/src/systems/imperial/CMakeLists.txt b/src/systems/imperial/CMakeLists.txt deleted file mode 100644 index cdde9f2f..00000000 --- a/src/systems/imperial/CMakeLists.txt +++ /dev/null @@ -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 -) diff --git a/src/utility/include/mp-units/math.h b/src/systems/include/mp-units/systems/angular/angular.h similarity index 74% rename from src/utility/include/mp-units/math.h rename to src/systems/include/mp-units/systems/angular/angular.h index 53743dee..e9461440 100644 --- a/src/utility/include/mp-units/math.h +++ b/src/systems/include/mp-units/systems/angular/angular.h @@ -22,12 +22,5 @@ #pragma once -#include -#include -#include - -// 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 +#include +#include diff --git a/src/utility/include/mp-units/bits/math_angular.h b/src/systems/include/mp-units/systems/angular/math.h similarity index 99% rename from src/utility/include/mp-units/bits/math_angular.h rename to src/systems/include/mp-units/systems/angular/math.h index aa49afb5..f2954f05 100644 --- a/src/utility/include/mp-units/bits/math_angular.h +++ b/src/systems/include/mp-units/systems/angular/math.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include // IWYU pragma: begin_exports diff --git a/src/systems/angular/include/mp-units/systems/angular/angular.h b/src/systems/include/mp-units/systems/angular/units.h similarity index 100% rename from src/systems/angular/include/mp-units/systems/angular/angular.h rename to src/systems/include/mp-units/systems/angular/units.h diff --git a/src/systems/cgs/include/mp-units/systems/cgs/cgs.h b/src/systems/include/mp-units/systems/cgs/cgs.h similarity index 100% rename from src/systems/cgs/include/mp-units/systems/cgs/cgs.h rename to src/systems/include/mp-units/systems/cgs/cgs.h diff --git a/src/systems/hep/include/mp-units/systems/hep/hep.h b/src/systems/include/mp-units/systems/hep/hep.h similarity index 100% rename from src/systems/hep/include/mp-units/systems/hep/hep.h rename to src/systems/include/mp-units/systems/hep/hep.h diff --git a/src/systems/iau/include/mp-units/systems/iau/iau.h b/src/systems/include/mp-units/systems/iau/iau.h similarity index 100% rename from src/systems/iau/include/mp-units/systems/iau/iau.h rename to src/systems/include/mp-units/systems/iau/iau.h diff --git a/src/systems/iec80000/include/mp-units/systems/iec80000/binary_prefixes.h b/src/systems/include/mp-units/systems/iec80000/binary_prefixes.h similarity index 100% rename from src/systems/iec80000/include/mp-units/systems/iec80000/binary_prefixes.h rename to src/systems/include/mp-units/systems/iec80000/binary_prefixes.h diff --git a/src/systems/iec80000/include/mp-units/systems/iec80000/iec80000.h b/src/systems/include/mp-units/systems/iec80000/iec80000.h similarity index 100% rename from src/systems/iec80000/include/mp-units/systems/iec80000/iec80000.h rename to src/systems/include/mp-units/systems/iec80000/iec80000.h diff --git a/src/systems/iec80000/include/mp-units/systems/iec80000/quantities.h b/src/systems/include/mp-units/systems/iec80000/quantities.h similarity index 100% rename from src/systems/iec80000/include/mp-units/systems/iec80000/quantities.h rename to src/systems/include/mp-units/systems/iec80000/quantities.h diff --git a/src/systems/iec80000/include/mp-units/systems/iec80000/unit_symbols.h b/src/systems/include/mp-units/systems/iec80000/unit_symbols.h similarity index 100% rename from src/systems/iec80000/include/mp-units/systems/iec80000/unit_symbols.h rename to src/systems/include/mp-units/systems/iec80000/unit_symbols.h diff --git a/src/systems/iec80000/include/mp-units/systems/iec80000/units.h b/src/systems/include/mp-units/systems/iec80000/units.h similarity index 100% rename from src/systems/iec80000/include/mp-units/systems/iec80000/units.h rename to src/systems/include/mp-units/systems/iec80000/units.h diff --git a/src/systems/imperial/include/mp-units/systems/imperial/imperial.h b/src/systems/include/mp-units/systems/imperial/imperial.h similarity index 100% rename from src/systems/imperial/include/mp-units/systems/imperial/imperial.h rename to src/systems/include/mp-units/systems/imperial/imperial.h diff --git a/src/systems/international/include/mp-units/systems/international/international.h b/src/systems/include/mp-units/systems/international/international.h similarity index 100% rename from src/systems/international/include/mp-units/systems/international/international.h rename to src/systems/include/mp-units/systems/international/international.h diff --git a/src/systems/isq/include/mp-units/systems/isq/atomic_and_nuclear_physics.h b/src/systems/include/mp-units/systems/isq/atomic_and_nuclear_physics.h similarity index 100% rename from src/systems/isq/include/mp-units/systems/isq/atomic_and_nuclear_physics.h rename to src/systems/include/mp-units/systems/isq/atomic_and_nuclear_physics.h diff --git a/src/systems/isq/include/mp-units/systems/isq/base_quantities.h b/src/systems/include/mp-units/systems/isq/base_quantities.h similarity index 100% rename from src/systems/isq/include/mp-units/systems/isq/base_quantities.h rename to src/systems/include/mp-units/systems/isq/base_quantities.h diff --git a/src/systems/isq/include/mp-units/systems/isq/electromagnetism.h b/src/systems/include/mp-units/systems/isq/electromagnetism.h similarity index 100% rename from src/systems/isq/include/mp-units/systems/isq/electromagnetism.h rename to src/systems/include/mp-units/systems/isq/electromagnetism.h diff --git a/src/systems/isq/include/mp-units/systems/isq/isq.h b/src/systems/include/mp-units/systems/isq/isq.h similarity index 100% rename from src/systems/isq/include/mp-units/systems/isq/isq.h rename to src/systems/include/mp-units/systems/isq/isq.h diff --git a/src/systems/isq/include/mp-units/systems/isq/mechanics.h b/src/systems/include/mp-units/systems/isq/mechanics.h similarity index 100% rename from src/systems/isq/include/mp-units/systems/isq/mechanics.h rename to src/systems/include/mp-units/systems/isq/mechanics.h diff --git a/src/systems/isq/include/mp-units/systems/isq/space_and_time.h b/src/systems/include/mp-units/systems/isq/space_and_time.h similarity index 100% rename from src/systems/isq/include/mp-units/systems/isq/space_and_time.h rename to src/systems/include/mp-units/systems/isq/space_and_time.h diff --git a/src/systems/isq/include/mp-units/systems/isq/thermodynamics.h b/src/systems/include/mp-units/systems/isq/thermodynamics.h similarity index 100% rename from src/systems/isq/include/mp-units/systems/isq/thermodynamics.h rename to src/systems/include/mp-units/systems/isq/thermodynamics.h diff --git a/src/systems/isq_angle/include/mp-units/systems/isq_angle/isq_angle.h b/src/systems/include/mp-units/systems/isq_angle/isq_angle.h similarity index 100% rename from src/systems/isq_angle/include/mp-units/systems/isq_angle/isq_angle.h rename to src/systems/include/mp-units/systems/isq_angle/isq_angle.h diff --git a/src/systems/natural/include/mp-units/systems/natural/natural.h b/src/systems/include/mp-units/systems/natural/natural.h similarity index 100% rename from src/systems/natural/include/mp-units/systems/natural/natural.h rename to src/systems/include/mp-units/systems/natural/natural.h diff --git a/src/utility/include/mp-units/chrono.h b/src/systems/include/mp-units/systems/si/chrono.h similarity index 100% rename from src/utility/include/mp-units/chrono.h rename to src/systems/include/mp-units/systems/si/chrono.h diff --git a/src/systems/si/include/mp-units/systems/si/constants.h b/src/systems/include/mp-units/systems/si/constants.h similarity index 100% rename from src/systems/si/include/mp-units/systems/si/constants.h rename to src/systems/include/mp-units/systems/si/constants.h diff --git a/src/utility/include/mp-units/bits/math_si.h b/src/systems/include/mp-units/systems/si/math.h similarity index 100% rename from src/utility/include/mp-units/bits/math_si.h rename to src/systems/include/mp-units/systems/si/math.h diff --git a/src/systems/si/include/mp-units/systems/si/prefixes.h b/src/systems/include/mp-units/systems/si/prefixes.h similarity index 100% rename from src/systems/si/include/mp-units/systems/si/prefixes.h rename to src/systems/include/mp-units/systems/si/prefixes.h diff --git a/src/systems/si/include/mp-units/systems/si/si.h b/src/systems/include/mp-units/systems/si/si.h similarity index 94% rename from src/systems/si/include/mp-units/systems/si/si.h rename to src/systems/include/mp-units/systems/si/si.h index 9efad6f3..b2668de5 100644 --- a/src/systems/si/include/mp-units/systems/si/si.h +++ b/src/systems/include/mp-units/systems/si/si.h @@ -22,7 +22,9 @@ #pragma once +#include #include +#include #include #include #include diff --git a/src/systems/si/include/mp-units/systems/si/unit_symbols.h b/src/systems/include/mp-units/systems/si/unit_symbols.h similarity index 100% rename from src/systems/si/include/mp-units/systems/si/unit_symbols.h rename to src/systems/include/mp-units/systems/si/unit_symbols.h diff --git a/src/systems/si/include/mp-units/systems/si/units.h b/src/systems/include/mp-units/systems/si/units.h similarity index 100% rename from src/systems/si/include/mp-units/systems/si/units.h rename to src/systems/include/mp-units/systems/si/units.h diff --git a/src/systems/typographic/include/mp-units/systems/typographic/typographic.h b/src/systems/include/mp-units/systems/typographic/typographic.h similarity index 100% rename from src/systems/typographic/include/mp-units/systems/typographic/typographic.h rename to src/systems/include/mp-units/systems/typographic/typographic.h diff --git a/src/systems/usc/include/mp-units/systems/usc/usc.h b/src/systems/include/mp-units/systems/usc/usc.h similarity index 100% rename from src/systems/usc/include/mp-units/systems/usc/usc.h rename to src/systems/include/mp-units/systems/usc/usc.h diff --git a/src/systems/international/CMakeLists.txt b/src/systems/international/CMakeLists.txt deleted file mode 100644 index 36844f97..00000000 --- a/src/systems/international/CMakeLists.txt +++ /dev/null @@ -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) diff --git a/src/systems/isq/CMakeLists.txt b/src/systems/isq/CMakeLists.txt deleted file mode 100644 index c0276bf1..00000000 --- a/src/systems/isq/CMakeLists.txt +++ /dev/null @@ -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 -) diff --git a/src/systems/isq_angle/CMakeLists.txt b/src/systems/isq_angle/CMakeLists.txt deleted file mode 100644 index be5b3b9f..00000000 --- a/src/systems/isq_angle/CMakeLists.txt +++ /dev/null @@ -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 -) diff --git a/src/mp-units-systems.cpp b/src/systems/mp-units-systems.cpp similarity index 80% rename from src/mp-units-systems.cpp rename to src/systems/mp-units-systems.cpp index eaa63218..f9494203 100644 --- a/src/mp-units-systems.cpp +++ b/src/systems/mp-units-systems.cpp @@ -1,7 +1,7 @@ module; -#include -#include +#include +#include export module mp_units.systems; @@ -9,7 +9,6 @@ export import mp_units.core; export { -// systems #include #include #include @@ -23,8 +22,4 @@ export #include #include #include - -// utility -#include -#include } diff --git a/src/systems/natural/CMakeLists.txt b/src/systems/natural/CMakeLists.txt deleted file mode 100644 index 1489b2e8..00000000 --- a/src/systems/natural/CMakeLists.txt +++ /dev/null @@ -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) diff --git a/src/systems/si/CMakeLists.txt b/src/systems/si/CMakeLists.txt deleted file mode 100644 index 7f9de7a8..00000000 --- a/src/systems/si/CMakeLists.txt +++ /dev/null @@ -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 -) diff --git a/src/systems/typographic/CMakeLists.txt b/src/systems/typographic/CMakeLists.txt deleted file mode 100644 index f9bd1a7c..00000000 --- a/src/systems/typographic/CMakeLists.txt +++ /dev/null @@ -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) diff --git a/src/systems/usc/CMakeLists.txt b/src/systems/usc/CMakeLists.txt deleted file mode 100644 index d5041e29..00000000 --- a/src/systems/usc/CMakeLists.txt +++ /dev/null @@ -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) diff --git a/src/utility/CMakeLists.txt b/src/utility/CMakeLists.txt deleted file mode 100644 index a9642ef0..00000000 --- a/src/utility/CMakeLists.txt +++ /dev/null @@ -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 -) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0b8c706a..8430bfa4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -22,7 +22,5 @@ cmake_minimum_required(VERSION 3.5) -add_subdirectory(unit_test/runtime) -add_subdirectory(unit_test/static) - -# add_subdirectory(metabench) +add_subdirectory(runtime) +add_subdirectory(static) diff --git a/test/unit_test/runtime/CMakeLists.txt b/test/runtime/CMakeLists.txt similarity index 87% rename from test/unit_test/runtime/CMakeLists.txt rename to test/runtime/CMakeLists.txt index 21686ab5..29fa0036 100644 --- a/test/unit_test/runtime/CMakeLists.txt +++ b/test/runtime/CMakeLists.txt @@ -25,12 +25,10 @@ cmake_minimum_required(VERSION 3.5) find_package(Catch2 3 CONFIG REQUIRED) add_executable(unit_tests_runtime distribution_test.cpp fmt_test.cpp math_test.cpp) -if(TARGET mp-units::modules) - target_link_libraries(unit_tests_runtime PRIVATE mp-units::modules) -else() - target_link_libraries(unit_tests_runtime PRIVATE mp-units::mp-units) +if(${projectPrefix}BUILD_CXX_MODULES) + target_compile_definitions(unit_tests_runtime PUBLIC ${projectPrefix}MODULES) 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) find_package(wg21_linear_algebra CONFIG REQUIRED) diff --git a/test/unit_test/runtime/almost_equals.h b/test/runtime/almost_equals.h similarity index 98% rename from test/unit_test/runtime/almost_equals.h rename to test/runtime/almost_equals.h index 8a871fe9..5913c990 100644 --- a/test/unit_test/runtime/almost_equals.h +++ b/test/runtime/almost_equals.h @@ -21,7 +21,7 @@ // SOFTWARE. #include -#include +#include #include #ifdef MP_UNITS_MODULES import mp_units; diff --git a/test/unit_test/runtime/distribution_test.cpp b/test/runtime/distribution_test.cpp similarity index 100% rename from test/unit_test/runtime/distribution_test.cpp rename to test/runtime/distribution_test.cpp diff --git a/test/unit_test/runtime/fmt_test.cpp b/test/runtime/fmt_test.cpp similarity index 99% rename from test/unit_test/runtime/fmt_test.cpp rename to test/runtime/fmt_test.cpp index 482838b4..ef914a1f 100644 --- a/test/unit_test/runtime/fmt_test.cpp +++ b/test/runtime/fmt_test.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include diff --git a/test/unit_test/runtime/linear_algebra_test.cpp b/test/runtime/linear_algebra_test.cpp similarity index 99% rename from test/unit_test/runtime/linear_algebra_test.cpp rename to test/runtime/linear_algebra_test.cpp index 4e227728..cbdb9c6c 100644 --- a/test/unit_test/runtime/linear_algebra_test.cpp +++ b/test/runtime/linear_algebra_test.cpp @@ -21,7 +21,7 @@ // SOFTWARE. #include -#include +#include #include #include #ifdef MP_UNITS_MODULES diff --git a/test/unit_test/runtime/math_test.cpp b/test/runtime/math_test.cpp similarity index 99% rename from test/unit_test/runtime/math_test.cpp rename to test/runtime/math_test.cpp index c6dcc589..c4e6b759 100644 --- a/test/unit_test/runtime/math_test.cpp +++ b/test/runtime/math_test.cpp @@ -30,8 +30,7 @@ import mp_units; #include #include #include -#include -#include +#include #endif using namespace mp_units; diff --git a/test/unit_test/static/CMakeLists.txt b/test/static/CMakeLists.txt similarity index 84% rename from test/unit_test/static/CMakeLists.txt rename to test/static/CMakeLists.txt index 37cb00c7..2f660568 100644 --- a/test/unit_test/static/CMakeLists.txt +++ b/test/static/CMakeLists.txt @@ -23,11 +23,10 @@ cmake_minimum_required(VERSION 3.5) add_library(unit_tests_static_truncating quantity_test.cpp) -if(TARGET mp-units::modules) - target_link_libraries(unit_tests_static_truncating PRIVATE mp-units::modules) -else() - target_link_libraries(unit_tests_static_truncating PRIVATE mp-units::mp-units) +if(${projectPrefix}BUILD_CXX_MODULES) + target_compile_definitions(unit_tests_static_truncating PUBLIC ${projectPrefix}MODULES) endif() +target_link_libraries(unit_tests_static_truncating PRIVATE mp-units::mp-units) target_compile_options( unit_tests_static_truncating PRIVATE $,/wd4242 /wd4244,-Wno-conversion> ) @@ -68,9 +67,8 @@ add_library( usc_test.cpp ) -if(TARGET mp-units::modules) - target_link_libraries(unit_tests_static PRIVATE mp-units::modules) -else() - target_link_libraries(unit_tests_static PRIVATE mp-units::mp-units) +target_link_libraries(unit_tests_static PRIVATE mp-units::mp-units) +if(${projectPrefix}BUILD_CXX_MODULES) + target_compile_definitions(unit_tests_static PUBLIC ${projectPrefix}MODULES) endif() target_link_libraries(unit_tests_static PRIVATE unit_tests_static_truncating) diff --git a/test/unit_test/static/angular_test.cpp b/test/static/angular_test.cpp similarity index 100% rename from test/unit_test/static/angular_test.cpp rename to test/static/angular_test.cpp diff --git a/test/unit_test/static/cgs_test.cpp b/test/static/cgs_test.cpp similarity index 100% rename from test/unit_test/static/cgs_test.cpp rename to test/static/cgs_test.cpp diff --git a/test/unit_test/static/chrono_test.cpp b/test/static/chrono_test.cpp similarity index 99% rename from test/unit_test/static/chrono_test.cpp rename to test/static/chrono_test.cpp index df5fa356..dc807697 100644 --- a/test/unit_test/static/chrono_test.cpp +++ b/test/static/chrono_test.cpp @@ -27,9 +27,8 @@ import mp_units; #else #include -#include #include -#include +#include #endif namespace { diff --git a/test/unit_test/static/compare_test.cpp b/test/static/compare_test.cpp similarity index 100% rename from test/unit_test/static/compare_test.cpp rename to test/static/compare_test.cpp diff --git a/test/unit_test/static/concepts_test.cpp b/test/static/concepts_test.cpp similarity index 99% rename from test/unit_test/static/concepts_test.cpp rename to test/static/concepts_test.cpp index 2c050f8b..3bfd265d 100644 --- a/test/unit_test/static/concepts_test.cpp +++ b/test/static/concepts_test.cpp @@ -27,7 +27,6 @@ #ifdef MP_UNITS_MODULES import mp_units; #else -#include #include #include #include diff --git a/test/unit_test/static/custom_rep_test_min_expl.cpp b/test/static/custom_rep_test_min_expl.cpp similarity index 100% rename from test/unit_test/static/custom_rep_test_min_expl.cpp rename to test/static/custom_rep_test_min_expl.cpp diff --git a/test/unit_test/static/custom_rep_test_min_impl.cpp b/test/static/custom_rep_test_min_impl.cpp similarity index 100% rename from test/unit_test/static/custom_rep_test_min_impl.cpp rename to test/static/custom_rep_test_min_impl.cpp diff --git a/test/unit_test/static/dimension_test.cpp b/test/static/dimension_test.cpp similarity index 100% rename from test/unit_test/static/dimension_test.cpp rename to test/static/dimension_test.cpp diff --git a/test/unit_test/static/fixed_string_test.cpp b/test/static/fixed_string_test.cpp similarity index 100% rename from test/unit_test/static/fixed_string_test.cpp rename to test/static/fixed_string_test.cpp diff --git a/test/unit_test/static/fractional_exponent_quantity.cpp b/test/static/fractional_exponent_quantity.cpp similarity index 98% rename from test/unit_test/static/fractional_exponent_quantity.cpp rename to test/static/fractional_exponent_quantity.cpp index 6014b34e..3e3c79ca 100644 --- a/test/unit_test/static/fractional_exponent_quantity.cpp +++ b/test/static/fractional_exponent_quantity.cpp @@ -20,7 +20,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#include +#include #ifdef MP_UNITS_MODULES import mp_units; #else diff --git a/test/unit_test/static/hep_test.cpp b/test/static/hep_test.cpp similarity index 100% rename from test/unit_test/static/hep_test.cpp rename to test/static/hep_test.cpp diff --git a/test/unit_test/static/iau_test.cpp b/test/static/iau_test.cpp similarity index 100% rename from test/unit_test/static/iau_test.cpp rename to test/static/iau_test.cpp diff --git a/test/unit_test/static/iec80000_test.cpp b/test/static/iec80000_test.cpp similarity index 100% rename from test/unit_test/static/iec80000_test.cpp rename to test/static/iec80000_test.cpp diff --git a/test/unit_test/static/imperial_test.cpp b/test/static/imperial_test.cpp similarity index 100% rename from test/unit_test/static/imperial_test.cpp rename to test/static/imperial_test.cpp diff --git a/test/unit_test/static/international_test.cpp b/test/static/international_test.cpp similarity index 100% rename from test/unit_test/static/international_test.cpp rename to test/static/international_test.cpp diff --git a/test/unit_test/static/isq_angle_test.cpp b/test/static/isq_angle_test.cpp similarity index 100% rename from test/unit_test/static/isq_angle_test.cpp rename to test/static/isq_angle_test.cpp diff --git a/test/unit_test/static/isq_test.cpp b/test/static/isq_test.cpp similarity index 100% rename from test/unit_test/static/isq_test.cpp rename to test/static/isq_test.cpp diff --git a/test/unit_test/static/magnitude_test.cpp b/test/static/magnitude_test.cpp similarity index 100% rename from test/unit_test/static/magnitude_test.cpp rename to test/static/magnitude_test.cpp diff --git a/test/unit_test/static/math_test.cpp b/test/static/math_test.cpp similarity index 100% rename from test/unit_test/static/math_test.cpp rename to test/static/math_test.cpp diff --git a/test/unit_test/static/natural_test.cpp b/test/static/natural_test.cpp similarity index 100% rename from test/unit_test/static/natural_test.cpp rename to test/static/natural_test.cpp diff --git a/test/unit_test/static/prime_test.cpp b/test/static/prime_test.cpp similarity index 100% rename from test/unit_test/static/prime_test.cpp rename to test/static/prime_test.cpp diff --git a/test/unit_test/static/quantity_point_test.cpp b/test/static/quantity_point_test.cpp similarity index 99% rename from test/unit_test/static/quantity_point_test.cpp rename to test/static/quantity_point_test.cpp index b44da9f0..3ffe3615 100644 --- a/test/unit_test/static/quantity_point_test.cpp +++ b/test/static/quantity_point_test.cpp @@ -28,7 +28,6 @@ #include import mp_units; #else -#include #include #include #include diff --git a/test/unit_test/static/quantity_spec_test.cpp b/test/static/quantity_spec_test.cpp similarity index 100% rename from test/unit_test/static/quantity_spec_test.cpp rename to test/static/quantity_spec_test.cpp diff --git a/test/unit_test/static/quantity_test.cpp b/test/static/quantity_test.cpp similarity index 99% rename from test/unit_test/static/quantity_test.cpp rename to test/static/quantity_test.cpp index ed038077..891cf21d 100644 --- a/test/unit_test/static/quantity_test.cpp +++ b/test/static/quantity_test.cpp @@ -29,7 +29,6 @@ #include import mp_units; #else -#include #include #include #include diff --git a/test/unit_test/static/ratio_test.cpp b/test/static/ratio_test.cpp similarity index 100% rename from test/unit_test/static/ratio_test.cpp rename to test/static/ratio_test.cpp diff --git a/test/unit_test/static/reference_test.cpp b/test/static/reference_test.cpp similarity index 100% rename from test/unit_test/static/reference_test.cpp rename to test/static/reference_test.cpp diff --git a/test/unit_test/static/si_test.cpp b/test/static/si_test.cpp similarity index 100% rename from test/unit_test/static/si_test.cpp rename to test/static/si_test.cpp diff --git a/test/unit_test/static/symbol_text_test.cpp b/test/static/symbol_text_test.cpp similarity index 100% rename from test/unit_test/static/symbol_text_test.cpp rename to test/static/symbol_text_test.cpp diff --git a/test/unit_test/static/test_tools.h b/test/static/test_tools.h similarity index 97% rename from test/unit_test/static/test_tools.h rename to test/static/test_tools.h index bf6f77a5..27587442 100644 --- a/test/unit_test/static/test_tools.h +++ b/test/static/test_tools.h @@ -24,7 +24,7 @@ #include #ifdef MP_UNITS_MODULES -#include +#include import mp_units; #else #include diff --git a/test/unit_test/static/type_list_test.cpp b/test/static/type_list_test.cpp similarity index 100% rename from test/unit_test/static/type_list_test.cpp rename to test/static/type_list_test.cpp diff --git a/test/unit_test/static/typographic_test.cpp b/test/static/typographic_test.cpp similarity index 100% rename from test/unit_test/static/typographic_test.cpp rename to test/static/typographic_test.cpp diff --git a/test/unit_test/static/unit_symbol_test.cpp b/test/static/unit_symbol_test.cpp similarity index 100% rename from test/unit_test/static/unit_symbol_test.cpp rename to test/static/unit_symbol_test.cpp diff --git a/test/unit_test/static/unit_test.cpp b/test/static/unit_test.cpp similarity index 100% rename from test/unit_test/static/unit_test.cpp rename to test/static/unit_test.cpp diff --git a/test/unit_test/static/usc_test.cpp b/test/static/usc_test.cpp similarity index 100% rename from test/unit_test/static/usc_test.cpp rename to test/static/usc_test.cpp