diff --git a/vn-link-cli/Cargo.toml b/vn-link-cli/Cargo.toml index 9430979..df9ef7c 100644 --- a/vn-link-cli/Cargo.toml +++ b/vn-link-cli/Cargo.toml @@ -9,6 +9,9 @@ common = { path = "../common", default-features = false } tokio = { version = "1.37.0", features = ["full"] } log = "0.4.17" +[target.'cfg(windows)'.build-dependencies] +thunk-rs = { version = "0.3.3", features = ["win7"] } + [features] default = ["default-feature"] default-feature = ["server_encrypt", "aes_gcm", "aes_cbc", "aes_ecb", "sm4_cbc", "chacha20_poly1305", "port_mapping", "log", "command", "file_config", "lz4", "ws"] diff --git a/vn-link-cli/build.rs b/vn-link-cli/build.rs new file mode 100644 index 0000000..60bfdd2 --- /dev/null +++ b/vn-link-cli/build.rs @@ -0,0 +1,6 @@ + +fn main() { + // 配置 thunk-rs 来链接 Windows 7 兼容库,并自动设置链接参数 + #[cfg(target_os = "windows")] + thunk::thunk(); +} diff --git a/vnt-cli/Cargo.toml b/vnt-cli/Cargo.toml index 050d7a6..0569ed7 100644 --- a/vnt-cli/Cargo.toml +++ b/vnt-cli/Cargo.toml @@ -19,6 +19,9 @@ signal-hook = "0.3.17" [target.'cfg(target_os = "windows")'.dependencies] winapi = { version = "0.3.9", features = ["handleapi", "processthreadsapi", "winnt", "securitybaseapi", "impl-default"] } +[target.'cfg(windows)'.build-dependencies] +thunk-rs = { version = "0.3.3", features = ["win7"] } + [features] default = ["default-feature"] default-feature = ["server_encrypt", "aes_gcm", "aes_cbc", "aes_ecb", "sm4_cbc", "chacha20_poly1305", "ip_proxy", "port_mapping", "log", "command", "file_config", "lz4", "ws"] @@ -44,4 +47,4 @@ command = ["common/command"] file_config = ["common/file_config"] [build-dependencies] rand = "0.8.5" -chrono = "0.4.23" \ No newline at end of file +chrono = "0.4.23" diff --git a/vnt/build.rs b/vnt/build.rs index 5dd2e36..b0c6827 100644 --- a/vnt/build.rs +++ b/vnt/build.rs @@ -1,6 +1,9 @@ use cfg_aliases::cfg_aliases; fn main() { + #[cfg(target_os = "windows")] + thunk::thunk(); + cfg_aliases! { cipher: { any(feature = "aes_gcm",