This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory.git
The following commit(s) were added to refs/heads/main by this push:
new 6f3634580 docs(cpp): clarify MSVC preprocessor requirement (#3695)
6f3634580 is described below
commit 6f363458069d1b074325d8bf14588268979015ca
Author: Shawn Yang <[email protected]>
AuthorDate: Wed May 20 16:37:43 2026 +0800
docs(cpp): clarify MSVC preprocessor requirement (#3695)
## Why?
## What does this PR do?
## Related issues
Closes #3693
## AI Contribution Checklist
- [ ] Substantial AI assistance was used in this PR: `yes` / `no`
- [ ] If `yes`, I included a completed [AI Contribution
Checklist](https://github.com/apache/fory/blob/main/AI_POLICY.md#9-contributor-checklist-for-ai-assisted-prs)
in this PR description and the required `AI Usage Disclosure`.
- [ ] If `yes`, my PR description includes the required `ai_review`
summary and screenshot evidence of the final clean AI review results
from both fresh reviewers on the current PR diff or current HEAD after
the latest code changes.
## Does this PR introduce any user-facing change?
- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?
## Benchmark
---
README.md | 3 +++
cpp/README.md | 18 ++++++++++++++++++
docs/guide/cpp/index.md | 11 +++++++++++
3 files changed, 32 insertions(+)
diff --git a/README.md b/README.md
index 4b93788f8..59296be0b 100644
--- a/README.md
+++ b/README.md
@@ -217,6 +217,9 @@ git_override(module_name = "fory", remote =
"https://github.com/apache/fory.git"
deps = ["@fory//cpp/fory/serialization:fory_serialization"]
```
+When building C++ with MSVC, enable the conforming preprocessor option
+`/Zc:preprocessor`; see the C++ installation guide for setup details.
+
See the [C++ installation
guide](https://fory.apache.org/docs/guide/cpp/#installation)
for complete CMake, Bazel, and source-build details.
diff --git a/cpp/README.md b/cpp/README.md
index 4e7ab89e5..fc1c5d029 100644
--- a/cpp/README.md
+++ b/cpp/README.md
@@ -359,11 +359,20 @@ cpp/fory/
- **C++ Standard**: C++17 or later
- **Build System**: Bazel 8.2.1+ or CMake 3.16+
+- **MSVC**: configure your build system to pass `/Zc:preprocessor`.
## Building
### With Bazel
+When building with MSVC, add the conforming preprocessor option to your Bazel
+configuration:
+
+```bazel
+# .bazelrc
+build --cxxopt=/Zc:preprocessor
+```
+
```bash
# Build all projects
bazel build //cpp/...
@@ -377,6 +386,15 @@ bazel test $(bazel query //cpp/fory/serialization/...)
### With CMake
+When building with MSVC, add `/Zc:preprocessor` before bringing Fory into the
+build:
+
+```cmake
+if(MSVC)
+ add_compile_options(/Zc:preprocessor)
+endif()
+```
+
```bash
mkdir build && cd build
cmake ..
diff --git a/docs/guide/cpp/index.md b/docs/guide/cpp/index.md
index 537ef9fd1..fba62ef41 100644
--- a/docs/guide/cpp/index.md
+++ b/docs/guide/cpp/index.md
@@ -42,6 +42,9 @@ The C++ implementation supports both CMake and Bazel build
systems.
- CMake 3.16+ (for CMake build) or Bazel 8+ (for Bazel build)
- C++17 compatible compiler (GCC 7+, Clang 5+, MSVC 2017+)
+When building with MSVC, configure your build system to pass
+`/Zc:preprocessor`.
+
### Using CMake (Recommended)
The easiest way to use Fory is with CMake's `FetchContent` module:
@@ -107,6 +110,14 @@ cc_binary(
)
```
+When building with MSVC, add the conforming preprocessor option to your Bazel
+configuration:
+
+```bazel
+# .bazelrc
+build --cxxopt=/Zc:preprocessor
+```
+
Then build and run:
```bash
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]