Skip to content

Commit

Permalink
Merge pull request #57 from kamiyaowl/issue-12
Browse files Browse the repository at this point in the history
Issue 12 ライブラリとして独立させた
  • Loading branch information
kamiyaowl authored Sep 14, 2019
2 parents 74be693 + afd218d commit c5eb6a4
Show file tree
Hide file tree
Showing 30 changed files with 1,344 additions and 1,230 deletions.
51 changes: 4 additions & 47 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,63 +18,20 @@ jobs:
- run:
name: rustup component add
command: rustup component add clippy rustfmt
# いまはまだformatもlintも気にしない
# - run:
# name: fmt
# command: cargo fmt -- --check
# debug build and test
- run:
name: build
command: cargo build
# - run:
# name: lint
# command: cargo clippy -- -D warnings
- run:
name: test
command: cargo test -- --test-threads=1
command: cd test && cargo test
when: always
- run:
name: test ignored
command: cargo test -- --test-threads=1 --ignored
when: always
- store_artifacts:
path: test_run_hello_ppu.bmp
destination: hello.bmp
- store_artifacts:
path: nestest_normal_menu.bmp
destination: nestest_normal_menu.bmp
- store_artifacts:
path: nestest_normal.bmp
destination: nestest_normal.bmp
- store_artifacts:
path: nestest_extra_menu.bmp
destination: nestest_extra_menu.bmp
- store_artifacts:
path: nestest_extra.bmp
destination: nestest_extra.bmp
# release build and test
- run:
name: build release
command: cargo build --release
when: always
- run:
name: test release
command: cargo test --release -- --test-threads=1
when: always
- run:
name: test release ignored
command: cargo test --release -- --test-threads=1 --ignored
command: cd test && cargo test --release
when: always
- store_artifacts:
path: test_run_hello_ppu.bmp
destination: release_hello.bmp
- store_artifacts:
path: nestest_normal_menu.bmp
destination: release_nestest_normal_menu.bmp
- store_artifacts:
path: nestest_normal.bmp
destination: release_nestest_normal.bmp
- store_artifacts:
path: nestest_extra_menu.bmp
destination: release_nestest_extra_menu.bmp
- store_artifacts:
path: nestest_extra.bmp
destination: release_nestest_extra.bmp
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Cargo
# will have compiled files and executables
/target/
**/target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Expand Down
42 changes: 7 additions & 35 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,16 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"type": "lldb",
"request": "launch",
"name": "Debug executable 'rust-nes-emulator'",
"cargo": {
"args": [
"build",
"--bin=rust-nes-emulator",
"--package=rust-nes-emulator"
],
"filter": {
"name": "rust-nes-emulator",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}",
"preLaunchTask": "cargo build"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug unit tests in executable 'rust-nes-emulator'",
"cargo": {
"args": [
"test",
"--no-run",
"--bin=rust-nes-emulator",
"--package=rust-nes-emulator"
],
"filter": {
"name": "rust-nes-emulator",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
"name": "Debug 'rust_nes_emulator_desktop'",
"sourceLanguages": [
"rust",
],
"cwd": "${workspaceFolder}/desktop",
"preLaunchTask": "build desktop",
"program": "${workspaceFolder}/desktop/target/debug/rust-nes-emulator-desktop.exe",
}
]
}
86 changes: 72 additions & 14 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,57 @@
"tasks": [
{
"type": "shell",
"label": "cargo test -- --test-threads=1",
"label": "rustfmt",
"command": "cargo",
"options": {
"cwd": "${fileDirname}/../"
},
"args": [
"fmt",
],
"problemMatcher": [
"$rustc"
],
},
{
"type": "shell",
"label": "test",
"command": "cargo",
"options": {
"cwd": "${workspaceFolder}/test"
},
"args": [
"test",
"--",
"--test-threads=1",
],
"problemMatcher": [
"$rustc"
],
},
{
"type": "shell",
"label": "cargo test -- --test-threads=1 --ignored",
"label": "test release",
"command": "cargo",
"options": {
"cwd": "${workspaceFolder}/test"
},
"args": [
"test",
"--release"
],
"problemMatcher": [
"$rustc"
],
},
{
"type": "shell",
"label": "test ignored",
"command": "cargo",
"options": {
"cwd": "${workspaceFolder}/test"
},
"args": [
"test",
"--",
"--test-threads=1",
"--ignored",
],
"problemMatcher": [
Expand All @@ -32,33 +64,57 @@
},
{
"type": "shell",
"label": "cargo test -- --test-threads=1 --nocapture",
"label": "test release ignored",
"command": "cargo",
"options": {
"cwd": "${workspaceFolder}/test"
},
"args": [
"test",
"--release",
"--",
"--test-threads=1",
"--nocapture",
"--ignored",
],
"problemMatcher": [
"$rustc"
],
},
{
"type": "shell",
"label": "run desktop",
"command": "cargo",
"options": {
"cwd": "${workspaceFolder}/desktop"
},
"args": [
"run",
],
"problemMatcher": [
"$rustc"
],
},
{
"type": "shell",
"label": "cargo run",
"label": "run desktop release",
"command": "cargo",
"options": {
"cwd": "${workspaceFolder}/desktop"
},
"args": [
"run",
"--release",
],
"problemMatcher": [
"$rustc"
],
},
{
"type": "shell",
"label": "cargo build",
"label": "build desktop",
"command": "cargo",
"options": {
"cwd": "${workspaceFolder}/desktop"
},
"args": [
"build",
],
Expand All @@ -68,16 +124,18 @@
},
{
"type": "shell",
"label": "cargo run --release",
"label": "build desktop release",
"command": "cargo",
"options": {
"cwd": "${workspaceFolder}/desktop"
},
"args": [
"run",
"--release",
"build",
"--release"
],
"problemMatcher": [
"$rustc"
],
},

]
}
17 changes: 7 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ edition = "2018"
[features]
default = []

[profile.dev]
opt-level = 0

[profile.release]
opt-level = 3

[lib]
path = "src/lib.rs"
name = "rust_nes_emulator"

[dependencies]
lazy_static = "1.4.0"
bmp = "*"
image = "0.22.1"
gfx = "0.18.1"
gfx_device_gl = "0.16.2"
piston_window = "0.104.0"
nfd = "0.0.4"
name = "rust_nes_emulator"
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ NES Emulator written in Rust

---

## Build & Run
## Build & Run (for Desktop)

```
$ cd desktop
$ cargo run --release
```

Expand All @@ -79,7 +80,7 @@ rustc 1.37.0 required

```
$ docker-compose run build-release
$ ./target/release/rust-nes-emulator
$ ./desktop/target/release/rust-nes-emulator-desktop
```

## Test ROMs
Expand Down
26 changes: 26 additions & 0 deletions desktop/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "rust-nes-emulator-desktop"
version = "0.1.0"
authors = ["K <[email protected]>"]
edition = "2018"

[lib]
path = "src/main.rs"
name = "rust_nes_emulator_desktop"

[profile.dev]
opt-level = 0

[profile.release]
opt-level = 3

[dependencies.rust-nes-emulator]
path = "../"

[dependencies]
bmp = "0.5.0"
image = "0.22.1"
gfx = "0.18.1"
gfx_device_gl = "0.16.2"
piston_window = "0.104.0"
nfd = "0.0.4"
Loading

0 comments on commit c5eb6a4

Please sign in to comment.