mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Properly detect changes in Rust code and recompile Rust libraries
Due to we need to substitude config for Rust builds (see #44762 for details), the source dir is copied to the binary dir, but this is done only once, so to detect changes in sources you need to run cmake, without this patch. Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
parent
3d6883dd9c
commit
9f9989ea72
@ -51,8 +51,20 @@ file(COPY ".cargo" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
function(add_rust_subdirectory src)
|
||||
set(dst "${CMAKE_CURRENT_BINARY_DIR}/${src}")
|
||||
message(STATUS "Copy ${src} to ${dst}")
|
||||
file(COPY "${src}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
file(COPY "${src}" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
PATTERN target EXCLUDE)
|
||||
add_subdirectory("${dst}" "${dst}")
|
||||
|
||||
# cmake -E copy* do now know how to exclude files
|
||||
# but we need to exclude "target" folder from copying, if someone or semantic
|
||||
# completion created it.
|
||||
add_custom_target(${src}-update ALL
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DFROM=${src}
|
||||
-DTO=${CMAKE_CURRENT_BINARY_DIR}
|
||||
-P "${CMAKE_CURRENT_SOURCE_DIR}/copy_exclude.cmake"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
VERBATIM)
|
||||
endfunction()
|
||||
|
||||
add_rust_subdirectory (BLAKE3)
|
||||
|
2
rust/copy_exclude.cmake
Normal file
2
rust/copy_exclude.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
file(COPY "${FROM}" DESTINATION "${TO}"
|
||||
PATTERN target EXCLUDE)
|
Loading…
Reference in New Issue
Block a user