From 30c03edb64ccc15e13b76fc52364fc91e2a11353 Mon Sep 17 00:00:00 2001 From: Douglas Yau Date: Thu, 24 Nov 2022 15:29:37 -0600 Subject: [PATCH 1/3] Add feature gate for gdcmcharls --- Cargo.toml | 3 +++ build.rs | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index a97fa34..bb21ab0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,3 +25,6 @@ strum_macros = "0.24.2" [lib] name = "gdcm_rs" path = "src/lib.rs" + +[features] +disable-charls = [] diff --git a/build.rs b/build.rs index 4e0668b..711d139 100644 --- a/build.rs +++ b/build.rs @@ -39,7 +39,6 @@ fn build() { // gdcm libs println!("cargo:rustc-link-lib=static=gdcmMSFF"); - println!("cargo:rustc-link-lib=static=gdcmcharls"); println!("cargo:rustc-link-lib=static=gdcmCommon"); println!("cargo:rustc-link-lib=static=gdcmDICT"); println!("cargo:rustc-link-lib=static=gdcmDSED"); @@ -53,6 +52,9 @@ fn build() { println!("cargo:rustc-link-lib=static=gdcmMEXD"); println!("cargo:rustc-link-lib=static=gdcmzlib"); + #[cfg(not(feature="disable-charls"))] + println!("cargo:rustc-link-lib=static=gdcmcharls"); + // FIXME: OSX ONLY println!("Building for {}", env::consts::OS); match env::consts::OS { From ac1206ba5a3d9c80d4af0f99a27ce05d8d16b958 Mon Sep 17 00:00:00 2001 From: Douglas Yau Date: Fri, 25 Nov 2022 15:00:34 -0600 Subject: [PATCH 2/3] Change the flag to enable gdcmcharls instead of disabling it --- Cargo.toml | 2 +- README.md | 2 ++ build.rs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bb21ab0..f8ff58b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,4 +27,4 @@ name = "gdcm_rs" path = "src/lib.rs" [features] -disable-charls = [] +charls = [] diff --git a/README.md b/README.md index a4ae6d9..9e4517c 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,5 @@ Rust bindings for [Grassroots DICOM (GDCM)](https://github.com/malaterre/GDCM). The goal of this project is to provide an easy to use interface with GDCM. This can be used to decode a wide variety of compressed DICOM objects. +### Feature Flags +* `charls` use built-in libcharls diff --git a/build.rs b/build.rs index 711d139..aa7823f 100644 --- a/build.rs +++ b/build.rs @@ -52,7 +52,7 @@ fn build() { println!("cargo:rustc-link-lib=static=gdcmMEXD"); println!("cargo:rustc-link-lib=static=gdcmzlib"); - #[cfg(not(feature="disable-charls"))] + #[cfg(feature="charls")] println!("cargo:rustc-link-lib=static=gdcmcharls"); // FIXME: OSX ONLY From edb760c9a7152440141c1c64bae907af96974a68 Mon Sep 17 00:00:00 2001 From: Douglas Yau Date: Fri, 25 Nov 2022 15:02:13 -0600 Subject: [PATCH 3/3] Add charls flag to the default --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index f8ff58b..efa323a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,4 +27,5 @@ name = "gdcm_rs" path = "src/lib.rs" [features] +default = ["charls"] charls = []