My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
CompileOnLinux  

Phase-Support, Featured
Updated Aug 21, 2009 by vinicius...@gmail.com

This a document that describes how to build troll on linux.

Dennis H contributes a script to build Troll2D using SDL under Linux.

The script is below. Save it as SConstruct and put it in the project's root directory. Running scons should get it to build, provided you have the required libs. It'll make a static library; if you want a shared library then just change env.StaticLibrary to env.SharedLibrary (I didn't add an option for it yet).

#Troll2d SConstruct
vars = Variables()
vars.AddVariables(EnumVariable("backend", "Choose the backend for
Troll2d.",
       "SDL", allowed_values = ("SDL", "allegro")))

env = Environment(variables = vars)
Help(vars.GenerateHelpText(env))

cpp_path = []
extra_sources = []

if env["backend"] == "SDL":
   env.ParseConfig("sdl-config --cflags --libs")

   cpp_path = ["modules/sdl/include",
       "modules/sdl/include/SDL_image",
       "modules/sdl/include/sprig"]

   extra_sources = Glob("modules/sdl/src/*.c*") + \
       Glob("modules/sdl/src/SDL_image/*.c*") + \
       Glob("modules/sdl/src/sprig/*.c*")

if env["backend"] == "allegro":
   print "Sorry, the allegro backend can't be built just yet."
   env.Exit()

env.Append(CFLAGS = ["-Wall"],
   CPPPATH = ["include"] + cpp_path)

env.StaticLibrary("troll2d", Glob("src/*.c*") + extra_sources)

Thanks Dennis H

Comment by walke...@gmail.com, Nov 3, 2009

This doesn't work. Followed the instructions, and saved as SConstruct in the root dir. Ran scons which complains:

scons: Reading SConscript files ... NameError?: name 'Variables' is not defined:

File "/home/awalker/devel/other/Troll-0.0.3/SConstruct", line 6:
vars = Variables()

Comment by Arctic...@gmail.com, Nov 6, 2009

I'm sorry it's not working for you =(. What version are you using? I tested the script and it works fine with SCons version 1.2.0

You can remove the Variables part if you want, as the allegro backend can't be built with this script anyway. Just be sure to remove the corresponding if statements.


Sign in to add a comment
Powered by Google Project Hosting