Xuanwo commented on code in PR #6503: URL: https://github.com/apache/opendal/pull/6503#discussion_r2275770812
########## bindings/cpp/README.md: ########## @@ -104,6 +104,7 @@ make docs - `OPENDAL_DOCS_ONLY`: Only build documentation. Default: `OFF` - `OPENDAL_ENABLE_TESTING`: Enable testing. Default: `OFF` - `OPENDAL_ENABLE_ASYNC`: Enable async support. Default: `OFF` +- `FEATURES`: Specify OpenDAL services to include, like `"opendal/services-s3,opendal/services-memory"`. Default: `""` Review Comment: Please make the naming consist. ########## bindings/cpp/CMakeLists.txt: ########## @@ -39,6 +39,7 @@ option(OPENDAL_DOCS_ONLY "Only build documentation (dev only for quick ci)" OFF) option(OPENDAL_ENABLE_TESTING "Enable building test binary for opendal" OFF) option(OPENDAL_DEV "Enable dev mode" OFF) option(OPENDAL_ENABLE_ASYNC "Enable async mode (requires C++20)" OFF) +set(FEATURES "" CACHE STRING "opendal features") Review Comment: How about using `OPENDAL_FEATURES`? ########## bindings/cpp/CMakeLists.txt: ########## @@ -144,6 +153,27 @@ if (OPENDAL_ENABLE_ASYNC) endif() target_link_libraries(opendal_cpp PUBLIC ${RUST_LIB}) target_link_libraries(opendal_cpp PRIVATE ${CMAKE_DL_LIBS}) + +if(FEATURES MATCHES "services-rocksdb") + if(DEFINED ENV{ROCKSDB_LIB_DIR}) + find_library(ROCKSDB_LIB rocksdb PATHS $ENV{ROCKSDB_LIB_DIR} NO_DEFAULT_PATH) + target_link_libraries(opendal_cpp PUBLIC ${ROCKSDB_LIB}) + endif() +endif() + +if(FEATURES MATCHES "services-hdfs") + if(DEFINED ENV{HADOOP_HOME}) + find_library(HDFS_LIB NAMES hdfs PATHS $ENV{HADOOP_HOME}/lib/native NO_DEFAULT_PATH) + if(HDFS_LIB) + target_link_libraries(opendal_cpp PUBLIC ${HDFS_LIB}) + endif() + else() + find_library(HDFS_LIB hdfs) + if(HDFS_LIB) + target_link_libraries(opendal_cpp PUBLIC ${HDFS_LIB}) + endif() + endif() +endif() Review Comment: Why we need this? It should be done by rust's `build.rs`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@opendal.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org