Skip to content

Commit

Permalink
Merge branch 'window-frame' of github.com:/aspectron/kaspa-ng into cu…
Browse files Browse the repository at this point in the history
…mulative-1
  • Loading branch information
aspect committed Jan 9, 2024
2 parents 0c18c9c + df8e7b1 commit 3fba9c8
Show file tree
Hide file tree
Showing 11 changed files with 666 additions and 416 deletions.
124 changes: 48 additions & 76 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ jobs:
name: Check
runs-on: ubuntu-latest
steps:

- name: Install desktop dependencies
run: |
sudo apt install -y libglib2.0-dev libatk1.0-dev libgtk-3-dev
- name: Checkout sources
uses: actions/checkout@v3

Expand Down Expand Up @@ -79,6 +84,10 @@ jobs:

swap-storage: true

- name: Install desktop dependencies
run: |
sudo apt install -y libglib2.0-dev libatk1.0-dev libgtk-3-dev
- name: Checkout sources
uses: actions/checkout@v3

Expand Down Expand Up @@ -124,6 +133,11 @@ jobs:
name: Lints
runs-on: ubuntu-latest
steps:

- name: Install desktop dependencies
run: |
sudo apt install -y libglib2.0-dev libatk1.0-dev libgtk-3-dev
- name: Checkout sources
uses: actions/checkout@v3

Expand Down Expand Up @@ -152,11 +166,10 @@ jobs:
run: cargo fmt --all -- --check

- name: Run cargo clippy
run: cargo clippy --workspace --tests --benches -- -D warnings

run: cargo clippy --workspace --all-targets --tests --benches -- -D warnings

check-wasm32:
name: Check Wasm32
wasm32:
name: Wasm32
runs-on: ubuntu-latest
steps:
- name: Checkout sources
Expand Down Expand Up @@ -189,72 +202,18 @@ jobs:
sudo apt-get update
sudo apt install -y gcc-multilib
- name: Install stable toolchain
if: steps.install_llvm.outcome == 'success' && steps.install_llvm.conclusion == 'success'
uses: dtolnay/rust-toolchain@stable

- name: Add wasm32 target
run: rustup target add wasm32-unknown-unknown

- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

# append here any new wasm32 crate not already covered by the existing checks

- name: Run cargo check for wasm32 target
run: cargo clippy --target wasm32-unknown-unknown

build-wasm32:
name: Build Wasm32
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install llvm
id: install_llvm
continue-on-error: true
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo apt-get install -y clang-15 lldb-15 lld-15 clangd-15 clang-tidy-15 clang-format-15 clang-tools-15 llvm-15-dev lld-15 lldb-15 llvm-15-tools libomp-15-dev libc++-15-dev libc++abi-15-dev libclang-common-15-dev libclang-15-dev libclang-cpp15-dev libunwind-15-dev
# Make Clang 15 default
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-15/bin/clang++ 100
sudo update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-15/bin/clang 100
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/lib/llvm-15/bin/clang-format 100
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/lib/llvm-15/bin/clang-tidy 100
sudo update-alternatives --install /usr/bin/run-clang-tidy run-clang-tidy /usr/lib/llvm-15/bin/run-clang-tidy 100
# Alias cc to clang
sudo update-alternatives --install /usr/bin/cc cc /usr/lib/llvm-15/bin/clang 0
sudo update-alternatives --install /usr/bin/c++ c++ /usr/lib/llvm-15/bin/clang++ 0
- name: Install gcc-multilib
# gcc-multilib allows clang to find gnu libraries properly
- name: Install desktop dependencies
run: |
sudo apt-get update
sudo apt install -y gcc-multilib
sudo apt install -y libglib2.0-dev libatk1.0-dev libgtk-3-dev
- name: Install stable toolchain
if: steps.install_llvm.outcome == 'success' && steps.install_llvm.conclusion == 'success'
uses: dtolnay/rust-toolchain@stable

- name: Cargo install wasm-pack
run: cargo install wasm-pack

- name: Cargo install trunk
run: cargo install trunk
- name: Cargo install wasm-pack and trunk
run: |
cargo install wasm-pack
cargo install trunk
- name: Add wasm32 target
run: rustup target add wasm32-unknown-unknown
Expand All @@ -270,24 +229,37 @@ jobs:
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build Chrome Browser Extension
run: rm -rf ./dist-chrome
run: mkdir ./dist-chrome
run: mkdir ./dist-chrome/icons
# - name: Run cargo check for wasm32 target
# run: cargo clippy --target wasm32-unknown-unknown

run: cp -r ./resources/icons ./dist-chrome/
run: cp ./resources/style.css ./dist-chrome/
run: cp ./extensions/chrome/manifest.json ./dist-chrome/
run: cp ./extensions/chrome/popup.html ./dist-chrome/
run: cp ./extensions/chrome/popup.js ./dist-chrome/
run: cp ./extensions/chrome/background.js ./dist-chrome/
- name: Build Web App
run: |
trunk build --release
run: wasm-pack build --target web --out-name kaspa-ng --out-dir ../../dist-chrome ./extensions/chrome
- name: Build Chrome Browser Extension
run: |
rm -rf ./dist-chrome
mkdir ./dist-chrome
mkdir ./dist-chrome/icons
# copy resources
cp -r ./resources/icons ./dist-chrome/
cp ./resources/style.css ./dist-chrome/
cp ./extensions/chrome/manifest.json ./dist-chrome/
cp ./extensions/chrome/popup.html ./dist-chrome/
cp ./extensions/chrome/popup.js ./dist-chrome/
cp ./extensions/chrome/background.js ./dist-chrome/
# build
wasm-pack build --target web --out-name kaspa-ng --out-dir ../../dist-chrome ./extensions/chrome
build-release:
name: Build Ubuntu Release
name: Ubuntu Release
runs-on: ubuntu-latest
steps:

- name: Install desktop dependencies
run: |
sudo apt install -y libglib2.0-dev libatk1.0-dev libgtk-3-dev
- name: Checkout sources
uses: actions/checkout@v3

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ jobs:
if: runner.os == 'Windows'
run: git config --global core.autocrlf false

- name: Install desktop dependencies
run: |
sudo apt install -y libglib2.0-dev libatk1.0-dev libgtk-3-dev librust-atk-dev
- name: Checkout sources
uses: actions/checkout@v3

Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ With Kaspa-ng you can run a full node and a wallet on your desktop as well as co

To build this project, you need to be able to build Rusty Kaspa. If you have not built Rusty Kaspa before, please follow the Rusty Kaspa [build instructions](https://github.com/kaspanet/rusty-kaspa/blob/master/README.md).

In addition, on linux, you need to perform the following installs:

#### Ubuntu/Debian:
```bash
sudo apt-get install libglib2.0-dev libatk1.0-dev libgtk-3-dev librust-atk-dev
```

#### Fedora:
```bash
sudo dnf install glib2-devel atk-devel gtk3-devel
```

Once you have Rusty Kaspa built, you will be able to build and run this project as follows:

#### Running as Native App
Expand Down
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ egui_plot.workspace = true
egui_extras.workspace = true
chrono.workspace = true
eframe = { workspace = true, default-features = false, features = [
# "accesskit", # Make egui comptaible with screen readers. NOTE: adds a lot of dependencies.
"accesskit", # Make egui comptaible with screen readers. NOTE: adds a lot of dependencies.
"default_fonts", # Embed the default egui fonts.
# "wgpu", # Use the glow rendering backend. Alternative: "wgpu".
"glow", # Use the glow rendering backend. Alternative: "wgpu".
Expand Down
27 changes: 19 additions & 8 deletions core/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,25 @@ cfg_if! {

let runtime: Arc<Mutex<Option<runtime::Runtime>>> = Arc::new(Mutex::new(None));
let delegate = runtime.clone();

let window_frame = true;

let mut viewport = egui::ViewportBuilder::default()
.with_resizable(true)
.with_title(i18n("Kaspa NG"))
.with_min_inner_size([400.0,320.0])
.with_inner_size([1000.0,600.0])
.with_icon(svg_to_icon_data(KASPA_NG_ICON_SVG, FitTo::Size(256,256)));

if window_frame {
viewport = viewport
.with_decorations(false)
.with_transparent(true);
}

let native_options = eframe::NativeOptions {
persist_window : true,
viewport: egui::ViewportBuilder::default()
.with_resizable(true)
.with_title(i18n("Kaspa NG"))
.with_min_inner_size([400.0,320.0])
.with_inner_size([1000.0,600.0])
.with_icon(svg_to_icon_data(KASPA_NG_ICON_SVG, FitTo::Size(256,256))),
viewport,
..Default::default()
};
eframe::run_native(
Expand All @@ -239,7 +250,7 @@ cfg_if! {
runtime::signals::Signals::bind(&runtime);
runtime.start();

Box::new(kaspa_ng_core::Core::new(cc, runtime, settings))
Box::new(kaspa_ng_core::Core::new(cc, runtime, settings, window_frame))
}),
)?;

Expand Down Expand Up @@ -307,7 +318,7 @@ cfg_if! {
&JsValue::from(adaptor),
).expect("failed to set adaptor");

Box::new(kaspa_ng_core::Core::new(cc, runtime, settings))
Box::new(kaspa_ng_core::Core::new(cc, runtime, settings, false))
}),
)
.await
Expand Down
Loading

0 comments on commit 3fba9c8

Please sign in to comment.