opencv/3rdparty/zlib-ng/arch/riscv
FantasqueX 85923c8f30
Merge pull request #26113 from FantasqueX:zlib-ng-2-2-1
Update zlib-ng to 2.2.1 #26113

Release: https://github.com/zlib-ng/zlib-ng/releases/tag/2.2.1
ARM diagnostics patch: https://github.com/zlib-ng/zlib-ng/pull/1774

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
2024-09-12 16:05:24 +03:00
..
adler32_rvv.c Merge pull request #26113 from FantasqueX:zlib-ng-2-2-1 2024-09-12 16:05:24 +03:00
chunkset_rvv.c Add zlib-ng as an alternative zlib implementation 2024-01-14 14:58:47 +08:00
compare256_rvv.c Merge pull request #26113 from FantasqueX:zlib-ng-2-2-1 2024-09-12 16:05:24 +03:00
README.md Add zlib-ng as an alternative zlib implementation 2024-01-14 14:58:47 +08:00
riscv_features.c Merge pull request #26113 from FantasqueX:zlib-ng-2-2-1 2024-09-12 16:05:24 +03:00
riscv_features.h Merge pull request #26113 from FantasqueX:zlib-ng-2-2-1 2024-09-12 16:05:24 +03:00
riscv_functions.h Merge pull request #26113 from FantasqueX:zlib-ng-2-2-1 2024-09-12 16:05:24 +03:00
slide_hash_rvv.c Merge pull request #26113 from FantasqueX:zlib-ng-2-2-1 2024-09-12 16:05:24 +03:00

Building RISC-V Target with Cmake

Warning

Runtime rvv detection (using hwcap) requires linux kernel 6.5 or newer.

When running on older kernels, we fall back to compile-time detection, potentially this can cause crashes if rvv is enabled at compile but not supported by the target cpu. Therefore if older kernel support is needed, rvv should be disabled if the target cpu does not support it.

Prerequisite: Build RISC-V Clang Toolchain and QEMU

If you don't have prebuilt clang and riscv64 qemu, you can refer to the script to get the source. Copy the script to the zlib-ng root directory, and run it to download the source and build them. Modify the content according to your conditions (e.g., toolchain version).

./prepare_riscv_toolchain_qemu.sh

After running script, clang & qemu are built in build-toolchain-qemu/riscv-clang/ & build-toolchain-qemu/riscv-qemu/.

build-toolchain-qemu/riscv-clang/ is your TOOLCHAIN_PATH. build-toolchain-qemu/riscv-qemu/bin/qemu-riscv64 is your QEMU_PATH.

You can also download the prebuilt toolchain & qemu from the release page, and enjoy using them.

Cross-Compile for RISC-V Target

cmake -G Ninja -B ./build-riscv \
  -D CMAKE_TOOLCHAIN_FILE=./cmake/toolchain-riscv.cmake \
  -D CMAKE_INSTALL_PREFIX=./build-riscv/install \
  -D TOOLCHAIN_PATH={TOOLCHAIN_PATH} \
  -D QEMU_PATH={QEMU_PATH} \
  .

cmake --build ./build-riscv

Disable the option if there is no RVV support:

-D WITH_RVV=OFF

Run Unittests on User Mode QEMU

cd ./build-riscv && ctest --verbose