Skip to content

Commit

Permalink
fix link order
Browse files Browse the repository at this point in the history
  • Loading branch information
jiacai2050 committed Nov 6, 2024
1 parent 7e7922a commit 39d0fb2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include(FetchContent)
FetchContent_Declare(
vsag
GIT_REPOSITORY https://github.com/alipay/vsag
GIT_TAG v0.11.6
GIT_TAG v0.11.7
)
FetchContent_MakeAvailable(vsag)

Expand Down
5 changes: 3 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
fn main() {
println!("cargo:rerun-if-changed=include/wrapper.h");
println!("cargo:rerun-if-changed=src/wrapper.cpp");
println!("cargo:rerun-if-changed=build.rs");

let dst = cmake::Config::new("")
.build_target("vsag_wrapper")
Expand All @@ -23,11 +24,11 @@ fn main() {
.env("TARGET", "")
.build();

println!("cargo:rustc-link-lib=static=vsag_wrapper");
println!("cargo:rustc-link-lib=dylib=vsag");
println!("cargo:rustc-link-search=native={}/build", dst.display());
println!(
"cargo:rustc-link-search=native={}/build/_deps/vsag-build/src",
dst.display()
);
println!("cargo:rustc-link-lib=dylib=vsag");
println!("cargo:rustc-link-lib=static=vsag_wrapper");
}
4 changes: 4 additions & 0 deletions include/wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
#include <cstddef>
#include <cstdint>

#ifdef __cplusplus
extern "C" {
#endif

#define VSAG_WRAPPER_MAX_ERROR_MESSAGE_LENGTH 256

Expand Down Expand Up @@ -61,4 +63,6 @@ void free_i64_vector(int64_t *vector);
void free_f32_vector(float *vector);
} // extern "C"

#ifdef __cplusplus
#endif // WRAPPER_H
#endif
3 changes: 0 additions & 3 deletions src/wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ template <typename T> static void readBinaryPOD(std::istream &in, T &podRef) {
in.read((char *)&podRef, sizeof(T));
}

extern "C" {
CError *new_error(int type_, const char *msg) {
CError *err = (CError *)malloc(sizeof(CError));
if (err == NULL) {
Expand Down Expand Up @@ -303,5 +302,3 @@ void free_f32_vector(float *vector) {
delete[] vector;
}
}

} // extern "C"

0 comments on commit 39d0fb2

Please sign in to comment.