Skip to content

Commit

Permalink
Add CLI application
Browse files Browse the repository at this point in the history
  • Loading branch information
valadaptive committed Oct 31, 2024
1 parent ee32e2c commit a0ed2ce
Show file tree
Hide file tree
Showing 17 changed files with 993 additions and 185 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/build-workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,18 @@ jobs:
name: ntsc-rs-linux-openfx
path: crates/openfx-plugin/build/

- name: Package Linux binaries
run: |
mkdir ntsc-rs-linux-standalone
cp target/release/ntsc-rs-standalone ntsc-rs-linux-standalone
cp target/release/ntsc-rs-cli ntsc-rs-linux-standalone
- name: Archive Linux binary
uses: actions/upload-artifact@v4
if: ${{ github.ref_type == 'tag' }}
with:
name: ntsc-rs-linux-standalone
path: target/release/ntsc-rs-standalone
path: ntsc-rs-standalone

build-windows:
runs-on: windows-2019
Expand Down Expand Up @@ -131,6 +137,7 @@ jobs:
robocopy $Env:GSTREAMER_1_0_ROOT_MSVC_X86_64 .\ *.dll /s /copy:DT; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null }
robocopy $Env:GSTREAMER_1_0_ROOT_MSVC_X86_64\share\licenses .\licenses /s /copy:DT; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null }
cp ..\target\release\ntsc-rs-standalone.exe .\bin\
cp ..\target\release\ntsc-rs-cli.exe .\bin\
cp ..\target\release\ntsc-rs-launcher.exe .\
- name: Archive Windows binary
Expand Down
138 changes: 128 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions crates/gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ open = "5.1.4"
serde = "1.0"
trash = "5.0.0"
blocking = "1.6.1"
clap = { version = "4.5.17", features = ["cargo"] }
color-eyre = "0.6.3"
console = "0.15.8"

[build-dependencies]
embed-resource = "2.4"
Expand All @@ -36,5 +39,8 @@ name = "ntsc-rs-standalone"
[[bin]]
name = "ntsc-rs-launcher"

[[bin]]
name = "ntsc-rs-cli"

[lints]
workspace = true
18 changes: 17 additions & 1 deletion crates/gui/src/app/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use futures_lite::{Future, FutureExt};
use gstreamer::glib::clone::Downgrade;
use log::trace;

use super::AppFn;
use super::{AppFn, ApplessFn, NtscApp};

struct AppExecutorInner {
executor: Arc<Executor<'static>>,
Expand Down Expand Up @@ -118,3 +118,19 @@ impl AppTaskSpawner {
exec.lock().unwrap().spawn(future);
}
}

pub trait ApplessExecutor: Send + Sync {
fn spawn(&self, future: impl Future<Output = Option<ApplessFn>> + 'static + Send);
}

impl ApplessExecutor for AppExecutor {
fn spawn(&self, future: impl Future<Output = Option<ApplessFn>> + 'static + Send) {
self.spawn(async { future.await.map(|cb| Box::new(|_: &mut NtscApp| cb()) as _) });
}
}

impl ApplessExecutor for AppTaskSpawner {
fn spawn(&self, future: impl Future<Output = Option<ApplessFn>> + 'static + Send) {
self.spawn(async { future.await.map(|cb| Box::new(|_: &mut NtscApp| cb()) as _) });
}
}
Loading

0 comments on commit a0ed2ce

Please sign in to comment.