Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
18 changes: 18 additions & 0 deletions cpp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/...
Expand All @@ -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 ..
Expand Down
11 changes: 11 additions & 0 deletions docs/guide/cpp/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
Loading