Skip to content

Commit

Permalink
Add Windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
olimpiu committed Feb 26, 2023
1 parent 8de7150 commit 033b297
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
target
*.DS_Store
*.DS_Store
.vscode
vm/SDL2.dll
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Dependencies:
- The [Rust toolchain](https://www.rust-lang.org/tools/install)
- The [SDL2 libraries](https://wiki.libsdl.org/SDL2/Installation)

To install SDL2 on MacOS:
### To install SDL2 on MacOS:
```
brew install sdl2
```
Expand All @@ -57,7 +57,7 @@ On MacOS, add this to `~/.zprofile`:
export LIBRARY_PATH="$LIBRARY_PATH:$(brew --prefix)/lib"
```

To install SDL2 on Debian/Ubuntu
### To install SDL2 on Debian/Ubuntu:
```
sudo apt-get install libsdl2-dev
```
Expand All @@ -67,7 +67,14 @@ Install the Rust toolchain:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

Compile the project:
### To install SDL2 on Windows:

[Install the Rust toolchain](https://www.rust-lang.org/tools/install)

Get SDL2.dll from one of [SDL2 Releases](https://github.com/libsdl-org/SDL/releases)
Copy `SDL2.dll` (unzip) to the `vm/` folder

### Compile the project:
```
cd vm
cargo build
Expand All @@ -78,6 +85,9 @@ To run the compiled UVM binary:
cargo run <input_file>
```

### To run the test suite:
Run `cargo test` in `vm`, `ncc` and `test` directories

## Codebase Organization

The repository is organized into a 3 different subprojects, each of which is a Rust codebase which can be compiled with `cargo`:
Expand Down
6 changes: 5 additions & 1 deletion ncc/src/cpp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,11 @@ fn process_input_rec(
output += &format!("{}", input.line_no);
}
else if ident == "__FILE__" {
output += &format!("\"{}\"", input.src_name);
let mut filename: String = format!("\"{}\"", input.src_name);
if cfg!(windows) {
filename = str::replace(&filename, "\\", "/");
}
output += &filename;
}
else
{
Expand Down

0 comments on commit 033b297

Please sign in to comment.