Skip to content

Commit

Permalink
Make cxx a feature
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchalmers committed Dec 8, 2023
1 parent de23b0a commit a860cec
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,14 @@ jobs:
components: clippy
- uses: Swatinem/[email protected]

- name: cargo clippy
- name: Run clippy
shell: bash
run: |
cargo clippy --tests --benches --workspace --examples -- -D warnings
run: cargo clippy --tests --benches --workspace --examples -- -D warnings
env:
RUST_BACKTRACE: 1
- name: Run clippy (all features)
shell: bash
run: cargo clippy --tests --benches --workspace --examples --all-features -- -D warnings
env:
RUST_BACKTRACE: 1

Expand Down
6 changes: 5 additions & 1 deletion modeling-cmds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license = "MIT"

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

[lints]
workspace = true

[features]
default = []
cxx = ["dep:cxx"]
1 change: 1 addition & 0 deletions modeling-cmds/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub mod format;
/// Modeling command IDs, used to associated requests and responses.
/// Also used to construct commands which refer to previous commands.
pub mod id;
#[cfg(feature = "cxx")]
pub mod impl_extern_type;
mod impl_traits;
/// When a modeling command is successful, these responses could be returned.
Expand Down
5 changes: 4 additions & 1 deletion modeling-cmds/src/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ use parse_display_derive::{Display, FromStr};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use crate::{impl_extern_type, units::UnitAngle};
#[cfg(feature = "cxx")]
use crate::impl_extern_type;
use crate::units::UnitAngle;

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

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

0 comments on commit a860cec

Please sign in to comment.