Custom window title #8
5 changed files with 54 additions and 17 deletions
14
Cargo.toml
14
Cargo.toml
|
@ -9,9 +9,21 @@ keywords = [ "crypto", "grin", "mimblewimble" ]
|
|||
edition = "2021"
|
||||
build = "src/build/build.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "grim-bin"
|
||||
path = "src/main.rs"
|
||||
|
||||
[lib]
|
||||
name="grim"
|
||||
crate_type=["cdylib", "rlib"]
|
||||
crate-type = ["rlib"]
|
||||
|
||||
[profile.release-apk]
|
||||
inherits = "release"
|
||||
strip = true
|
||||
opt-level = "z"
|
||||
lto = true
|
||||
codegen-units = 1
|
||||
panic = "abort"
|
||||
|
||||
[dependencies]
|
||||
log = "0.4"
|
||||
|
|
|
@ -18,7 +18,7 @@ To build and run application go to project directory and run:
|
|||
|
||||
```
|
||||
cargo build --release
|
||||
./target/release/grim
|
||||
./target/release/grim-bin
|
||||
```
|
||||
|
||||
### Android
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
case $1 in
|
||||
x86|arm)
|
||||
x86|arm|all)
|
||||
;;
|
||||
*)
|
||||
echo "Usage: release_macos.sh [platform]\n - platform: 'x86', 'arm'" >&2
|
||||
echo "Usage: release_macos.sh [platform]\n - platform: 'x86', 'arm', 'all'" >&2
|
||||
exit 1
|
||||
esac
|
||||
|
||||
|
@ -23,23 +24,31 @@ BASEDIR=$(cd $(dirname $0) && pwd)
|
|||
cd ${BASEDIR}
|
||||
cd ..
|
||||
|
||||
# Setup platform argument
|
||||
# Setup platform
|
||||
rustup target add x86_64-apple-darwin
|
||||
rustup target add aarch64-apple-darwin
|
||||
|
||||
rm -rf target/x86_64-apple-darwin
|
||||
rm -rf target/aarch64-apple-darwin
|
||||
|
||||
[[ $1 == "x86" ]] && arch+=(x86_64-apple-darwin)
|
||||
[[ $1 == "arm" ]] && arch+=(aarch64-apple-darwin)
|
||||
[[ $1 == "all" ]] && arch+=(universal2-apple-darwin)
|
||||
|
||||
# Start release build with zig linker for cross-compilation
|
||||
cargo install cargo-zigbuild
|
||||
# zig 0.12 required
|
||||
cargo install cargo-zigbuild@0.18.4
|
||||
cargo zigbuild --release --target ${arch}
|
||||
rm .intentionally-empty-file.o
|
||||
yes | cp -rf target/${arch}/release/grim macos/Grim.app/Contents/MacOS/grim-bin
|
||||
rm -rf .intentionally-empty-file.o
|
||||
yes | cp -rf target/${arch}/release/grim-bin macos/Grim.app/Contents/MacOS
|
||||
|
||||
### Sign .app before distribution:
|
||||
### rcodesign generate-self-signed-certificate
|
||||
### rcodesign sign --pem-file cert.pem macos/Grim.app
|
||||
### Sign .app resources:
|
||||
#rcodesign generate-self-signed-certificate
|
||||
#rcodesign sign --pem-file cert.pem macos/Grim.app
|
||||
|
||||
# Create release package
|
||||
FILE_NAME=Grim-0.1.0-macos-$1.zip
|
||||
rm target/${arch}/release/${FILE_NAME}
|
||||
rm -rf target/${arch}/release/${FILE_NAME}
|
||||
cd macos
|
||||
zip -r ${FILE_NAME} Grim.app
|
||||
mv ${FILE_NAME} ../target/${arch}/release
|
|
@ -24,7 +24,7 @@ cd ..
|
|||
|
||||
# Setup release argument
|
||||
type=$1
|
||||
[[ ${type} == "release" ]] && release_param+=(--release)
|
||||
[[ ${type} == "release" ]] && release_param="--profile release-apk"
|
||||
|
||||
# Setup platform argument
|
||||
[[ $2 == "v7" ]] && arch+=(armeabi-v7a)
|
||||
|
@ -39,12 +39,29 @@ type=$1
|
|||
[[ $2 == "v8" ]] && rustup target install aarch64-linux-android
|
||||
|
||||
# Build native code
|
||||
mkdir -p android/app/src/main/jniLibs
|
||||
cargo install cargo-ndk
|
||||
|
||||
rm -rf target/aarch64-linux-android
|
||||
rm -rf target/armv7-linux-androideabi
|
||||
mkdir -p android/app/src/main/jniLibs
|
||||
|
||||
sed -i -e 's/"rlib"/"rlib","cdylib"/g' Cargo.toml
|
||||
|
||||
# temp fix for https://stackoverflow.com/questions/57193895/error-use-of-undeclared-identifier-pthread-mutex-robust-cargo-build-liblmdb-s
|
||||
success=0
|
||||
export CPPFLAGS="-DMDB_USE_ROBUST=0" && export CFLAGS="-DMDB_USE_ROBUST=0"
|
||||
cargo ndk -t ${arch} -o android/app/src/main/jniLibs build ${release_param}
|
||||
unset CPPFLAGS && unset CFLAGS
|
||||
cargo ndk -t ${arch} -o android/app/src/main/jniLibs build ${release_param}
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
success=1
|
||||
fi
|
||||
|
||||
sed -i -e 's/"rlib","cdylib"/"rlib"/g' Cargo.toml
|
||||
|
||||
# Build Android application and launch at all connected devices
|
||||
if [ $? -eq 0 ]
|
||||
if [ $success -eq 1 ]
|
||||
then
|
||||
cd android
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
|
||||
#![windows_subsystem = "windows"]
|
||||
|
||||
use egui::os::OperatingSystem;
|
||||
|
||||
pub fn main() {
|
||||
#[allow(dead_code)]
|
||||
#[cfg(not(target_os = "android"))]
|
||||
|
@ -37,6 +35,7 @@ fn real_main() {
|
|||
|
||||
use std::sync::Arc;
|
||||
use egui::pos2;
|
||||
use egui::os::OperatingSystem;
|
||||
use eframe::icon_data::from_png_bytes;
|
||||
|
||||
let platform = Desktop::default();
|
||||
|
|
Loading…
Reference in a new issue