Skip to content

Commit 1b71bc4

Browse files
cursoragentlovasoa
andcommitted
Configure rpath for Linux targets and conditionalize odbc-sys
Co-authored-by: contact <[email protected]>
1 parent 3551434 commit 1b71bc4

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

.cargo/config.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,13 @@
77
LIBSQLITE3_FLAGS = "-DSQLITE_ENABLE_MATH_FUNCTIONS"
88

99
[build]
10+
rustflags = []
11+
12+
[target.x86_64-unknown-linux-gnu]
13+
rustflags = ["-C", "link-arg=-Wl,-rpath=$ORIGIN/sqlpage:$ORIGIN/lib"]
14+
15+
[target.aarch64-unknown-linux-gnu]
16+
rustflags = ["-C", "link-arg=-Wl,-rpath=$ORIGIN/sqlpage:$ORIGIN/lib"]
17+
18+
[target.armv7-unknown-linux-gnueabihf]
1019
rustflags = ["-C", "link-arg=-Wl,-rpath=$ORIGIN/sqlpage:$ORIGIN/lib"]

Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ sqlparser = { version = "0.59.0", default-features = false, features = [
4949
"std",
5050
"visitor",
5151
] }
52-
odbc-sys = { version = "0.27", features = ["static"] }
5352
async-stream = "0.3"
5453
async-trait = "0.1.61"
5554
async-recursion = "1.0.0"
@@ -79,3 +78,10 @@ rustls = "0.23"
7978
actix-rt = "2.8"
8079
libflate = "2"
8180
futures-util = "0.3.21"
81+
82+
[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
83+
# Enable static linking of unixODBC only on Linux/Unix, not on Windows/macOS
84+
odbc-sys = { version = "0.27", features = ["static"] }
85+
86+
[target.'cfg(any(target_os = "windows", target_os = "macos"))'.dependencies]
87+
odbc-sys = { version = "0.27" }

0 commit comments

Comments
 (0)