Reordered setup options

MSVC and MinGW to the top
This commit is contained in:
halvnykterist
2021-02-04 19:14:16 +02:00
committed by GitHub
parent 831dba0453
commit b5ff4f5606
+78 -77
View File
@@ -122,6 +122,84 @@ use_sdl2_mac_framework = ["sdl2/use_mac_framework"]
Instructions to generate a static binary on macOS and other operating systems using [vcpkg][vcpkg] are [here][cargo-vcpkg-usage].
### Windows (MSVC)
1. Download MSVC development libraries from http://www.libsdl.org/ (SDL2-devel-2.0.x-VC.zip).
2. Unpack SDL2-devel-2.0.x-VC.zip to a folder of your choosing (You can delete it afterwards).
3. Copy all lib files from
> SDL2-devel-2.0.x-VC\SDL2-2.0.x\lib\x64\
to (for Rust 1.6 and above)
> C:\Program Files\Rust\\**lib**\rustlib\x86_64-pc-windows-msvc\lib
or to (for Rust versions 1.5 and below)
> C:\Program Files\Rust\\**bin**\rustlib\x86_64-pc-windows-msvc\lib
or to your library folder of choice, and ensure you have a system environment variable of
> LIB = C:\your\rust\library\folder
For Rustup users, this folder will be in
> C:\Users\\{Your Username}\\.rustup\toolchains\\{current toolchain}\lib\rustlib\\{current toolchain}\lib
Where current toolchain is likely `stable-x86_64-pc-windows-msvc`.
4. Copy SDL2.dll from
> SDL2-devel-2.0.x-VC\SDL2-2.0.x\lib\x64\
into your cargo project, right next to your Cargo.toml.
5. When you're shipping your game make sure to copy SDL2.dll to the same directory that your compiled exe is in, otherwise the game won't launch.
#### Static linking with MSVC
The MSVC development libraries provided by http://libsdl.org/ don't include a static library. This means that if you want to use the `static-link` feature with the windows-msvc toolchain, you have to do one of
- build an SDL2 static library yourself and copy it to your toolchain's `lib` directory; or
- also enable the `bundled` feature, which will build a static library for you; or
- use a static SDL2 library from vcpkg as described below.
### Windows (MinGW)
1. Download mingw development libraries from
http://www.libsdl.org/ (SDL2-devel-2.0.x-mingw.tar.gz).
2. Unpack to a folder of your choosing (You can delete it afterwards).
3. Copy all lib files from
> SDL2-devel-2.0.x-mingw\SDL2-2.0.x\x86_64-w64-mingw32\lib
to (for Rust 1.6 and above)
> C:\Program Files\Rust\\**lib**\rustlib\x86_64-pc-windows-gnu\lib
or to (for Rust versions 1.5 and below)
> C:\Program Files\Rust\\**bin**\rustlib\x86_64-pc-windows-gnu\lib
or to your library folder of choice, and ensure you have a system environment variable of
> LIBRARY_PATH = C:\your\rust\library\folder
For Rustup users, this folder will be in
> C:\Users\\{Your Username}\\.rustup\toolchains\\{current toolchain}\lib\rustlib\\{current toolchain}\lib
Where current toolchain is likely `stable-x86_64-pc-windows-gnu`.
4. Copy SDL2.dll from
> SDL2-devel-2.0.x-mingw\SDL2-2.0.x\x86_64-w64-mingw32\bin
into your cargo project, right next to your Cargo.toml.
5. When you're shipping your game make sure to copy SDL2.dll to the same directory that your compiled exe is in, otherwise the game won't launch.
#### Static linking with MinGW
If you want to use the `static-link` feature with the windows-gnu toolchain, then you will also need the following libraries:
libimm32.a
libversion.a
libdinput8.a
libdxguid.a
These files are not currently included with the windows-gnu toolchain, but can be downloaded [here](https://sourceforge.net/projects/mingw-w64/files/). For the x86_64 toolchain, you want the `x86_64-win32-seh` package, and for i686 you want the `i686-win32-dwarf` one.
You will find the aforementioned libraries under `mingw64/x86_64-w64-mingw32/lib/` (for x86_64) or `mingw32/i686-w64-mingw32/lib/` (for i686). Copy them to your toolchain's `lib` directory (the same one you copied the SDL .a files to).
### Windows with build script
1. Download mingw and msvc development libraries from
@@ -210,47 +288,6 @@ fn main() {
And now your project should build and run on any Windows computer!
### Windows (MinGW)
1. Download mingw development libraries from
http://www.libsdl.org/ (SDL2-devel-2.0.x-mingw.tar.gz).
2. Unpack to a folder of your choosing (You can delete it afterwards).
3. Copy all lib files from
> SDL2-devel-2.0.x-mingw\SDL2-2.0.x\x86_64-w64-mingw32\lib
to (for Rust 1.6 and above)
> C:\Program Files\Rust\\**lib**\rustlib\x86_64-pc-windows-gnu\lib
or to (for Rust versions 1.5 and below)
> C:\Program Files\Rust\\**bin**\rustlib\x86_64-pc-windows-gnu\lib
or to your library folder of choice, and ensure you have a system environment variable of
> LIBRARY_PATH = C:\your\rust\library\folder
For Rustup users, this folder will be in
> C:\Users\\{Your Username}\\.rustup\toolchains\\{current toolchain}\lib\rustlib\\{current toolchain}\lib
Where current toolchain is likely `stable-x86_64-pc-windows-gnu`.
4. Copy SDL2.dll from
> SDL2-devel-2.0.x-mingw\SDL2-2.0.x\x86_64-w64-mingw32\bin
into your cargo project, right next to your Cargo.toml.
5. When you're shipping your game make sure to copy SDL2.dll to the same directory that your compiled exe is in, otherwise the game won't launch.
#### Static linking with MinGW
If you want to use the `static-link` feature with the windows-gnu toolchain, then you will also need the following libraries:
libimm32.a
libversion.a
libdinput8.a
libdxguid.a
These files are not currently included with the windows-gnu toolchain, but can be downloaded [here](https://sourceforge.net/projects/mingw-w64/files/). For the x86_64 toolchain, you want the `x86_64-win32-seh` package, and for i686 you want the `i686-win32-dwarf` one.
You will find the aforementioned libraries under `mingw64/x86_64-w64-mingw32/lib/` (for x86_64) or `mingw32/i686-w64-mingw32/lib/` (for i686). Copy them to your toolchain's `lib` directory (the same one you copied the SDL .a files to).
### Windows (MSVC with vcpkg)
1. Install [MS build tools](https://visualstudio.microsoft.com/downloads/) and [vcpkg][vcpkg]
@@ -264,42 +301,6 @@ SET LIB=%LIB%;C:\Users\my_user\dev\vcpkg\installed\x64-windows\lib
```
5. `cargo build`
### Windows (MSVC)
1. Download MSVC development libraries from http://www.libsdl.org/ (SDL2-devel-2.0.x-VC.zip).
2. Unpack SDL2-devel-2.0.x-VC.zip to a folder of your choosing (You can delete it afterwards).
3. Copy all lib files from
> SDL2-devel-2.0.x-VC\SDL2-2.0.x\lib\x64\
to (for Rust 1.6 and above)
> C:\Program Files\Rust\\**lib**\rustlib\x86_64-pc-windows-msvc\lib
or to (for Rust versions 1.5 and below)
> C:\Program Files\Rust\\**bin**\rustlib\x86_64-pc-windows-msvc\lib
or to your library folder of choice, and ensure you have a system environment variable of
> LIB = C:\your\rust\library\folder
For Rustup users, this folder will be in
> C:\Users\\{Your Username}\\.rustup\toolchains\\{current toolchain}\lib\rustlib\\{current toolchain}\lib
Where current toolchain is likely `stable-x86_64-pc-windows-msvc`.
4. Copy SDL2.dll from
> SDL2-devel-2.0.x-VC\SDL2-2.0.x\lib\x64\
into your cargo project, right next to your Cargo.toml.
5. When you're shipping your game make sure to copy SDL2.dll to the same directory that your compiled exe is in, otherwise the game won't launch.
#### Static linking with MSVC
The MSVC development libraries provided by http://libsdl.org/ don't include a static library. This means that if you want to use the `static-link` feature with the windows-msvc toolchain, you have to do one of
- build an SDL2 static library yourself and copy it to your toolchain's `lib` directory; or
- also enable the `bundled` feature, which will build a static library for you; or
- use a static SDL2 library from vcpkg as described below.
### Windows, Linux and macOS with vcpkg
Another method of getting the development libraries is with [vcpkg][vcpkg]. To set up a project to build a static binary on Windows (MSVC), Linux or macOS that is buildable like this: