mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Vendor rust dependencies
This commit is contained in:
parent
24dd34fb29
commit
f77822e732
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -369,3 +369,6 @@
|
|||||||
[submodule "contrib/idna"]
|
[submodule "contrib/idna"]
|
||||||
path = contrib/idna
|
path = contrib/idna
|
||||||
url = https://github.com/ada-url/idna.git
|
url = https://github.com/ada-url/idna.git
|
||||||
|
[submodule "contrib/rust_vendor"]
|
||||||
|
path = contrib/rust_vendor
|
||||||
|
url = https://github.com/ClickHouse/rust_vendor.git
|
||||||
|
1
contrib/rust_vendor
vendored
Submodule
1
contrib/rust_vendor
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit d9cdb3cc4404b60dce8b6c4184226c7f7d50eef9
|
@ -52,6 +52,7 @@ macro(configure_rustc)
|
|||||||
message(STATUS "RUSTFLAGS: ${RUSTFLAGS}")
|
message(STATUS "RUSTFLAGS: ${RUSTFLAGS}")
|
||||||
message(STATUS "RUST_CARGO_BUILD_STD: ${RUST_CARGO_BUILD_STD}")
|
message(STATUS "RUST_CARGO_BUILD_STD: ${RUST_CARGO_BUILD_STD}")
|
||||||
|
|
||||||
|
set(RUST_VENDOR_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../contrib/rust_vendor")
|
||||||
# NOTE: requires RW access for the source dir
|
# NOTE: requires RW access for the source dir
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/.cargo/config.toml.in" "${CMAKE_CURRENT_SOURCE_DIR}/.cargo/config.toml" @ONLY)
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/.cargo/config.toml.in" "${CMAKE_CURRENT_SOURCE_DIR}/.cargo/config.toml" @ONLY)
|
||||||
endmacro()
|
endmacro()
|
||||||
@ -80,9 +81,7 @@ function(clickhouse_import_crate)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Note, here --offline is not used, since on CI vendor archive is used, and
|
corrosion_import_crate(NO_STD ${ARGN} PROFILE ${profile} FLAGS --offline)
|
||||||
# passing --offline here will be inconvenient for local development.
|
|
||||||
corrosion_import_crate(NO_STD ${ARGN} PROFILE ${profile})
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Add crate from the build directory.
|
# Add crate from the build directory.
|
||||||
@ -100,18 +99,6 @@ function(add_rust_subdirectory src)
|
|||||||
file(COPY "${src}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}"
|
file(COPY "${src}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
PATTERN target EXCLUDE)
|
PATTERN target EXCLUDE)
|
||||||
|
|
||||||
# Check is Rust available or not.
|
|
||||||
#
|
|
||||||
# `cargo update --dry-run` will not update anything, but will check the internet connectivity.
|
|
||||||
execute_process(COMMAND ${Rust_CARGO_CACHED} update --dry-run
|
|
||||||
WORKING_DIRECTORY "${dst}"
|
|
||||||
RESULT_VARIABLE CARGO_UPDATE_RESULT
|
|
||||||
OUTPUT_VARIABLE CARGO_UPDATE_STDOUT
|
|
||||||
ERROR_VARIABLE CARGO_UPDATE_STDERR)
|
|
||||||
if (CARGO_UPDATE_RESULT)
|
|
||||||
message(FATAL_ERROR "Rust (${Rust_CARGO_CACHED}) support is not available (likely there is no internet connectivity):\n${CARGO_UPDATE_STDERR}\nYou can disable Rust support with -DENABLE_RUST=OFF")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_subdirectory("${dst}" "${dst}")
|
add_subdirectory("${dst}" "${dst}")
|
||||||
|
|
||||||
# cmake -E copy* do now know how to exclude files
|
# cmake -E copy* do now know how to exclude files
|
||||||
|
3
rust/VENDOR.md
Normal file
3
rust/VENDOR.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
- Update Cargo.lock
|
||||||
|
- Run `cargo vendor --locked ../contrib/rust_vendor`
|
||||||
|
- Update `rust_vendor` submodule with the new contents
|
8
rust/prql/.cargo/config.toml.in
Normal file
8
rust/prql/.cargo/config.toml.in
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[env]
|
||||||
|
CXXFLAGS = "@RUST_CXXFLAGS@"
|
||||||
|
|
||||||
|
[source.crates-io]
|
||||||
|
replace-with = "vendored-sources"
|
||||||
|
|
||||||
|
[source.vendored-sources]
|
||||||
|
directory = "@RUST_VENDOR_DIR@"
|
@ -1,3 +1,4 @@
|
|||||||
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/.cargo/config.toml.in" "${CMAKE_CURRENT_SOURCE_DIR}/.cargo/config.toml" @ONLY)
|
||||||
clickhouse_import_crate(MANIFEST_PATH Cargo.toml)
|
clickhouse_import_crate(MANIFEST_PATH Cargo.toml)
|
||||||
target_include_directories(_ch_rust_prql INTERFACE include)
|
target_include_directories(_ch_rust_prql INTERFACE include)
|
||||||
add_library(ch_rust::prql ALIAS _ch_rust_prql)
|
add_library(ch_rust::prql ALIAS _ch_rust_prql)
|
||||||
|
1
rust/prql/Cargo.lock
generated
Symbolic link
1
rust/prql/Cargo.lock
generated
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../Cargo.lock
|
@ -1,2 +1,8 @@
|
|||||||
[env]
|
[env]
|
||||||
CXXFLAGS = "@RUST_CXXFLAGS@"
|
CXXFLAGS = "@RUST_CXXFLAGS@"
|
||||||
|
|
||||||
|
[source.crates-io]
|
||||||
|
replace-with = "vendored-sources"
|
||||||
|
|
||||||
|
[source.vendored-sources]
|
||||||
|
directory = "@RUST_VENDOR_DIR@"
|
||||||
|
@ -1,25 +1,18 @@
|
|||||||
if (OS_FREEBSD)
|
if (OS_FREEBSD)
|
||||||
# Right nix/libc requires fspacectl and it had been added only since FreeBSD14.
|
# Right nix/libc requires fspacectl and it had been added only since FreeBSD14.
|
||||||
# And sicne sysroot has older libararies you will got undefined reference for clickhouse binary.
|
# And since sysroot has older libraries you will got undefined reference for clickhouse binary.
|
||||||
#
|
#
|
||||||
# But likely everything should work without this syscall, however it is not
|
# But likely everything should work without this syscall, however it is not
|
||||||
# possible right now to gently override libraries versions for depdendcies,
|
# possible right now to gently override libraries versions for dependencies,
|
||||||
# and forking rust modules is a little bit too much for this thing.
|
# and forking rust modules is a little bit too much for this thing.
|
||||||
#
|
#
|
||||||
# You can take a look at the details in the fillowing issue [1].
|
# You can take a look at the details in the following issue [1].
|
||||||
#
|
#
|
||||||
# [1]: https://github.com/rust-lang/cargo/issues/5640
|
# [1]: https://github.com/rust-lang/cargo/issues/5640
|
||||||
#
|
#
|
||||||
message(STATUS "skim is disabled for FreeBSD")
|
message(STATUS "skim is disabled for FreeBSD")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
if (SANITIZE STREQUAL "thread")
|
|
||||||
# Rust does not supports Thread Sanitizer [1]
|
|
||||||
#
|
|
||||||
# [1]: https://doc.rust-lang.org/beta/unstable-book/compiler-flags/sanitizer.html#threadsanitizer
|
|
||||||
message(STATUS "skim is disabled under Thread Sanitizer")
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
clickhouse_import_crate(MANIFEST_PATH Cargo.toml)
|
clickhouse_import_crate(MANIFEST_PATH Cargo.toml)
|
||||||
|
|
||||||
@ -32,24 +25,5 @@ message(STATUS "RUST_CXXFLAGS (for skim): ${RUST_CXXFLAGS}")
|
|||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build.rs.in" "${CMAKE_CURRENT_SOURCE_DIR}/build.rs" @ONLY)
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build.rs.in" "${CMAKE_CURRENT_SOURCE_DIR}/build.rs" @ONLY)
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/.cargo/config.toml.in" "${CMAKE_CURRENT_SOURCE_DIR}/.cargo/config.toml" @ONLY)
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/.cargo/config.toml.in" "${CMAKE_CURRENT_SOURCE_DIR}/.cargo/config.toml" @ONLY)
|
||||||
|
|
||||||
set (ffi_binding_generated_path
|
target_include_directories(_ch_rust_skim_rust INTERFACE include)
|
||||||
${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/cargo/build/${Rust_CARGO_TARGET_CACHED}/cxxbridge/_ch_rust_skim_rust/src/lib.rs.cc)
|
add_library(ch_rust::skim ALIAS _ch_rust_skim_rust)
|
||||||
set (ffi_binding_final_path ${CMAKE_CURRENT_BINARY_DIR}/skim-ffi.cc)
|
|
||||||
message(STATUS "Writing FFI Binding for skim: ${ffi_binding_generated_path} => ${ffi_binding_final_path}")
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${ffi_binding_final_path}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${ffi_binding_generated_path} ${ffi_binding_final_path}
|
|
||||||
DEPENDS cargo-build__ch_rust_skim_rust)
|
|
||||||
|
|
||||||
add_library(_ch_rust_skim_ffi ${ffi_binding_final_path})
|
|
||||||
|
|
||||||
# cxx bridge compiles such bindings
|
|
||||||
set_target_properties(_ch_rust_skim_ffi PROPERTIES COMPILE_FLAGS "${CXXBRIDGE_CXXFLAGS}")
|
|
||||||
|
|
||||||
add_library(_ch_rust_skim INTERFACE)
|
|
||||||
target_include_directories(_ch_rust_skim INTERFACE include)
|
|
||||||
target_link_libraries(_ch_rust_skim INTERFACE
|
|
||||||
_ch_rust_skim_rust
|
|
||||||
_ch_rust_skim_ffi)
|
|
||||||
|
|
||||||
add_library(ch_rust::skim ALIAS _ch_rust_skim)
|
|
||||||
|
1
rust/skim/Cargo.lock
generated
Symbolic link
1
rust/skim/Cargo.lock
generated
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../Cargo.lock
|
Loading…
Reference in New Issue
Block a user