Skip to content

Commit 22ae08d

Browse files
committed
Merge remote-tracking branch 'upstream/master' into feature/faster-CI
2 parents 3a50086 + 0144588 commit 22ae08d

File tree

118 files changed

+11264
-3217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+11264
-3217
lines changed

.github/generate-job-matrix.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def for_github(self):
8888
return ret
8989

9090

91-
def make_gcc_config(version: int) -> Platform:
91+
def make_gcc_platform(version: int) -> Platform:
9292
return Platform(
9393
name=f"GCC-{version}",
9494
os="ubuntu-24.04",
@@ -105,7 +105,7 @@ def make_gcc_config(version: int) -> Platform:
105105
)
106106

107107

108-
def make_clang_config(
108+
def make_clang_platform(
109109
version: int, architecture: typing.Literal["x86-64", "arm64"] = "x86-64"
110110
) -> Platform:
111111
cfg = SimpleNamespace(
@@ -139,22 +139,24 @@ def make_clang_config(
139139
return Platform(**vars(ret))
140140

141141

142-
def make_apple_clang_config(version: int) -> Platform:
142+
def make_apple_clang_platform(
143+
os: str, version: str, std_format_support: bool
144+
) -> Platform:
143145
ret = Platform(
144146
name=f"Apple Clang {version}",
145-
os="macos-13",
147+
os=os,
146148
compiler=Compiler(
147149
type="APPLE_CLANG",
148-
version=f"{version}.0",
150+
version=version,
149151
cc="clang",
150152
cxx="clang++",
151153
),
152-
feature_support=Features(),
154+
feature_support=Features(std_format=std_format_support),
153155
)
154156
return ret
155157

156158

157-
def make_msvc_config(release: str, version: int) -> Platform:
159+
def make_msvc_platform(release: str, version: int) -> Platform:
158160
ret = Platform(
159161
name=f"MSVC {release}",
160162
os="windows-2022",
@@ -173,16 +175,24 @@ def make_msvc_config(release: str, version: int) -> Platform:
173175

174176
platforms = {
175177
p.name: p
176-
for p in [make_gcc_config(ver) for ver in [12, 13, 14]]
178+
for p in [make_gcc_platform(ver) for ver in [12, 13, 14]]
177179
+ [
178-
make_clang_config(ver, arch)
180+
make_clang_platform(ver, arch)
179181
for ver in [16, 17, 18]
180182
for arch in ["x86-64", "arm64"]
181183
# arm64 runners are expensive; only consider one version
182184
if ver == 18 or arch != "arm64"
183185
]
184-
+ [make_apple_clang_config(ver) for ver in [15]]
185-
+ [make_msvc_config(release="14.4", version=194)]
186+
+ [
187+
make_apple_clang_platform("macos-13", ver, std_format_support=False)
188+
for ver in ["15.2"]
189+
]
190+
# std::format is available in Xcode 16.1 or later
191+
+ [
192+
make_apple_clang_platform("macos-14", ver, std_format_support=True)
193+
for ver in ["16.1"]
194+
]
195+
+ [make_msvc_platform(release="14.4", version=194)]
186196
}
187197

188198
full_matrix = dict(

.github/workflows/ci-test-package-cmake.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,13 @@ jobs:
205205
run: |
206206
cmake --preset conan-default -Dmp-units_DIR=../build -Bbuild/local
207207
cmake --build build/local --config ${{ matrix.build_type }}
208+
- name: Run test_package-headers (local build)
209+
shell: bash
210+
working-directory: test_package/build/local/${{ matrix.build_type }}
211+
run: |
212+
./test_package-headers
208213
- name: Run test_package (local build)
214+
if: matrix.config.cxx_modules == 'True'
209215
shell: bash
210216
working-directory: test_package/build/local/${{ matrix.build_type }}
211217
run: |
@@ -225,7 +231,13 @@ jobs:
225231
run: |
226232
cmake --preset conan-default -DCMAKE_INSTALL_PREFIX=../out -Bbuild/install
227233
cmake --build build/install --config ${{ matrix.build_type }}
234+
- name: Run test_package-headers (installation)
235+
shell: bash
236+
working-directory: test_package/build/install/${{ matrix.build_type }}
237+
run: |
238+
./test_package-headers
228239
- name: Run test_package (installation)
240+
if: matrix.config.cxx_modules == 'True'
229241
shell: bash
230242
working-directory: test_package/build/install/${{ matrix.build_type }}
231243
run: |

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ CMakeUserPresets.json
5050
# cxxdraft-htmlgen
5151
docs/api_reference/src/source/
5252
docs/api_reference/gen
53+
54+
# macOS files
55+
.DS_Store

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
default_stages: [commit]
1+
default_stages: [pre-commit]
22

33
repos:
44
- repo: meta
55
hooks:
66
- id: check-hooks-apply
77
- id: check-useless-excludes
88
- repo: https://github.com/pre-commit/pre-commit-hooks
9-
rev: v4.3.0
9+
rev: v5.0.0
1010
hooks:
1111
- id: trailing-whitespace
1212
- id: end-of-file-fixer
1313
- repo: https://github.com/pre-commit/mirrors-clang-format
14-
rev: v19.1.2
14+
rev: v19.1.5
1515
hooks:
1616
- id: clang-format
1717
- repo: https://github.com/cheshirekow/cmake-format-precommit
@@ -23,17 +23,17 @@ repos:
2323
# additional_dependencies: ["cmakelang"]
2424
# exclude: "cmake/.*"
2525
- repo: https://github.com/psf/black
26-
rev: 22.10.0
26+
rev: 24.10.0
2727
hooks:
2828
- id: black
2929
language_version: python3
3030
- repo: https://github.com/PyCQA/isort
31-
rev: 5.12.0
31+
rev: 5.13.2
3232
hooks:
3333
- id: isort
3434
args: [--profile, black, --multi-line, "3"]
3535
- repo: https://github.com/PyCQA/flake8
36-
rev: 7.1.0
36+
rev: 7.1.1
3737
hooks:
3838
- id: flake8
3939

CHANGELOG.md

Lines changed: 111 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,115 @@
44

55
### 2.5.0 <small>WIP</small> { id="2.5.0" }
66

7+
- (!) feat: representation concepts improved
8+
- (!) feat: `representation_of` concept now also accepts a `quantity_spec` and accepts any representation character for quantity kinds
9+
- (!) feat: `quantity::one()` removed
10+
- (!) feat: `Representation` concept removed
11+
- feat: `SymbolicArg` applied to expression templates
12+
- feat: `per` and `power` made `final`
13+
- feat: `derived_XXX` are now constrained with `SymbolicConstant`
14+
- feat: prime factorization extended to any magnitude (thanks [@chiphogg](https://github.com/chiphogg))
15+
- feat: `cartesian_vector` added
16+
- feat: `equivalent` now accept any units (even non-convertible)
17+
- feat: text output should fallback to the portable mode when UTF-8 is not used for `text_encoding`
18+
- feat: precondition added to `to_u8string`
19+
- feat: text output of scaled units is now enclosed in parenthesis `(...)` instead of brackets `[...]`
20+
- feat: `abs(quantity)` exposed for conforming freestanding implementations
21+
- feat: proper constraints for `kind_of`
22+
- feat: missing precondition added for `quantity::op/`
23+
- feat: `quantity_spec` conversions improved
24+
- feat: `rankine` unit added
25+
- feat: `std::numeric_limits` support added
26+
- feat: `overflows_non_zero_values` added to detect conversions overflowing `rep`
27+
- feat: deprecation messages now provide the release version where the deprecation happened
28+
- feat: electromagnetism.h updated to IEC80000-6-2022
29+
- feat: `ConvertibleWithNumber` introduced to improve convertibility of unit `one` with raw numbers
30+
- feat(example): `is_vector` specialization no longer needed for `si_constants`
31+
- (!) refactor: `type_list` moved to implementation details
32+
- (!) refactor: from now `unit_symbol` and `dimension_symbol` always returns `std::string_view`
33+
- (!) refactor: `text_encoding` renamed to `character_set`
34+
- (!) refactor: `Magnitude` renamed to `UnitMagnitude` and `magnitude` to `unit_magnitude`
35+
- (!) refactor: `unit_magnitude` moved to `detail` namespace
36+
- (!) refactor: `absolute` renamed to `point`
37+
- (!) refactor: `power` members refactored to be explicitly exposition only
38+
- (!) refactor: `is_XXX` customization points for representation types removed
39+
- (!) refactor: `quantity_values` renamed to representation values
40+
- (!) refactor: `scalar` and `complex` characters renamed to `real_scalar` and `complex_scalar` respectively + concepts refactoring
41+
- (!) refactor: `MagConstant` concept renamed to `detail::is_mag_constant` variable trait
42+
- refactor: mp_units.core defined in terms of `core.h`
43+
- refactor: `MP_UNITS_NONCONST_TYPE` introduced to benefit from the C++23 feature
44+
- refactor: `SymbolicConstant` concept refactored
45+
- refactor: explicit type of `op/` for `quantity` and `reference` replaced with constrained placeholder
46+
- refactor: private `unit_magnitude` interface renamed to not use leading `_`
47+
- refactor: `one_of` concept removed and replaced with `QSProperty` in `quantity_spec`
48+
- refactor: `std::is_trivial` will be deprecated in C++26
49+
- refactor: `SameQuantitySpec` concept removed and replaced with direct comparison
50+
- refactor: unused `SameReference` concept removed
51+
- refactor: `type_name_less` introduced and used as a default predicate for expression templates
52+
- refactor: "expression templates" renamed to "symbolic expressions"
53+
- refactor: `all_are_kinds` removed and `get_associated_quantity` simplified
54+
- refactor: `reference` now returns explicit types for `inverse`, `pow`, `sqrt`, and `cbrt`
55+
- refactor: repeated concept checks removed from `get_common_reference`
56+
- refactor: `std::assignable_from` used in `ValuePreservingTo` concept
57+
- refactor: `quantity` constructor refactored to use another constructor with the result of `sudo_cast`
58+
- refactor: preconditions for quantity operations now use `is_neq_zero`
59+
- refactor: implicit expression variations used in `quantity` and `quantity_point` constraints
60+
- refactor: `inverse()` constraints improved
61+
- refactor: `make_quantity_point` introduced
62+
- refactor: `point_origin_interface::op+` return type unified with the rest of the interfaces
63+
- refactor: `std::convertible_to` replaced with `std::same_as` in `basic_fixed_string`
64+
- refactor: `less`, `ceil`, and `round` refactored and improved + more unit tests for `round`
65+
- refactor: `math_concepts.h` removed and concepts replaced with explicit expression in constraints
66+
- (!) fix: `electric_current_phasor`, `voltage_phasor`, `apparent_power` switched to complex character
67+
- (!) fix: `position_vector` and `displacement` moved to a different place in a tree
68+
- (!) fix: `velocity` is now defined in terms of `displacement` instead of `position_vector`
69+
- fix: missing `core.h` added to CMake
70+
- fix: `const` was leaking to some `SymbolicConstant`s
71+
- fix: `make_reference` should skip only the exact kinds deduced from a unit
72+
- fix: inconsistencies in `get_common_quantity_spec()` fixed
73+
- fix: unused `convertible_kinds()` argument removed
74+
- fix: compile-time branch condition fixed in `quantity_point::point_for`
75+
- fix: `inverse(Quantity)` fixed for subkinds of `dimensionless`
76+
- fix: `point_origin_interface::op+` constraints fixed
77+
- fix: missing `get_common_unit()` overload added
78+
- fix: `floor` and `ceil` constraints fixed
79+
- fix: quantity characters fixed in electromagnetism quantities
80+
- test: lots of tests for complex quantities
81+
- test: runtime unit tests refactored to have a bigger granularity (less top level tests)
82+
- test: _surface tension_ replaced with _entropy_ in an fmt test
83+
- test: test_package now is tested also with C++20 modules
84+
- test: tests for dimensionless quantities static data members
85+
- test: a few more natural units tests added
86+
- test: tests to check if `quantity` satisfies `Scalar`
87+
- test: add static tests for concept `DimensionOf` (thanks [@jvocht](https://github.com/jvocht))
88+
- test: quantity character concepts tests for quantities added
89+
- docs: ISQ part 6 released
90+
- docs: new chapter about our documentation added to the contributing guide
91+
- docs: directory name updated in the contributing guide
92+
- docs: mp-units Conan options added to conanfile.txt examples
93+
- docs: `contracts` Conan option default value description improved
94+
- docs: outdated note removed from the "Text Output" chapter
95+
- docs: a paragraph about additional formatting options removed (applicable only to quantity symbols which we do not support)
96+
- docs: Wrocław 2024 meeting report
97+
- docs: explicit unit conversion example added to the "Symbols of common units" chapter
98+
- docs: "Bringing Quantity-Safety To The Next Level" blog post added
99+
- docs: quantity-safety mentioned in the docs
100+
- docs: `complex` character added to the "Quantity character" chapter
101+
- docs: intro to "Value Conversions" chapter added
102+
- docs: "Scaling overflow prevention" chapter added
103+
- docs: "Concepts" chapter updated
104+
- docs: old customization points removed from the "Character of a Quantity" chapter
105+
- docs(ref): document most of `mp_units.core` (thanks [@JohelEGP](https://github.com/JohelEGP))
106+
- build: `CheckCacheVarValues` CMake module file added
107+
- build: `MP_UNITS_DEV_TIME_TRACE` CMake option added
108+
- build: `MP_UNITS_API_NO_CRTP` removed from `test_package` CMake
109+
- build: require at least CMake 3.31 with Conan
110+
- build: fmt/11.1.1
111+
- ci: CI matrix generation added (thanks [@burnpanck](https://github.com/burnpanck))
112+
- ci: `import_std` now checks if at least C++23 is being used
113+
- perf: caching of the results of heavy `consteval` functions execution added
114+
- perf: `expr_projectable` concept removed to improve compilation performance
115+
7116
### 2.4.0 <small>November 5, 2024</small> { id="2.4.0" }
8117

9118
- (!) feat: `phase_velocity` and `group_velocity` aliases removed from ISQ by ISO
@@ -204,7 +313,7 @@
204313
- feat: `quantity_point` support added for `quantity_cast` and `value_cast`
205314
- feat: `value_cast<Unit, Representation>` added
206315
- feat: `value_cast<Quantity>(q)`, `value_cast<Quantity>(qp)` and `value_cast<QuantityPoint>(qp)` added by [@burnpanck](https://github.com/burnpanck)
207-
- feat: `interconvertible(QuantitySpec, QuantitySpec)` added
316+
- feat: `interconvertible(quantity_spec, quantity_spec)` added
208317
- feat: `qp.quantity_from_zero()` added
209318
- feat: `value_type` type trait added
210319
- feat: do not print space between a number and `percent` or `per_mille`
@@ -248,7 +357,7 @@
248357
- refactor: not needed `remove_reference_t` and `remove_cvref_t` removed
249358
- refactor: binary operators of `quantity` and `quantity_point` are now hidden friends
250359
- fix: `QuantityLike` conversions required `Q::rep` instead of using one provided by `quantity_like_traits`
251-
- fix: `QuantitySpec[Unit]` replaced with `make_reference` in `value_cast`
360+
- fix: `quantity_spec[Unit]` replaced with `make_reference` in `value_cast`
252361
- fix: `ice_point` is now defined with the integral offset from `absolute_zero`
253362
- fix: performance regression in `sudo_cast` fixed
254363
- fix: explicit object parameter support fixed

conanfile.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def _feature_compatibility(self):
9999
"compiler": {
100100
"gcc": "13",
101101
"clang": "17",
102-
"apple-clang": "",
102+
"apple-clang": "16",
103103
"msvc": "194",
104104
},
105105
},
@@ -213,10 +213,10 @@ def requirements(self):
213213
elif self.options.contracts == "ms-gsl":
214214
self.requires("ms-gsl/4.0.0", transitive_headers=True)
215215
if not self.options.std_format:
216-
self.requires("fmt/11.0.1", transitive_headers=True)
216+
self.requires("fmt/11.1.1", transitive_headers=True)
217217

218218
def build_requirements(self):
219-
self.tool_requires("cmake/[>=3.30 <4]")
219+
self.tool_requires("cmake/[>=3.31 <4]")
220220
if self._build_all:
221221
if not self.options.freestanding:
222222
self.test_requires("catch2/3.7.0")
@@ -252,9 +252,9 @@ def generate(self):
252252
tc.absolute_paths = True # only needed for CMake CI
253253
if self._build_all:
254254
tc.cache_variables["CMAKE_EXPORT_COMPILE_COMMANDS"] = True
255-
tc.cache_variables[
256-
"CMAKE_VERIFY_INTERFACE_HEADER_SETS"
257-
] = not opt.import_std
255+
tc.cache_variables["CMAKE_VERIFY_INTERFACE_HEADER_SETS"] = (
256+
not opt.import_std
257+
)
258258
tc.cache_variables["MP_UNITS_DEV_BUILD_LA"] = not self._skip_la
259259
if self._run_clang_tidy:
260260
tc.cache_variables["MP_UNITS_DEV_CLANG_TIDY"] = True
@@ -264,9 +264,9 @@ def generate(self):
264264
if opt.import_std:
265265
tc.cache_variables["CMAKE_CXX_MODULE_STD"] = True
266266
# Current experimental support according to `Help/dev/experimental.rst`
267-
tc.cache_variables[
268-
"CMAKE_EXPERIMENTAL_CXX_IMPORT_STD"
269-
] = "0e5b6991-d74f-4b3d-a41c-cf096e0b2508"
267+
tc.cache_variables["CMAKE_EXPERIMENTAL_CXX_IMPORT_STD"] = (
268+
"0e5b6991-d74f-4b3d-a41c-cf096e0b2508"
269+
)
270270

271271
# TODO remove the below when Conan will learn to handle C++ modules
272272
if opt.freestanding:

docs/api_reference/src/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ include(JEGPAddStandardeseSources)
55

66
set(pdf_title "mp-units Library")
77
set(page_license "MIT License")
8-
set(first_library_chapter "qties")
9-
set(last_library_chapter "qties")
8+
set(first_library_chapter "quantities")
9+
set(last_library_chapter "quantities")
1010
set(cover_title "mp-units Library Reference Documentations")
1111
set(reply_to "\\href{${PROJECT_HOMEPAGE_URL}/discussions}{Discussions}, \\href{${PROJECT_HOMEPAGE_URL}/issues}{issues}")
1212
jegp_add_standardese_sources(
@@ -21,6 +21,7 @@ jegp_add_standardese_sources(
2121
# Latex commands.
2222
[[\\href{([^}]+)}{([^}]+)};HREF(\1)(\2)]]
2323
# Macros extensions.
24+
[[\\txtrm;\\textrm]]
2425
[[\\refcpp{([^}]+)};REFCPP(\1)]]
2526
[[\\irefcpp{([^}]+)};~(REFCPP(\1))]]
2627
[[\\refcppx{([^}]+)}{([^}]+)};REFCPPX(\1)(\2)]]

docs/api_reference/src/intro.tex

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@
3838
Available from: \url{https://wg21.link/\IsoCpp{}}
3939
\item
4040
The \Cpp{} Standards Committee.
41+
P3094R5: \doccite{\tcode{std::basic_fixed_string}}.
42+
Edited by Mateusz Pusz.
43+
Available from: \url{https://wg21.link/P3094R5}
44+
\item
45+
The \Cpp{} Standards Committee.
4146
SD-8: \doccite{Standard Library Compatibility}.
4247
Edited by Bryce Lelbach.
4348
Available from: \url{https://wg21.link/SD8}
@@ -102,11 +107,11 @@
102107
{ll}
103108
\topline
104109
\hdstyle{Clause} & \hdstyle{Category} \\ \capsep
105-
\ref{qties} & Quantities library \\
110+
\ref{quantities} & Quantities library \\
106111
\end{floattable}
107112

108113
\pnum
109-
The quantities library\iref{qties}
114+
The quantities library\iref{quantities}
110115
describes components for dealing with quantities.
111116

112117
\rSec1[spec.mods]{Modules}

0 commit comments

Comments
 (0)