Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to use SFML on git  (Read 6552 times)

0 Members and 1 Guest are viewing this topic.

kim366

  • Newbie
  • *
  • Posts: 35
    • View Profile
How to use SFML on git
« on: January 22, 2017, 06:20:06 pm »
Hi,

this topic may be a bit SFML-unrelated, so please forgive me.

How should I use git in a cross-platform git project?

My 3 ideas
  • Copy the download for the specific compiler into the repository
    Problems: The graph shows 22k additions on the first commit, which are not mine. The library is OS/Compiler-specific
  • Create a separate repository for SFML and put the download in there and use it as a submodule in your actual repo
    This fixes Problem 1, but the second one still remains
  • Use the official SFML repo as a submodule
    Problem: How do you use SFML in it's raw state? Do you have to add all necessary cpp files to the makefile?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
How to use SFML on git
« Reply #1 on: January 22, 2017, 07:31:44 pm »
You generally don't include external libraries in your git repository. Your repo is reserved for your code, build scripts and maybe asset files only.

For external libraries you could create SDK packages for each platform. They will contain binaries and header files and if everything is setup nicely in your build scripts, you should be able to extract the SDK and immediately start building.
You can use a separate git repo for this, however I'd probably go more with a simple file download, since git isn't really designed for large file storage.

On platforms that have a central package manager (like any Linux distro), it's recommended to use the libraries provided through the package manager. That way you don't have to deal with building them. It might help to keep track of all the dependencies and maybe write a script that will automatically install the wanted libs.

For asset files, if you're writing a small game, it might be okay to keep them in the same repository. But once things grow larger, you will have to either create another git repo, or probably better use some sort of cloud storage, since you'll be store quite a few MB or even GB of data, plus your artist should be able to easily make use of it.

I don't really recommend using submodules, since library repos are pretty much never laid out to be used as submodule. If you want to spend a lot of time, you could run a sort of "distribution" repository where you provide the needed binaries, but I'd argue it's a lot easier to create SDKs at that point.

Hope that helped. :)
« Last Edit: January 23, 2017, 07:06:36 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

kim366

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: How to use SFML on git
« Reply #2 on: January 23, 2017, 05:34:31 pm »
Thank you so much for the elaborate answer!

I asked a friend of mine today the same question and he too replied that external libraries should not be in git.

When it comes to large files, couldn't you just use git LFS, though?

Oh right! On linux you install SFML globally! Well, I am now definately switching.

Would you put the name of the library into .gitignore or .git/info/exclude on other operating systems?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: How to use SFML on git
« Reply #3 on: January 25, 2017, 01:18:15 pm »
git LFS would be an option. Just make sure to ask yourself whether you really need version control for assets and binaries and if it's worth the potential additional work.

Since I never store libraries within my source tree, there's no need to add them to .gitignore, but I do have rules that will exclude binaries and at times the asset directory, so the in-tree compiled builds will be ignored.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

kim366

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: How to use SFML on git
« Reply #4 on: January 25, 2017, 04:13:11 pm »
Okay, thanks!

PS: Even more off-topic: What is the word that includes both mouse buttons and keyboard keys? I need it for my inputManager class

madpew

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: How to use SFML on git
« Reply #5 on: February 24, 2017, 03:10:21 pm »
I used "InputEvent" in my engine to group all kinds of input (keyboard, mouse and joystick)

 

anything