From 7df4513690d4c8d2b8776439ac96f46a33af0736 Mon Sep 17 00:00:00 2001 From: William Venner Date: Wed, 27 Oct 2021 17:17:24 +0100 Subject: [PATCH] Feature gate advanced stuff --- Cargo.lock | 2 +- gmod/Cargo.toml | 30 ++++++++++++++++++------------ gmod/src/lib.rs | 25 +++++++++++++++---------- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6add894..aa3ddee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -109,7 +109,7 @@ dependencies = [ [[package]] name = "gmod" -version = "7.0.1" +version = "8.0.0" dependencies = [ "cfg_table", "cstr", diff --git a/gmod/Cargo.toml b/gmod/Cargo.toml index a32110d..8e6ba9c 100644 --- a/gmod/Cargo.toml +++ b/gmod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gmod" -version = "7.0.2" +version = "8.0.0" authors = ["William Venner "] edition = "2018" license = "MIT" @@ -9,17 +9,23 @@ repository = "https://github.com/WilliamVenner/gmod-rs" keywords = ["gmod", "garrysmod", "module", "glua"] categories = ["api-bindings", "external-ffi-bindings", "game-development", "development-tools"] +[features] +default = ["hax"] +hax = ["ctor", "skidscan", "detour", "fn_type_alias", "fn_abi", "cfg_table", "null_fn", "fn_has_this"] + [dependencies] -libloading = "0" -detour = "0" -skidscan = "2" -cstr = "0" -lazy_static = "1" -ctor = "0" gmod-macros = { version = "1.0.0", path = "../gmod-macros" } -fn_type_alias = "0" -fn_abi = "2" -cfg_table = "0" -null_fn = "0" -fn_has_this = "0" +libloading = "0" +cstr = "0" +lazy_static = "1" + +detour = { version = "0", optional = true } +ctor = { version = "0", optional = true } +skidscan = { version = "2", optional = true } + +fn_type_alias = { version = "0", optional = true } +fn_abi = { version = "2", optional = true } +cfg_table = { version = "0", optional = true } +null_fn = { version = "0", optional = true } +fn_has_this = { version = "0", optional = true } diff --git a/gmod/src/lib.rs b/gmod/src/lib.rs index b0b4792..be702f1 100644 --- a/gmod/src/lib.rs +++ b/gmod/src/lib.rs @@ -1,19 +1,24 @@ #![feature(c_unwind)] #![feature(thread_id_value)] -pub use libloading; -pub use detour; -pub use skidscan as sigscan; pub use cstr; -pub use ctor::{ctor as dllopen, dtor as dllclose}; +pub use libloading; pub use gmod_macros::*; -// Reexport common macros -pub use fn_type_alias::*; -pub use fn_abi::*; -pub use cfg_table::*; -pub use null_fn::*; -pub use fn_has_this::*; +#[cfg(feature = "hax")] +mod haxports { + pub use detour; + pub use skidscan as sigscan; + pub use ctor::{ctor as dllopen, dtor as dllclose}; + + pub use fn_type_alias::*; + pub use fn_abi::*; + pub use cfg_table::*; + pub use null_fn::*; + pub use fn_has_this::*; +} +#[cfg(feature = "hax")] +pub use haxports::*; /// Lua interface pub mod lua;