Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add implementation of build for protobuf>=22.0 on Windows #5359

Merged
merged 1 commit into from
Mar 4, 2024
Merged
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
39 changes: 38 additions & 1 deletion docs/how-to-build/how-to-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ cmake --build . --config Release --target install
```
(optional) Download and install Vulkan SDK from https://vulkan.lunarg.com/sdk/home

Build ncnn library (replace <protobuf-root-dir> with a proper path):
Build ncnn library (replace `<protobuf-root-dir>` with a proper path):

```shell
cd <ncnn-root-dir>
Expand All @@ -193,6 +193,43 @@ cmake --build . --config Release --target install

Note: To speed up compilation process on multi core machines, configuring `cmake` to use `jom` or `ninja` using `-G` flag is recommended.

Note: For protobuf >=22.0 (Take v25.3 for example):

Build zlib:
```shell
git clone -b -v1.3.1 https://github.com/madler/zlib.git
cd zlib
mkdir build
cd build
cmake -A x64 -DCMAKE_INSTALL_PREFIX=%cd%/install ..
cmake --build . --config Release -j 2
cmake --build . --config Release --target install
```

Build protobuf library (replace `<zlib-root-dir>` with a proper path):
```shell
git clone -b v25.3 https://github.com/protocolbuffers/protobuf.git
cd protobuf
git submodule update --init --recursive

mkdir protobuf_build
cd protobuf_build
cmake -A x64 -DCMAKE_INSTALL_PREFIX=%cd%/install -DCMAKE_CXX_STANDARD=14 -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=OFF -DZLIB_INCLUDE_DIR=<zlib-root-dir>\build\install\include -DZLIB_LIBRARY=<zlib-root-dir>\build\install\lib\zlib.lib -DABSL_PROPAGATE_CXX_STD=ON ../cmake
cmake --build . --config Release -j 2
cmake --build . --config Release --target install
```

Build ncnn library (replace `<zlib-root-dir>` and `<protobuf-root-dir>` with a proper path):

```shell
cd <ncnn-root-dir>
mkdir -p build
cd build
cmake -A x64 -DCMAKE_INSTALL_PREFIX=%cd%/install -DCMAKE_PREFIX_PATH=<protobuf-root-dir>/protobuf_build\install\cmake -DZLIB_INCLUDE_DIR=<zlib-root-dir>\build\install\include -DZLIB_LIBRARY=<zlib-root-dir>\build\install\lib\zlib.lib -Dabsl_DIR=<protobuf-root-dir>/protobuf_build\install\lib\cmake\absl -Dutf8_range_DIR=<protobuf-root-dir>/protobuf_build\install\lib\cmake\utf8_range -DNCNN_VULKAN=ON ..
cmake --build . --config Release -j 2
cmake --build . --config Release --target install
```

***
### Build for macOS

Expand Down