-
Notifications
You must be signed in to change notification settings - Fork 639
feat(bindings/cpp): tweak settings to support build opendal_cpp in windows #6231
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,14 +42,11 @@ option(OPENDAL_DEV "Enable dev mode" OFF) | |
option(OPENDAL_ENABLE_ASYNC "Enable async mode (requires C++20)" OFF) | ||
|
||
if(OPENDAL_ENABLE_ASYNC) | ||
set(CMAKE_CXX_STANDARD 20) | ||
|
||
if (NOT ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))) | ||
message(FATAL_ERROR "currently C++ compiler must be clang for async mode") | ||
endif() | ||
else() | ||
set(CMAKE_CXX_STANDARD 17) | ||
endif() | ||
set(CMAKE_CXX_STANDARD 20) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
if (OPENDAL_DEV) | ||
|
@@ -83,7 +80,9 @@ endif() | |
execute_process(COMMAND cargo locate-project --workspace --message-format plain | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Additionally, I am considering whether we can first simply add a CI for Windows platform compilation and C++ unit test execution, so as to initially and easily ensure that compilation changes are reliable. |
||
OUTPUT_VARIABLE CARGO_TARGET_DIR | ||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) | ||
string(REGEX REPLACE "/Cargo.toml\n$" "/target" CARGO_TARGET_DIR "${CARGO_TARGET_DIR}") | ||
cmake_path(GET CARGO_TARGET_DIR PARENT_PATH CARGO_TARGET_DIR) | ||
cmake_path(APPEND CARGO_TARGET_DIR "target" ) | ||
|
||
set(CARGO_MANIFEST ${PROJECT_SOURCE_DIR}/Cargo.toml) | ||
set(RUST_SOURCE_FILE ${PROJECT_SOURCE_DIR}/src/lib.rs) | ||
list(APPEND RUST_BRIDGE_CPP ${CARGO_TARGET_DIR}/cxxbridge/opendal-cpp/src/lib.rs.cc) | ||
|
@@ -171,7 +170,7 @@ endif() | |
|
||
# Platform-specific test configuration | ||
if(WIN32) | ||
target_link_libraries(opendal_cpp userenv ws2_32 bcrypt) | ||
target_link_libraries(opendal_cpp PRIVATE userenv ws2_32 bcrypt Ntdll.lib) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. System libraries (such as userenv/ws2_32) should use PUBLIC, as they are interface dependencies, while internal libraries (Ntdll.lib) should use PRIVATE. |
||
set_target_properties( | ||
opendal_cpp | ||
PROPERTIES | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to require C++17, because many projects cannot directly support C++20 for the time being, and it is necessary to retain this practice.