質問編集履歴

3

試したこと の修正

2023/04/24 11:56

投稿

rumia_ch
rumia_ch

スコア19

test CHANGED
File without changes
test CHANGED
@@ -126,6 +126,9 @@
126
126
  }
127
127
  ```
128
128
 
129
+ extern crate windres; を build.rs内から削除 --> 変化なし
130
+
131
+
129
132
  ソースコード自体から winres に関する行を削除するとwasmビルド時でも動く。
130
133
 
131
134
 

2

cargo.toml内 に [target.'cfg(target_family="windows")'.build-dependencies] を記入

2023/04/24 11:53

投稿

rumia_ch
rumia_ch

スコア19

test CHANGED
File without changes
test CHANGED
@@ -106,7 +106,7 @@
106
106
 
107
107
  [package.metadata.winres]
108
108
  OriginalFilename = "PROGRAM.EXE"
109
- LegalCopyright = "Copyright ©BHM 2023"
109
+ LegalCopyright = "Copyright 著作者"
110
110
  ```
111
111
  ほぼ [eframe template](https://github.com/emilk/eframe_template) そのまま
112
112
  ### 試したこと

1

Cargo.toml の追加 build.rs, 内の extern crate windres; の削除

2023/04/24 11:50

投稿

rumia_ch
rumia_ch

スコア19

test CHANGED
File without changes
test CHANGED
@@ -34,7 +34,6 @@
34
34
  ```build.rs
35
35
  #[cfg(target_family="windows")]
36
36
  fn only_win(){
37
- extern crate windres;
38
37
  use windres::Build;
39
38
  Build::new().compile("assets/icon.rc").unwrap();
40
39
  }
@@ -45,6 +44,71 @@
45
44
  }
46
45
  ```
47
46
 
47
+ ```Cargo.toml
48
+ [package]
49
+ name = "ソフト名"
50
+ version = "0.1.0"
51
+ authors = ["名前"]
52
+ edition = "2021"
53
+ rust-version = "1.68"
54
+ build = "build.rs"
55
+
56
+
57
+ [dependencies]
58
+ egui = "0.21.0"
59
+ eframe = { version = "0.21.0", default-features = false, features = [
60
+ "accesskit", # Make egui comptaible with screen readers. NOTE: adds a lot of dependencies.
61
+ "default_fonts", # Embed the default egui fonts.
62
+ "glow", # Use the glow rendering backend. Alternative: "wgpu".
63
+ "persistence", # Enable restoring app state when restarting the app.
64
+ ] }
65
+ kira = "0.7.3"
66
+
67
+ # You only need serde if you want app persistence:
68
+ serde = { version = "1", features = ["derive"] }
69
+
70
+ # native:
71
+ [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
72
+ tracing-subscriber = "0.3"
73
+
74
+ # web:
75
+ [target.'cfg(target_arch = "wasm32")'.dependencies]
76
+ console_error_panic_hook = "0.1.6"
77
+ tracing-wasm = "0.2"
78
+ wasm-bindgen-futures = "0.4"
79
+
80
+
81
+ [profile.release]
82
+ opt-level = 2 # fast and small wasm
83
+
84
+ # Optimize all dependencies even in debug builds:
85
+ [profile.dev.package."*"]
86
+ opt-level = 2
87
+
88
+
89
+ [patch.crates-io]
90
+
91
+ # If you want to use the bleeding edge version of egui and eframe:
92
+ # egui = { git = "https://github.com/emilk/egui", branch = "master" }
93
+ # eframe = { git = "https://github.com/emilk/egui", branch = "master" }
94
+
95
+ # If you fork https://github.com/emilk/egui you can test with:
96
+ # egui = { path = "../egui/crates/egui" }
97
+ # eframe = { path = "../egui/crates/eframe" }
98
+
99
+ # ビルド設定
100
+
101
+ #[build-dependencies]
102
+ #cfg-if = "1.0.0"
103
+
104
+ [target.'cfg(all(target_family="windows",not(target_family="wasm")))'.build-dependencies]
105
+ windres = "0.2"
106
+
107
+ [package.metadata.winres]
108
+ OriginalFilename = "PROGRAM.EXE"
109
+ LegalCopyright = "Copyright ©BHM 2023"
110
+ ```
111
+ ほぼ [eframe template](https://github.com/emilk/eframe_template) そのまま
48
112
  ### 試したこと
49
113
 
50
114
  all と not を使って完全にwasmの条件を排除しようとしてもダメだった。