Skip to content

Commit

Permalink
Make: Rust Windows build (#472)
Browse files Browse the repository at this point in the history
Closes #477

Co-authored-by: T-T <[email protected]>
Signed-off-by: brkp <[email protected]>
  • Loading branch information
nullptropy and CCnut authored Aug 28, 2024
1 parent 9952834 commit 50a6608
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ fn main() {
.flag_if_supported("/std:c++17")
.flag_if_supported("/O2")
.flag_if_supported("/fp:fast")
.flag_if_supported("/W1"); // Reduce warnings verbosity
.flag_if_supported("/W1") // Reduce warnings verbosity
.flag_if_supported("/EHsc")
.flag_if_supported("/MD")
.flag_if_supported("/permissive-")
.flag_if_supported("/sdl-")
.define("_ALLOW_RUNTIME_LIBRARY_MISMATCH", None)
.define("_ALLOW_POINTER_TO_CONST_MISMATCH", None);
}

let mut result = build.try_compile("usearch");
Expand Down
6 changes: 3 additions & 3 deletions rust/lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ NativeIndex::NativeIndex(std::unique_ptr<index_t> index) : index_(std::move(inde
auto make_predicate(uptr_t metric, uptr_t metric_state) {
return [=](vector_key_t key) {
auto func = reinterpret_cast<bool (*)(uptr_t, vector_key_t)>(metric);
auto state = reinterpret_cast<uptr_t>(metric_state);
auto state = static_cast<uptr_t>(metric_state);
return func(key, state);
};
}
Expand Down Expand Up @@ -104,8 +104,8 @@ void NativeIndex::change_expansion_search(size_t n) const { index_->change_expan

void NativeIndex::change_metric(uptr_t metric, uptr_t state) const {
index_->change_metric(metric_punned_t::stateful( //
reinterpret_cast<std::uintptr_t>(metric), //
reinterpret_cast<std::uintptr_t>(state), //
static_cast<std::uintptr_t>(metric), //
static_cast<std::uintptr_t>(state), //
index_->metric().metric_kind(), //
index_->scalar_kind()));
}
Expand Down

0 comments on commit 50a6608

Please sign in to comment.