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

Author Topic: Using SFML on Linux (SCons and Eclipse IDE)  (Read 8502 times)

0 Members and 1 Guest are viewing this topic.

Merkoth

  • Guest
Using SFML on Linux (SCons and Eclipse IDE)
« on: September 03, 2007, 05:13:03 am »
Hi all, this is a small tutorial on how to:

1) Set up a SFML-based project using SCons (a Python-powered software construction system)

2) Set up an Eclipse SFML project.

1) Using SCons
   a. Install SCons: This might be different for each distro, wheter it's apt or rpm based, so your mileage may vary. See http://www.scons.org/download.php for more details.

   b. Set up your project folder structure, since it's a matter of taste I won't give much advice on this.

   c. Create a textfile named SConstruct on your source directory, containing the following:

 
Code: [Select]
env = Environment(CPPPATH='/usr/include')
env.Program('SFMLApp',['source1.cpp', 'source2.cpp', 'source3.cpp'], LIBS = ['sfml-window','sfml-system','sfml-graphics', 'GLU', 'GL'], LIBPATH = ['/usr/lib', '/usr/local/lib'])


Please note that you should check every path in that code, since it might be different for your distro. You should replace SFMLApp with the name of your app, and add/remove sourcefiles as necessary. The same goes for libraries, the ones I'm showing there are enough for a basic SFML app without sound, you should add as necessary.

   d. Fire up a terminal, go to your project folder and type "scons" (without the quotes, of course).

   e. Done!

2) Using Eclipse

   a. Get Eclipse with C/C++ support (http://www.eclipse.org/downloads/)

   b. Create a new project.
   
   c. Go to Project -> Properties, you should see something like this:



   d. Configure the C++ compiler directories, so it can find the SFML headers:



  e. Configure the linker, including the lib directory and the needed libs (remember, you might need more or less libs, depending on which parts of SFML you're using. sfml-window, sfml-system, sfml-graphics, GL and GLU should be enough for a basic app without sound):



  f. Done! Should be ready to go :)

I'm not really sure if manually including GL and GLU is really a must, since it appears that libs like DeviL are found without specifying them but...

Anyway, I hope someone can find this useful :)

P.S: It's been a long, long time since I took frech classes at school, sorry guys :P

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Using SFML on Linux (SCons and Eclipse IDE)
« Reply #1 on: September 05, 2007, 09:12:40 am »
Thank you for this tutorial :)
Laurent Gomila - SFML developer