Archive

Posts Tagged ‘git’

More Restructuring

09.04.2012 12 comments

Okay, a quick update on the site’s pending rearrangement.  Firstly, tutorials are in fact going to stay as posts, not pages. I decided I didn’t want a static front page, but I don’t want general “blog” content on the front page either, so thing’s will have to stay as they are. Secondly, I’m finding more and more as I write tutorials that I have to bother going into detail about which software to install and so on and so forth. This is not only time consuming for me, but also probably annoying for the majority of you who have the software already. But I have a solution: I’m going to write a few new posts about setting up “development environments” on Windows and Unix. Then, when I do a tutorial, I’ll just assume you’ve done all the setup in the other post. In fact, I’m thinking I might more generally put a little “prerequisites” and “recommended reading” section at the top of each tutorial. That way, we can focus on the new stuff, but all the background material is easily available to those who need it.

Summary of Content

Naturally there’ll be one for Windows and one for Linux/Unix, each with various subsections. Now, I don’t want to spend too long writing these setup tutorials, but I do want to keep everyone happy ;) So here’s a quick list of what I’ll cover in each one – lot me know if there’s anything you really want added!

Windows

  • Visual C++
  • MinGW
  • Code::Blocks
  • MSYS

Linux/Unix

  • GCC
  • Code::Blocks
  • Text editor (e.g. vim)

Generic

  • CMake
  • Doxygen
  • Git
  • Subversion

These last few will be covered in both tutorials, although the specifics will be a little different of course.

Automatic SFML 2.0 Build – Unix

As you know, I’ve been providing prebuilt SFML 2.0 binaries for Windows (both MinGW and MSVC) for a while now (new ones will be out soon, by the way…)

I don’t really want to provide prebuilt binaries on Unix right now, but instead I’ve written a little script which will build them for you. All you do is run the script. Then it goes ahead and downloads the source, runs CMake and then builds and installs the binaries, header files, examples and documentation. You can go ahead and download the script, but read on a bit so you know what you’re doing. And of course, if you don’t trust me, you can always read through the script yourself :)

I’m sure it’s not very robust at the moment, so let me know if you have any issues with it. I’ll try to fix them as soon as possible. If you do come up against problems, you can probably just delete the directory it created and run it again. Oh, and you can run it a second time to check for source code updates and recompile.

Anyway, all you have to do is download the script, put it in the desired directory, e.g. ~/Development,  make it executable and run it (probably with no options, but see below for details).

chmod +x InstallSFML.sh
./InstallSFML.sh

Warning: If you install SFML to the default location of /usr/local, it will override any older versions (e.g. SFML 1.6) already installed in /usr. If you wish to continue using an already installed older version, read on to learn how to install SFML to an alternate location.

Usage Notes

There are just a few details of usage which I’d like to share. Firstly, as you probably know,  certain tools and libraries are required for the build. Namely, the script invokes CMake, make, git and doxygen. In fact, the script can have a go at installing these for you. Just run it with the -t switch. However, it handles this in a very primitive way. It installs them using apt-get so it’s specific to Ubuntu, Linux Mint and the like. Also, of course, the package names may change a little in the future (for example, git-core recently became simply git).

As for the libraries, you can try the -l switch. However, I’d say this is even less reliable. Again, it relies on apt-get and moreover it depends on the particular package names. However, I’ll try to keep these up to date so that it works on Ubuntu-like OSs at least. Anyway, if you have trouble with installation of packages or tools, let me know so I can look into it.

If you can’t get these features to work, don’t worry. The rest of the script should run fine, you’ll just need to ensure that the following tools are installed, along with the dependencies specified here.

  • CMake
  • GCC/Make
  • doxygen
  • git

There are just two last options. You can specify -D directory to have SFML installed into directory rather than the default location of /usr/local. And you can specify -S directory to have the SFML source downloaded into directory rather than a new subdirectory called SFML of the active directory. If you specify an existing directory (or if you use the defaults and there is an existing directory called SFML in the current active directory) then the script will check if it’s a Git repository. If so, it will update the repo and then build and install as normal; if it’s not a repo, it will give you the choice to cancel the operation or to delete the directory and re-clone the source from Git Hub.

sf::Window::IsOpen()

Previously, we always checked if our SFML window was open using sf::Window::IsOpened(), which returned bool. Well, the function has recently been renamed to IsOpen(), although it appears otherwise unchanged (externally at least). So bear in mind that if you’re using a very up to date SFML snapshot, you may need to use sf::Window::IsOpen() rather than the old sf::Window::IsOpened().

Follow

Get every new post delivered to your Inbox.

Join 72 other followers