Skip to content

Commit 30f9d8f

Browse files
authored
Make cxx a feature (#11)
1 parent de23b0a commit 30f9d8f

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,14 @@ jobs:
4949
components: clippy
5050
- uses: Swatinem/[email protected]
5151

52-
- name: cargo clippy
52+
- name: Run clippy
5353
shell: bash
54-
run: |
55-
cargo clippy --tests --benches --workspace --examples -- -D warnings
54+
run: cargo clippy --tests --benches --workspace --examples -- -D warnings
55+
env:
56+
RUST_BACKTRACE: 1
57+
- name: Run clippy (all features)
58+
shell: bash
59+
run: cargo clippy --tests --benches --workspace --examples --all-features -- -D warnings
5660
env:
5761
RUST_BACKTRACE: 1
5862

@@ -81,8 +85,7 @@ jobs:
8185
- name: Set up Python
8286
uses: actions/setup-python@v4
8387
- name: Install codespell
84-
run: |
85-
python -m pip install codespell
88+
run: python -m pip install codespell
8689
- name: Run codespell
8790
# Edit this file to tweak the typo list and other configuration.
8891
run: codespell --config .codespellrc

modeling-cmds/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ license = "MIT"
1212

1313
[dependencies]
1414
chrono = "0.4.31"
15-
cxx = "1.0"
15+
cxx = { version = "1.0", optional = true }
1616
data-encoding = "2.5.0"
1717
diesel = { version = "2.1.1", features = ["serde_json", "mysql", "chrono", "r2d2", "uuid", "numeric"] }
1818
diesel_derives = "2.1.2"
@@ -31,3 +31,7 @@ uuid = { version = "1.6.1", features = ["serde"] }
3131

3232
[lints]
3333
workspace = true
34+
35+
[features]
36+
default = []
37+
cxx = ["dep:cxx"]

modeling-cmds/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub mod format;
1212
/// Modeling command IDs, used to associated requests and responses.
1313
/// Also used to construct commands which refer to previous commands.
1414
pub mod id;
15+
#[cfg(feature = "cxx")]
1516
pub mod impl_extern_type;
1617
mod impl_traits;
1718
/// When a modeling command is successful, these responses could be returned.

modeling-cmds/src/shared.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ use parse_display_derive::{Display, FromStr};
77
use schemars::JsonSchema;
88
use serde::{Deserialize, Serialize};
99

10-
use crate::{impl_extern_type, units::UnitAngle};
10+
#[cfg(feature = "cxx")]
11+
use crate::impl_extern_type;
12+
use crate::units::UnitAngle;
1113

1214
// A helper macro for allowing enums of only strings to be saved to the database.
1315
macro_rules! impl_string_enum_sql {
@@ -726,6 +728,7 @@ impl_string_enum_sql! {FileImportFormat}
726728

727729
// Enum: Connect Rust Enums to Cpp
728730
// add our native c++ names for our cxx::ExternType implementation
731+
#[cfg(feature = "cxx")]
729732
impl_extern_type! {
730733
[Trivial]
731734
// File

0 commit comments

Comments
 (0)