Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make cxx a feature #11

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 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 Expand Up @@ -81,8 +85,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
- name: Install codespell
run: |
python -m pip install codespell
run: python -m pip install codespell
- name: Run codespell
# Edit this file to tweak the typo list and other configuration.
run: codespell --config .codespellrc
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
Loading