Skip to content

Distributing games without users requiring external dependencies #1109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AlanFoster opened this issue May 8, 2021 · 2 comments
Closed

Distributing games without users requiring external dependencies #1109

AlanFoster opened this issue May 8, 2021 · 2 comments

Comments

@AlanFoster
Copy link

Sorry if this question has been answered before, but what's the preferred method of distributing runnable games?
The readme suggests that you can statically link the sdl2 dependencies into a single runnable binary, but from some of the previously raised issues, it looks like this isn't currently possible? 👀

The CI scripts suggest the same:

steps:
- uses: actions/checkout@v2
- name: Build SDL2
shell: bash
env:
# Bundled doesn't yet support gfx, image, ttf, mixer.
CI_BUILD_FEATURES: "bundled"
RUST_TEST_THREADS: 1

My goal is for mac/linux, and maybe windows, users to be able to run the game entirely from a single directory with all of its dependencies provided either in a single binary, or with the libraries sitting beside the main binary - whichever is easiest! Any direction would be appreciated 👍

@waych
Copy link
Contributor

waych commented May 11, 2021

While the bundled feature doesn't support those additional libraries, they aren't needed to use sdl. If those libraries in particular are really needed, the use-vcpkg mode of build can be considered which supports building them from source and will also produce static libraries linked into your executable.

In either case, even if these libraries are built in statically, more work would need to be considered for whether or not you wish to distribute with a static CRT or be dependent upon a distributed one. This is beyond being an SDL or even a rust issue however. Just to see, I tried compiling my rust-sdl2 dependent project just now with crt-static and the build failed in different ways on Windows and Linux.

@Cobrand
Copy link
Member

Cobrand commented May 12, 2021

waych mentioned different possibilities, but the most trust worthy way of installing and distributing SDL2 is simply downloading it from the SDL2 website itself and putting it next to your binary. It takes about 2 minutes per .dll and it's really well explained in the README https://github.com/Rust-SDL2/rust-sdl2#windows-msvc .

@Cobrand Cobrand closed this as completed May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants