Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix link order #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- name: fmt
run: |
make fmt
git diff --exit-code
- name: test
run: |
make test
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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.PHONY: fmt
fmt:
find src include -iname "*.h" -o -iname "*.cpp" | xargs clang-format -i
cargo fmt

.PHONY: test
test:
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
1 change: 1 addition & 0 deletions src/wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ template <typename T> static void readBinaryPOD(std::istream &in, T &podRef) {
}

extern "C" {
zhongzc marked this conversation as resolved.
Show resolved Hide resolved

CError *new_error(int type_, const char *msg) {
CError *err = (CError *)malloc(sizeof(CError));
if (err == NULL) {
Expand Down