diff options
author | Akshay <[email protected]> | 2020-07-23 18:36:22 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2020-07-23 18:36:22 +0100 |
commit | d7c303dda4750a432478c94b3ed41bca1352d839 (patch) | |
tree | dccaba932e18a1414d91a67246fba3e0890d27f0 | |
parent | 2f47f50b0382491099391185c6a2702b1370b206 (diff) |
enable feature based compilation to support windowsv0.2.2-alpha
-rw-r--r-- | .github/workflows/main.yml | 6 | ||||
-rw-r--r-- | Cargo.toml | 5 | ||||
-rw-r--r-- | src/main.rs | 4 |
3 files changed, 9 insertions, 6 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e2995b8..5c3e6f9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml | |||
@@ -39,7 +39,7 @@ jobs: | |||
39 | && sudo apt-get install -y \ | 39 | && sudo apt-get install -y \ |
40 | libdbus-1-dev | 40 | libdbus-1-dev |
41 | - name: Build | 41 | - name: Build |
42 | run: cargo build --all --release && strip target/release/dijo | 42 | run: cargo build -all --no-default-features --features unix --release && strip target/release/dijo |
43 | 43 | ||
44 | - name: Upload binaries to release | 44 | - name: Upload binaries to release |
45 | uses: svenstaro/upload-release-action@v1-release | 45 | uses: svenstaro/upload-release-action@v1-release |
@@ -72,7 +72,7 @@ jobs: | |||
72 | override: true | 72 | override: true |
73 | 73 | ||
74 | - name: Build for mac | 74 | - name: Build for mac |
75 | run: cargo build --all --release && strip target/release/dijo | 75 | run: cargo build --all --no-default-features --features unix --release && strip target/release/dijo |
76 | 76 | ||
77 | - name: Upload binaries to release | 77 | - name: Upload binaries to release |
78 | uses: svenstaro/upload-release-action@v1-release | 78 | uses: svenstaro/upload-release-action@v1-release |
@@ -106,7 +106,7 @@ jobs: | |||
106 | 106 | ||
107 | - name: Build for windows | 107 | - name: Build for windows |
108 | run: | | 108 | run: | |
109 | cargo build --all --release | 109 | cargo build --all --no-default-features --features windows --release |
110 | strip target/release/dijo | 110 | strip target/release/dijo |
111 | 111 | ||
112 | - name: Upload binaries to release | 112 | - name: Upload binaries to release |
@@ -23,7 +23,10 @@ notify = "4.0" | |||
23 | [dependencies.cursive] | 23 | [dependencies.cursive] |
24 | version = "0.15" | 24 | version = "0.15" |
25 | default-features = false | 25 | default-features = false |
26 | features = ["termion-backend", "crossterm-backend"] | 26 | |
27 | [features] | ||
28 | unix = ["cursive/termion-backend"] | ||
29 | windows = ["cursive/crossterm-backend"] | ||
27 | 30 | ||
28 | [dependencies.chrono] | 31 | [dependencies.chrono] |
29 | version = "0.4" | 32 | version = "0.4" |
diff --git a/src/main.rs b/src/main.rs index dec3156..609738e 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -13,7 +13,7 @@ use crate::utils::{load_configuration_file, AppConfig}; | |||
13 | 13 | ||
14 | use clap::{App as ClapApp, Arg}; | 14 | use clap::{App as ClapApp, Arg}; |
15 | 15 | ||
16 | #[cfg(target_os = "linux")] | 16 | #[cfg(any(target_os = "linux", target_os = "macos"))] |
17 | use cursive::termion; | 17 | use cursive::termion; |
18 | 18 | ||
19 | #[cfg(target_os = "windows")] | 19 | #[cfg(target_os = "windows")] |
@@ -71,7 +71,7 @@ fn main() { | |||
71 | #[cfg(target_os = "windows")] | 71 | #[cfg(target_os = "windows")] |
72 | let mut s = crossterm().unwrap(); | 72 | let mut s = crossterm().unwrap(); |
73 | 73 | ||
74 | #[cfg(target_os = "linux")] | 74 | #[cfg(any(target_os = "linux", target_os = "macos"))] |
75 | let mut s = termion().unwrap(); | 75 | let mut s = termion().unwrap(); |
76 | 76 | ||
77 | let app = App::load_state(); | 77 | let app = App::load_state(); |