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
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:
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.