-
Notifications
You must be signed in to change notification settings - Fork 92
Windows
NOTE: This article is severely outdated and needs to be updated.
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
.
Then you can set the following environment variables:
-
SFML_INCLUDE_DIR
toC:/Users/Me/Downloads/SFML/include
. -
SFML_LIBS_DIR
toC:/Users/Me/Downloads/SFML/lib
.
You might need to log out and back in 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 ===
- 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 fromCSFML\lib\gcc
andSFML\lib
toC:\Program Files\Rust stable 1.3\bin\rustlib\x86_64-pc-windows-gnu\lib
- Copy the
- Build your project e.g. using
cargo build --release
- Copy the
DLL
files fromCSFML\bin
totarget\release
- Copy the
- Download the archived precompiled Visual C++ SFML and CSFML libraries for SFML. Extract both zip files to a preferred location for libraries. i.e. D:\libs\x64\
- Download LLVM
- Set for path for user or users during install.
- Set environment variables:
- SFML_INCLUDE_DIR=D:\libs\x64\SFML-2.5.1\include
- SFML_LIBS_DIR=D:\libs\x64\SFML-2.5.1\lib
- From within the extracted archives:
- Copy the
*.lib
files fromCSFML\lib\msvc
andSFML\lib
toC:\Users\[USERNAME]\.rustup\toolchains\[RUST_TOOLCHAIN]\lib\rustlib\[MSVC_TOOLCHAIN]\lib
- If you change Rust toolchains, make sure to copy the
*.lib
files to the new toolchain's directory as well.
- Copy the
- Build your project
- Copy the
*.dll
files fromCSFML\bin
to the working directory of your compiled executable (usuallytarget\debug
ortarget\release
) - Note: You only need to copy the
*.dll
files that correspond to the rust-sfml modules you are using. e.g. copycsfml-graphics-2.dll
if your code containsusing sfml::graphics
.
- Copy the
Note: If you cloned this repo to test the examples you need to copy the
*.dll
files fromSFML\bin
totarget\debug\examples
ortarget\release\examples
. You only need to copy the*.dll
files that correspond to the rust-sfml modules you are using. e.g. copysfml-graphics-2.dll
if your code containsuse sfml::graphics
.