bug: cpp bindings can not be compiled in windows
- Dominant language
- Rust
- Stars
- 5.4k
- Forks
- 825
- Avg merge
- 1d 14m
- Merged PRs (30d)
- 127
Description
### Describe the bug
1. c++ standard mismatch
Currently `c++ 17` is used at
https://github.com/apache/opendal/blob/193a30ec111ec4379b0124a58b63692d018773dc/bindings/cpp/CMakeLists.txt#L51
But `Designated Initializers` is `c++ 20` feature.
https://github.com/apache/opendal/blob/193a30ec111ec4379b0124a58b63692d018773dc/bindings/cpp/src/operator.cpp#L38
https://github.com/apache/opendal/blob/193a30ec111ec4379b0124a58b63692d018773dc/bindings/cpp/src/utils/ffi_converter.cpp#L25
2. `target_link_libraries` issue
On windows platform, some extra depdencies are linked to target using `plain-style` (without `PRIVATE` or `PUBLIC`)
https://github.com/apache/opendal/blob/193a30ec111ec4379b0124a58b63692d018773dc/bindings/cpp/CMakeLists.txt#L174
But there exist several `keyword-style` linking.
https://github.com/apache/opendal/blob/193a30ec111ec4379b0124a58b63692d018773dc/bindings/cpp/CMakeLists.txt#L174
Using both `plain` and `keyword` for the same target is not allowed in `cmake`
3. `path` issue
Regular expression is used to handle path at
https://github.com/apache/opendal/blob/193a30ec111ec4379b0124a58b63692d018773dc/bindings/cpp/CMakeLists.txt#L86
On windows platform, the line terminator can be `\r\n`. Therefore this regex may generate wrong result with unexpected `\r`
### Steps to Reproduce
Compiling the cpp bindings sample can reproduce this problem
### Expected Behavior
cpp bindings sample should be compiled properly.
### Additional Context
_No response_
### Are you willing to submit a PR to fix this bug?
- [x] Yes, I would like to submit a PR.
Contributor guide
Research direction
Start by reproducing the Windows build of the C++ bindings sample, then inspect bindings/cpp/CMakeLists.txt and the referenced locations in bindings/cpp/src/operator.cpp and bindings/cpp/src/utils/ffi_converter.cpp. Done means the C++ bindings sample compiles properly on Windows without the reported standard, target-linking, or path-handling errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100