Commit Graph

24 Commits

Author SHA1 Message Date
Mateusz Pusz 1c54623024 feat: import std; enabled for g++ 2026-06-03 21:29:55 +02:00
Mateusz Pusz 8df25adeef docs: use cl-style 19.5+ for MSVC in compiler support table
The previous `195+` is the Conan-side encoding (matching
`_feature_compatibility` in conanfile.py) and is ambiguous in prose —
the digits collide with `_MSC_VER`/cl-version/toolset variants. The
cl-version `19.5+` is what users see from `cl /version`, and what's
already used in src/CMakeLists.txt when this project talks about MSVC
versions. Realign the MSVC column to accommodate the wider cell.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 16:47:45 +02:00
Mateusz Pusz 96965634f5 feat: support import std; on MSVC
mp-units' minimum-supported MSVC 195 (VS 2026) has solid `import std;`
support, but enabling `-o import_std=True` against the build hit two
issues that this change fixes.

(1) Module scanning was only enabled when `cxx_modules=True`.

Without `CMAKE_CXX_SCAN_FOR_MODULES=ON`, CMake doesn't link the implicit
std module BMI into non-module translation units that do `import std;`,
producing C2230 "could not find module 'std'". Enable scanning whenever
`import_std=True` as well. Same bug fixed in `test_package/conanfile.py`.

(2) The std module BMI is built with mismatched compile flags.

CMake materializes the implicit std module BMI as `__cmake_cxx_std_NN`,
a separate internal target that does not link mp-units and therefore
does not inherit mp-units' target-level options. On MSVC this caused
C5050 (`_UTF8` defined on consumer but not on module command line) and
on Clang 21 there is a parallel `-Wreserved-module-identifier` issue
already partially handled in `src/CMakeLists.txt` but in a directory
scope that did not actually reach the BMI either.

Consolidate the workarounds into one `src/cmake/import-std-setup.cmake`
snippet that applies the flags project-wide via `add_compile_options`,
self-guarded by `if(NOT CMAKE_CXX_MODULE_STD) return()`. It is included
from every entry point so all delivery paths converge:
  - top-level `CMakeLists.txt` for the dev build
  - bundled `mp-unitsConfig.cmake` for `find_package` consumers
  - via `cmake_build_modules` in `package_info()` for Conan-generated
    configs (the `cxx_modules=False` consumer path)

Other pieces:
  - `test/static/unit_magnitude_test.cpp` was the only test in the repo
    missing the `MP_UNITS_IMPORT_STD` gate around `#include <type_traits>`,
    causing duplicate `std::integral_constant` definitions in this
    configuration.
  - Compiler support table announces MSVC 195+ for `import std;`.
  - Installation docs gain a consumer-side setup note covering the
    CMake cache variables required, what mp-units handles automatically
    via the snippet, and the `add_subdirectory`-vendored caveat.

Verified: `conan build . -pr msvc195 -o '&:cxx_modules=False'
-o '&:import_std=True' -s compiler.cppstd=23 -c
user.mp-units.build:all=True` -> 40/40 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 23:45:51 +02:00
Mateusz Pusz 393c671608 docs: MSVC 195 works with mp-units now
Resolves #761
2026-05-24 21:46:41 +02:00
Mateusz Pusz 8a33381f0b docs: most of the How-to Guides improved 2026-01-28 21:28:19 +01:00
Mateusz Pusz 6703f3e835 docs: Hwo-to Guides directory structure refactored 2026-01-25 22:58:22 +01:00
Mateusz Pusz adda270c33 docs: a large refactoring of TOC
Some chapters moved to the top level and other moved to other places
2026-01-14 09:56:52 +01:00
Mateusz Pusz 57381cf991 docs: "Use Cases" renamed to "How-to Guides" 2026-01-13 17:00:49 +01:00
Roth Michaels 0b8f78e4c5 Disable building with AppleClang 17
AppleClang 17 has the same compiler bug as Clang 19:
https://github.com/llvm/llvm-project/issues/110231

Updated conan configuration to disable building with AppleClang 17.

Updated compiler support documentation to show incompatible Xcode.
2025-11-11 11:45:43 +00:00
Mateusz Pusz 1e45ab1cb9 Merge branch 'master' into crtp_fix 2025-11-05 03:43:50 +01:00
Mateusz Pusz ce334ac0f4 docs: markdownlint issues fixed 2025-10-14 18:25:58 +02:00
Alexandros Theodotou 16ce422cdf build: explicit_this enabled for AppleClang 17 and MSVC 19.32
Both compilers do not implement the feature test macro, but they do
implement `explicit_this`, as mentioned in their corresponding release
notes:
- https://developer.apple.com/documentation/xcode-release-notes/xcode-16_3-release-notes
- https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.2

Resolves #722.
2025-09-24 21:25:22 +09:00
Mateusz Pusz 50af5ea5a1 docs: minor improvements 2025-09-21 13:15:42 +02:00
Mateusz Pusz 39754018ba build: explicit_this enabled for MSVC 19.5 2025-09-17 19:40:59 -06:00
Mateusz Pusz 40abc664e8 docs: clang-19 issues mentioned in a compiler support table 2025-04-03 07:59:18 +01:00
Mateusz Pusz dc8843eeeb refactor: MSVC bug is fixed so workaround is removed 2025-02-15 10:39:36 +01:00
Roth Michaels 8293f023dd Update apple-clang compiler support info for std::format 2024-12-19 14:10:21 -05:00
Mateusz Pusz 7b64b4b650 refactor: 💥 from now unit_symbol and dimension_symbol always returns std::string_view 2024-11-16 09:57:53 +01:00
Mateusz Pusz e6c65d6c89 build: MP_UNITS_BUILD_IMPORT_STD CMake option removed 2024-09-20 09:34:38 -06:00
Mateusz Pusz 866550eefc docs: MSVC compilation announced and its bugs listed on the compiler's conformance page 2024-09-10 21:00:30 +02:00
Mateusz Pusz 698accac4f docs: import std; row added to the "C++ compiler support" table 2024-07-16 20:50:42 +02:00
Mateusz Pusz 4551a247b5 fix: broken links in the docs fixed 2024-05-30 12:10:19 +02:00
Mateusz Pusz 9c4a87e2e4 docs: gcc-14 does not support C++ modules correctly 2024-05-29 20:45:26 +02:00
Mateusz Pusz 8e0a26b933 feat: 💥 API-related Conan, CMake, and preprocessor options redesigned 2024-04-16 21:48:36 +01:00