2022-12-14 10:51:12 +00:00
|
|
|
# NOTE: should be macro to export RUST_CXXFLAGS/RUST_CFLAGS for subfolders
|
|
|
|
macro(configure_rustc)
|
2022-12-07 12:14:24 +00:00
|
|
|
# NOTE: this can also be done by overriding rustc, but it not trivial with rustup.
|
|
|
|
set(RUST_CFLAGS "${CMAKE_C_FLAGS}")
|
|
|
|
|
|
|
|
set(CXX_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/llvm-project/libcxx/include")
|
2022-12-14 10:51:12 +00:00
|
|
|
set(RUST_CXXFLAGS "${CMAKE_CXX_FLAGS} -isystem ${CXX_INCLUDE_DIR} -nostdinc++")
|
2022-12-07 12:14:24 +00:00
|
|
|
|
|
|
|
if (CMAKE_OSX_SYSROOT)
|
|
|
|
set(RUST_CXXFLAGS "${RUST_CXXFLAGS} -isysroot ${CMAKE_OSX_SYSROOT}")
|
|
|
|
set(RUST_CFLAGS "${RUST_CFLAGS} -isysroot ${CMAKE_OSX_SYSROOT}")
|
|
|
|
elseif(CMAKE_SYSROOT)
|
|
|
|
set(RUST_CXXFLAGS "${RUST_CXXFLAGS} --sysroot ${CMAKE_SYSROOT}")
|
|
|
|
set(RUST_CFLAGS "${RUST_CFLAGS} --sysroot ${CMAKE_SYSROOT}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
message(STATUS "RUST_CFLAGS: ${RUST_CFLAGS}")
|
|
|
|
message(STATUS "RUST_CXXFLAGS: ${RUST_CXXFLAGS}")
|
|
|
|
|
|
|
|
# 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)
|
2022-12-14 10:51:12 +00:00
|
|
|
endmacro()
|
2022-12-07 12:14:24 +00:00
|
|
|
configure_rustc()
|
|
|
|
|
2022-12-14 10:51:46 +00:00
|
|
|
function(clickhouse_import_crate)
|
|
|
|
# This is a workaround for Corrosion case sensitive build type matching in
|
|
|
|
# _generator_add_cargo_targets(), that leads to different paths in
|
|
|
|
# IMPORTED_LOCATION and real path of the library.
|
|
|
|
#
|
|
|
|
# It uses CMAKE_CONFIGURATION_TYPES and $<CONFIG>, so here we preserve the
|
|
|
|
# case of ${CMAKE_BUILD_TYPE} in ${CMAKE_CONFIGURATION_TYPES}.
|
|
|
|
if ("${CMAKE_BUILD_TYPE_UC}" STREQUAL "DEBUG")
|
|
|
|
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_BUILD_TYPE};release")
|
|
|
|
else()
|
|
|
|
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_BUILD_TYPE};debug")
|
|
|
|
endif()
|
|
|
|
# NOTE: we may use LTO for rust too
|
|
|
|
|
|
|
|
corrosion_import_crate(NO_STD ${ARGN})
|
|
|
|
endfunction()
|
|
|
|
|
2022-09-12 19:51:43 +00:00
|
|
|
add_subdirectory (BLAKE3)
|
2022-12-03 11:55:46 +00:00
|
|
|
add_subdirectory (skim)
|