Skip to content
Fernando B edited this page Dec 1, 2023 · 13 revisions

For MSVC Toolchains

The gist of setting up SFML on windows is to download the SFML version matching your toolchain from https://www.sfml-dev.org/download/sfml/2.5.1/, then extract it to a place of your liking, say, C:/Users/Me/Downloads/SFML.

NB: Remember to check sfml version needed for rust-sfml. rust-sfml 0.21.0 needs 2.6, rust-sfml 0.20.0 and below can use 2.5

Then you can set the following environment variables:

  • SFML_INCLUDE_DIR to C:/Users/Me/Downloads/SFML/include.
  • SFML_LIBS_DIR to C:/Users/Me/Downloads/SFML/lib.

Close cmd prompt and reopen for environment variables to take effect.

This should let rust-sfml build correctly.

When you want to run your rust-sfml project, you should copy the .dlls inside C:/Users/Me/Downloads/SFML/bin to your projects target/debug or /target/release folder. Or possibly the working directory. I'm not sure if that's necessary.

=== EVERYTHING BELOW HERE IS SEVERELY OUTDATED ===

For GNU Toolchains

NB: If you use GNU toolchains, try following similar steps listed in MSVC toolchain, and if that works please edit this wiki or let us know in https://github.com/jeremyletang/rust-sfml/issues/320

  • Download the CSFML and SFML zip files from the links at https://github.com/jeremyletang/rust-sfml#prerequisites
  • From within the extracted archives:
    • Copy the *.a files from CSFML\lib\gcc and SFML\lib to C:\Program Files\Rust stable 1.3\bin\rustlib\x86_64-pc-windows-gnu\lib
  • Build your project e.g. using cargo build --release
    • Copy the DLL files from CSFML\bin to target\release
Clone this wiki locally