Skip to content

Commit

Permalink
enable feature based compilation to support windows
Browse files Browse the repository at this point in the history
  • Loading branch information
oppiliappan committed Jul 23, 2020
1 parent 2f47f50 commit d7c303d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
&& sudo apt-get install -y \
libdbus-1-dev
- name: Build
run: cargo build --all --release && strip target/release/dijo
run: cargo build -all --no-default-features --features unix --release && strip target/release/dijo

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
override: true

- name: Build for mac
run: cargo build --all --release && strip target/release/dijo
run: cargo build --all --no-default-features --features unix --release && strip target/release/dijo

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:

- name: Build for windows
run: |
cargo build --all --release
cargo build --all --no-default-features --features windows --release
strip target/release/dijo
- name: Upload binaries to release
Expand Down
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ notify = "4.0"
[dependencies.cursive]
version = "0.15"
default-features = false
features = ["termion-backend", "crossterm-backend"]

[features]
unix = ["cursive/termion-backend"]
windows = ["cursive/crossterm-backend"]

[dependencies.chrono]
version = "0.4"
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::utils::{load_configuration_file, AppConfig};

use clap::{App as ClapApp, Arg};

#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "macos"))]
use cursive::termion;

#[cfg(target_os = "windows")]
Expand Down Expand Up @@ -71,7 +71,7 @@ fn main() {
#[cfg(target_os = "windows")]
let mut s = crossterm().unwrap();

#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "macos"))]
let mut s = termion().unwrap();

let app = App::load_state();
Expand Down

0 comments on commit d7c303d

Please sign in to comment.