MathisWellmann / gym-rs

OpenAI's Gym written in pure Rust for blazingly fast performance
MIT License
77 stars 15 forks source link

Update readme to make it easier to use gym-rs on windows #6

Closed aDecoy closed 11 months ago

aDecoy commented 1 year ago

Hi, i had a bit of problems with SDL2 install, but found out that cargo can bring it in for us. I belive this will make gym-rs easier to get started with and use.

Not sure if it should be added in toml, or just as a hint in README.md

[dependencies.sdl2]
version = "0.35.2"
default-features = false
features = ["static-link", "use-vcpkg", "gfx"]

[package.metadata.vcpkg]
dependencies = ["sdl2", "sdl2-gfx"]
git = "https://github.com/microsoft/vcpkg"
rev = "501db0f"

[package.metadata.vcpkg.target]
x86_64-pc-windows-msvc = { triplet = "x64-windows-static-md" }
aDecoy commented 1 year ago

Context that i forgot to add: I was on a windows laptop. I am guessing this is only really relevant for windows users

MathisWellmann commented 1 year ago

Can you make this into a PR such that it adds these hints to the README.md? I don't use windows and don't intend to support it thus a comment in the README should be sufficient for people seeking for a quick solution to SDL2 issues If you validate these steps on your windows machine then I'm happy to have this note added to the README.md Thanks :)

rn7s2 commented 1 year ago

I followed @aDecoy 's steps on Windows and can validate the steps:

  1. clone the repo & cd to the root dir of the repo
  2. modify Cargo.toml, remove dependency sdl2 line and add following code:
    
    [dependencies.sdl2]
    version = "0.35.2"
    default-features = false
    features = ["static-link", "use-vcpkg", "gfx"]

[package.metadata.vcpkg] dependencies = ["sdl2", "sdl2-gfx"] git = "https://github.com/microsoft/vcpkg" rev = "16ee2ec"

[package.metadata.vcpkg.target] x86_64-pc-windows-msvc = { triplet = "x64-windows-static-md" }


2. install [cargo-vcpkg](https://github.com/mcgoo/cargo-vcpkg) using `cargo install cargo-vcpkg`
3. under the root dir of the repo, `cargo vcpkg build`
4. now build and run, such as `cargo run --example=mountain_car`

It will be great for those who want to try out the lib on Windows if these notes could be added to README, thanks!
MathisWellmann commented 11 months ago

Added a section to the README.md. Thanks both of you :heart: