Skip to content

Commit c5eb6a4

Browse files
authored
Merge pull request #57 from kamiyaowl/issue-12
Issue 12 ライブラリとして独立させた
2 parents 74be693 + afd218d commit c5eb6a4

30 files changed

+1344
-1230
lines changed

.circleci/config.yml

Lines changed: 4 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -18,63 +18,20 @@ jobs:
1818
- run:
1919
name: rustup component add
2020
command: rustup component add clippy rustfmt
21-
# いまはまだformatもlintも気にしない
22-
# - run:
23-
# name: fmt
24-
# command: cargo fmt -- --check
21+
# debug build and test
2522
- run:
2623
name: build
2724
command: cargo build
28-
# - run:
29-
# name: lint
30-
# command: cargo clippy -- -D warnings
3125
- run:
3226
name: test
33-
command: cargo test -- --test-threads=1
27+
command: cd test && cargo test
3428
when: always
35-
- run:
36-
name: test ignored
37-
command: cargo test -- --test-threads=1 --ignored
38-
when: always
39-
- store_artifacts:
40-
path: test_run_hello_ppu.bmp
41-
destination: hello.bmp
42-
- store_artifacts:
43-
path: nestest_normal_menu.bmp
44-
destination: nestest_normal_menu.bmp
45-
- store_artifacts:
46-
path: nestest_normal.bmp
47-
destination: nestest_normal.bmp
48-
- store_artifacts:
49-
path: nestest_extra_menu.bmp
50-
destination: nestest_extra_menu.bmp
51-
- store_artifacts:
52-
path: nestest_extra.bmp
53-
destination: nestest_extra.bmp
29+
# release build and test
5430
- run:
5531
name: build release
5632
command: cargo build --release
5733
when: always
5834
- run:
5935
name: test release
60-
command: cargo test --release -- --test-threads=1
61-
when: always
62-
- run:
63-
name: test release ignored
64-
command: cargo test --release -- --test-threads=1 --ignored
36+
command: cd test && cargo test --release
6537
when: always
66-
- store_artifacts:
67-
path: test_run_hello_ppu.bmp
68-
destination: release_hello.bmp
69-
- store_artifacts:
70-
path: nestest_normal_menu.bmp
71-
destination: release_nestest_normal_menu.bmp
72-
- store_artifacts:
73-
path: nestest_normal.bmp
74-
destination: release_nestest_normal.bmp
75-
- store_artifacts:
76-
path: nestest_extra_menu.bmp
77-
destination: release_nestest_extra_menu.bmp
78-
- store_artifacts:
79-
path: nestest_extra.bmp
80-
destination: release_nestest_extra.bmp

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Generated by Cargo
22
# will have compiled files and executables
3-
/target/
3+
**/target/
44

55
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
66
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html

.vscode/launch.json

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,16 @@
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
7-
87
{
98
"type": "lldb",
109
"request": "launch",
11-
"name": "Debug executable 'rust-nes-emulator'",
12-
"cargo": {
13-
"args": [
14-
"build",
15-
"--bin=rust-nes-emulator",
16-
"--package=rust-nes-emulator"
17-
],
18-
"filter": {
19-
"name": "rust-nes-emulator",
20-
"kind": "bin"
21-
}
22-
},
23-
"args": [],
24-
"cwd": "${workspaceFolder}",
25-
"preLaunchTask": "cargo build"
26-
},
27-
{
28-
"type": "lldb",
29-
"request": "launch",
30-
"name": "Debug unit tests in executable 'rust-nes-emulator'",
31-
"cargo": {
32-
"args": [
33-
"test",
34-
"--no-run",
35-
"--bin=rust-nes-emulator",
36-
"--package=rust-nes-emulator"
37-
],
38-
"filter": {
39-
"name": "rust-nes-emulator",
40-
"kind": "bin"
41-
}
42-
},
43-
"args": [],
44-
"cwd": "${workspaceFolder}"
10+
"name": "Debug 'rust_nes_emulator_desktop'",
11+
"sourceLanguages": [
12+
"rust",
13+
],
14+
"cwd": "${workspaceFolder}/desktop",
15+
"preLaunchTask": "build desktop",
16+
"program": "${workspaceFolder}/desktop/target/debug/rust-nes-emulator-desktop.exe",
4517
}
4618
]
4719
}

.vscode/tasks.json

Lines changed: 72 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,57 @@
55
"tasks": [
66
{
77
"type": "shell",
8-
"label": "cargo test -- --test-threads=1",
8+
"label": "rustfmt",
99
"command": "cargo",
10+
"options": {
11+
"cwd": "${fileDirname}/../"
12+
},
13+
"args": [
14+
"fmt",
15+
],
16+
"problemMatcher": [
17+
"$rustc"
18+
],
19+
},
20+
{
21+
"type": "shell",
22+
"label": "test",
23+
"command": "cargo",
24+
"options": {
25+
"cwd": "${workspaceFolder}/test"
26+
},
1027
"args": [
1128
"test",
12-
"--",
13-
"--test-threads=1",
1429
],
1530
"problemMatcher": [
1631
"$rustc"
1732
],
1833
},
1934
{
2035
"type": "shell",
21-
"label": "cargo test -- --test-threads=1 --ignored",
36+
"label": "test release",
37+
"command": "cargo",
38+
"options": {
39+
"cwd": "${workspaceFolder}/test"
40+
},
41+
"args": [
42+
"test",
43+
"--release"
44+
],
45+
"problemMatcher": [
46+
"$rustc"
47+
],
48+
},
49+
{
50+
"type": "shell",
51+
"label": "test ignored",
2252
"command": "cargo",
53+
"options": {
54+
"cwd": "${workspaceFolder}/test"
55+
},
2356
"args": [
2457
"test",
2558
"--",
26-
"--test-threads=1",
2759
"--ignored",
2860
],
2961
"problemMatcher": [
@@ -32,33 +64,57 @@
3264
},
3365
{
3466
"type": "shell",
35-
"label": "cargo test -- --test-threads=1 --nocapture",
67+
"label": "test release ignored",
3668
"command": "cargo",
69+
"options": {
70+
"cwd": "${workspaceFolder}/test"
71+
},
3772
"args": [
3873
"test",
74+
"--release",
3975
"--",
40-
"--test-threads=1",
41-
"--nocapture",
76+
"--ignored",
77+
],
78+
"problemMatcher": [
79+
"$rustc"
80+
],
81+
},
82+
{
83+
"type": "shell",
84+
"label": "run desktop",
85+
"command": "cargo",
86+
"options": {
87+
"cwd": "${workspaceFolder}/desktop"
88+
},
89+
"args": [
90+
"run",
4291
],
4392
"problemMatcher": [
4493
"$rustc"
4594
],
4695
},
4796
{
4897
"type": "shell",
49-
"label": "cargo run",
98+
"label": "run desktop release",
5099
"command": "cargo",
100+
"options": {
101+
"cwd": "${workspaceFolder}/desktop"
102+
},
51103
"args": [
52104
"run",
105+
"--release",
53106
],
54107
"problemMatcher": [
55108
"$rustc"
56109
],
57110
},
58111
{
59112
"type": "shell",
60-
"label": "cargo build",
113+
"label": "build desktop",
61114
"command": "cargo",
115+
"options": {
116+
"cwd": "${workspaceFolder}/desktop"
117+
},
62118
"args": [
63119
"build",
64120
],
@@ -68,16 +124,18 @@
68124
},
69125
{
70126
"type": "shell",
71-
"label": "cargo run --release",
127+
"label": "build desktop release",
72128
"command": "cargo",
129+
"options": {
130+
"cwd": "${workspaceFolder}/desktop"
131+
},
73132
"args": [
74-
"run",
75-
"--release",
133+
"build",
134+
"--release"
76135
],
77136
"problemMatcher": [
78137
"$rustc"
79138
],
80139
},
81-
82140
]
83141
}

Cargo.toml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,12 @@ edition = "2018"
77
[features]
88
default = []
99

10+
[profile.dev]
11+
opt-level = 0
12+
13+
[profile.release]
14+
opt-level = 3
15+
1016
[lib]
1117
path = "src/lib.rs"
12-
name = "rust_nes_emulator"
13-
14-
[dependencies]
15-
lazy_static = "1.4.0"
16-
bmp = "*"
17-
image = "0.22.1"
18-
gfx = "0.18.1"
19-
gfx_device_gl = "0.16.2"
20-
piston_window = "0.104.0"
21-
nfd = "0.0.4"
18+
name = "rust_nes_emulator"

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ NES Emulator written in Rust
6767

6868
---
6969

70-
## Build & Run
70+
## Build & Run (for Desktop)
7171

7272
```
73+
$ cd desktop
7374
$ cargo run --release
7475
```
7576

@@ -79,7 +80,7 @@ rustc 1.37.0 required
7980

8081
```
8182
$ docker-compose run build-release
82-
$ ./target/release/rust-nes-emulator
83+
$ ./desktop/target/release/rust-nes-emulator-desktop
8384
```
8485

8586
## Test ROMs

desktop/Cargo.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[package]
2+
name = "rust-nes-emulator-desktop"
3+
version = "0.1.0"
4+
authors = ["K <[email protected]>"]
5+
edition = "2018"
6+
7+
[lib]
8+
path = "src/main.rs"
9+
name = "rust_nes_emulator_desktop"
10+
11+
[profile.dev]
12+
opt-level = 0
13+
14+
[profile.release]
15+
opt-level = 3
16+
17+
[dependencies.rust-nes-emulator]
18+
path = "../"
19+
20+
[dependencies]
21+
bmp = "0.5.0"
22+
image = "0.22.1"
23+
gfx = "0.18.1"
24+
gfx_device_gl = "0.16.2"
25+
piston_window = "0.104.0"
26+
nfd = "0.0.4"

0 commit comments

Comments
 (0)